Fixes for MSVC 2019

This commit is contained in:
Ian Geiser 2021-08-02 18:25:51 +00:00 committed by Dawid Drozd
parent 3238c41ea5
commit 4689564c4c
3 changed files with 11 additions and 6 deletions

View File

@ -79,8 +79,8 @@ set(CMAKE_CXX_FLAGS_UBSAN
CACHE STRING "Flags used by the C++ compiler during UndefinedBehaviourSanitizer builds."
FORCE)
add_subdirectory(lib/)
add_subdirectory(use_case/)
add_subdirectory(lib)
add_subdirectory(use_case)
if(ENABLE_TEST)
enable_testing()
@ -91,9 +91,11 @@ if(ENABLE_PERFORMANCE)
add_subdirectory(performance/)
endif()
target_compile_options(EventBus PRIVATE
if(NOT MSVC)
target_compile_options(EventBus PRIVATE
-Wall -pedantic
-Wnon-virtual-dtor
-Werror
-Wno-error=deprecated-declarations
)
endif()

View File

@ -3,6 +3,8 @@
//
#include "EventBus.hpp"
#include <iterator>
namespace dexode
{
@ -70,7 +72,7 @@ eventbus::stream::EventStream* EventBus::findStream(
void EventBus::unlistenAll(const std::uint32_t listenerID)
{
std::shared_lock readGuard{_mutexStreams};
for(auto& eventStream : _eventToStream)
for(const auto& eventStream : _eventToStream)
{
eventStream.second->removeListener(listenerID);
}
@ -120,7 +122,7 @@ eventbus::stream::EventStream* EventBus::listen(const std::uint32_t,
void EventBus::unlisten(const std::uint32_t listenerID,
const eventbus::internal::event_id_t eventID)
{
auto* eventStream = findStream(eventID);
eventbus::stream::EventStream* eventStream = findStream(eventID);
if(eventStream != nullptr)
{
eventStream->removeListener(listenerID);

View File

@ -3,8 +3,9 @@
#include <algorithm>
#include <cassert>
#include <functional>
#include <vector>
#include <iterator>
#include <shared_mutex>
#include <vector>
#include "dexode/eventbus/stream/EventStream.hpp"