// (C) Copyright Jeremy Siek 2000. Permission to copy, use, modify, // sell and distribute this software is granted provided this // copyright notice appears in all copies. This software is provided // "as is" without express or implied warranty, and with no claim as // to its suitability for any purpose. #include #include /* This file verifies that the BOOST_FUNCTION_REQUIRES macros of the Boost Concept Checking Library do not cause errors when they are not suppose to and verifies that the concept archetypes meet the requirements of their matching concepts. */ int main() { using namespace boost; //=========================================================================== // Basic Concepts { typedef default_constructible_archetype<> foo; function_requires< DefaultConstructibleConcept >(); } { typedef assignable_archetype<> foo; function_requires< AssignableConcept >(); } { typedef copy_constructible_archetype<> foo; function_requires< CopyConstructibleConcept >(); } { typedef sgi_assignable_archetype<> foo; function_requires< SGIAssignableConcept >(); } { typedef copy_constructible_archetype<> foo; typedef convertible_to_archetype convertible_to_foo; function_requires< ConvertibleConcept >(); } { function_requires< ConvertibleConcept >(); } { typedef equality_comparable_archetype<> foo; function_requires< EqualityComparableConcept >(); } { typedef less_than_comparable_archetype<> foo; function_requires< LessThanComparableConcept >(); } { typedef comparable_archetype<> foo; function_requires< ComparableConcept >(); } { typedef equal_op_first_archetype<> First; typedef equal_op_second_archetype<> Second; function_requires< EqualOpConcept >(); } { typedef not_equal_op_first_archetype<> First; typedef not_equal_op_second_archetype<> Second; function_requires< NotEqualOpConcept >(); } { typedef less_than_op_first_archetype<> First; typedef less_than_op_second_archetype<> Second; function_requires< LessThanOpConcept >(); } { typedef less_equal_op_first_archetype<> First; typedef less_equal_op_second_archetype<> Second; function_requires< LessEqualOpConcept >(); } { typedef greater_than_op_first_archetype<> First; typedef greater_than_op_second_archetype<> Second; function_requires< GreaterThanOpConcept >(); } { typedef greater_equal_op_first_archetype<> First; typedef greater_equal_op_second_archetype<> Second; function_requires< GreaterEqualOpConcept >(); } { typedef copy_constructible_archetype<> Return; typedef plus_op_first_archetype First; typedef plus_op_second_archetype Second; function_requires< PlusOpConcept >(); } //=========================================================================== // Function Object Concepts { typedef generator_archetype > foo; function_requires< GeneratorConcept > >(); } { function_requires< GeneratorConcept< void_generator_archetype, void > >(); } { typedef unary_function_archetype F; function_requires< UnaryFunctionConcept >(); } { typedef binary_function_archetype F; function_requires< BinaryFunctionConcept >(); } { typedef unary_predicate_archetype F; function_requires< UnaryPredicateConcept >(); } { typedef binary_predicate_archetype F; function_requires< BinaryPredicateConcept >(); typedef const_binary_predicate_archetype const_F; function_requires< Const_BinaryPredicateConcept >(); } //=========================================================================== // Iterator Concepts { typedef trivial_iterator_archetype > Iter; function_requires< TrivialIteratorConcept >(); } { typedef mutable_trivial_iterator_archetype > Iter; function_requires< Mutable_TrivialIteratorConcept >(); } { typedef input_iterator_archetype > Iter; function_requires< InputIteratorConcept >(); } { typedef output_iterator_archetype Iter; function_requires< OutputIteratorConcept >(); } { typedef forward_iterator_archetype > Iter; function_requires< ForwardIteratorConcept >(); } { typedef forward_iterator_archetype > Iter; function_requires< Mutable_ForwardIteratorConcept >(); } { typedef bidirectional_iterator_archetype > Iter; function_requires< BidirectionalIteratorConcept >(); } { typedef bidirectional_iterator_archetype > Iter; function_requires< Mutable_BidirectionalIteratorConcept >(); } { typedef random_access_iterator_archetype > Iter; function_requires< RandomAccessIteratorConcept >(); } { typedef random_access_iterator_archetype > Iter; function_requires< Mutable_RandomAccessIteratorConcept >(); } //=========================================================================== // Container Concepts { function_requires< ContainerConcept< > >(); } { } return 0; }