diff --git a/src/include/xpr/pos_type.cc.h b/src/include/xpr/pos_type.cc.h index 21fada7..2837adb 100644 --- a/src/include/xpr/pos_type.cc.h +++ b/src/include/xpr/pos_type.cc.h @@ -280,6 +280,17 @@ namespace CNORXZ { return FPos(pos.val(), map); } + + template + static constexpr decltype(auto) mks(const PosT& pos, std::index_sequence is) + { + if constexpr(is_static_pos_type::value){ + return SFPos {}; + } + else { + return mk(pos, &SFPos<0,Is...>::permutation[0]); + } + } }; template @@ -289,6 +300,13 @@ namespace CNORXZ { return mkMPos( MkFPos::mk( pos, map ), MkFPos::mk( pos.next(), map ) ); } + + template + static constexpr decltype(auto) mks(const MPos& pos, + std::index_sequence is) + { + return mkMPos( MkFPos::mks( pos, is ), MkFPos::mks( pos.next(), is ) ); + } }; template @@ -297,13 +315,19 @@ namespace CNORXZ return MkFPos::mk(pos, map); } + template + constexpr decltype(auto) mkSFPos(const PosT& pos, std::index_sequence is) + { + return MkFPos::mks(pos, is); + } + /*===========+ | SFPos | +===========*/ template - Arr SFPos::sMs = { Ms... }; + Arr SFPos::permutation = { Ms... }; template constexpr SizeT SFPos::size() const @@ -343,10 +367,10 @@ namespace CNORXZ } else { if constexpr(is_epos_type::value){ - return FPos(N * a.scal().val(), &sMs[0]); + return FPos(N * a.scal().val(), &permutation[0]); } else { - return FPos(N * a.val(), &sMs[0]); + return FPos(N * a.val(), &permutation[0]); } } } @@ -392,7 +416,7 @@ namespace CNORXZ template constexpr SFPos::operator FPos() const { - return FPos(N, &sMs[0]); + return FPos(N, &permutation[0]); } template diff --git a/src/include/xpr/pos_type.h b/src/include/xpr/pos_type.h index 6879f4f..14505d1 100644 --- a/src/include/xpr/pos_type.h +++ b/src/include/xpr/pos_type.h @@ -129,9 +129,9 @@ namespace CNORXZ template class SFPos { - private: - static Arr sMs; public: + static Arr permutation; + constexpr SFPos() = default; constexpr SizeT size() const;