Fix compilation with MSVC 19.

This commit is contained in:
Thibaut Cuvelier 2020-12-31 03:46:53 +01:00
parent f500a287d4
commit adf62c3184
2 changed files with 8 additions and 1 deletions

View File

@ -1069,6 +1069,13 @@ if(MSVC)
set(CMAKE_CXX_FLAGS_MINSIZEREL "${CMAKE_CXX_FLAGS_MINSIZEREL} /Zc:wchar_t-")
endif()
if (MSVC_VERSION GREATER_EQUAL 1914)
# Ensure the __cplusplus macro is set to a sensible value.
set(CMAKE_CXX_FLAGS_DEBUG "${CMAKE_CXX_FLAGS_DEBUG} /Zc:__cplusplus")
set(CMAKE_CXX_FLAGS_RELEASE "${CMAKE_CXX_FLAGS_RELEASE} /Zc:__cplusplus")
set(CMAKE_CXX_FLAGS_MINSIZEREL "${CMAKE_CXX_FLAGS_MINSIZEREL} /Zc:__cplusplus")
endif()
message(STATUS "----- Warning level : ${CMAKE_CXX_WARNING_LEVEL} ${WARNING_LEVEL_MESSAGE}")
message(STATUS "----- Warnings as errors : ${MSVC_W_ERROR}")
message(STATUS "----- Warnings disabled : ${MSVC_W_DISABLE}")

View File

@ -296,7 +296,7 @@ public:
const_iterator iterator_at(size_t i) const
{
return (i == size()) ? end() : iterCont_[i];
return (i == size()) ? end() : const_iterator(iterCont_[i]);
}
iterator iterator_at(size_t i)