diff --git a/CMakeLists.txt b/CMakeLists.txt index 157e921..e44515a 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -54,6 +54,12 @@ list(APPEND LIBRARIES "${Boost_LIBRARIES}") link_directories("${Boost_LIBRARY_DIRS}") include_directories(SYSTEM "${Boost_INCLUDE_DIR}") +check_compiler_flag(CPP11_FLAG "-std=c++11") +if("${CPP11_FLAG}" STREQUAL "") + check_compiler_flag(CPP11_FLAG "-std=c++0x") +endif() +set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} ${CPP11_FLAG}") + add_cxxflag("-Wall") add_cxxflag("-Wextra") add_cxxflag("-Wformat=2") diff --git a/src/util/storedenum.hpp b/src/util/storedenum.hpp index a9b3bcf..3428c37 100644 --- a/src/util/storedenum.hpp +++ b/src/util/storedenum.hpp @@ -27,6 +27,7 @@ #include #include +#include #include "util/enum.hpp" #include "util/load.hpp" @@ -42,7 +43,7 @@ struct enum_value_map { }; #define STORED_ENUM_MAP(MapName, Default, ...) \ -struct MapName : public enum_value_map { \ +struct MapName : public enum_value_map { \ static const flag_type default_value; \ static const flag_type values[]; \ static const size_t count; \ @@ -139,8 +140,8 @@ public: std::bitset result(0); for(size_t i = 0; i < count; i++) { for(size_t j = 0; j < ceildiv(base_size, ulong_size); j++) { - result |= std::bitset(static_cast(bits[i] >> (j * ulong_size))) - << ((i * base_size) + (j * ulong_size)); + ulong_type chunk = static_cast(bits[i] >> (j * ulong_size)); + result |= std::bitset(chunk) << ((i * base_size) + (j * ulong_size)); } } return result;