[type_traits] an is_iterator, not is_pointer, trait

Hi, I'm looking to use a trait in enable_if that can distinguish between a raw pointer and any other valid iterator type, essentially the difference between iterator traits and the raw pointer specialization. template <class Iterator> struct iterator_traits; template <class T> struct iterator_traits<T*>; I was hoping to find a boost::is_iterator type trait which would return false_type for is_iterator<int*> (any raw pointer) and true type for any other valid iterator. This would allow me to group iterators via is_pointer and is_iterator. I was just wondering if this already exists somewhere? Thanks. -- Noel Belcourt

I'm looking to use a trait in enable_if that can distinguish between a raw pointer and any other valid iterator type, essentially the difference between iterator traits and the raw pointer specialization.
You could maybe use the following: ::boost::type_traits::ice_and< ::boost::type_traits::ice_not< ::boost::is_pointer< T >::value >::value, ::boost::has_post_increment< T >::value, ::boost::has_dereference< T >::value
::value
Frédéric

On Nov 3, 2011, at 4:06 PM, Frédéric Bron wrote:
I'm looking to use a trait in enable_if that can distinguish between a raw pointer and any other valid iterator type, essentially the difference between iterator traits and the raw pointer specialization.
You could maybe use the following:
::boost::type_traits::ice_and< ::boost::type_traits::ice_not< ::boost::is_pointer< T >::value
::value, ::boost::has_post_increment< T >::value, ::boost::has_dereference< T >::value ::value
Thanks Frédéric, that's the path I was heading down. I appreciate the help! -- Noel

::boost::type_traits::ice_and< ::boost::type_traits::ice_not< ::boost::is_pointer< T >::value >::value, ::boost::has_post_increment< T >::value, ::boost::has_dereference< T >::value
::value
Thanks Frédéric, that's the path I was heading down. I appreciate the help!
I forgot to mention that this works only with 1.48.0 as the operator detection is new to this release. Frédéric
participants (2)
-
Belcourt, K. Noel
-
Frédéric Bron