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 06:13:55


I tried to roll my own solution but I'm failing to see how to enable
the specialization for certain iterator types.
What I have done is to create a generic metafunction that applies
unless a specialization is found

  template<class Iterator>
  struct is_contingous_in_memory : boost::mpl::false_ {};

Now, when dealing with std::vector<int> I can declare

  template<> struct
is_contingous_in_memory<std::vector<int>::iterator> :
boost::mpl::true_ {};
  template<> struct
is_contingous_in_memory<std::vector<int>::iterator> :
boost::mpl::true_ {};

That way I would need to declare several variants for all integral and
floating point types. So I thought, that
I could write

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

but that fails to compile with "template parameter not used or
deducible in partial specialization 'specialization'".
How to deal with that (on MSVC 9)?

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