diff --git a/.github/workflows/conda-forge-ci.yml b/.github/workflows/conda-forge-ci.yml index 8339092f..59e4a30a 100644 --- a/.github/workflows/conda-forge-ci.yml +++ b/.github/workflows/conda-forge-ci.yml @@ -23,9 +23,8 @@ jobs: - uses: conda-incubator/setup-miniconda@v2 with: - mamba-version: "*" - channels: conda-forge,defaults - channel-priority: true + miniforge-variant: Mambaforge + miniforge-version: latest - name: Dependencies shell: bash -l {0} @@ -49,7 +48,7 @@ jobs: run: | mkdir -p build cd build - cmake -G"Visual Studio 16 2019" -DBUILD_TESTING:BOOL=ON -DCMAKE_BUILD_TYPE=${{ matrix.build_type }} .. + cmake -G"Visual Studio 16 2019" -DBUILD_TESTING:BOOL=ON -DDISABLE_PERMISSIVE:BOOL=ON -DCMAKE_BUILD_TYPE=${{ matrix.build_type }} .. - name: Build shell: bash -l {0} diff --git a/CMakeLists.txt b/CMakeLists.txt index 0091c288..3bf2ea07 100755 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -31,6 +31,9 @@ set(CMAKE_WINDOWS_EXPORT_ALL_SYMBOLS ON) # installation directories. if(MSVC) set(CMAKE_DEBUG_POSTFIX "d") + + option(DISABLE_PERMISSIVE "Add the /permissive- flag to MSVC" OFF) + mark_as_advanced(DISABLE_PERMISSIVE) endif() # Build position independent code. @@ -188,6 +191,12 @@ if (Eigen3_FOUND) endif() target_compile_features(matioCpp PUBLIC cxx_std_14) +if(DISABLE_PERMISSIVE) + message(STATUS "Adding /permissive- flag.") + set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} /permissive-") + set(CMAKE_CXX_FLAGS_RELEASE "${CMAKE_CXX_FLAGS_RELEASE} /permissive-") + add_compile_options(/permissive-) +endif() set_target_properties(matioCpp PROPERTIES OUTPUT_NAME matioCpp diff --git a/include/matioCpp/impl/MultiDimensionalArray.tpp b/include/matioCpp/impl/MultiDimensionalArray.tpp index 5367ccd5..c45be05c 100644 --- a/include/matioCpp/impl/MultiDimensionalArray.tpp +++ b/include/matioCpp/impl/MultiDimensionalArray.tpp @@ -65,7 +65,7 @@ matioCpp::MultiDimensionalArray::MultiDimensionalArray(const std::string &nam } template -matioCpp::MultiDimensionalArray::MultiDimensionalArray(const std::string &name, const std::vector::index_type> &dimensions) +matioCpp::MultiDimensionalArray::MultiDimensionalArray(const std::string &name, const std::vector::index_type> &dimensions) { matioCpp::MultiDimensionalArray::index_type totalElements = 1; for (matioCpp::MultiDimensionalArray::index_type dim : dimensions) @@ -88,7 +88,7 @@ matioCpp::MultiDimensionalArray::MultiDimensionalArray(const std::string &nam } template -matioCpp::MultiDimensionalArray::MultiDimensionalArray(const std::string &name, const std::vector::index_type> &dimensions, matioCpp::MultiDimensionalArray::const_pointer inputVector) +matioCpp::MultiDimensionalArray::MultiDimensionalArray(const std::string &name, const std::vector::index_type> &dimensions, matioCpp::MultiDimensionalArray::const_pointer inputVector) { for (matioCpp::MultiDimensionalArray::index_type dim : dimensions) { @@ -316,13 +316,13 @@ typename matioCpp::MultiDimensionalArray::value_type matioCpp::MultiDimension } template -typename matioCpp::MultiDimensionalArray::reference matioCpp::MultiDimensionalArray::operator[](const std::vector::index_type> &el) +typename matioCpp::MultiDimensionalArray::reference matioCpp::MultiDimensionalArray::operator[](const std::vector::index_type> &el) { return data()[rawIndexFromIndices(el)]; } template -typename matioCpp::MultiDimensionalArray::value_type matioCpp::MultiDimensionalArray::operator[](const std::vector::index_type> &el) const +typename matioCpp::MultiDimensionalArray::value_type matioCpp::MultiDimensionalArray::operator[](const std::vector::index_type> &el) const { return data()[rawIndexFromIndices(el)]; }