1 // Copyright David Abrahams 2003. Use, modification and distribution is
2 // subject to the Boost Software License, Version 1.0. (See accompanying
3 // file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
8 #include <boost/static_assert.hpp>
9 #include <boost/noncopyable.hpp>
10 #include <boost/iterator/is_readable_iterator.hpp>
11 #include <boost/iterator.hpp>
13 // Last, for BOOST_NO_LVALUE_RETURN_DETECTION
14 #include <boost/iterator/detail/config_def.hpp>
23 struct value_iterator
: boost::iterator
<std::input_iterator_tag
,v
>
28 struct noncopyable_iterator
: boost::iterator
<std::forward_iterator_tag
,boost::noncopyable
>
30 boost::noncopyable
const& operator*() const;
33 struct proxy_iterator
: boost::iterator
<std::output_iterator_tag
,v
>
35 #if BOOST_WORKAROUND(__GNUC__, == 2)
36 typedef boost::iterator
<std::input_iterator_tag
,v
> base
;
37 typedef base::iterator_category iterator_category
;
38 typedef base::value_type value_type
;
39 typedef base::difference_type difference_type
;
40 typedef base::pointer pointer
;
41 typedef base::reference reference
;
47 proxy
& operator=(v
) const;
50 proxy
operator*() const;
53 struct proxy_iterator2
: boost::iterator
<std::output_iterator_tag
,v
>
55 #if BOOST_WORKAROUND(__GNUC__, == 2)
56 typedef boost::iterator
<std::input_iterator_tag
,v
> base
;
57 typedef base::iterator_category iterator_category
;
58 typedef base::value_type value_type
;
59 typedef base::difference_type difference_type
;
60 typedef base::pointer pointer
;
61 typedef base::reference reference
;
66 proxy
& operator=(v
) const;
69 proxy
operator*() const;
75 BOOST_STATIC_ASSERT(boost::is_readable_iterator
<v
*>::value
);
76 BOOST_STATIC_ASSERT(boost::is_readable_iterator
<v
const*>::value
);
77 BOOST_STATIC_ASSERT(boost::is_readable_iterator
<std::deque
<v
>::iterator
>::value
);
78 BOOST_STATIC_ASSERT(boost::is_readable_iterator
<std::deque
<v
>::const_iterator
>::value
);
79 BOOST_STATIC_ASSERT(!boost::is_readable_iterator
<std::back_insert_iterator
<std::deque
<v
> > >::value
);
80 BOOST_STATIC_ASSERT(!boost::is_readable_iterator
<std::ostream_iterator
<v
> >::value
);
81 BOOST_STATIC_ASSERT(boost::is_readable_iterator
<proxy_iterator
>::value
);
82 BOOST_STATIC_ASSERT(!boost::is_readable_iterator
<proxy_iterator2
>::value
);
83 BOOST_STATIC_ASSERT(boost::is_readable_iterator
<value_iterator
>::value
);
85 // Make sure inaccessible copy constructor doesn't prevent
87 BOOST_STATIC_ASSERT(boost::is_readable_iterator
<noncopyable_iterator
>::value
);