12#ifndef __cxz_pos_type_cc_h__
13#define __cxz_pos_type_cc_h__
101 template <
class PosT>
135 template <
class PosT>
138 return UPos(mExt +
in.val());
141 template <
class PosT>
144 return UPos(mExt -
in.val());
152 template <
class PosT>
155 return UPos(mExt *
in.val());
163 template <
class PosT>
166 return UPos(mExt *
in.val());
169 template <
class PosT>
175 template <
class PosT>
176 constexpr decltype(
auto) UPos::operator<<(
const PosT& a)
const
181 constexpr UPos::operator
SizeT()
const
202 template <
class PosT1>
205 return UPos(mExt + a.val());
208 template <
class PosT>
211 return FPos(mExt *
in.val(), mMap);
214 template <
class PosT1>
217 return UPos(mExt * mMap[a.val()]);
220 template <
class PosT>
226 template <
class PosT>
227 constexpr decltype(
auto) FPos::operator<<(
const PosT& a)
const
232 constexpr FPos::operator
SizeT()
const
244 template <SizeT N, SizeT...
Ms>
287 return FPos(N * a.
val(), &sMs[0]);
298 template <
class PosT>
305 template <
class PosT>
314 return FPos(N, &sMs[0]);
327 template <
class BPosT,
class NPosT>
331 "MPos has to be derived from scalar pos type");
334 template <
class BPosT,
class NPosT>
339 "MPos has to be derived from scalar pos type");
342 template <
class BPosT,
class NPosT>
343 template <
typename...
Args>
345 BPosT(
args...), mNext(next)
348 "MPos has to be derived from scalar pos type");
351 template <
class BPosT,
class NPosT>
352 template <
typename...
Args>
354 BPosT(
args...), mNext(next)
357 "MPos has to be derived from scalar pos type");
360 template <
class BPosT,
class NPosT>
363 return BPosT::size() + mNext.size();
366 template <
class BPosT,
class NPosT>
372 template <
class BPosT,
class NPosT>
373 template <
class PosT>
376 typedef decltype(BPosT::operator+(a))
OBPosT;
377 typedef decltype(mNext + a.next())
ONPosT;
381 template <
class BPosT,
class NPosT>
382 template <
class PosT>
385 typedef decltype(BPosT::operator*(a))
OBPosT;
386 typedef decltype(mNext * a)
ONPosT;
390 template <
class BPosT,
class NPosT>
391 template <
class PosT>
394 typedef decltype(BPosT::operator()(a))
OBPosT;
395 typedef decltype(mNext(a))
ONPosT;
399 template <
class BPosT,
class NPosT>
400 template <
class PosT>
403 typedef decltype(mNext.extend(a))
ONPosT;
407 template <
class BPosT,
class NPosT>
408 template <
class PosT>
426 template <
class PosT>
432 "DPos can only be constructed from pos types");
435 template <
class PosT>
441 "DPos can only be constructed from pos types");
470 template <
class PosT>
473 if constexpr(std::is_same<PosT,DPos>::value
or std::is_same<PosT,DPosRef>::value){
474 return DPos(
mC->vplus( a.vpos() ));
482 template <
class PosT>
485 if constexpr(std::is_same<PosT,DPos>::value
or std::is_same<PosT,DPosRef>::value){
486 return DPos(
mC->vtimes( a.vpos() ));
495 template <
class PosT>
498 if constexpr(std::is_same<PosT,DPos>::value
or std::is_same<PosT,DPosRef>::value){
499 return DPos(
mC->vexec( a.vpos() ));
507 template <
class PosT>
551 template <
class PosT>
554 if constexpr(std::is_same<PosT,DPos>::value
or std::is_same<PosT,DPosRef>::value){
563 template <
class PosT>
566 if constexpr(std::is_same<PosT,DPos>::value
or std::is_same<PosT,DPosRef>::value){
576 template <
class PosT>
579 if constexpr(std::is_same<PosT,DPos>::value
or std::is_same<PosT,DPosRef>::value){
588 template <
class PosT>
595 inline DPosRef::operator
SizeT()
const
604 template <
class BPosT,
class...
OPosTs>
610 template <
class BPosT,
class...
OPosTs>
616 template <
class BPosT,
class...
OPosTs>
617 template <
class PosT>
620 return iter<0,
sizeof...(OPosTs)>
621 ( [&](
auto i) {
return std::get<i>(mP); },
622 [&](
const auto&...
e) {
return EPos<
decltype(BPosT::operator+(a)),
OPosTs...>
623 (BPosT::operator+(a),
e...); } );
626 template <
class BPosT,
class...
OPosTs>
627 template <
class PosT>
630 return iter<0,
sizeof...(OPosTs)>
631 ( [&](
auto i) {
return std::get<i>(mP); },
632 [&](
const auto&...
e) {
return EPos<
decltype(BPosT::operator*(a)),
OPosTs...>
633 (BPosT::operator*(a),
e*a...); } );
636 template <
class BPosT,
class...
OPosTs>
637 template <
class PosT>
640 return iter<0,
sizeof...(OPosTs)>
641 ( [&](
auto i) {
return std::get<i>(mP); },
642 [&](
const auto&...
e) {
return EPos<
decltype(BPosT::operator()(a)),
OPosTs...>
643 (BPosT::operator()(a),
e*a...); } );
647 template <
class BPosT,
class...
OPosTs>
650 return ival(std::index_sequence_for<OPosTs...>{});
653 template <
class BPosT,
class...
OPosTs>
656 return inext(std::index_sequence_for<OPosTs...>{});
659 template <
class BPosT,
class...
OPosTs>
662 return static_cast<const BPosT&
>(*this);
665 template <
class BPosT,
class...
OPosTs>
669 return scal()+std::get<I>(mP);
672 template <
class BPosT,
class...
OPosTs>
677 return std::index_sequence<std::get<Is>(mP).
val()...>{};
680 return Arr<
SizeT,
is.size()> { (BPosT::val()+std::get<Is>(mP).val())... };
684 template <
class BPosT,
class...
OPosTs>
689 return OEPosT(BPosT::next(), std::get<Is>(mP).next()...);
696 template <
class BPosT,
class OPosT, SizeT N>
699 return mkiEPos(a,
b, std::make_index_sequence<N>{});
702 template <
class BPosT,
class NPosT,
class OPosT,
class ONPosT, SizeT N>
705 const BPosT& ax =
static_cast<const BPosT&
>(a);
711 template <SizeT N,
class BPosT,
class OPosT>
717 template <
class BPosT,
class OPosT, SizeT...
Is>
724 constexpr bool pos_types_consecutive_2<OPosT1,OPosT2,OPosTs...>::eval()
726 if constexpr(is_static_pos_type<OPosT1>::value
and is_static_pos_type<OPosT2>::value){
727 if constexpr(
sizeof...(OPosTs) != 0){
738 constexpr bool pos_type_same<OPosT1,OPosTs...>::eval()
740 if constexpr(is_static_pos_type<OPosT1>::value){
741 if constexpr(
sizeof...(OPosTs) != 0){
745 return OPosT1().val() == 0;
const VPosBase * vpos() const
const VPosBase * get() const
DPos operator()(const PosT &a) const
decltype(auto) extend(const PosT &a) const
DPos operator+(const PosT &a) const
DPos operator*(const PosT &a) const
DPosRef(const VPosBase *p)
DPos(Uptr< VPosBase > &&a)
DPos operator+(const PosT &a) const
const VPosBase * get() const
DPos operator()(const PosT &a) const
const VPosBase * vpos() const
decltype(auto) extend(const PosT &a) const
constexpr decltype(auto) val() const
constexpr decltype(auto) next() const
constexpr EPos(const BPosT &b, const OPosTs &... os)
FPos(SizeT ext, const SizeT *map)
constexpr FPos operator*(const PosT1 &a) const
constexpr const SizeT & val() const
constexpr UPos operator()(const PosT &a) const
constexpr UPos operator+(const PosT1 &a) const
constexpr decltype(auto) extend(const PosT &a) const
constexpr SizeT size() const
constexpr const NPosT & next() const
constexpr auto operator()(const PosT &a) const
constexpr auto operator+(const PosT &a) const
constexpr SizeT size() const
constexpr auto operator*(const PosT &a) const
constexpr SizeT val() const
constexpr auto operator*(const SPos< N1 > &a) const
constexpr SizeT size() const
constexpr auto operator+(const SPos< N1 > &a) const
constexpr auto operator()(const SPos< N1 > &a) const
constexpr auto operator*(const SPos< N1 > &a) const
constexpr SizeT val() const
constexpr SizeT size() const
constexpr auto operator+(const SPos< N1 > &a) const
constexpr auto operator-(const SPos< N1 > &a) const
constexpr auto operator()(const SPos< N1 > &a) const
constexpr UPos(SizeT ext)
constexpr UPos operator+(const PosT &a) const
constexpr SPos< 0 > operator()(const SPos< 0 > &a) const
constexpr SPos< 0 > operator*(const SPos< 0 > &a) const
constexpr SizeT size() const
constexpr const SizeT & val() const
constexpr decltype(auto) extend(const PosT &a) const
constexpr UPos operator-(const PosT &a) const
virtual Uptr< VPosBase > vtimes(const VPosBase *a) const =0
virtual Uptr< VPosBase > vplus(const VPosBase *a) const =0
virtual Uptr< VPosBase > vexec(const VPosBase *a) const =0
virtual SizeT vsize() const =0
virtual SizeT vval() const =0
virtual const VPosBase * vget() const =0
virtual const VPosBase * vnext() const =0
decltype(auto) mkiEPos(const BPosT &a, const OPosT &b, std::index_sequence< Is... > is)
decltype(auto) mkEPos(const BPosT &a, const OPosT &b)
std::unique_ptr< T > Uptr
Sptr< Range > rangeCast(const RangePtr r)
constexpr decltype(auto) iter(const G &g, const F &f)
Position types declarations.
static decltype(auto) mk(const BPosT &a, const OPosT &b)
Dynamic position types declarations.