39#ifndef _BOOST_CONCEPT_CHECK_H
40#define _BOOST_CONCEPT_CHECK_H 1
43#pragma GCC system_header
49namespace std _GLIBCXX_VISIBILITY(default)
51_GLIBCXX_BEGIN_NAMESPACE_VERSION
52_GLIBCXX_BEGIN_NAMESPACE_CONTAINER
54 struct _Bit_const_iterator;
55_GLIBCXX_END_NAMESPACE_CONTAINER
56_GLIBCXX_END_NAMESPACE_VERSION
61 template<
typename _Iterator,
typename _Sequence,
typename _Category>
65namespace __gnu_cxx _GLIBCXX_VISIBILITY(default)
67_GLIBCXX_BEGIN_NAMESPACE_VERSION
69#pragma GCC diagnostic push
70#pragma GCC diagnostic ignored "-Wunused-local-typedefs"
71#pragma GCC diagnostic ignored "-Wlong-long"
73#define _IsUnused __attribute__ ((__unused__))
78template <
class _Concept>
79_GLIBCXX14_CONSTEXPR
inline void __function_requires()
81 void (_Concept::*__x)() _IsUnused = &_Concept::__constraints;
87void __error_type_must_be_an_integer_type();
88void __error_type_must_be_an_unsigned_integer_type();
89void __error_type_must_be_a_signed_integer_type();
92#define _GLIBCXX_CLASS_REQUIRES(_type_var, _ns, _concept) \
93 typedef void (_ns::_concept <_type_var>::* _func##_type_var##_concept)(); \
94 template <_func##_type_var##_concept _Tp1> \
95 struct _concept_checking##_type_var##_concept { }; \
96 typedef _concept_checking##_type_var##_concept< \
97 &_ns::_concept <_type_var>::__constraints> \
98 _concept_checking_typedef##_type_var##_concept
100#define _GLIBCXX_CLASS_REQUIRES2(_type_var1, _type_var2, _ns, _concept) \
101 typedef void (_ns::_concept <_type_var1,_type_var2>::* _func##_type_var1##_type_var2##_concept)(); \
102 template <_func##_type_var1##_type_var2##_concept _Tp1> \
103 struct _concept_checking##_type_var1##_type_var2##_concept { }; \
104 typedef _concept_checking##_type_var1##_type_var2##_concept< \
105 &_ns::_concept <_type_var1,_type_var2>::__constraints> \
106 _concept_checking_typedef##_type_var1##_type_var2##_concept
108#define _GLIBCXX_CLASS_REQUIRES3(_type_var1, _type_var2, _type_var3, _ns, _concept) \
109 typedef void (_ns::_concept <_type_var1,_type_var2,_type_var3>::* _func##_type_var1##_type_var2##_type_var3##_concept)(); \
110 template <_func##_type_var1##_type_var2##_type_var3##_concept _Tp1> \
111 struct _concept_checking##_type_var1##_type_var2##_type_var3##_concept { }; \
112 typedef _concept_checking##_type_var1##_type_var2##_type_var3##_concept< \
113 &_ns::_concept <_type_var1,_type_var2,_type_var3>::__constraints> \
114 _concept_checking_typedef##_type_var1##_type_var2##_type_var3##_concept
116#define _GLIBCXX_CLASS_REQUIRES4(_type_var1, _type_var2, _type_var3, _type_var4, _ns, _concept) \
117 typedef void (_ns::_concept <_type_var1,_type_var2,_type_var3,_type_var4>::* _func##_type_var1##_type_var2##_type_var3##_type_var4##_concept)(); \
118 template <_func##_type_var1##_type_var2##_type_var3##_type_var4##_concept _Tp1> \
119 struct _concept_checking##_type_var1##_type_var2##_type_var3##_type_var4##_concept { }; \
120 typedef _concept_checking##_type_var1##_type_var2##_type_var3##_type_var4##_concept< \
121 &_ns::_concept <_type_var1,_type_var2,_type_var3,_type_var4>::__constraints> \
122 _concept_checking_typedef##_type_var1##_type_var2##_type_var3##_type_var4##_concept
125template <
class _Tp1,
class _Tp2>
126struct _Aux_require_same { };
129struct _Aux_require_same<_Tp,_Tp> {
typedef _Tp _Type; };
131 template <
class _Tp1,
class _Tp2>
132 struct _SameTypeConcept
134 void __constraints() {
135 typedef typename _Aux_require_same<_Tp1, _Tp2>::_Type _Required;
140 struct _IntegerConcept {
141 void __constraints() {
142 __error_type_must_be_an_integer_type();
145 template <>
struct _IntegerConcept<short> {
void __constraints() {} };
146 template <>
struct _IntegerConcept<unsigned short> {
void __constraints(){} };
147 template <>
struct _IntegerConcept<int> {
void __constraints() {} };
148 template <>
struct _IntegerConcept<unsigned int> {
void __constraints() {} };
149 template <>
struct _IntegerConcept<long> {
void __constraints() {} };
150 template <>
struct _IntegerConcept<unsigned long> {
void __constraints() {} };
151 template <>
struct _IntegerConcept<long long> {
void __constraints() {} };
152 template <>
struct _IntegerConcept<unsigned long long>
153 {
void __constraints() {} };
156 struct _SignedIntegerConcept {
157 void __constraints() {
158 __error_type_must_be_a_signed_integer_type();
161 template <>
struct _SignedIntegerConcept<short> {
void __constraints() {} };
162 template <>
struct _SignedIntegerConcept<int> {
void __constraints() {} };
163 template <>
struct _SignedIntegerConcept<long> {
void __constraints() {} };
164 template <>
struct _SignedIntegerConcept<long long> {
void __constraints(){}};
167 struct _UnsignedIntegerConcept {
168 void __constraints() {
169 __error_type_must_be_an_unsigned_integer_type();
172 template <>
struct _UnsignedIntegerConcept<unsigned short>
173 {
void __constraints() {} };
174 template <>
struct _UnsignedIntegerConcept<unsigned int>
175 {
void __constraints() {} };
176 template <>
struct _UnsignedIntegerConcept<unsigned long>
177 {
void __constraints() {} };
178 template <>
struct _UnsignedIntegerConcept<unsigned long long>
179 {
void __constraints() {} };
185 struct _DefaultConstructibleConcept
187 void __constraints() {
193 struct _AssignableConcept
195 void __constraints() {
197 __const_constraints(__a);
199 void __const_constraints(
const _Tp& __b) {
208 struct _CopyConstructibleConcept
210 void __constraints() {
212 _Tp* __ptr _IsUnused = &__a;
213 __const_constraints(__a);
215 void __const_constraints(
const _Tp& __a) {
216 _Tp __c _IsUnused(__a);
217 const _Tp* __ptr _IsUnused = &__a;
224 struct _SGIAssignableConcept
226 void __constraints() {
227 _Tp __b _IsUnused(__a);
229 __const_constraints(__a);
231 void __const_constraints(
const _Tp& __b) {
232 _Tp __c _IsUnused(__b);
238 template <
class _From,
class _To>
239 struct _ConvertibleConcept
241 void __constraints() {
242 _To __y _IsUnused = __x;
257 void __aux_require_boolean_expr(
const _Tp& __t) {
258 bool __x _IsUnused = __t;
263 struct _EqualityComparableConcept
265 void __constraints() {
266 __aux_require_boolean_expr(__a == __b);
272 struct _LessThanComparableConcept
274 void __constraints() {
275 __aux_require_boolean_expr(__a < __b);
282 struct _ComparableConcept
284 void __constraints() {
285 __aux_require_boolean_expr(__a < __b);
286 __aux_require_boolean_expr(__a > __b);
287 __aux_require_boolean_expr(__a <= __b);
288 __aux_require_boolean_expr(__a >= __b);
293#define _GLIBCXX_DEFINE_BINARY_PREDICATE_OP_CONSTRAINT(_OP,_NAME) \
294 template <class _First, class _Second> \
296 void __constraints() { (void)__constraints_(); } \
297 bool __constraints_() { \
298 return __a _OP __b; \
304#define _GLIBCXX_DEFINE_BINARY_OPERATOR_CONSTRAINT(_OP,_NAME) \
305 template <class _Ret, class _First, class _Second> \
307 void __constraints() { (void)__constraints_(); } \
308 _Ret __constraints_() { \
309 return __a _OP __b; \
315 _GLIBCXX_DEFINE_BINARY_PREDICATE_OP_CONSTRAINT(==, _EqualOpConcept);
316 _GLIBCXX_DEFINE_BINARY_PREDICATE_OP_CONSTRAINT(!=, _NotEqualOpConcept);
317 _GLIBCXX_DEFINE_BINARY_PREDICATE_OP_CONSTRAINT(<, _LessThanOpConcept);
318 _GLIBCXX_DEFINE_BINARY_PREDICATE_OP_CONSTRAINT(<=, _LessEqualOpConcept);
319 _GLIBCXX_DEFINE_BINARY_PREDICATE_OP_CONSTRAINT(>, _GreaterThanOpConcept);
320 _GLIBCXX_DEFINE_BINARY_PREDICATE_OP_CONSTRAINT(>=, _GreaterEqualOpConcept);
322 _GLIBCXX_DEFINE_BINARY_OPERATOR_CONSTRAINT(+, _PlusOpConcept);
323 _GLIBCXX_DEFINE_BINARY_OPERATOR_CONSTRAINT(*, _TimesOpConcept);
324 _GLIBCXX_DEFINE_BINARY_OPERATOR_CONSTRAINT(/, _DivideOpConcept);
325 _GLIBCXX_DEFINE_BINARY_OPERATOR_CONSTRAINT(-, _SubtractOpConcept);
326 _GLIBCXX_DEFINE_BINARY_OPERATOR_CONSTRAINT(%, _ModOpConcept);
328#undef _GLIBCXX_DEFINE_BINARY_PREDICATE_OP_CONSTRAINT
329#undef _GLIBCXX_DEFINE_BINARY_OPERATOR_CONSTRAINT
334 template <
class _Func,
class _Return>
335 struct _GeneratorConcept
337 void __constraints() {
338 const _Return& __r _IsUnused = __f();
344 template <
class _Func>
345 struct _GeneratorConcept<_Func,void>
347 void __constraints() {
353 template <
class _Func,
class _Return,
class _Arg>
354 struct _UnaryFunctionConcept
356 void __constraints() {
364 template <
class _Func,
class _Arg>
365 struct _UnaryFunctionConcept<_Func, void, _Arg> {
366 void __constraints() {
373 template <
class _Func,
class _Return,
class _First,
class _Second>
374 struct _BinaryFunctionConcept
376 void __constraints() {
377 __r = __f(__first, __second);
385 template <
class _Func,
class _First,
class _Second>
386 struct _BinaryFunctionConcept<_Func, void, _First, _Second>
388 void __constraints() {
389 __f(__first, __second);
396 template <
class _Func,
class _Arg>
397 struct _UnaryPredicateConcept
399 void __constraints() {
400 __aux_require_boolean_expr(__f(__arg));
406 template <
class _Func,
class _First,
class _Second>
407 struct _BinaryPredicateConcept
409 void __constraints() {
410 __aux_require_boolean_expr(__f(__a, __b));
418 template <
class _Func,
class _First,
class _Second>
419 struct _Const_BinaryPredicateConcept {
420 void __constraints() {
421 __const_constraints(__f);
423 void __const_constraints(
const _Func& __fun) {
424 __function_requires<_BinaryPredicateConcept<_Func, _First, _Second> >();
426 __aux_require_boolean_expr(__fun(__a, __b));
437 struct _TrivialIteratorConcept
439 void __constraints() {
441 __function_requires< _AssignableConcept<_Tp> >();
442 __function_requires< _EqualityComparableConcept<_Tp> >();
450 struct _Mutable_TrivialIteratorConcept
452 void __constraints() {
453 __function_requires< _TrivialIteratorConcept<_Tp> >();
460 struct _InputIteratorConcept
462 void __constraints() {
463 __function_requires< _TrivialIteratorConcept<_Tp> >();
465 typedef typename std::iterator_traits<_Tp>::difference_type _Diff;
467 typedef typename std::iterator_traits<_Tp>::reference _Ref;
468 typedef typename std::iterator_traits<_Tp>::pointer _Pt;
469 typedef typename std::iterator_traits<_Tp>::iterator_category _Cat;
470 __function_requires< _ConvertibleConcept<
471 typename std::iterator_traits<_Tp>::iterator_category,
472 std::input_iterator_tag> >();
479 template <
class _Tp,
class _ValueT>
480 struct _OutputIteratorConcept
482 void __constraints() {
483 __function_requires< _AssignableConcept<_Tp> >();
494 template<
typename _Tp>
495 struct _Is_vector_bool_iterator
496 {
static const bool __value =
false; };
499 namespace __cont = ::std::_GLIBCXX_STD_C;
506 struct _Is_vector_bool_iterator<
__cont::_Bit_iterator>
507 {
static const bool __value =
true; };
511 struct _Is_vector_bool_iterator<
__cont::_Bit_const_iterator>
512 {
static const bool __value =
true; };
515 template <
typename _It,
typename _Seq,
typename _Tag>
516 struct _Is_vector_bool_iterator<__gnu_debug::_Safe_iterator<_It, _Seq, _Tag> >
517 : _Is_vector_bool_iterator<_It> { };
519 template <class _Tp, bool = _Is_vector_bool_iterator<_Tp>::__value>
520 struct _ForwardIteratorReferenceConcept
522 void __constraints() {
523#if __cplusplus >= 201103L
524 typedef typename std::iterator_traits<_Tp>::reference _Ref;
525 static_assert(std::is_reference<_Ref>::value,
526 "reference type of a forward iterator must be a real reference");
531 template <class _Tp, bool = _Is_vector_bool_iterator<_Tp>::__value>
532 struct _Mutable_ForwardIteratorReferenceConcept
534 void __constraints() {
535 typedef typename std::iterator_traits<_Tp>::reference _Ref;
536 typedef typename std::iterator_traits<_Tp>::value_type _Val;
537 __function_requires< _SameTypeConcept<_Ref, _Val&> >();
543 struct _ForwardIteratorReferenceConcept<_Tp, true>
545 void __constraints() { }
550 struct _Mutable_ForwardIteratorReferenceConcept<_Tp, true>
552 void __constraints() { }
555#pragma GCC diagnostic push
556#pragma GCC diagnostic ignored "-Wunused-variable"
559 struct _ForwardIteratorConcept
561 void __constraints() {
562 __function_requires< _InputIteratorConcept<_Tp> >();
563 __function_requires< _DefaultConstructibleConcept<_Tp> >();
564 __function_requires< _ConvertibleConcept<
565 typename std::iterator_traits<_Tp>::iterator_category,
566 std::forward_iterator_tag> >();
567 __function_requires< _ForwardIteratorReferenceConcept<_Tp> >();
569 const _Tp& __k = __i++;
570 typedef typename std::iterator_traits<_Tp>::reference _Ref;
578 struct _Mutable_ForwardIteratorConcept
580 void __constraints() {
581 __function_requires< _ForwardIteratorConcept<_Tp> >();
582 typedef typename std::iterator_traits<_Tp>::reference _Ref;
583 typedef typename std::iterator_traits<_Tp>::value_type _Val;
584 __function_requires< _Mutable_ForwardIteratorReferenceConcept<_Tp> >();
590 struct _BidirectionalIteratorConcept
592 void __constraints() {
593 __function_requires< _ForwardIteratorConcept<_Tp> >();
594 __function_requires< _ConvertibleConcept<
595 typename std::iterator_traits<_Tp>::iterator_category,
596 std::bidirectional_iterator_tag> >();
598 const _Tp& __k = __i--;
599 typedef typename std::iterator_traits<_Tp>::reference _Ref;
606 struct _Mutable_BidirectionalIteratorConcept
608 void __constraints() {
609 __function_requires< _BidirectionalIteratorConcept<_Tp> >();
610 __function_requires< _Mutable_ForwardIteratorConcept<_Tp> >();
617 struct _RandomAccessIteratorConcept
619 void __constraints() {
620 __function_requires< _BidirectionalIteratorConcept<_Tp> >();
621 __function_requires< _ComparableConcept<_Tp> >();
622 __function_requires< _ConvertibleConcept<
623 typename std::iterator_traits<_Tp>::iterator_category,
624 std::random_access_iterator_tag> >();
625 typedef typename std::iterator_traits<_Tp>::reference _Ref;
627 _Tp& __j = __i += __n;
628 __i = __i + __n; __i = __n + __i;
629 _Tp& __k = __i -= __n;
637 typename std::iterator_traits<_Tp>::difference_type __n;
641 struct _Mutable_RandomAccessIteratorConcept
643 void __constraints() {
644 __function_requires< _RandomAccessIteratorConcept<_Tp> >();
645 __function_requires< _Mutable_BidirectionalIteratorConcept<_Tp> >();
648 typename std::iterator_traits<_Tp>::difference_type __n;
651#pragma GCC diagnostic pop
656 template <
class _Container>
657 struct _ContainerConcept
659 typedef typename _Container::value_type _Value_type;
660 typedef typename _Container::difference_type _Difference_type;
661 typedef typename _Container::size_type _Size_type;
662 typedef typename _Container::const_reference _Const_reference;
663 typedef typename _Container::const_pointer _Const_pointer;
664 typedef typename _Container::const_iterator _Const_iterator;
666 void __constraints() {
667 __function_requires< _InputIteratorConcept<_Const_iterator> >();
668 __function_requires< _AssignableConcept<_Container> >();
669 const _Container __c;
673 __n = __c.max_size();
681 template <
class _Container>
682 struct _Mutable_ContainerConcept
684 typedef typename _Container::value_type _Value_type;
685 typedef typename _Container::reference _Reference;
686 typedef typename _Container::iterator _Iterator;
687 typedef typename _Container::pointer _Pointer;
689 void __constraints() {
690 __function_requires< _ContainerConcept<_Container> >();
691 __function_requires< _AssignableConcept<_Value_type> >();
692 __function_requires< _InputIteratorConcept<_Iterator> >();
699 _Container __c, __c2;
702 template <
class _ForwardContainer>
703 struct _ForwardContainerConcept
705 void __constraints() {
706 __function_requires< _ContainerConcept<_ForwardContainer> >();
707 typedef typename _ForwardContainer::const_iterator _Const_iterator;
708 __function_requires< _ForwardIteratorConcept<_Const_iterator> >();
712 template <
class _ForwardContainer>
713 struct _Mutable_ForwardContainerConcept
715 void __constraints() {
716 __function_requires< _ForwardContainerConcept<_ForwardContainer> >();
717 __function_requires< _Mutable_ContainerConcept<_ForwardContainer> >();
718 typedef typename _ForwardContainer::iterator _Iterator;
719 __function_requires< _Mutable_ForwardIteratorConcept<_Iterator> >();
723 template <
class _ReversibleContainer>
724 struct _ReversibleContainerConcept
726 typedef typename _ReversibleContainer::const_iterator _Const_iterator;
727 typedef typename _ReversibleContainer::const_reverse_iterator
728 _Const_reverse_iterator;
730 void __constraints() {
731 __function_requires< _ForwardContainerConcept<_ReversibleContainer> >();
732 __function_requires< _BidirectionalIteratorConcept<_Const_iterator> >();
734 _BidirectionalIteratorConcept<_Const_reverse_iterator> >();
736 const _ReversibleContainer __c;
737 _Const_reverse_iterator __i = __c.rbegin();
742 template <
class _ReversibleContainer>
743 struct _Mutable_ReversibleContainerConcept
745 typedef typename _ReversibleContainer::iterator _Iterator;
746 typedef typename _ReversibleContainer::reverse_iterator _Reverse_iterator;
748 void __constraints() {
749 __function_requires<_ReversibleContainerConcept<_ReversibleContainer> >();
751 _Mutable_ForwardContainerConcept<_ReversibleContainer> >();
752 __function_requires<_Mutable_BidirectionalIteratorConcept<_Iterator> >();
754 _Mutable_BidirectionalIteratorConcept<_Reverse_iterator> >();
756 _Reverse_iterator __i = __c.rbegin();
759 _ReversibleContainer __c;
762 template <
class _RandomAccessContainer>
763 struct _RandomAccessContainerConcept
765 typedef typename _RandomAccessContainer::size_type _Size_type;
766 typedef typename _RandomAccessContainer::const_reference _Const_reference;
767 typedef typename _RandomAccessContainer::const_iterator _Const_iterator;
768 typedef typename _RandomAccessContainer::const_reverse_iterator
769 _Const_reverse_iterator;
771 void __constraints() {
773 _ReversibleContainerConcept<_RandomAccessContainer> >();
774 __function_requires< _RandomAccessIteratorConcept<_Const_iterator> >();
776 _RandomAccessIteratorConcept<_Const_reverse_iterator> >();
778 const _RandomAccessContainer __c;
779 _Const_reference __r _IsUnused = __c[__n];
784 template <
class _RandomAccessContainer>
785 struct _Mutable_RandomAccessContainerConcept
787 typedef typename _RandomAccessContainer::size_type _Size_type;
788 typedef typename _RandomAccessContainer::reference _Reference;
789 typedef typename _RandomAccessContainer::iterator _Iterator;
790 typedef typename _RandomAccessContainer::reverse_iterator _Reverse_iterator;
792 void __constraints() {
794 _RandomAccessContainerConcept<_RandomAccessContainer> >();
796 _Mutable_ReversibleContainerConcept<_RandomAccessContainer> >();
797 __function_requires< _Mutable_RandomAccessIteratorConcept<_Iterator> >();
799 _Mutable_RandomAccessIteratorConcept<_Reverse_iterator> >();
801 _Reference __r _IsUnused = __c[__i];
804 _RandomAccessContainer __c;
808 template <
class _Sequence>
809 struct _SequenceConcept
811 typedef typename _Sequence::reference _Reference;
812 typedef typename _Sequence::const_reference _Const_reference;
814 void __constraints() {
818 __function_requires< _Mutable_ForwardContainerConcept<_Sequence> >();
819 __function_requires< _DefaultConstructibleConcept<_Sequence> >();
822 __c _IsUnused(__n, __t),
823 __c2 _IsUnused(__first, __last);
825 __c.insert(__p, __t);
826 __c.insert(__p, __n, __t);
827 __c.insert(__p, __first, __last);
832 _Reference __r _IsUnused = __c.front();
834 __const_constraints(__c);
836 void __const_constraints(
const _Sequence& __c) {
837 _Const_reference __r _IsUnused = __c.front();
839 typename _Sequence::value_type __t;
840 typename _Sequence::size_type __n;
841 typename _Sequence::value_type *__first, *__last;
842 typename _Sequence::iterator __p, __q;
845 template <
class _FrontInsertionSequence>
846 struct _FrontInsertionSequenceConcept
848 void __constraints() {
849 __function_requires< _SequenceConcept<_FrontInsertionSequence> >();
854 _FrontInsertionSequence __c;
855 typename _FrontInsertionSequence::value_type __t;
858 template <
class _BackInsertionSequence>
859 struct _BackInsertionSequenceConcept
861 typedef typename _BackInsertionSequence::reference _Reference;
862 typedef typename _BackInsertionSequence::const_reference _Const_reference;
864 void __constraints() {
865 __function_requires< _SequenceConcept<_BackInsertionSequence> >();
869 _Reference __r _IsUnused = __c.back();
871 void __const_constraints(
const _BackInsertionSequence& __c) {
872 _Const_reference __r _IsUnused = __c.back();
874 _BackInsertionSequence __c;
875 typename _BackInsertionSequence::value_type __t;
878_GLIBCXX_END_NAMESPACE_VERSION
881#pragma GCC diagnostic pop
ISO C++ entities toplevel namespace is std.
GNU extensions for public use.
GNU debug classes for public use.