Boost logo

Boost Users :

Subject: Re: [Boost-users] [Boost.Range][Boost.Iterators] - iterator as pointer
From: Christoph Heindl (christoph.heindl_at_[hidden])
Date: 2011-08-15 13:44:35


On Mon, Aug 15, 2011 at 7:22 PM, Gordon Woodhull <gordon_at_[hidden]> wrote:
>
> If you still have the container type at the place where you're trying to deduce is_continuous, I think that would be the way to go.

Unfortunately I don't have access to the container type, because my
iterator comes from any boost.range compatible type.
I'm doing something along the lines of

/** Some policy */
struct error {
  /** Test if range iterator can be handled like a pointer to
continuous memory */
  template<class Range>
  inline bool operator()(const Range &r) const {

     // If your compiler traps here, you probably used the
memory_policies::error
     // policy and failed to supply an appropriate
is_continuous_in_memory for your
     // range argument.
     BOOST_STATIC_ASSERT((is_continuous_in_memory<boost::range_iterator<Range>::type>::value));

     return true;
  }
};

Best regards,
Christoph


Boost-users list run by williamkempf at hotmail.com, kalb at libertysoft.com, bjorn.karlsson at readsoft.com, gregod at cs.rpi.edu, wekempf at cox.net