[Boost-bugs] [Boost C++ Libraries] #2815: transform_iterator change stl iterator_category

Subject: [Boost-bugs] [Boost C++ Libraries] #2815: transform_iterator change stl iterator_category
From: Boost C++ Libraries (noreply_at_[hidden])
Date: 2009-03-02 21:45:43


#2815: transform_iterator change stl iterator_category
-----------------------------+----------------------------------------------
 Reporter: bismuth_at_[hidden] | Owner: dave
     Type: Bugs | Status: new
Milestone: | Component: iterator
  Version: Boost 1.36.0 | Severity: Problem
 Keywords: iterators |
-----------------------------+----------------------------------------------
 Why does this code compile?


 {{{
 #include <stdio.h>
 #include <tchar.h>

 #include <vector>
 #include <boost/iterator/transform_iterator.hpp>
 #include <boost/static_assert.hpp>

 struct Tr1:
     std::unary_function<unsigned, unsigned>
 {
     unsigned operator()(unsigned a)const
     {
         return a;
     }
 };

 int _tmain(int argc, _TCHAR* argv[])
 {
     typedef std::vector<unsigned>::iterator some_ra_iterator_t;
     typedef boost::transform_iterator<Tr1, some_ra_iterator_t> tr_iter_t;

     BOOST_STATIC_ASSERT
     (( boost::is_convertible
         < std::iterator_traits<some_ra_iterator_t>::iterator_category,
             std::random_access_iterator_tag
>::value
     ));

     BOOST_STATIC_ASSERT
     (( ! boost::is_convertible
         < std::iterator_traits<tr_iter_t>::iterator_category,
             std::random_access_iterator_tag
>::value
     ));

     BOOST_STATIC_ASSERT
     (( boost::is_same
         < std::iterator_traits<tr_iter_t>::iterator_category,
             boost::detail::iterator_category_with_traversal
             < std::input_iterator_tag, //?!
                 boost::random_access_traversal_tag
>
>::value
     ));

     return 0;
 }

 }}}

-- 
Ticket URL: <https://svn.boost.org/trac/boost/ticket/2815>
Boost C++ Libraries <http://www.boost.org/>
Boost provides free peer-reviewed portable C++ source libraries.

This archive was generated by hypermail 2.1.7 : 2017-02-16 18:49:59 UTC