2 // (C) Copyright Jeremy Siek 2000.
3 // Distributed under the Boost Software License, Version 1.0. (See
4 // accompanying file LICENSE_1_0.txt or copy at
5 // http://www.boost.org/LICENSE_1_0.txt)
8 // 05 May 2001: Workarounds for HP aCC from Thomas Matelich. (Jeremy Siek)
9 // 02 April 2001: Removed limits header altogether. (Jeremy Siek)
10 // 01 April 2001: Modified to use new <boost/limits.hpp> header. (JMaddock)
13 // See http://www.boost.org/libs/concept_check for documentation.
15 #ifndef BOOST_CONCEPT_CHECKS_HPP
16 # define BOOST_CONCEPT_CHECKS_HPP
18 # include <boost/concept/assert.hpp>
20 # include <boost/iterator.hpp>
21 # include <boost/type_traits/conversion_traits.hpp>
23 # include <boost/type_traits/is_same.hpp>
24 # include <boost/type_traits/is_void.hpp>
25 # include <boost/mpl/assert.hpp>
26 # include <boost/mpl/bool.hpp>
27 # include <boost/detail/workaround.hpp>
28 # include <boost/detail/iterator.hpp>
30 # include <boost/concept/usage.hpp>
31 # include <boost/concept/detail/concept_def.hpp>
37 // Backward compatibility
40 template <class Model>
41 inline void function_requires(Model* = 0)
43 BOOST_CONCEPT_ASSERT((Model));
45 template <class T> inline void ignore_unused_variable_warning(T const&) {}
47 # define BOOST_CLASS_REQUIRE(type_var, ns, concept) \
48 BOOST_CONCEPT_ASSERT((ns::concept<type_var>))
50 # define BOOST_CLASS_REQUIRE2(type_var1, type_var2, ns, concept) \
51 BOOST_CONCEPT_ASSERT((ns::concept<type_var1,type_var2>))
53 # define BOOST_CLASS_REQUIRE3(tv1, tv2, tv3, ns, concept) \
54 BOOST_CONCEPT_ASSERT((ns::concept<tv1,tv2,tv3>))
56 # define BOOST_CLASS_REQUIRE4(tv1, tv2, tv3, tv4, ns, concept) \
57 BOOST_CONCEPT_ASSERT((ns::concept<tv1,tv2,tv3,tv4>))
61 // Begin concept definitions
63 BOOST_concept(Integer, (T))
65 BOOST_CONCEPT_USAGE(Integer)
67 x.error_type_must_be_an_integer_type();
73 template <> struct Integer<signed char> {};
74 template <> struct Integer<unsigned char> {};
75 template <> struct Integer<short> {};
76 template <> struct Integer<unsigned short> {};
77 template <> struct Integer<int> {};
78 template <> struct Integer<unsigned int> {};
79 template <> struct Integer<long> {};
80 template <> struct Integer<unsigned long> {};
81 # if defined(BOOST_HAS_LONG_LONG)
82 template <> struct Integer< ::boost::long_long_type> {};
83 template <> struct Integer< ::boost::ulong_long_type> {};
84 # elif defined(BOOST_HAS_MS_INT64)
85 template <> struct Integer<__int64> {};
86 template <> struct Integer<unsigned __int64> {};
89 BOOST_concept(SignedInteger,(T)) {
90 BOOST_CONCEPT_USAGE(SignedInteger) {
91 x.error_type_must_be_a_signed_integer_type();
96 template <> struct SignedInteger<signed char> { };
97 template <> struct SignedInteger<short> {};
98 template <> struct SignedInteger<int> {};
99 template <> struct SignedInteger<long> {};
100 # if defined(BOOST_HAS_LONG_LONG)
101 template <> struct SignedInteger< ::boost::long_long_type> {};
102 # elif defined(BOOST_HAS_MS_INT64)
103 template <> struct SignedInteger<__int64> {};
106 BOOST_concept(UnsignedInteger,(T)) {
107 BOOST_CONCEPT_USAGE(UnsignedInteger) {
108 x.error_type_must_be_an_unsigned_integer_type();
114 template <> struct UnsignedInteger<unsigned char> {};
115 template <> struct UnsignedInteger<unsigned short> {};
116 template <> struct UnsignedInteger<unsigned int> {};
117 template <> struct UnsignedInteger<unsigned long> {};
118 # if defined(BOOST_HAS_LONG_LONG)
119 template <> struct UnsignedInteger< ::boost::ulong_long_type> {};
120 # elif defined(BOOST_HAS_MS_INT64)
121 template <> struct UnsignedInteger<unsigned __int64> {};
124 //===========================================================================
127 BOOST_concept(DefaultConstructible,(TT))
129 BOOST_CONCEPT_USAGE(DefaultConstructible) {
130 TT a; // require default constructor
131 ignore_unused_variable_warning(a);
135 BOOST_concept(Assignable,(TT))
137 BOOST_CONCEPT_USAGE(Assignable) {
138 #if !defined(_ITERATOR_) // back_insert_iterator broken for VC++ STL
139 a = a; // require assignment operator
141 const_constraints(a);
144 void const_constraints(const TT& b) {
145 #if !defined(_ITERATOR_) // back_insert_iterator broken for VC++ STL
146 a = b; // const required for argument to assignment
148 ignore_unused_variable_warning(b);
156 BOOST_concept(CopyConstructible,(TT))
158 BOOST_CONCEPT_USAGE(CopyConstructible) {
159 TT a(b); // require copy constructor
160 TT* ptr = &a; // require address of operator
161 const_constraints(a);
162 ignore_unused_variable_warning(ptr);
165 void const_constraints(const TT& a) {
166 TT c(a); // require const copy constructor
167 const TT* ptr = &a; // require const address of operator
168 ignore_unused_variable_warning(c);
169 ignore_unused_variable_warning(ptr);
174 #if (defined _MSC_VER)
175 # pragma warning( push )
176 # pragma warning( disable : 4510 ) // default constructor could not be generated
177 # pragma warning( disable : 4610 ) // object 'class' can never be instantiated - user-defined constructor required
179 // The SGI STL version of Assignable requires copy constructor and operator=
180 BOOST_concept(SGIAssignable,(TT))
182 BOOST_CONCEPT_USAGE(SGIAssignable) {
184 #if !defined(_ITERATOR_) // back_insert_iterator broken for VC++ STL
185 a = a; // require assignment operator
187 const_constraints(a);
188 ignore_unused_variable_warning(b);
191 void const_constraints(const TT& b) {
193 #if !defined(_ITERATOR_) // back_insert_iterator broken for VC++ STL
194 a = b; // const required for argument to assignment
196 ignore_unused_variable_warning(c);
200 #if (defined _MSC_VER)
201 # pragma warning( pop )
204 BOOST_concept(Convertible,(X)(Y))
206 BOOST_CONCEPT_USAGE(Convertible) {
208 ignore_unused_variable_warning(y);
214 // The C++ standard requirements for many concepts talk about return
215 // types that must be "convertible to bool". The problem with this
216 // requirement is that it leaves the door open for evil proxies that
217 // define things like operator|| with strange return types. Two
218 // possible solutions are:
219 // 1) require the return type to be exactly bool
220 // 2) stay with convertible to bool, and also
221 // specify stuff about all the logical operators.
222 // For now we just test for convertible to bool.
224 void require_boolean_expr(const TT& t) {
226 ignore_unused_variable_warning(x);
229 BOOST_concept(EqualityComparable,(TT))
231 BOOST_CONCEPT_USAGE(EqualityComparable) {
232 require_boolean_expr(a == b);
233 require_boolean_expr(a != b);
239 BOOST_concept(LessThanComparable,(TT))
241 BOOST_CONCEPT_USAGE(LessThanComparable) {
242 require_boolean_expr(a < b);
248 // This is equivalent to SGI STL's LessThanComparable.
249 BOOST_concept(Comparable,(TT))
251 BOOST_CONCEPT_USAGE(Comparable) {
252 require_boolean_expr(a < b);
253 require_boolean_expr(a > b);
254 require_boolean_expr(a <= b);
255 require_boolean_expr(a >= b);
261 #define BOOST_DEFINE_BINARY_PREDICATE_OP_CONSTRAINT(OP,NAME) \
262 BOOST_concept(NAME, (First)(Second)) \
264 BOOST_CONCEPT_USAGE(NAME) { (void)constraints_(); } \
266 bool constraints_() { return a OP b; } \
271 #define BOOST_DEFINE_BINARY_OPERATOR_CONSTRAINT(OP,NAME) \
272 BOOST_concept(NAME, (Ret)(First)(Second)) \
274 BOOST_CONCEPT_USAGE(NAME) { (void)constraints_(); } \
276 Ret constraints_() { return a OP b; } \
281 BOOST_DEFINE_BINARY_PREDICATE_OP_CONSTRAINT(==, EqualOp);
282 BOOST_DEFINE_BINARY_PREDICATE_OP_CONSTRAINT(!=, NotEqualOp);
283 BOOST_DEFINE_BINARY_PREDICATE_OP_CONSTRAINT(<, LessThanOp);
284 BOOST_DEFINE_BINARY_PREDICATE_OP_CONSTRAINT(<=, LessEqualOp);
285 BOOST_DEFINE_BINARY_PREDICATE_OP_CONSTRAINT(>, GreaterThanOp);
286 BOOST_DEFINE_BINARY_PREDICATE_OP_CONSTRAINT(>=, GreaterEqualOp);
288 BOOST_DEFINE_BINARY_OPERATOR_CONSTRAINT(+, PlusOp);
289 BOOST_DEFINE_BINARY_OPERATOR_CONSTRAINT(*, TimesOp);
290 BOOST_DEFINE_BINARY_OPERATOR_CONSTRAINT(/, DivideOp);
291 BOOST_DEFINE_BINARY_OPERATOR_CONSTRAINT(-, SubtractOp);
292 BOOST_DEFINE_BINARY_OPERATOR_CONSTRAINT(%, ModOp);
294 //===========================================================================
295 // Function Object Concepts
297 BOOST_concept(Generator,(Func)(Return))
299 BOOST_CONCEPT_USAGE(Generator) { test(is_void<Return>()); }
302 void test(boost::mpl::false_)
304 // Do we really want a reference here?
305 const Return& r = f();
306 ignore_unused_variable_warning(r);
309 void test(boost::mpl::true_)
317 BOOST_concept(UnaryFunction,(Func)(Return)(Arg))
319 BOOST_CONCEPT_USAGE(UnaryFunction) { test(is_void<Return>()); }
322 void test(boost::mpl::false_)
324 f(arg); // "priming the pump" this way keeps msvc6 happy (ICE)
326 ignore_unused_variable_warning(r);
329 void test(boost::mpl::true_)
334 #if (BOOST_WORKAROUND(__GNUC__, BOOST_TESTED_AT(4) \
335 && BOOST_WORKAROUND(__GNUC__, > 3)))
336 // Declare a dummy construktor to make gcc happy.
337 // It seems the compiler can not generate a sensible constructor when this is instantiated with a refence type.
338 // (warning: non-static reference "const double& boost::UnaryFunction<YourClassHere>::arg"
339 // in class without a constructor [-Wuninitialized])
347 BOOST_concept(BinaryFunction,(Func)(Return)(First)(Second))
349 BOOST_CONCEPT_USAGE(BinaryFunction) { test(is_void<Return>()); }
351 void test(boost::mpl::false_)
354 Return r = f(first, second); // require operator()
358 void test(boost::mpl::true_)
368 BOOST_concept(UnaryPredicate,(Func)(Arg))
370 BOOST_CONCEPT_USAGE(UnaryPredicate) {
371 require_boolean_expr(f(arg)); // require operator() returning bool
378 BOOST_concept(BinaryPredicate,(Func)(First)(Second))
380 BOOST_CONCEPT_USAGE(BinaryPredicate) {
381 require_boolean_expr(f(a, b)); // require operator() returning bool
389 // use this when functor is used inside a container class like std::set
390 BOOST_concept(Const_BinaryPredicate,(Func)(First)(Second))
391 : BinaryPredicate<Func, First, Second>
393 BOOST_CONCEPT_USAGE(Const_BinaryPredicate) {
394 const_constraints(f);
397 void const_constraints(const Func& fun) {
398 // operator() must be a const member function
399 require_boolean_expr(fun(a, b));
406 BOOST_concept(AdaptableGenerator,(Func)(Return))
407 : Generator<Func, typename Func::result_type>
409 typedef typename Func::result_type result_type;
411 BOOST_CONCEPT_USAGE(AdaptableGenerator)
413 BOOST_CONCEPT_ASSERT((Convertible<result_type, Return>));
417 BOOST_concept(AdaptableUnaryFunction,(Func)(Return)(Arg))
418 : UnaryFunction<Func, typename Func::result_type, typename Func::argument_type>
420 typedef typename Func::argument_type argument_type;
421 typedef typename Func::result_type result_type;
423 ~AdaptableUnaryFunction()
425 BOOST_CONCEPT_ASSERT((Convertible<result_type, Return>));
426 BOOST_CONCEPT_ASSERT((Convertible<Arg, argument_type>));
430 BOOST_concept(AdaptableBinaryFunction,(Func)(Return)(First)(Second))
433 , typename Func::result_type
434 , typename Func::first_argument_type
435 , typename Func::second_argument_type
438 typedef typename Func::first_argument_type first_argument_type;
439 typedef typename Func::second_argument_type second_argument_type;
440 typedef typename Func::result_type result_type;
442 ~AdaptableBinaryFunction()
444 BOOST_CONCEPT_ASSERT((Convertible<result_type, Return>));
445 BOOST_CONCEPT_ASSERT((Convertible<First, first_argument_type>));
446 BOOST_CONCEPT_ASSERT((Convertible<Second, second_argument_type>));
450 BOOST_concept(AdaptablePredicate,(Func)(Arg))
451 : UnaryPredicate<Func, Arg>
452 , AdaptableUnaryFunction<Func, bool, Arg>
456 BOOST_concept(AdaptableBinaryPredicate,(Func)(First)(Second))
457 : BinaryPredicate<Func, First, Second>
458 , AdaptableBinaryFunction<Func, bool, First, Second>
462 //===========================================================================
465 BOOST_concept(InputIterator,(TT))
467 , EqualityComparable<TT>
469 typedef typename boost::detail::iterator_traits<TT>::value_type value_type;
470 typedef typename boost::detail::iterator_traits<TT>::difference_type difference_type;
471 typedef typename boost::detail::iterator_traits<TT>::reference reference;
472 typedef typename boost::detail::iterator_traits<TT>::pointer pointer;
473 typedef typename boost::detail::iterator_traits<TT>::iterator_category iterator_category;
475 BOOST_CONCEPT_USAGE(InputIterator)
477 BOOST_CONCEPT_ASSERT((SignedInteger<difference_type>));
478 BOOST_CONCEPT_ASSERT((Convertible<iterator_category, std::input_iterator_tag>));
481 (void)*i; // require dereference operator
482 ++j; // require preincrement operator
483 i++; // require postincrement operator
489 BOOST_concept(OutputIterator,(TT)(ValueT))
492 BOOST_CONCEPT_USAGE(OutputIterator) {
494 ++i; // require preincrement operator
495 i++; // require postincrement operator
496 *i++ = t; // require postincrement and assignment
503 BOOST_concept(ForwardIterator,(TT))
506 BOOST_CONCEPT_USAGE(ForwardIterator)
508 BOOST_CONCEPT_ASSERT((Convertible<
509 BOOST_DEDUCED_TYPENAME ForwardIterator::iterator_category
510 , std::forward_iterator_tag
513 typename InputIterator<TT>::reference r = *i;
514 ignore_unused_variable_warning(r);
521 BOOST_concept(Mutable_ForwardIterator,(TT))
522 : ForwardIterator<TT>
524 BOOST_CONCEPT_USAGE(Mutable_ForwardIterator) {
525 *i++ = *i; // require postincrement and assignment
531 BOOST_concept(BidirectionalIterator,(TT))
532 : ForwardIterator<TT>
534 BOOST_CONCEPT_USAGE(BidirectionalIterator)
536 BOOST_CONCEPT_ASSERT((Convertible<
537 BOOST_DEDUCED_TYPENAME BidirectionalIterator::iterator_category
538 , std::bidirectional_iterator_tag
541 --i; // require predecrement operator
542 i--; // require postdecrement operator
548 BOOST_concept(Mutable_BidirectionalIterator,(TT))
549 : BidirectionalIterator<TT>
550 , Mutable_ForwardIterator<TT>
552 BOOST_CONCEPT_USAGE(Mutable_BidirectionalIterator)
554 *i-- = *i; // require postdecrement and assignment
560 BOOST_concept(RandomAccessIterator,(TT))
561 : BidirectionalIterator<TT>
564 BOOST_CONCEPT_USAGE(RandomAccessIterator)
566 BOOST_CONCEPT_ASSERT((Convertible<
567 BOOST_DEDUCED_TYPENAME BidirectionalIterator<TT>::iterator_category
568 , std::random_access_iterator_tag
571 i += n; // require assignment addition operator
572 i = i + n; i = n + i; // require addition with difference type
573 i -= n; // require assignment subtraction operator
574 i = i - n; // require subtraction with difference type
575 n = i - j; // require difference operator
576 (void)i[n]; // require element access operator
582 typename boost::detail::iterator_traits<TT>::difference_type n;
585 BOOST_concept(Mutable_RandomAccessIterator,(TT))
586 : RandomAccessIterator<TT>
587 , Mutable_BidirectionalIterator<TT>
589 BOOST_CONCEPT_USAGE(Mutable_RandomAccessIterator)
591 i[n] = *i; // require element access and assignment
595 typename boost::detail::iterator_traits<TT>::difference_type n;
598 //===========================================================================
601 BOOST_concept(Container,(C))
604 typedef typename C::value_type value_type;
605 typedef typename C::difference_type difference_type;
606 typedef typename C::size_type size_type;
607 typedef typename C::const_reference const_reference;
608 typedef typename C::const_pointer const_pointer;
609 typedef typename C::const_iterator const_iterator;
611 BOOST_CONCEPT_USAGE(Container)
613 BOOST_CONCEPT_ASSERT((InputIterator<const_iterator>));
614 const_constraints(c);
618 void const_constraints(const C& cc) {
631 BOOST_concept(Mutable_Container,(C))
634 typedef typename C::reference reference;
635 typedef typename C::iterator iterator;
636 typedef typename C::pointer pointer;
638 BOOST_CONCEPT_USAGE(Mutable_Container)
640 BOOST_CONCEPT_ASSERT((
641 Assignable<typename Mutable_Container::value_type>));
643 BOOST_CONCEPT_ASSERT((InputIterator<iterator>));
655 BOOST_concept(ForwardContainer,(C))
658 BOOST_CONCEPT_USAGE(ForwardContainer)
660 BOOST_CONCEPT_ASSERT((
662 typename ForwardContainer::const_iterator
667 BOOST_concept(Mutable_ForwardContainer,(C))
668 : ForwardContainer<C>
669 , Mutable_Container<C>
671 BOOST_CONCEPT_USAGE(Mutable_ForwardContainer)
673 BOOST_CONCEPT_ASSERT((
674 Mutable_ForwardIterator<
675 typename Mutable_ForwardContainer::iterator
680 BOOST_concept(ReversibleContainer,(C))
681 : ForwardContainer<C>
684 C::const_reverse_iterator
685 const_reverse_iterator;
687 BOOST_CONCEPT_USAGE(ReversibleContainer)
689 BOOST_CONCEPT_ASSERT((
690 BidirectionalIterator<
691 typename ReversibleContainer::const_iterator>));
693 BOOST_CONCEPT_ASSERT((BidirectionalIterator<const_reverse_iterator>));
695 const_constraints(c);
698 void const_constraints(const C& cc)
700 const_reverse_iterator i = cc.rbegin();
706 BOOST_concept(Mutable_ReversibleContainer,(C))
707 : Mutable_ForwardContainer<C>
708 , ReversibleContainer<C>
710 typedef typename C::reverse_iterator reverse_iterator;
712 BOOST_CONCEPT_USAGE(Mutable_ReversibleContainer)
714 typedef typename Mutable_ForwardContainer<C>::iterator iterator;
715 BOOST_CONCEPT_ASSERT((Mutable_BidirectionalIterator<iterator>));
716 BOOST_CONCEPT_ASSERT((Mutable_BidirectionalIterator<reverse_iterator>));
718 reverse_iterator i = c.rbegin();
725 BOOST_concept(RandomAccessContainer,(C))
726 : ReversibleContainer<C>
728 typedef typename C::size_type size_type;
729 typedef typename C::const_reference const_reference;
731 BOOST_CONCEPT_USAGE(RandomAccessContainer)
733 BOOST_CONCEPT_ASSERT((
734 RandomAccessIterator<
735 typename RandomAccessContainer::const_iterator
738 const_constraints(c);
741 void const_constraints(const C& cc)
743 const_reference r = cc[n];
744 ignore_unused_variable_warning(r);
751 BOOST_concept(Mutable_RandomAccessContainer,(C))
752 : Mutable_ReversibleContainer<C>
753 , RandomAccessContainer<C>
756 typedef Mutable_RandomAccessContainer self;
758 BOOST_CONCEPT_USAGE(Mutable_RandomAccessContainer)
760 BOOST_CONCEPT_ASSERT((Mutable_RandomAccessIterator<typename self::iterator>));
761 BOOST_CONCEPT_ASSERT((Mutable_RandomAccessIterator<typename self::reverse_iterator>));
763 typename self::reference r = c[i];
764 ignore_unused_variable_warning(r);
768 typename Mutable_ReversibleContainer<C>::size_type i;
772 // A Sequence is inherently mutable
773 BOOST_concept(Sequence,(S))
774 : Mutable_ForwardContainer<S>
775 // Matt Austern's book puts DefaultConstructible here, the C++
776 // standard places it in Container --JGS
777 // ... so why aren't we following the standard? --DWA
778 , DefaultConstructible<S>
780 BOOST_CONCEPT_USAGE(Sequence)
789 c.insert(p, first, last);
794 typename Sequence::reference r = c.front();
796 ignore_unused_variable_warning(c);
797 ignore_unused_variable_warning(c2);
798 ignore_unused_variable_warning(c3);
799 ignore_unused_variable_warning(r);
800 const_constraints(c);
803 void const_constraints(const S& c) {
804 typename Sequence::const_reference r = c.front();
805 ignore_unused_variable_warning(r);
808 typename S::value_type t;
809 typename S::size_type n;
810 typename S::value_type* first, *last;
811 typename S::iterator p, q;
814 BOOST_concept(FrontInsertionSequence,(S))
817 BOOST_CONCEPT_USAGE(FrontInsertionSequence)
824 typename S::value_type t;
827 BOOST_concept(BackInsertionSequence,(S))
830 BOOST_CONCEPT_USAGE(BackInsertionSequence)
834 typename BackInsertionSequence::reference r = c.back();
835 ignore_unused_variable_warning(r);
836 const_constraints(c);
839 void const_constraints(const S& cc) {
840 typename BackInsertionSequence::const_reference
842 ignore_unused_variable_warning(r);
845 typename S::value_type t;
848 BOOST_concept(AssociativeContainer,(C))
849 : ForwardContainer<C>
850 , DefaultConstructible<C>
852 typedef typename C::key_type key_type;
853 typedef typename C::key_compare key_compare;
854 typedef typename C::value_compare value_compare;
855 typedef typename C::iterator iterator;
857 BOOST_CONCEPT_USAGE(AssociativeContainer)
860 r = c.equal_range(k);
863 c.erase(r.first, r.second);
864 const_constraints(c);
865 BOOST_CONCEPT_ASSERT((BinaryPredicate<key_compare,key_type,key_type>));
867 typedef typename AssociativeContainer::value_type value_type_;
868 BOOST_CONCEPT_ASSERT((BinaryPredicate<value_compare,value_type_,value_type_>));
871 // Redundant with the base concept, but it helps below.
872 typedef typename C::const_iterator const_iterator;
874 void const_constraints(const C& cc)
878 cr = cc.equal_range(k);
883 std::pair<iterator,iterator> r;
885 std::pair<const_iterator,const_iterator> cr;
886 typename C::key_type k;
887 typename C::size_type n;
890 BOOST_concept(UniqueAssociativeContainer,(C))
891 : AssociativeContainer<C>
893 BOOST_CONCEPT_USAGE(UniqueAssociativeContainer)
897 pos_flag = c.insert(t);
898 c.insert(first, last);
900 ignore_unused_variable_warning(c);
903 std::pair<typename C::iterator, bool> pos_flag;
904 typename C::value_type t;
905 typename C::value_type* first, *last;
908 BOOST_concept(MultipleAssociativeContainer,(C))
909 : AssociativeContainer<C>
911 BOOST_CONCEPT_USAGE(MultipleAssociativeContainer)
916 c.insert(first, last);
918 ignore_unused_variable_warning(c);
919 ignore_unused_variable_warning(pos);
922 typename C::iterator pos;
923 typename C::value_type t;
924 typename C::value_type* first, *last;
927 BOOST_concept(SimpleAssociativeContainer,(C))
928 : AssociativeContainer<C>
930 BOOST_CONCEPT_USAGE(SimpleAssociativeContainer)
932 typedef typename C::key_type key_type;
933 typedef typename C::value_type value_type;
934 BOOST_MPL_ASSERT((boost::is_same<key_type,value_type>));
938 BOOST_concept(PairAssociativeContainer,(C))
939 : AssociativeContainer<C>
941 BOOST_CONCEPT_USAGE(PairAssociativeContainer)
943 typedef typename C::key_type key_type;
944 typedef typename C::value_type value_type;
945 typedef typename C::mapped_type mapped_type;
946 typedef std::pair<const key_type, mapped_type> required_value_type;
947 BOOST_MPL_ASSERT((boost::is_same<value_type,required_value_type>));
951 BOOST_concept(SortedAssociativeContainer,(C))
952 : AssociativeContainer<C>
953 , ReversibleContainer<C>
955 BOOST_CONCEPT_USAGE(SortedAssociativeContainer)
962 p = c.upper_bound(k);
963 p = c.lower_bound(k);
964 r = c.equal_range(k);
968 ignore_unused_variable_warning(c);
969 ignore_unused_variable_warning(c2);
970 ignore_unused_variable_warning(c3);
971 const_constraints(c);
974 void const_constraints(const C& c)
979 cp = c.upper_bound(k);
980 cp = c.lower_bound(k);
981 cr = c.equal_range(k);
985 typename C::key_compare kc;
986 typename C::value_compare vc;
987 typename C::value_type t;
988 typename C::key_type k;
989 typedef typename C::iterator iterator;
990 typedef typename C::const_iterator const_iterator;
992 typedef SortedAssociativeContainer self;
995 std::pair<typename self::iterator,typename self::iterator> r;
996 std::pair<typename self::const_iterator,typename self::const_iterator> cr;
997 typename C::value_type* first, *last;
1000 // HashedAssociativeContainer
1002 } // namespace boost
1004 # include <boost/concept/detail/concept_undef.hpp>
1006 #endif // BOOST_CONCEPT_CHECKS_HPP