static type call(A0& a0, I const& indices) { Idx idx = nt2::function_index(indices, a0.extent(), meta::as_<typename A0::indexes_type>()); std::size_t b = nt2::run(idx, 0u, meta::as_<std::size_t>()); std::size_t e = nt2::run(idx, nt2::numel(idx.extent())-1u, meta::as_<std::size_t>())+1u; typename A0::value_type* p = const_cast<typename A0::value_type*>(a0.raw()); return type(expr::make(container_ref(boost::make_shared<container>(idx.extent(), nt2::share(p+b, p+e))))); }
/** does the current state of the underlying sequence differ * from the state embodied into the last reference snapshot taken? * @remarks will possibly evaluate and iterate the whole sequence */ bool isChanged() const { auto snapshot = refIdx_.begin(); for (auto const& elm : currentData_) if (snapshot != refIdx_.end() && elm != *snapshot++) return true; return false; }
static type call(A0& a0, I const& indices) { Idx idx = nt2::function_index(indices, a0.extent(), meta::as_<typename A0::indexes_type>()); std::size_t b = nt2::run(idx, 0u, meta::as_<std::size_t>()); return nt2_expr(basic_expr::make(container_ref(boost::proto::value(a0), boost::proto::value(a0).begin()+b, idx.extent()))); }
Val const& consumeNew() { return new_->getElement (newHead_++); }
Val const& consumeOld() { return old_.getElement (oldHead_++); }
Val const& newElm() const { return new_->getElement (newHead_); }
Val const& oldElm() const { return old_.getElement (oldHead_); }
bool obsoleted() const { return hasOld() && newHead_ > new_->pos(oldElm()); }
bool needFetch() const { return hasNew() && oldHead_ < old_.pos(newElm()); }
bool canInsert() const { return hasNew() && !old_.contains(newElm()); }
bool canDelete() const { return hasOld() && !new_->contains(oldElm()); }
bool hasNew() const { return newHead_ < new_->size(); }
bool hasOld() const { return oldHead_ < old_.size(); }