various improvements regarding static pos evaluation
This commit is contained in:
parent
a549fb6b9c
commit
ee3e1b5d4f
4 changed files with 32 additions and 3 deletions
|
@ -49,7 +49,13 @@ namespace CNORXZ
|
|||
template <class Xpr, class F>
|
||||
decltype(auto) LIndex<Index,L>::ifor(const Xpr& xpr, F&& f) const
|
||||
{
|
||||
return For<L,Xpr,F>(this->pmax().val(), this->id(), xpr, std::forward<F>(f));
|
||||
if constexpr(index_has_const_size<Index>::value){
|
||||
constexpr SizeT S = index_const_size<Index>::value;
|
||||
return SFor<S,L,Xpr,F>(this->id(), xpr, std::forward<F>(f));
|
||||
}
|
||||
else {
|
||||
return For<L,Xpr,F>(this->pmax().val(), this->id(), xpr, std::forward<F>(f));
|
||||
}
|
||||
}
|
||||
|
||||
template <class Index, SizeT L, class I1>
|
||||
|
|
|
@ -247,6 +247,22 @@ namespace CNORXZ
|
|||
{
|
||||
static constexpr bool value = true;
|
||||
};
|
||||
|
||||
/** ***
|
||||
SIndex has static range size
|
||||
@see index_expression_exists
|
||||
*/
|
||||
template <typename MetaT, SizeT S>
|
||||
struct index_has_const_size<SIndex<MetaT,S>>
|
||||
{ static constexpr bool value = true; };
|
||||
|
||||
/** ***
|
||||
SIndex has static range size
|
||||
@see index_expression_exists
|
||||
*/
|
||||
template <typename MetaT, SizeT S>
|
||||
struct index_const_size<SIndex<MetaT,S>>
|
||||
{ static constexpr SizeT value = S; };
|
||||
}
|
||||
|
||||
#endif
|
||||
|
|
|
@ -480,13 +480,19 @@ namespace CNORXZ
|
|||
return mNext;
|
||||
}
|
||||
|
||||
template <class BPosT, class NPosT>
|
||||
constexpr const BPosT& MPos<BPosT,NPosT>::bpos() const
|
||||
{
|
||||
return *this;
|
||||
}
|
||||
|
||||
template <class BPosT, class NPosT>
|
||||
template <class PosT>
|
||||
constexpr decltype(auto) MPos<BPosT,NPosT>::operator+(const PosT& a) const
|
||||
{
|
||||
typedef decltype(BPosT::operator+(a)) OBPosT;
|
||||
typedef decltype(BPosT::operator+(a.bpos())) OBPosT;
|
||||
typedef decltype(mNext + a.next()) ONPosT;
|
||||
return MPos<OBPosT,ONPosT>( BPosT::operator+(a), mNext + a.next() );
|
||||
return MPos<OBPosT,ONPosT>( BPosT::operator+(a.bpos()), mNext + a.next() );
|
||||
}
|
||||
|
||||
template <class BPosT, class NPosT>
|
||||
|
|
|
@ -177,6 +177,7 @@ namespace CNORXZ
|
|||
|
||||
constexpr SizeT size() const;
|
||||
constexpr const NPosT& next() const;
|
||||
constexpr const BPosT& bpos() const;
|
||||
|
||||
template <class PosT>
|
||||
constexpr decltype(auto) operator+(const PosT& a) const;
|
||||
|
|
Loading…
Reference in a new issue