// Copyright David Abrahams 2003. Use, modification and distribution is // subject to the Boost Software License, Version 1.0. (See accompanying // file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt) #include #include #include #include #include #include #include // Last, for BOOST_NO_LVALUE_RETURN_DETECTION #include struct v { v(); ~v(); }; struct value_iterator : boost::iterator { v operator*() const; }; struct noncopyable_iterator : boost::iterator { boost::noncopyable const& operator*() const; }; struct proxy_iterator : boost::iterator { #if BOOST_WORKAROUND(__GNUC__, == 2) typedef boost::iterator base; typedef base::iterator_category iterator_category; typedef base::value_type value_type; typedef base::difference_type difference_type; typedef base::pointer pointer; typedef base::reference reference; #endif struct proxy { operator v&(); proxy& operator=(v) const; }; proxy operator*() const; }; struct proxy_iterator2 : boost::iterator { #if BOOST_WORKAROUND(__GNUC__, == 2) typedef boost::iterator base; typedef base::iterator_category iterator_category; typedef base::value_type value_type; typedef base::difference_type difference_type; typedef base::pointer pointer; typedef base::reference reference; #endif struct proxy { proxy& operator=(v) const; }; proxy operator*() const; }; int main() { BOOST_STATIC_ASSERT(boost::is_readable_iterator::value); BOOST_STATIC_ASSERT(boost::is_readable_iterator::value); BOOST_STATIC_ASSERT(boost::is_readable_iterator::iterator>::value); BOOST_STATIC_ASSERT(boost::is_readable_iterator::const_iterator>::value); BOOST_STATIC_ASSERT(!boost::is_readable_iterator > >::value); BOOST_STATIC_ASSERT(!boost::is_readable_iterator >::value); BOOST_STATIC_ASSERT(boost::is_readable_iterator::value); BOOST_STATIC_ASSERT(!boost::is_readable_iterator::value); BOOST_STATIC_ASSERT(boost::is_readable_iterator::value); // Make sure inaccessible copy constructor doesn't prevent // readability BOOST_STATIC_ASSERT(boost::is_readable_iterator::value); return 0; }