add anonToDynView for mutable array types
This commit is contained in:
parent
d1c4372825
commit
6ee89f6bff
2 changed files with 30 additions and 0 deletions
|
@ -223,6 +223,19 @@ namespace MultiArrayTools
|
||||||
return ConstSlice<T,Range1,RangeTypes...,DynamicRange<EC>>(mNSpace, ma.data());
|
return ConstSlice<T,Range1,RangeTypes...,DynamicRange<EC>>(mNSpace, ma.data());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
template <typename T, class EC, class Range1, class... RangeTypes>
|
||||||
|
auto anonToDynView(MutableMultiArrayBase<T,Range1,RangeTypes...,AnonymousRange>& ma)
|
||||||
|
-> Slice<T,Range1,RangeTypes...,DynamicRange<EC>>
|
||||||
|
{
|
||||||
|
constexpr size_t LAST = sizeof...(RangeTypes)+1;
|
||||||
|
DynamicRangeFactory<EC> drf(rptr<LAST>(ma)->orig());
|
||||||
|
std::tuple<std::shared_ptr<Range1>,std::shared_ptr<RangeTypes>...,
|
||||||
|
std::shared_ptr<DynamicRange<EC>>> mNSpace;
|
||||||
|
CopyRanges<LAST-1>::exec(ma.range()->space(),mNSpace);
|
||||||
|
std::get<LAST>(mNSpace) = createExplicit( drf );
|
||||||
|
return Slice<T,Range1,RangeTypes...,DynamicRange<EC>>(mNSpace, ma.data());
|
||||||
|
}
|
||||||
|
|
||||||
template <typename T, class EC, class Range1, class... RangeTypes>
|
template <typename T, class EC, class Range1, class... RangeTypes>
|
||||||
auto dynToAnonMove(MultiArray<T,Range1,RangeTypes...,DynamicRange<EC>>&& ma)
|
auto dynToAnonMove(MultiArray<T,Range1,RangeTypes...,DynamicRange<EC>>&& ma)
|
||||||
-> MultiArray<T,Range1,RangeTypes...,AnonymousRange>
|
-> MultiArray<T,Range1,RangeTypes...,AnonymousRange>
|
||||||
|
@ -245,6 +258,15 @@ namespace MultiArrayTools
|
||||||
return ConstSlice<T,DynamicRange<EC>>(mNSpace, ma.data());
|
return ConstSlice<T,DynamicRange<EC>>(mNSpace, ma.data());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
template <typename T, class EC>
|
||||||
|
auto anonToDynView(MutableMultiArrayBase<T,AnonymousRange>& ma)
|
||||||
|
-> Slice<T,DynamicRange<EC>>
|
||||||
|
{
|
||||||
|
DynamicRangeFactory<EC> drf(rptr<0>(ma)->orig());
|
||||||
|
auto mNSpace = std::make_tuple( createExplicit( drf ) );
|
||||||
|
return Slice<T,DynamicRange<EC>>(mNSpace, ma.data());
|
||||||
|
}
|
||||||
|
|
||||||
template <typename T, class EC>
|
template <typename T, class EC>
|
||||||
auto dynToAnonMove(MultiArray<T,DynamicRange<EC>>&& ma)
|
auto dynToAnonMove(MultiArray<T,DynamicRange<EC>>&& ma)
|
||||||
-> MultiArray<T,AnonymousRange>
|
-> MultiArray<T,AnonymousRange>
|
||||||
|
|
|
@ -97,6 +97,10 @@ namespace MultiArrayTools
|
||||||
auto anonToDynView(const MultiArrayBase<T,Range1,RangeTypes...,AnonymousRange>& ma)
|
auto anonToDynView(const MultiArrayBase<T,Range1,RangeTypes...,AnonymousRange>& ma)
|
||||||
-> ConstSlice<T,Range1,RangeTypes...,DynamicRange<EC>>;
|
-> ConstSlice<T,Range1,RangeTypes...,DynamicRange<EC>>;
|
||||||
|
|
||||||
|
template <typename T, class EC, class Range1, class... RangeTypes>
|
||||||
|
auto anonToDynView(MutableMultiArrayBase<T,Range1,RangeTypes...,AnonymousRange>& ma)
|
||||||
|
-> Slice<T,Range1,RangeTypes...,DynamicRange<EC>>;
|
||||||
|
|
||||||
template <typename T, class EC, class Range1, class... RangeTypes>
|
template <typename T, class EC, class Range1, class... RangeTypes>
|
||||||
auto dynToAnonMove(MultiArray<T,Range1,RangeTypes...,DynamicRange<EC>>&& ma)
|
auto dynToAnonMove(MultiArray<T,Range1,RangeTypes...,DynamicRange<EC>>&& ma)
|
||||||
-> MultiArray<T,Range1,RangeTypes...,AnonymousRange>;
|
-> MultiArray<T,Range1,RangeTypes...,AnonymousRange>;
|
||||||
|
@ -105,6 +109,10 @@ namespace MultiArrayTools
|
||||||
auto anonToDynView(const MultiArrayBase<T,AnonymousRange>& ma)
|
auto anonToDynView(const MultiArrayBase<T,AnonymousRange>& ma)
|
||||||
-> ConstSlice<T,DynamicRange<EC>>;
|
-> ConstSlice<T,DynamicRange<EC>>;
|
||||||
|
|
||||||
|
template <typename T, class EC>
|
||||||
|
auto anonToDynView(MutableMultiArrayBase<T,AnonymousRange>& ma)
|
||||||
|
-> Slice<T,DynamicRange<EC>>;
|
||||||
|
|
||||||
template <typename T, class EC>
|
template <typename T, class EC>
|
||||||
auto dynToAnonMove(MultiArray<T,DynamicRange<EC>>&& ma)
|
auto dynToAnonMove(MultiArray<T,DynamicRange<EC>>&& ma)
|
||||||
-> MultiArray<T,AnonymousRange>;
|
-> MultiArray<T,AnonymousRange>;
|
||||||
|
|
Loading…
Reference in a new issue