Example #1
0
    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)))));
    }
Example #2
0
 /** 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;
   }
Example #3
0
    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())));
    }
Example #4
0
 Val const& consumeNew()       { return new_->getElement (newHead_++); }
Example #5
0
 Val const& consumeOld()       { return old_.getElement (oldHead_++); }
Example #6
0
 Val const& newElm()     const { return new_->getElement (newHead_); }
Example #7
0
 Val const& oldElm()     const { return old_.getElement (oldHead_); }
Example #8
0
 bool obsoleted() const { return hasOld() && newHead_ > new_->pos(oldElm()); }
Example #9
0
 bool needFetch() const { return hasNew() && oldHead_ < old_.pos(newElm());  }
Example #10
0
 bool canInsert() const { return hasNew() && !old_.contains(newElm());       }
Example #11
0
 bool canDelete() const { return hasOld() && !new_->contains(oldElm());      }
Example #12
0
 bool hasNew()    const { return newHead_ < new_->size(); }
Example #13
0
 bool hasOld()    const { return oldHead_ < old_.size(); }