|
Boost Users : |
Subject: Re: [Boost-users] [Boost.Range][Boost.Iterators] - iterator as pointer
From: Nathan Crookston (nathan.crookston_at_[hidden])
Date: 2011-08-15 12:48:16
Christoph,
Just a guess since I don't have access to that compiler, but keep in
mind that std::vector has two parameters -- they type T and an
allocator (defaults to std::allocator<T>).
Try adding that to the partial specialization:
template<class T, class A> struct is_contingous_in_memory< typename
std::vector<T, A>::iterator > : boost::mpl::true_ {};
HTH,
Nate
On Mon, Aug 15, 2011 at 4:13 AM, Christoph Heindl
<christoph.heindl_at_[hidden]> wrote:
> 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 mailing list
> Boost-users_at_[hidden]
> http://lists.boost.org/mailman/listinfo.cgi/boost-users
>
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