1 //
2 // Test for boost/iterator.hpp
3 //
4 // Copyright 2014 Peter Dimov
5 //
6 // Distributed under the Boost Software License, Version 1.0.
7 // See accompanying file LICENSE_1_0.txt or copy at
8 // http://www.boost.org/LICENSE_1_0.txt
9 //
10 
11 #include <boost/iterator.hpp>
12 #include <boost/core/is_same.hpp>
13 #include <boost/core/lightweight_test_trait.hpp>
14 
15 /*
16 
17 template< class Category, class T,
18   class Distance = ptrdiff_t,
19   class Pointer = T*,
20   class Reference = T&>
21 struct iterator
22 {
23     typedef T value_type;
24     typedef Distance difference_type;
25     typedef Pointer pointer;
26     typedef Reference reference;
27     typedef Category iterator_category;
28 };
29 
30 */
31 
32 struct C
33 {
34 };
35 
36 struct T
37 {
38 };
39 
40 struct D
41 {
42 };
43 
44 struct P
45 {
46 };
47 
48 struct R
49 {
50 };
51 
main()52 int main()
53 {
54     using boost::core::is_same;
55 
56     BOOST_TEST_TRAIT_TRUE((is_same<boost::iterator<C,T,D,P,R>::iterator_category,C>));
57     BOOST_TEST_TRAIT_TRUE((is_same<boost::iterator<C,T,D,P,R>::value_type,T>));
58     BOOST_TEST_TRAIT_TRUE((is_same<boost::iterator<C,T,D,P,R>::difference_type,D>));
59     BOOST_TEST_TRAIT_TRUE((is_same<boost::iterator<C,T,D,P,R>::pointer,P>));
60     BOOST_TEST_TRAIT_TRUE((is_same<boost::iterator<C,T,D,P,R>::reference,R>));
61 
62     BOOST_TEST_TRAIT_TRUE((is_same<boost::iterator<C,T>::iterator_category,C>));
63     BOOST_TEST_TRAIT_TRUE((is_same<boost::iterator<C,T>::value_type,T>));
64     BOOST_TEST_TRAIT_TRUE((is_same<boost::iterator<C,T>::difference_type,std::ptrdiff_t>));
65     BOOST_TEST_TRAIT_TRUE((is_same<boost::iterator<C,T>::pointer,T*>));
66     BOOST_TEST_TRAIT_TRUE((is_same<boost::iterator<C,T>::reference,T&>));
67 
68     return boost::report_errors();
69 }
70