"David Abrahams" <[EMAIL PROTECTED]> wrote in message news:[EMAIL PROTECTED] > "Thorsten Ottosen" <[EMAIL PROTECTED]> writes:
> > I see your point. Does anyone have a nice idea of how to detect when the > > template argument is an iterator? > > Sadly, there is no reliable way. The closest thing I can imagine is > to use SFINAE to check that iterator_traits<T> has valid types, and > that the types are consistent with the iterator requirements. I imagine that will be rather non-portable (Comeau and ?). This seems to work for como, gcc3.2, vc7: template< typename C, typename T, typename D, typename P, typename R > true_t is_iterator( const std::iterator<C,T,D,P,R>& ); template< typename C > true_t is_iterator( const std::back_insert_iterator<C>& ); template< typename C > true_t is_iterator( const std::front_insert_iterator<C>& ); template< typename C > true_t is_iterator( const std::insert_iterator<C>& ); template< typename T, typename C, typename Tr > true_t is_iterator( const std::istream_iterator<T,C,Tr>& ); template< typename T, typename C, typename Tr > true_t is_iterator( const std::ostream_iterator<T,C,Tr>& ); template< typename C, typename Tr > true_t is_iterator( const std::istreambuf_iterator<C,Tr>& ); template< typename C, typename Tr > true_t is_iterator( const std::ostreambuf_iterator<C,Tr>& ); false_t is_iterator( ... ); but I'm wondering if that is enough. Can anybody come up with some cases which will fail here and which is important? regards Thorsten _______________________________________________ Unsubscribe & other changes: http://lists.boost.org/mailman/listinfo.cgi/boost