Boost logo

Boost Users :

Subject: Re: [Boost-users] [Boost.Range][Boost.Iterators] - iterator as pointer
From: Gordon Woodhull (gordon_at_[hidden])
Date: 2011-08-15 13:22:57


On Aug 15, 2011, at 6:13 AM, Christoph Heindl <christoph.heindl_at_[hidden]> wrote:

> template<class T> struct is_contingous_in_memory< typename
> std::vector<T>::iterator > : boost::mpl::true_ {};

I've gotten bitten by this.

You can't put a type nesting into a partial specialization pattern because e.g. the compiler can't infer that the iterator type T* came from a vector. You've already lost the container information at that point; T* could be the ::iterator of any number of classes. Seems like the error message could be more helpful!

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.

(Apologies if my terminology is a little off; hope this gets the idea across.)

Cheers
Gordon


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