Initialize boost git in 2.0_beta.
[external/boost.git] / libs / concept_check / concept_check_test.cpp
1 // (C) Copyright Jeremy Siek 2000.
2 // Distributed under the Boost Software License, Version 1.0. (See
3 // accompanying file LICENSE_1_0.txt or copy at
4 // http://www.boost.org/LICENSE_1_0.txt)
5
6 #include <boost/concept_check.hpp>
7 #include <boost/concept_archetype.hpp>
8
9 /*
10
11   This file verifies that function_requires() of the Boost Concept
12   Checking Library does not cause errors when it is not suppose to
13   and verifies that the concept archetypes meet the requirements of
14   their matching concepts.
15
16 */
17
18
19 int
20 main()
21 {
22   using namespace boost;
23
24   //===========================================================================
25   // Basic Concepts
26   {
27     typedef default_constructible_archetype<> foo;
28     function_requires< DefaultConstructible<foo> >();
29   }
30   {
31     typedef assignable_archetype<> foo;
32     function_requires< Assignable<foo> >();
33   }
34   {
35     typedef copy_constructible_archetype<> foo;
36     function_requires< CopyConstructible<foo> >();
37   }
38   {
39     typedef sgi_assignable_archetype<> foo;
40     function_requires< SGIAssignable<foo> >();
41   }
42   {
43     typedef copy_constructible_archetype<> foo;
44     typedef convertible_to_archetype<foo> convertible_to_foo;
45     function_requires< Convertible<convertible_to_foo, foo> >();
46   }
47   {
48     function_requires< Convertible<boolean_archetype, bool> >();
49   }
50   {
51     typedef equality_comparable_archetype<> foo;
52     function_requires< EqualityComparable<foo> >();
53   }
54   {
55     typedef less_than_comparable_archetype<> foo;
56     function_requires< LessThanComparable<foo> >();
57   }
58   {
59     typedef comparable_archetype<> foo;
60     function_requires< Comparable<foo> >();
61   }
62   {
63     typedef equal_op_first_archetype<> First;
64     typedef equal_op_second_archetype<> Second;
65     function_requires< EqualOp<First, Second> >();
66   }
67   {
68     typedef not_equal_op_first_archetype<> First;
69     typedef not_equal_op_second_archetype<> Second;
70     function_requires< NotEqualOp<First, Second> >();
71   }
72   {
73     typedef less_than_op_first_archetype<> First;
74     typedef less_than_op_second_archetype<> Second;
75     function_requires< LessThanOp<First, Second> >();
76   }
77   {
78     typedef less_equal_op_first_archetype<> First;
79     typedef less_equal_op_second_archetype<> Second;
80     function_requires< LessEqualOp<First, Second> >();
81   }
82   {
83     typedef greater_than_op_first_archetype<> First;
84     typedef greater_than_op_second_archetype<> Second;
85     function_requires< GreaterThanOp<First, Second> >();
86   }
87   {
88     typedef greater_equal_op_first_archetype<> First;
89     typedef greater_equal_op_second_archetype<> Second;
90     function_requires< GreaterEqualOp<First, Second> >();
91   }
92
93   {
94     typedef copy_constructible_archetype<> Return;
95     typedef plus_op_first_archetype<Return> First;
96     typedef plus_op_second_archetype<Return> Second;
97     function_requires< PlusOp<Return, First, Second> >();
98   }
99
100   //===========================================================================
101   // Function Object Concepts
102
103   {
104     typedef generator_archetype<null_archetype<> > foo;
105     function_requires< Generator<foo, null_archetype<> > >();
106   }
107 #if !defined BOOST_NO_TEMPLATE_PARTIAL_SPECIALIZATION
108   {
109     function_requires< Generator< void_generator_archetype, void > >();
110   }
111 #endif
112   {
113     typedef unary_function_archetype<int, int> F;
114     function_requires< UnaryFunction<F, int, int> >();
115   }
116   {
117     typedef binary_function_archetype<int, int, int> F;
118     function_requires< BinaryFunction<F, int, int, int> >();
119   }
120   {
121     typedef unary_predicate_archetype<int> F;
122     function_requires< UnaryPredicate<F, int> >();
123   }
124   {
125     typedef binary_predicate_archetype<int, int> F;
126     function_requires< BinaryPredicate<F, int, int> >();
127   }
128
129   //===========================================================================
130   // Iterator Concepts
131   {
132     typedef input_iterator_archetype<null_archetype<> > Iter;
133     function_requires< InputIterator<Iter> >();
134   }
135   {
136     typedef output_iterator_archetype<int> Iter;
137     function_requires< OutputIterator<Iter, int> >();
138   }
139   {
140     typedef input_output_iterator_archetype<int> Iter;
141     function_requires< InputIterator<Iter> >();
142     function_requires< OutputIterator<Iter, int> >();
143   }
144   {
145     typedef forward_iterator_archetype<null_archetype<> > Iter;
146     function_requires< ForwardIterator<Iter> >();
147   }
148   {
149     typedef mutable_forward_iterator_archetype<assignable_archetype<> > Iter;
150     function_requires< Mutable_ForwardIterator<Iter> >();
151   }
152   {
153     typedef bidirectional_iterator_archetype<null_archetype<> > Iter;
154     function_requires< BidirectionalIterator<Iter> >();
155   }
156   {
157     typedef mutable_bidirectional_iterator_archetype<assignable_archetype<> > 
158       Iter;
159     function_requires< Mutable_BidirectionalIterator<Iter> >();
160   }
161   {
162     typedef random_access_iterator_archetype<null_archetype<> > Iter;
163     function_requires< RandomAccessIterator<Iter> >();
164   }
165   {
166     typedef mutable_random_access_iterator_archetype<assignable_archetype<> > 
167       Iter;
168     function_requires< Mutable_RandomAccessIterator<Iter> >();
169   }
170
171   //===========================================================================
172   // Container Concepts
173
174   // UNDER CONSTRUCTION
175
176   return 0;
177 }