dev #2

Merged
chizeta merged 32 commits from dev into main 2024-02-02 20:36:53 +01:00
Showing only changes of commit 91f9a3c957 - Show all commits

View file

@ -338,10 +338,19 @@ namespace CNORXZ
template <class RangeT> template <class RangeT>
RangePtr PRange<RangeT>::extend(const RangePtr& r) const RangePtr PRange<RangeT>::extend(const RangePtr& r) const
{ {
CXZ_ERROR("implement!!!"); if(r->type() == type()){
// if r is PRange of same Range, then just add parts Sptr<PRange<RangeT>> rx = std::dynamic_pointer_cast<PRange<RangeT>>(r);
// else derive and add meta of r if(rx->orig() == orig()){
return nullptr; Vector<SizeT> p(parts());
for(auto i: rx->parts()){
if(find(p.begin(), p.end(), i) != p.end()){
p.push_back(i);
}
}
return prange(orig(), p);
}
}
return derive()->extend(r);
} }
template <class RangeT> template <class RangeT>
@ -361,8 +370,9 @@ namespace CNORXZ
{ {
Vector<MetaType> meta(this->size()); Vector<MetaType> meta(this->size());
auto i = mRange->begin(); auto i = mRange->begin();
SizeT j = 0;
for(const auto& p: mParts){ for(const auto& p: mParts){
meta = *(i = p); meta[j++] = *(i = p);
} }
return URangeFactory<MetaType>( meta ).create(); return URangeFactory<MetaType>( meta ).create();
} }