Skip to content

Commit

Permalink
Merge pull request #65 from ami-iit/fix-permissive
Browse files Browse the repository at this point in the history
Fix permissive
  • Loading branch information
S-Dafarra authored Jan 20, 2023
2 parents e951ef3 + 3cff03d commit 86769a7
Show file tree
Hide file tree
Showing 3 changed files with 16 additions and 8 deletions.
7 changes: 3 additions & 4 deletions .github/workflows/conda-forge-ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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}
Expand All @@ -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}
Expand Down
9 changes: 9 additions & 0 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand Down Expand Up @@ -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
Expand Down
8 changes: 4 additions & 4 deletions include/matioCpp/impl/MultiDimensionalArray.tpp
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,7 @@ matioCpp::MultiDimensionalArray<T>::MultiDimensionalArray(const std::string &nam
}

template<typename T>
matioCpp::MultiDimensionalArray<T>::MultiDimensionalArray(const std::string &name, const std::vector<matioCpp::MultiDimensionalArray<T>::index_type> &dimensions)
matioCpp::MultiDimensionalArray<T>::MultiDimensionalArray(const std::string &name, const std::vector<typename matioCpp::MultiDimensionalArray<T>::index_type> &dimensions)
{
matioCpp::MultiDimensionalArray<T>::index_type totalElements = 1;
for (matioCpp::MultiDimensionalArray<T>::index_type dim : dimensions)
Expand All @@ -88,7 +88,7 @@ matioCpp::MultiDimensionalArray<T>::MultiDimensionalArray(const std::string &nam
}

template<typename T>
matioCpp::MultiDimensionalArray<T>::MultiDimensionalArray(const std::string &name, const std::vector<matioCpp::MultiDimensionalArray<T>::index_type> &dimensions, matioCpp::MultiDimensionalArray<T>::const_pointer inputVector)
matioCpp::MultiDimensionalArray<T>::MultiDimensionalArray(const std::string &name, const std::vector<typename matioCpp::MultiDimensionalArray<T>::index_type> &dimensions, matioCpp::MultiDimensionalArray<T>::const_pointer inputVector)
{
for (matioCpp::MultiDimensionalArray<T>::index_type dim : dimensions)
{
Expand Down Expand Up @@ -316,13 +316,13 @@ typename matioCpp::MultiDimensionalArray<T>::value_type matioCpp::MultiDimension
}

template<typename T>
typename matioCpp::MultiDimensionalArray<T>::reference matioCpp::MultiDimensionalArray<T>::operator[](const std::vector<matioCpp::MultiDimensionalArray<T>::index_type> &el)
typename matioCpp::MultiDimensionalArray<T>::reference matioCpp::MultiDimensionalArray<T>::operator[](const std::vector<typename matioCpp::MultiDimensionalArray<T>::index_type> &el)
{
return data()[rawIndexFromIndices(el)];
}

template<typename T>
typename matioCpp::MultiDimensionalArray<T>::value_type matioCpp::MultiDimensionalArray<T>::operator[](const std::vector<matioCpp::MultiDimensionalArray<T>::index_type> &el) const
typename matioCpp::MultiDimensionalArray<T>::value_type matioCpp::MultiDimensionalArray<T>::operator[](const std::vector<typename matioCpp::MultiDimensionalArray<T>::index_type> &el) const
{
return data()[rawIndexFromIndices(el)];
}
Expand Down

0 comments on commit 86769a7

Please sign in to comment.