diff --git a/CMakeLists.txt b/CMakeLists.txt index b382ec6..c0709b6 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -48,7 +48,15 @@ set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wall -Werror -std=c++17 -Wpedantic -O2 # TESTING -enable_testing() +if(DEFINED ENABLE_TESTS) + set(ENABLE_TESTS ${ENABLE_hdf5} CACHE BOOL "enable tests") +else() + set(ENABLE_TESTS TRUE CACHE BOOL "enable tests") +endif() + +if(ENABLE_TESTS) + enable_testing() +endif() # INSTALL PATH @@ -77,12 +85,6 @@ endif() # CHECK LIBRARIES message(STATUS "check for libraries") -if(DEFINED ENABLE_TESTS) - set(ENABLE_TESTS ${ENABLE_hdf5} CACHE BOOL "enable tests") -else() - set(ENABLE_TESTS TRUE CACHE BOOL "enable tests") -endif() - if(ENABLE_TESTS) # CHECK LIBRARIES : GTest find_package( GTest REQUIRED ) diff --git a/src/include/xpr/pos_type.cc.h b/src/include/xpr/pos_type.cc.h index 32b3fc3..903657c 100644 --- a/src/include/xpr/pos_type.cc.h +++ b/src/include/xpr/pos_type.cc.h @@ -49,7 +49,8 @@ namespace CNORXZ return mkEPos<epos_size<PosT>::value>(*this,SPos<0>{}) + a; } else if constexpr(is_static_pos_type<PosT>::value){ - return SPos<N+a.val()>{}; + constexpr PosT ax; + return SPos<N+ax.val()>{}; } else { return UPos(N+a.val()); @@ -68,7 +69,8 @@ namespace CNORXZ return SPos<0>{}; } else if constexpr(is_static_pos_type<PosT>::value){ - return SPos<N*a.val()>{}; + constexpr PosT ax; + return SPos<N*ax.val()>{}; } else { return UPos(N*a.val()); @@ -88,7 +90,8 @@ namespace CNORXZ return SPos<0>{}; } else if constexpr(is_static_pos_type<PosT>::value){ - return SPos<N*a.val()>{}; + constexpr PosT ax; + return SPos<N*ax.val()>{}; } else { return UPos(N*a.val()); @@ -346,7 +349,8 @@ namespace CNORXZ constexpr decltype(auto) SFPos<N,Ms...>::operator+(const PosT& a) const { if constexpr(is_static_pos_type<PosT>::value){ - return SPos<N+a.val()>(); + constexpr PosT ax; + return SPos<N+ax.val()>(); } else { return UPos(N + a.val()); @@ -359,10 +363,12 @@ namespace CNORXZ { if constexpr(is_static_pos_type<PosT>::value){ if constexpr(is_epos_type<PosT>::value){ - return SFPos<N*a.scal().val(),Ms...>(); + constexpr PosT ax; + return SFPos<N*ax.scal().val(),Ms...>(); } else { - return SFPos<N*a.val(),Ms...>(); + constexpr PosT ax; + return SFPos<N*ax.val(),Ms...>(); } } else { @@ -382,10 +388,12 @@ namespace CNORXZ if constexpr(is_static_pos_type<PosT>::value){ constexpr Arr<SizeT,sizeof...(Ms)> ms({ Ms... }); if constexpr(is_epos_type<PosT>::value){ - return SPos<N*std::get<a.scal().val()>(ms)>(); + constexpr PosT ax; + return SPos<N*std::get<ax.scal().val()>(ms)>(); } else { - return SPos<N*std::get<a.val()>(ms)>(); + constexpr PosT ax; + return SPos<N*std::get<ax.val()>(ms)>(); } } else { diff --git a/src/include/xpr/pos_type.h b/src/include/xpr/pos_type.h index 99597ef..f17b9ea 100644 --- a/src/include/xpr/pos_type.h +++ b/src/include/xpr/pos_type.h @@ -337,6 +337,9 @@ namespace CNORXZ template <class T> struct is_epos_type { CXZ_CVAL_FALSE; }; + //template <class T> + //struct static_pos_value {}; + template <class PosT> struct static_pos_size { @@ -429,6 +432,25 @@ namespace CNORXZ template <class BPosT, class NPosT> struct is_epos_type<MPos<BPosT,NPosT>> { static constexpr bool value = is_epos_type<BPosT>::value or is_epos_type<NPosT>::value; }; + /* + template <SizeT N> + struct static_pos_value<SPos<N>> + { + static constexpr SizeT value = N; + }; + + template <SizeT N, SizeT... Ms> + struct static_pos_value<SFPos<N,Ms...>> + { + static constexpr SizeT value = N; + }; + + template <class BPosT, class... OPosTs> + struct static_pos_value<EPos<BPosT,OPosTs...>> + { + static constexpr SizeT value = is_static_pos_type<EPos<BPosT,OPosTs...>>::value ? + }; + */ template <class BPosT, class NPosT> struct static_pos_size<MPos<BPosT,NPosT>> {