diff --git a/Jamfile b/Jamfile index 782ed1a..e16f2a0 100644 --- a/Jamfile +++ b/Jamfile @@ -4,11 +4,15 @@ import testing ; test-suite concept_check : [ run stl_concept_covering.cpp ] + [ run stl_concept_check.cpp ] [ run concept_check_test.cpp ] [ run class_concept_check_test.cpp ] [ compile-fail concept_check_fail_expected.cpp ] [ compile-fail class_concept_fail_expected.cpp ] + [ run where.cpp ] + [ compile-fail where_fail.cpp ] + # Backward compatibility tests [ run old_concept_pass.cpp ] [ compile-fail function_requires_fail.cpp ] diff --git a/Jamfile.v2 b/Jamfile.v2 index 02efb76..251542f 100644 --- a/Jamfile.v2 +++ b/Jamfile.v2 @@ -3,6 +3,7 @@ import testing ; test-suite concept_check : [ run stl_concept_covering.cpp ] + [ run stl_concept_check.cpp ] [ run concept_check_test.cpp ] [ run class_concept_check_test.cpp ] [ compile-fail concept_check_fail_expected.cpp ] @@ -17,3 +18,4 @@ test-suite concept_check [ compile-fail old_concept_function_fail.cpp ] [ compile-fail old_concept_class_fail.cpp ] ; + diff --git a/class_concept_check_test.cpp b/class_concept_check_test.cpp index d99845c..d5512c6 100644 --- a/class_concept_check_test.cpp +++ b/class_concept_check_test.cpp @@ -18,11 +18,11 @@ struct bar { bool operator()(int, char) { return true; } }; class class_requires_test { - BOOST_CONCEPT_ASSERT((boost::EqualityComparableConcept)); + BOOST_CONCEPT_ASSERT((boost::EqualityComparable)); typedef int* int_ptr; typedef const int* const_int_ptr; - BOOST_CONCEPT_ASSERT((boost::EqualOpConcept)); - BOOST_CONCEPT_ASSERT((boost::UnaryFunctionConcept)); -// BOOST_CONCEPT_ASSERT((boost::BinaryFunctionConcept)); + BOOST_CONCEPT_ASSERT((boost::EqualOp)); + BOOST_CONCEPT_ASSERT((boost::UnaryFunction)); + BOOST_CONCEPT_ASSERT((boost::BinaryFunction)); }; int diff --git a/class_concept_fail_expected.cpp b/class_concept_fail_expected.cpp index 6cafbd4..74268e3 100644 --- a/class_concept_fail_expected.cpp +++ b/class_concept_fail_expected.cpp @@ -20,7 +20,7 @@ struct foo { }; template class class_requires_test { - BOOST_CONCEPT_ASSERT((boost::EqualityComparableConcept)); + BOOST_CONCEPT_ASSERT((boost::EqualityComparable)); }; int diff --git a/concept_check.htm b/concept_check.htm index 0e55aa8..194b0c2 100644 --- a/concept_check.htm +++ b/concept_check.htm @@ -238,9 +238,9 @@ Library produces):
 boost/concept_check.hpp: In method `void LessThanComparableConcept
-  <_List_iterator<int,int &,int *> >::constraints()':
+  <_List_iterator<int,int &,int *> >::~LessThanComparableConcept()':
 boost/concept_check.hpp:334:   instantiated from `RandomAccessIteratorConcept
-  <_List_iterator<int,int &,int *> >::constraints()'
+  <_List_iterator<int,int &,int *> >::~RandomAccessIteratorConcept()'
 bad_error_eg.cpp:6:   instantiated from `stable_sort<_List_iterator
   <int,int &,int *> >(_List_iterator<int,int &,int *>, 
   _List_iterator<int,int &,int *>)'
@@ -260,10 +260,9 @@ href="http://www.sgi.com/tech/stl/RandomAccessIterator.html">
 RandomAccessIterator).
 
  • The error message is now much shorter and does not reveal internal STL functions. -
  • The presence of concept_check.hpp and - constraints() in the error message alerts the user to the - fact that the error lies in the user code and not in the library - implementation. +
  • The presence of concept_check.hpp in the error message + alerts the user to the fact that the error lies in the user code and + not in the library implementation.

    History

    diff --git a/concept_check_fail_expected.cpp b/concept_check_fail_expected.cpp index f213ab5..15bfe7a 100644 --- a/concept_check_fail_expected.cpp +++ b/concept_check_fail_expected.cpp @@ -21,6 +21,6 @@ struct foo { }; int main() { - BOOST_CONCEPT_ASSERT((boost::EqualityComparableConcept)); + BOOST_CONCEPT_ASSERT((boost::EqualityComparable)); return 0; } diff --git a/concept_check_test.cpp b/concept_check_test.cpp index 070988b..f39ced7 100644 --- a/concept_check_test.cpp +++ b/concept_check_test.cpp @@ -25,76 +25,76 @@ main() // Basic Concepts { typedef default_constructible_archetype<> foo; - function_requires< DefaultConstructibleConcept >(); + function_requires< DefaultConstructible >(); } { typedef assignable_archetype<> foo; - function_requires< AssignableConcept >(); + function_requires< Assignable >(); } { typedef copy_constructible_archetype<> foo; - function_requires< CopyConstructibleConcept >(); + function_requires< CopyConstructible >(); } { typedef sgi_assignable_archetype<> foo; - function_requires< SGIAssignableConcept >(); + function_requires< SGIAssignable >(); } { typedef copy_constructible_archetype<> foo; typedef convertible_to_archetype convertible_to_foo; - function_requires< ConvertibleConcept >(); + function_requires< Convertible >(); } { - function_requires< ConvertibleConcept >(); + function_requires< Convertible >(); } { typedef equality_comparable_archetype<> foo; - function_requires< EqualityComparableConcept >(); + function_requires< EqualityComparable >(); } { typedef less_than_comparable_archetype<> foo; - function_requires< LessThanComparableConcept >(); + function_requires< LessThanComparable >(); } { typedef comparable_archetype<> foo; - function_requires< ComparableConcept >(); + function_requires< Comparable >(); } { typedef equal_op_first_archetype<> First; typedef equal_op_second_archetype<> Second; - function_requires< EqualOpConcept >(); + function_requires< EqualOp >(); } { typedef not_equal_op_first_archetype<> First; typedef not_equal_op_second_archetype<> Second; - function_requires< NotEqualOpConcept >(); + function_requires< NotEqualOp >(); } { typedef less_than_op_first_archetype<> First; typedef less_than_op_second_archetype<> Second; - function_requires< LessThanOpConcept >(); + function_requires< LessThanOp >(); } { typedef less_equal_op_first_archetype<> First; typedef less_equal_op_second_archetype<> Second; - function_requires< LessEqualOpConcept >(); + function_requires< LessEqualOp >(); } { typedef greater_than_op_first_archetype<> First; typedef greater_than_op_second_archetype<> Second; - function_requires< GreaterThanOpConcept >(); + function_requires< GreaterThanOp >(); } { typedef greater_equal_op_first_archetype<> First; typedef greater_equal_op_second_archetype<> Second; - function_requires< GreaterEqualOpConcept >(); + function_requires< GreaterEqualOp >(); } { typedef copy_constructible_archetype<> Return; typedef plus_op_first_archetype First; typedef plus_op_second_archetype Second; - function_requires< PlusOpConcept >(); + function_requires< PlusOp >(); } //=========================================================================== @@ -102,70 +102,70 @@ main() { typedef generator_archetype > foo; - function_requires< GeneratorConcept > >(); + function_requires< Generator > >(); } #if !defined BOOST_NO_TEMPLATE_PARTIAL_SPECIALIZATION { - function_requires< GeneratorConcept< void_generator_archetype, void > >(); + function_requires< Generator< void_generator_archetype, void > >(); } #endif { typedef unary_function_archetype F; - function_requires< UnaryFunctionConcept >(); + function_requires< UnaryFunction >(); } { typedef binary_function_archetype F; - function_requires< BinaryFunctionConcept >(); + function_requires< BinaryFunction >(); } { typedef unary_predicate_archetype F; - function_requires< UnaryPredicateConcept >(); + function_requires< UnaryPredicate >(); } { typedef binary_predicate_archetype F; - function_requires< BinaryPredicateConcept >(); + function_requires< BinaryPredicate >(); } //=========================================================================== // Iterator Concepts { typedef input_iterator_archetype > Iter; - function_requires< InputIteratorConcept >(); + function_requires< InputIterator >(); } { typedef output_iterator_archetype Iter; - function_requires< OutputIteratorConcept >(); + function_requires< OutputIterator >(); } { typedef input_output_iterator_archetype Iter; - function_requires< InputIteratorConcept >(); - function_requires< OutputIteratorConcept >(); + function_requires< InputIterator >(); + function_requires< OutputIterator >(); } { typedef forward_iterator_archetype > Iter; - function_requires< ForwardIteratorConcept >(); + function_requires< ForwardIterator >(); } { typedef mutable_forward_iterator_archetype > Iter; - function_requires< Mutable_ForwardIteratorConcept >(); + function_requires< Mutable_ForwardIterator >(); } { typedef bidirectional_iterator_archetype > Iter; - function_requires< BidirectionalIteratorConcept >(); + function_requires< BidirectionalIterator >(); } { typedef mutable_bidirectional_iterator_archetype > Iter; - function_requires< Mutable_BidirectionalIteratorConcept >(); + function_requires< Mutable_BidirectionalIterator >(); } { typedef random_access_iterator_archetype > Iter; - function_requires< RandomAccessIteratorConcept >(); + function_requires< RandomAccessIterator >(); } { typedef mutable_random_access_iterator_archetype > Iter; - function_requires< Mutable_RandomAccessIteratorConcept >(); + function_requires< Mutable_RandomAccessIterator >(); } //=========================================================================== diff --git a/fake_sort.hpp b/fake_sort.hpp index 8f48f06..bdac487 100755 --- a/fake_sort.hpp +++ b/fake_sort.hpp @@ -5,7 +5,7 @@ # define BOOST_LIBS_CONCEPT_CHECK_FAKE_SORT_DWA2006430_HPP # include -# include +# include # include namespace fake @@ -14,8 +14,8 @@ namespace fake template BOOST_CONCEPT_WHERE( - ((Mutable_RandomAccessIteratorConcept)) - ((LessThanComparableConcept::value_type>)) + ((Mutable_RandomAccessIterator)) + ((LessThanComparable::value_type>)) , (void)) sort(RanIter,RanIter) diff --git a/function_requires_fail.cpp b/function_requires_fail.cpp index 5c9a4f3..03beaec 100755 --- a/function_requires_fail.cpp +++ b/function_requires_fail.cpp @@ -21,6 +21,6 @@ struct foo { }; int main() { - boost::function_requires< boost::EqualityComparableConcept >(); + boost::function_requires< boost::EqualityComparable >(); return 0; } diff --git a/include/boost/concept/detail/concept_def.hpp b/include/boost/concept/detail/concept_def.hpp new file mode 100755 index 0000000..56ba817 --- /dev/null +++ b/include/boost/concept/detail/concept_def.hpp @@ -0,0 +1,29 @@ +// Copyright David Abrahams 2006. Distributed under the Boost +// Software License, Version 1.0. (See accompanying +// file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt) +#ifndef BOOST_CONCEPT_DETAIL_CONCEPT_DEF_DWA200651_HPP +# define BOOST_CONCEPT_DETAIL_CONCEPT_DEF_DWA200651_HPP +# include +# include +# include +#endif // BOOST_CONCEPT_DETAIL_CONCEPT_DEF_DWA200651_HPP + +// BOOST_concept(SomeName, (p1)(p2)...(pN)) +// +// Expands to "template struct SomeName" +// +// Also defines an equivalent SomeNameConcept for backward compatibility. +// Maybe in the next release we can kill off the "Concept" suffix for good. +# define BOOST_CONCEPT_typename(r, ignored, index, t) \ + BOOST_PP_COMMA_IF(index) typename t + +# define BOOST_concept(name, params) \ + template < BOOST_PP_SEQ_FOR_EACH_I(BOOST_CONCEPT_typename, ~, params) > \ + struct name; \ + template < BOOST_PP_SEQ_FOR_EACH_I(BOOST_CONCEPT_typename, ~, params) > \ + struct BOOST_PP_CAT(name,Concept) : name< BOOST_PP_SEQ_ENUM(params) > \ + { BOOST_PP_CAT(name,Concept)(); }; /* ctor needed to satisfy gcc-3.4.4 */ \ + template < BOOST_PP_SEQ_FOR_EACH_I(BOOST_CONCEPT_typename, ~, params) > \ + struct name + + diff --git a/include/boost/concept/detail/concept_undef.hpp b/include/boost/concept/detail/concept_undef.hpp new file mode 100755 index 0000000..713db89 --- /dev/null +++ b/include/boost/concept/detail/concept_undef.hpp @@ -0,0 +1,5 @@ +// Copyright David Abrahams 2006. Distributed under the Boost +// Software License, Version 1.0. (See accompanying +// file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt) +# undef BOOST_concept_typename +# undef BOOST_concept diff --git a/include/boost/concept_check.hpp b/include/boost/concept_check.hpp index 2169a8d..3b43f2c 100644 --- a/include/boost/concept_check.hpp +++ b/include/boost/concept_check.hpp @@ -26,6 +26,7 @@ # include # include +# include namespace boost { @@ -57,57 +58,56 @@ namespace boost // // Begin concept definitions // - template - struct IntegerConcept { - ~IntegerConcept() { - x.error_type_must_be_an_integer_type(); - } + BOOST_concept(Integer, (T)) + { + ~Integer() + { + x.error_type_must_be_an_integer_type(); + } private: - T x; + T x; }; - template <> struct IntegerConcept {}; - template <> struct IntegerConcept {}; - template <> struct IntegerConcept {}; - template <> struct IntegerConcept {}; - template <> struct IntegerConcept {}; - template <> struct IntegerConcept {}; - template <> struct IntegerConcept {}; - template <> struct IntegerConcept {}; + template <> struct Integer {}; + template <> struct Integer {}; + template <> struct Integer {}; + template <> struct Integer {}; + template <> struct Integer {}; + template <> struct Integer {}; + template <> struct Integer {}; + template <> struct Integer {}; // etc. - template - struct SignedIntegerConcept { - ~SignedIntegerConcept() { + BOOST_concept(SignedInteger,(T)) { + ~SignedInteger() { x.error_type_must_be_a_signed_integer_type(); } private: T x; }; - template <> struct SignedIntegerConcept { }; - template <> struct SignedIntegerConcept {}; - template <> struct SignedIntegerConcept {}; - template <> struct SignedIntegerConcept {}; + template <> struct SignedInteger { }; + template <> struct SignedInteger {}; + template <> struct SignedInteger {}; + template <> struct SignedInteger {}; # if defined(BOOST_HAS_LONG_LONG) - template <> struct SignedIntegerConcept< ::boost::long_long_type> {}; + template <> struct SignedInteger< ::boost::long_long_type> {}; // etc. #endif - template - struct UnsignedIntegerConcept { - ~UnsignedIntegerConcept() { + BOOST_concept(UnsignedInteger,(T)) { + ~UnsignedInteger() { x.error_type_must_be_an_unsigned_integer_type(); } private: T x; }; - template <> struct UnsignedIntegerConcept {}; - template <> struct UnsignedIntegerConcept {}; - template <> struct UnsignedIntegerConcept {}; - template <> struct UnsignedIntegerConcept {}; + template <> struct UnsignedInteger {}; + template <> struct UnsignedInteger {}; + template <> struct UnsignedInteger {}; + template <> struct UnsignedInteger {}; # if defined(BOOST_HAS_LONG_LONG) - template <> struct UnsignedIntegerConcept< ::boost::ulong_long_type> {}; + template <> struct UnsignedInteger< ::boost::ulong_long_type> {}; // etc. #endif @@ -116,19 +116,17 @@ namespace boost //=========================================================================== // Basic Concepts - template - struct DefaultConstructibleConcept + BOOST_concept(DefaultConstructible,(TT)) { - ~DefaultConstructibleConcept() { + ~DefaultConstructible() { TT a; // require default constructor ignore_unused_variable_warning(a); } }; - template - struct AssignableConcept + BOOST_concept(Assignable,(TT)) { - ~AssignableConcept() { + ~Assignable() { #if !defined(_ITERATOR_) // back_insert_iterator broken for VC++ STL a = a; // require assignment operator #endif @@ -144,10 +142,9 @@ namespace boost TT a; }; - template - struct CopyConstructibleConcept + BOOST_concept(CopyConstructible,(TT)) { - ~CopyConstructibleConcept() { + ~CopyConstructible() { TT a(b); // require copy constructor TT* ptr = &a; // require address of operator const_constraints(a); @@ -164,10 +161,9 @@ namespace boost }; // The SGI STL version of Assignable requires copy constructor and operator= - template - struct SGIAssignableConcept + BOOST_concept(SGIAssignable,(TT)) { - ~SGIAssignableConcept() { + ~SGIAssignable() { TT b(a); #if !defined(_ITERATOR_) // back_insert_iterator broken for VC++ STL a = a; // require assignment operator @@ -186,10 +182,9 @@ namespace boost TT a; }; - template - struct ConvertibleConcept + BOOST_concept(Convertible,(X)(Y)) { - ~ConvertibleConcept() { + ~Convertible() { Y y = x; ignore_unused_variable_warning(y); } @@ -212,10 +207,9 @@ namespace boost ignore_unused_variable_warning(x); } - template - struct EqualityComparableConcept + BOOST_concept(EqualityComparable,(TT)) { - ~EqualityComparableConcept() { + ~EqualityComparable() { require_boolean_expr(a == b); require_boolean_expr(a != b); } @@ -223,10 +217,9 @@ namespace boost TT a, b; }; - template - struct LessThanComparableConcept + BOOST_concept(LessThanComparable,(TT)) { - ~LessThanComparableConcept() { + ~LessThanComparable() { require_boolean_expr(a < b); } private: @@ -234,10 +227,9 @@ namespace boost }; // This is equivalent to SGI STL's LessThanComparable. - template - struct ComparableConcept + BOOST_concept(Comparable,(TT)) { - ~ComparableConcept() { + ~Comparable() { require_boolean_expr(a < b); require_boolean_expr(a > b); require_boolean_expr(a <= b); @@ -248,49 +240,44 @@ namespace boost }; #define BOOST_DEFINE_BINARY_PREDICATE_OP_CONSTRAINT(OP,NAME) \ - template \ - struct NAME { \ - ~NAME() { (void)constraints_(); } \ + BOOST_concept(NAME, (First)(Second)) \ + { \ + ~NAME() { (void)constraints_(); } \ private: \ - bool constraints_() { \ - return a OP b; \ - } \ - First a; \ - Second b; \ + bool constraints_() { return a OP b; } \ + First a; \ + Second b; \ } #define BOOST_DEFINE_BINARY_OPERATOR_CONSTRAINT(OP,NAME) \ - template \ - struct NAME { \ - ~NAME() { (void)constraints_(); } \ - private: \ - Ret constraints_() { \ - return a OP b; \ - } \ - First a; \ - Second b; \ + BOOST_concept(NAME, (Ret)(First)(Second)) \ + { \ + ~NAME() { (void)constraints_(); } \ + private: \ + Ret constraints_() { return a OP b; } \ + First a; \ + Second b; \ } - BOOST_DEFINE_BINARY_PREDICATE_OP_CONSTRAINT(==, EqualOpConcept); - BOOST_DEFINE_BINARY_PREDICATE_OP_CONSTRAINT(!=, NotEqualOpConcept); - BOOST_DEFINE_BINARY_PREDICATE_OP_CONSTRAINT(<, LessThanOpConcept); - BOOST_DEFINE_BINARY_PREDICATE_OP_CONSTRAINT(<=, LessEqualOpConcept); - BOOST_DEFINE_BINARY_PREDICATE_OP_CONSTRAINT(>, GreaterThanOpConcept); - BOOST_DEFINE_BINARY_PREDICATE_OP_CONSTRAINT(>=, GreaterEqualOpConcept); + BOOST_DEFINE_BINARY_PREDICATE_OP_CONSTRAINT(==, EqualOp); + BOOST_DEFINE_BINARY_PREDICATE_OP_CONSTRAINT(!=, NotEqualOp); + BOOST_DEFINE_BINARY_PREDICATE_OP_CONSTRAINT(<, LessThanOp); + BOOST_DEFINE_BINARY_PREDICATE_OP_CONSTRAINT(<=, LessEqualOp); + BOOST_DEFINE_BINARY_PREDICATE_OP_CONSTRAINT(>, GreaterThanOp); + BOOST_DEFINE_BINARY_PREDICATE_OP_CONSTRAINT(>=, GreaterEqualOp); - BOOST_DEFINE_BINARY_OPERATOR_CONSTRAINT(+, PlusOpConcept); - BOOST_DEFINE_BINARY_OPERATOR_CONSTRAINT(*, TimesOpConcept); - BOOST_DEFINE_BINARY_OPERATOR_CONSTRAINT(/, DivideOpConcept); - BOOST_DEFINE_BINARY_OPERATOR_CONSTRAINT(-, SubtractOpConcept); - BOOST_DEFINE_BINARY_OPERATOR_CONSTRAINT(%, ModOpConcept); + BOOST_DEFINE_BINARY_OPERATOR_CONSTRAINT(+, PlusOp); + BOOST_DEFINE_BINARY_OPERATOR_CONSTRAINT(*, TimesOp); + BOOST_DEFINE_BINARY_OPERATOR_CONSTRAINT(/, DivideOp); + BOOST_DEFINE_BINARY_OPERATOR_CONSTRAINT(-, SubtractOp); + BOOST_DEFINE_BINARY_OPERATOR_CONSTRAINT(%, ModOp); //=========================================================================== // Function Object Concepts - template - struct GeneratorConcept + BOOST_concept(Generator,(Func)(Return)) { - ~GeneratorConcept() { test(is_void()); } + ~Generator() { test(is_void()); } private: void test(boost::mpl::false_) @@ -309,10 +296,9 @@ namespace boost }; - template - struct UnaryFunctionConcept + BOOST_concept(UnaryFunction,(Func)(Return)(Arg)) { - ~UnaryFunctionConcept() { test(is_void()); } + ~UnaryFunction() { test(is_void()); } private: void test(boost::mpl::false_) @@ -331,10 +317,9 @@ namespace boost Arg arg; }; - template - struct BinaryFunctionConcept + BOOST_concept(BinaryFunction,(Func)(Return)(First)(Second)) { - ~BinaryFunctionConcept() { test(is_void()); } + ~BinaryFunction() { test(is_void()); } private: void test(boost::mpl::false_) { @@ -354,10 +339,9 @@ namespace boost Return r; }; - template - struct UnaryPredicateConcept + BOOST_concept(UnaryPredicate,(Func)(Arg)) { - ~UnaryPredicateConcept() { + ~UnaryPredicate() { require_boolean_expr(f(arg)); // require operator() returning bool } private: @@ -365,10 +349,9 @@ namespace boost Arg arg; }; - template - struct BinaryPredicateConcept + BOOST_concept(BinaryPredicate,(Func)(First)(Second)) { - ~BinaryPredicateConcept() { + ~BinaryPredicate() { require_boolean_expr(f(a, b)); // require operator() returning bool } private: @@ -378,11 +361,10 @@ namespace boost }; // use this when functor is used inside a container class like std::set - template - struct Const_BinaryPredicateConcept - : BinaryPredicateConcept + BOOST_concept(Const_BinaryPredicate,(Func)(First)(Second)) + : BinaryPredicate { - ~Const_BinaryPredicateConcept() { + ~Const_BinaryPredicate() { const_constraints(f); } private: @@ -395,35 +377,32 @@ namespace boost Second b; }; - template - struct AdaptableGeneratorConcept - : GeneratorConcept + BOOST_concept(AdaptableGenerator,(Func)(Return)) + : Generator { typedef typename Func::result_type result_type; - ~AdaptableGeneratorConcept() + ~AdaptableGenerator() { - BOOST_CONCEPT_ASSERT((ConvertibleConcept)); + BOOST_CONCEPT_ASSERT((Convertible)); } }; - template - struct AdaptableUnaryFunctionConcept - : UnaryFunctionConcept + BOOST_concept(AdaptableUnaryFunction,(Func)(Return)(Arg)) + : UnaryFunction { typedef typename Func::argument_type argument_type; typedef typename Func::result_type result_type; - ~AdaptableUnaryFunctionConcept() + ~AdaptableUnaryFunction() { - BOOST_CONCEPT_ASSERT((ConvertibleConcept)); - BOOST_CONCEPT_ASSERT((ConvertibleConcept)); + BOOST_CONCEPT_ASSERT((Convertible)); + BOOST_CONCEPT_ASSERT((Convertible)); } }; - template - struct AdaptableBinaryFunctionConcept - : BinaryFunctionConcept< + BOOST_concept(AdaptableBinaryFunction,(Func)(Return)(First)(Second)) + : BinaryFunction< Func , typename Func::result_type , typename Func::first_argument_type @@ -434,33 +413,30 @@ namespace boost typedef typename Func::second_argument_type second_argument_type; typedef typename Func::result_type result_type; - ~AdaptableBinaryFunctionConcept() + ~AdaptableBinaryFunction() { - BOOST_CONCEPT_ASSERT((ConvertibleConcept)); - BOOST_CONCEPT_ASSERT((ConvertibleConcept)); - BOOST_CONCEPT_ASSERT((ConvertibleConcept)); + BOOST_CONCEPT_ASSERT((Convertible)); + BOOST_CONCEPT_ASSERT((Convertible)); + BOOST_CONCEPT_ASSERT((Convertible)); } }; - template - struct AdaptablePredicateConcept - : UnaryPredicateConcept - , AdaptableUnaryFunctionConcept + BOOST_concept(AdaptablePredicate,(Func)(Arg)) + : UnaryPredicate + , AdaptableUnaryFunction {}; - template - struct AdaptableBinaryPredicateConcept - : BinaryPredicateConcept - , AdaptableBinaryFunctionConcept + BOOST_concept(AdaptableBinaryPredicate,(Func)(First)(Second)) + : BinaryPredicate + , AdaptableBinaryFunction {}; //=========================================================================== // Iterator Concepts - template - struct InputIteratorConcept - : AssignableConcept - , EqualityComparableConcept + BOOST_concept(InputIterator,(TT)) + : Assignable + , EqualityComparable { typedef typename boost::detail::iterator_traits::value_type value_type; typedef typename boost::detail::iterator_traits::difference_type difference_type; @@ -468,10 +444,10 @@ namespace boost typedef typename boost::detail::iterator_traits::pointer pointer; typedef typename boost::detail::iterator_traits::iterator_category iterator_category; - ~InputIteratorConcept() + ~InputIterator() { - BOOST_CONCEPT_ASSERT((SignedIntegerConcept)); - BOOST_CONCEPT_ASSERT((ConvertibleConcept)); + BOOST_CONCEPT_ASSERT((SignedInteger)); + BOOST_CONCEPT_ASSERT((Convertible)); TT j(i); (void)*i; // require dereference operator @@ -482,11 +458,10 @@ namespace boost TT i; }; - template - struct OutputIteratorConcept - : AssignableConcept + BOOST_concept(OutputIterator,(TT)(ValueT)) + : Assignable { - ~OutputIteratorConcept() { + ~OutputIterator() { ++i; // require preincrement operator i++; // require postincrement operator @@ -497,18 +472,17 @@ namespace boost ValueT t; }; - template - struct ForwardIteratorConcept - : InputIteratorConcept + BOOST_concept(ForwardIterator,(TT)) + : InputIterator { - ~ForwardIteratorConcept() + ~ForwardIterator() { - BOOST_CONCEPT_ASSERT((ConvertibleConcept< - BOOST_DEDUCED_TYPENAME ForwardIteratorConcept::iterator_category + BOOST_CONCEPT_ASSERT((Convertible< + BOOST_DEDUCED_TYPENAME ForwardIterator::iterator_category , std::forward_iterator_tag >)); - typename InputIteratorConcept::reference r = *i; + typename InputIterator::reference r = *i; ignore_unused_variable_warning(r); } @@ -516,25 +490,23 @@ namespace boost TT i; }; - template - struct Mutable_ForwardIteratorConcept - : ForwardIteratorConcept + BOOST_concept(Mutable_ForwardIterator,(TT)) + : ForwardIterator { - ~Mutable_ForwardIteratorConcept() { + ~Mutable_ForwardIterator() { *i++ = *i; // require postincrement and assignment } private: TT i; }; - template - struct BidirectionalIteratorConcept - : ForwardIteratorConcept + BOOST_concept(BidirectionalIterator,(TT)) + : ForwardIterator { - ~BidirectionalIteratorConcept() + ~BidirectionalIterator() { - BOOST_CONCEPT_ASSERT((ConvertibleConcept< - BOOST_DEDUCED_TYPENAME BidirectionalIteratorConcept::iterator_category + BOOST_CONCEPT_ASSERT((Convertible< + BOOST_DEDUCED_TYPENAME BidirectionalIterator::iterator_category , std::bidirectional_iterator_tag >)); @@ -545,12 +517,11 @@ namespace boost TT i; }; - template - struct Mutable_BidirectionalIteratorConcept - : BidirectionalIteratorConcept - , Mutable_ForwardIteratorConcept + BOOST_concept(Mutable_BidirectionalIterator,(TT)) + : BidirectionalIterator + , Mutable_ForwardIterator { - ~Mutable_BidirectionalIteratorConcept() + ~Mutable_BidirectionalIterator() { *i-- = *i; // require postdecrement and assignment } @@ -559,15 +530,14 @@ namespace boost }; - template - struct RandomAccessIteratorConcept - : BidirectionalIteratorConcept - , ComparableConcept + BOOST_concept(RandomAccessIterator,(TT)) + : BidirectionalIterator + , Comparable { - ~RandomAccessIteratorConcept() + ~RandomAccessIterator() { - BOOST_CONCEPT_ASSERT((ConvertibleConcept< - BOOST_DEDUCED_TYPENAME BidirectionalIteratorConcept::iterator_category + BOOST_CONCEPT_ASSERT((Convertible< + BOOST_DEDUCED_TYPENAME BidirectionalIterator::iterator_category , std::random_access_iterator_tag >)); @@ -585,12 +555,11 @@ namespace boost typename boost::detail::iterator_traits::difference_type n; }; - template - struct Mutable_RandomAccessIteratorConcept - : RandomAccessIteratorConcept - , Mutable_BidirectionalIteratorConcept + BOOST_concept(Mutable_RandomAccessIterator,(TT)) + : RandomAccessIterator + , Mutable_BidirectionalIterator { - ~Mutable_RandomAccessIteratorConcept() + ~Mutable_RandomAccessIterator() { i[n] = *i; // require element access and assignment } @@ -600,53 +569,51 @@ namespace boost }; //=========================================================================== - // Container Concepts + // Container s - template - struct ContainerConcept - : AssignableConcept + BOOST_concept(Container,(C)) + : Assignable { - typedef typename Container::value_type value_type; - typedef typename Container::difference_type difference_type; - typedef typename Container::size_type size_type; - typedef typename Container::const_reference const_reference; - typedef typename Container::const_pointer const_pointer; - typedef typename Container::const_iterator const_iterator; + typedef typename C::value_type value_type; + typedef typename C::difference_type difference_type; + typedef typename C::size_type size_type; + typedef typename C::const_reference const_reference; + typedef typename C::const_pointer const_pointer; + typedef typename C::const_iterator const_iterator; - ~ContainerConcept() + ~Container() { - BOOST_CONCEPT_ASSERT((InputIteratorConcept)); + BOOST_CONCEPT_ASSERT((InputIterator)); const_constraints(c); } private: - void const_constraints(const Container& cc) { + void const_constraints(const C& cc) { i = cc.begin(); i = cc.end(); n = cc.size(); n = cc.max_size(); b = cc.empty(); } - Container c; + C c; bool b; const_iterator i; size_type n; }; - template - struct Mutable_ContainerConcept - : ContainerConcept + BOOST_concept(Mutable_Container,(C)) + : Container { - typedef typename Container::reference reference; - typedef typename Container::iterator iterator; - typedef typename Container::pointer pointer; + typedef typename C::reference reference; + typedef typename C::iterator iterator; + typedef typename C::pointer pointer; - ~Mutable_ContainerConcept() + ~Mutable_Container() { BOOST_CONCEPT_ASSERT(( - AssignableConcept)); + Assignable)); - BOOST_CONCEPT_ASSERT((InputIteratorConcept)); + BOOST_CONCEPT_ASSERT((InputIterator)); i = c.begin(); i = c.end(); @@ -655,143 +622,137 @@ namespace boost private: iterator i; - Container c, c2; + C c, c2; }; - template - struct ForwardContainerConcept - : ContainerConcept + BOOST_concept(ForwardContainer,(C)) + : Container { - ~ForwardContainerConcept() + ~ForwardContainer() { BOOST_CONCEPT_ASSERT(( - ForwardIteratorConcept< - typename ForwardContainerConcept::const_iterator + ForwardIterator< + typename ForwardContainer::const_iterator >)); } }; - template - struct Mutable_ForwardContainerConcept - : ForwardContainerConcept - , Mutable_ContainerConcept + BOOST_concept(Mutable_ForwardContainer,(C)) + : ForwardContainer + , Mutable_Container { - ~Mutable_ForwardContainerConcept() + ~Mutable_ForwardContainer() { BOOST_CONCEPT_ASSERT(( - Mutable_ForwardIteratorConcept< - typename Mutable_ForwardContainerConcept::iterator + Mutable_ForwardIterator< + typename Mutable_ForwardContainer::iterator >)); } }; - template - struct ReversibleContainerConcept - : ForwardContainerConcept + BOOST_concept(ReversibleContainer,(C)) + : ForwardContainer { typedef typename - ReversibleContainer::const_reverse_iterator + C::const_reverse_iterator const_reverse_iterator; - ~ReversibleContainerConcept() + ~ReversibleContainer() { BOOST_CONCEPT_ASSERT(( - BidirectionalIteratorConcept< - typename ReversibleContainerConcept::const_iterator>)); + BidirectionalIterator< + typename ReversibleContainer::const_iterator>)); - BOOST_CONCEPT_ASSERT((BidirectionalIteratorConcept)); + BOOST_CONCEPT_ASSERT((BidirectionalIterator)); const_constraints(c); } private: - void const_constraints(const ReversibleContainer& cc) + void const_constraints(const C& cc) { const_reverse_iterator i = cc.rbegin(); i = cc.rend(); } - ReversibleContainer c; + C c; }; - template - struct Mutable_ReversibleContainerConcept - : Mutable_ForwardContainerConcept - , ReversibleContainerConcept + BOOST_concept(Mutable_ReversibleContainer,(C)) + : Mutable_ForwardContainer + , ReversibleContainer { - typedef typename ReversibleContainer::iterator iterator; - typedef typename ReversibleContainer::reverse_iterator reverse_iterator; - - ~Mutable_ReversibleContainerConcept() + typedef typename C::reverse_iterator reverse_iterator; + + ~Mutable_ReversibleContainer() { - BOOST_CONCEPT_ASSERT((Mutable_BidirectionalIteratorConcept)); - BOOST_CONCEPT_ASSERT((Mutable_BidirectionalIteratorConcept)); - reverse_iterator i = c.rbegin(); - i = c.rend(); + typedef typename Mutable_ForwardContainer::iterator iterator; + BOOST_CONCEPT_ASSERT((Mutable_BidirectionalIterator)); + BOOST_CONCEPT_ASSERT((Mutable_BidirectionalIterator)); + + reverse_iterator i = c.rbegin(); + i = c.rend(); } private: - ReversibleContainer c; + C c; }; - template - struct RandomAccessContainerConcept - : ReversibleContainerConcept + BOOST_concept(RandomAccessContainer,(C)) + : ReversibleContainer { - typedef typename RandomAccessContainer::size_type size_type; - typedef typename RandomAccessContainer::const_reference const_reference; + typedef typename C::size_type size_type; + typedef typename C::const_reference const_reference; - ~RandomAccessContainerConcept() + ~RandomAccessContainer() { BOOST_CONCEPT_ASSERT(( - RandomAccessIteratorConcept< - typename RandomAccessContainerConcept::const_iterator + RandomAccessIterator< + typename RandomAccessContainer::const_iterator >)); const_constraints(c); } private: - void const_constraints(const RandomAccessContainer& cc) + void const_constraints(const C& cc) { const_reference r = cc[n]; ignore_unused_variable_warning(r); } - RandomAccessContainer c; + C c; size_type n; }; - template - struct Mutable_RandomAccessContainerConcept - : Mutable_ReversibleContainerConcept - , RandomAccessContainerConcept + BOOST_concept(Mutable_RandomAccessContainer,(C)) + : Mutable_ReversibleContainer + , RandomAccessContainer { private: - typedef Mutable_RandomAccessContainerConcept self; + typedef Mutable_RandomAccessContainer self; public: - ~Mutable_RandomAccessContainerConcept() + ~Mutable_RandomAccessContainer() { - BOOST_CONCEPT_ASSERT((Mutable_RandomAccessIteratorConcept)); - BOOST_CONCEPT_ASSERT((Mutable_RandomAccessIteratorConcept)); + BOOST_CONCEPT_ASSERT((Mutable_RandomAccessIterator)); + BOOST_CONCEPT_ASSERT((Mutable_RandomAccessIterator)); typename self::reference r = c[i]; ignore_unused_variable_warning(r); } private: - typename Mutable_ReversibleContainerConcept::size_type i; - RandomAccessContainer c; + typename Mutable_ReversibleContainer::size_type i; + C c; }; // A Sequence is inherently mutable - template - struct SequenceConcept - : Mutable_ForwardContainerConcept + BOOST_concept(Sequence,(S)) + : Mutable_ForwardContainer // Matt Austern's book puts DefaultConstructible here, the C++ // standard places it in Container --JGS // ... so why aren't we following the standard? --DWA - , DefaultConstructibleConcept + , DefaultConstructible { - ~SequenceConcept() + ~Sequence() { - Sequence + S c(n), c2(n, t), c3(first, last); @@ -803,7 +764,7 @@ namespace boost c.erase(p); c.erase(p, q); - typename SequenceConcept::reference r = c.front(); + typename Sequence::reference r = c.front(); ignore_unused_variable_warning(c); ignore_unused_variable_warning(c2); @@ -812,64 +773,61 @@ namespace boost const_constraints(c); } private: - void const_constraints(const Sequence& c) { - typename SequenceConcept::const_reference r = c.front(); + void const_constraints(const S& c) { + typename Sequence::const_reference r = c.front(); ignore_unused_variable_warning(r); } - typename Sequence::value_type t; - typename Sequence::size_type n; - typename Sequence::value_type* first, *last; - typename Sequence::iterator p, q; + typename S::value_type t; + typename S::size_type n; + typename S::value_type* first, *last; + typename S::iterator p, q; }; - template - struct FrontInsertionSequenceConcept - : SequenceConcept + BOOST_concept(FrontInsertionSequence,(S)) + : Sequence { - ~FrontInsertionSequenceConcept() + ~FrontInsertionSequence() { c.push_front(t); c.pop_front(); } private: - FrontInsertionSequence c; - typename FrontInsertionSequence::value_type t; + S c; + typename S::value_type t; }; - template - struct BackInsertionSequenceConcept - : SequenceConcept + BOOST_concept(BackInsertionSequence,(S)) + : Sequence { - ~BackInsertionSequenceConcept() + ~BackInsertionSequence() { c.push_back(t); c.pop_back(); - typename BackInsertionSequenceConcept::reference r = c.back(); + typename BackInsertionSequence::reference r = c.back(); ignore_unused_variable_warning(r); const_constraints(c); } private: - void const_constraints(const BackInsertionSequence& cc) { - typename BackInsertionSequenceConcept::const_reference + void const_constraints(const S& cc) { + typename BackInsertionSequence::const_reference r = cc.back(); ignore_unused_variable_warning(r); }; - BackInsertionSequence c; - typename BackInsertionSequence::value_type t; + S c; + typename S::value_type t; }; - template - struct AssociativeContainerConcept - : ForwardContainerConcept - , DefaultConstructibleConcept + BOOST_concept(AssociativeContainer,(C)) + : ForwardContainer + , DefaultConstructible { - typedef typename AssociativeContainer::key_type key_type; - typedef typename AssociativeContainer::key_compare key_compare; - typedef typename AssociativeContainer::value_compare value_compare; - typedef typename AssociativeContainer::iterator iterator; + typedef typename C::key_type key_type; + typedef typename C::key_compare key_compare; + typedef typename C::value_compare value_compare; + typedef typename C::iterator iterator; - ~AssociativeContainerConcept() + ~AssociativeContainer() { i = c.find(k); r = c.equal_range(k); @@ -877,38 +835,37 @@ namespace boost c.erase(i); c.erase(r.first, r.second); const_constraints(c); - BOOST_CONCEPT_ASSERT((BinaryPredicateConcept)); + BOOST_CONCEPT_ASSERT((BinaryPredicate)); - typedef typename AssociativeContainerConcept::value_type value_type_; - BOOST_CONCEPT_ASSERT((BinaryPredicateConcept)); + typedef typename AssociativeContainer::value_type value_type_; + BOOST_CONCEPT_ASSERT((BinaryPredicate)); } // Redundant with the base concept, but it helps below. - typedef typename AssociativeContainer::const_iterator const_iterator; + typedef typename C::const_iterator const_iterator; private: - void const_constraints(const AssociativeContainer& cc) + void const_constraints(const C& cc) { ci = cc.find(k); n = cc.count(k); cr = cc.equal_range(k); } - AssociativeContainer c; + C c; iterator i; std::pair r; const_iterator ci; std::pair cr; - typename AssociativeContainer::key_type k; - typename AssociativeContainer::size_type n; + typename C::key_type k; + typename C::size_type n; }; - template - struct UniqueAssociativeContainerConcept - : AssociativeContainerConcept + BOOST_concept(UniqueAssociativeContainer,(C)) + : AssociativeContainer { - ~UniqueAssociativeContainerConcept() + ~UniqueAssociativeContainer() { - UniqueAssociativeContainer c(first, last); + C c(first, last); pos_flag = c.insert(t); c.insert(first, last); @@ -916,18 +873,17 @@ namespace boost ignore_unused_variable_warning(c); } private: - std::pair pos_flag; - typename UniqueAssociativeContainer::value_type t; - typename UniqueAssociativeContainer::value_type* first, *last; + std::pair pos_flag; + typename C::value_type t; + typename C::value_type* first, *last; }; - template - struct MultipleAssociativeContainerConcept - : AssociativeContainerConcept + BOOST_concept(MultipleAssociativeContainer,(C)) + : AssociativeContainer { - ~MultipleAssociativeContainerConcept() + ~MultipleAssociativeContainer() { - MultipleAssociativeContainer c(first, last); + C c(first, last); pos = c.insert(t); c.insert(first, last); @@ -936,45 +892,42 @@ namespace boost ignore_unused_variable_warning(pos); } private: - typename MultipleAssociativeContainer::iterator pos; - typename MultipleAssociativeContainer::value_type t; - typename MultipleAssociativeContainer::value_type* first, *last; + typename C::iterator pos; + typename C::value_type t; + typename C::value_type* first, *last; }; - template - struct SimpleAssociativeContainerConcept - : AssociativeContainerConcept + BOOST_concept(SimpleAssociativeContainer,(C)) + : AssociativeContainer { - ~SimpleAssociativeContainerConcept() + ~SimpleAssociativeContainer() { - typedef typename SimpleAssociativeContainer::key_type key_type; - typedef typename SimpleAssociativeContainer::value_type value_type; + typedef typename C::key_type key_type; + typedef typename C::value_type value_type; BOOST_MPL_ASSERT((boost::is_same)); } }; - template - struct PairAssociativeContainerConcept - : AssociativeContainerConcept + BOOST_concept(PairAssociativeContainer,(C)) + : AssociativeContainer { - ~PairAssociativeContainerConcept() + ~PairAssociativeContainer() { - typedef typename SimpleAssociativeContainer::key_type key_type; - typedef typename SimpleAssociativeContainer::value_type value_type; - typedef typename SimpleAssociativeContainer::mapped_type mapped_type; + typedef typename C::key_type key_type; + typedef typename C::value_type value_type; + typedef typename C::mapped_type mapped_type; typedef std::pair required_value_type; BOOST_MPL_ASSERT((boost::is_same)); } }; - template - struct SortedAssociativeContainerConcept - : AssociativeContainerConcept - , ReversibleContainerConcept + BOOST_concept(SortedAssociativeContainer,(C)) + : AssociativeContainer + , ReversibleContainer { - ~SortedAssociativeContainerConcept() + ~SortedAssociativeContainer() { - SortedAssociativeContainer + C c(kc), c2(first, last), c3(first, last, kc); @@ -991,7 +944,7 @@ namespace boost const_constraints(c); } - void const_constraints(const SortedAssociativeContainer& c) + void const_constraints(const C& c) { kc = c.key_comp(); vc = c.value_comp(); @@ -1002,24 +955,26 @@ namespace boost } private: - typename SortedAssociativeContainer::key_compare kc; - typename SortedAssociativeContainer::value_compare vc; - typename SortedAssociativeContainer::value_type t; - typename SortedAssociativeContainer::key_type k; - typedef typename SortedAssociativeContainer::iterator iterator; - typedef typename SortedAssociativeContainer::const_iterator const_iterator; + typename C::key_compare kc; + typename C::value_compare vc; + typename C::value_type t; + typename C::key_type k; + typedef typename C::iterator iterator; + typedef typename C::const_iterator const_iterator; - typedef SortedAssociativeContainerConcept self; + typedef SortedAssociativeContainer self; iterator p; const_iterator cp; std::pair r; std::pair cr; - typename SortedAssociativeContainer::value_type* first, *last; + typename C::value_type* first, *last; }; // HashedAssociativeContainer } // namespace boost +# include + #endif // BOOST_CONCEPT_CHECKS_HPP diff --git a/stl_concept_check.cpp b/stl_concept_check.cpp index f84e220..8ec6f96 100644 --- a/stl_concept_check.cpp +++ b/stl_concept_check.cpp @@ -20,7 +20,7 @@ #include #include #include -#ifndef BOOST_NO_SLIST +#if 0 #include #endif @@ -43,27 +43,27 @@ main() typedef std::list List; // VC++ missing pointer and const_pointer typedefs - function_requires< Mutable_RandomAccessContainerConcept >(); - function_requires< BackInsertionSequenceConcept >(); + function_requires< Mutable_RandomAccessContainer >(); + function_requires< BackInsertionSequence >(); #if !(defined(__GNUC__) && defined(BOOST_HIDE_EXPECTED_ERRORS)) #if !(defined(__sgi) && defined(BOOST_HIDE_EXPECTED_ERRORS)) // old deque iterator missing n + iter operation - function_requires< Mutable_RandomAccessContainerConcept >(); + function_requires< Mutable_RandomAccessContainer >(); #endif // warnings about signed and unsigned in old deque version - function_requires< FrontInsertionSequenceConcept >(); - function_requires< BackInsertionSequenceConcept >(); + function_requires< FrontInsertionSequence >(); + function_requires< BackInsertionSequence >(); #endif // VC++ missing pointer and const_pointer typedefs - function_requires< Mutable_ReversibleContainerConcept >(); - function_requires< FrontInsertionSequenceConcept >(); - function_requires< BackInsertionSequenceConcept >(); + function_requires< Mutable_ReversibleContainer >(); + function_requires< FrontInsertionSequence >(); + function_requires< BackInsertionSequence >(); -#ifndef BOOST_NO_SLIST +#if 0 typedef BOOST_STD_EXTENSION_NAMESPACE::slist SList; - function_requires< FrontInsertionSequenceConcept >(); + function_requires< FrontInsertionSequence >(); #endif typedef std::set Set; @@ -71,21 +71,21 @@ main() typedef std::map Map; typedef std::multimap MultiMap; - function_requires< SortedAssociativeContainerConcept >(); - function_requires< SimpleAssociativeContainerConcept >(); - function_requires< UniqueAssociativeContainerConcept >(); + function_requires< SortedAssociativeContainer >(); + function_requires< SimpleAssociativeContainer >(); + function_requires< UniqueAssociativeContainer >(); - function_requires< SortedAssociativeContainerConcept >(); - function_requires< SimpleAssociativeContainerConcept >(); - function_requires< MultipleAssociativeContainerConcept >(); + function_requires< SortedAssociativeContainer >(); + function_requires< SimpleAssociativeContainer >(); + function_requires< MultipleAssociativeContainer >(); - function_requires< SortedAssociativeContainerConcept >(); - function_requires< UniqueAssociativeContainerConcept >(); - function_requires< PairAssociativeContainerConcept >(); + function_requires< SortedAssociativeContainer >(); + function_requires< UniqueAssociativeContainer >(); + function_requires< PairAssociativeContainer >(); - function_requires< SortedAssociativeContainerConcept >(); - function_requires< MultipleAssociativeContainerConcept >(); - function_requires< PairAssociativeContainerConcept >(); + function_requires< SortedAssociativeContainer >(); + function_requires< MultipleAssociativeContainer >(); + function_requires< PairAssociativeContainer >(); #endif return 0; diff --git a/stl_concept_covering.cpp b/stl_concept_covering.cpp index 5b05beb..338d23f 100644 --- a/stl_concept_covering.cpp +++ b/stl_concept_covering.cpp @@ -177,7 +177,7 @@ main() typedef equal_op_first_archetype<> Left; typedef input_iterator_archetype InIter; InIter in; - function_requires< InputIteratorConcept >(); + function_requires< InputIterator >(); equal_op_second_archetype<> value(dummy_cons); std::iterator_traits::difference_type n = std::count(in, in, value);