Killed off "Concept" suffixes on Boost concepts. Maintained

back-compatibility by using a macro to define XxxxConcept when
defining Xxxxx.


[SVN r33894]
This commit is contained in:
Dave Abrahams
2006-05-01 19:40:32 +00:00
parent f00741c14f
commit 79017f985a
14 changed files with 407 additions and 413 deletions

View File

@@ -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 ]

View File

@@ -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 ]
;

View File

@@ -18,11 +18,11 @@ struct bar { bool operator()(int, char) { return true; } };
class class_requires_test
{
BOOST_CONCEPT_ASSERT((boost::EqualityComparableConcept<int>));
BOOST_CONCEPT_ASSERT((boost::EqualityComparable<int>));
typedef int* int_ptr; typedef const int* const_int_ptr;
BOOST_CONCEPT_ASSERT((boost::EqualOpConcept<int_ptr,const_int_ptr>));
BOOST_CONCEPT_ASSERT((boost::UnaryFunctionConcept<foo,bool,int>));
// BOOST_CONCEPT_ASSERT((boost::BinaryFunctionConcept<bar,bool,int,char>));
BOOST_CONCEPT_ASSERT((boost::EqualOp<int_ptr,const_int_ptr>));
BOOST_CONCEPT_ASSERT((boost::UnaryFunction<foo,bool,int>));
BOOST_CONCEPT_ASSERT((boost::BinaryFunction<bar,bool,int,char>));
};
int

View File

@@ -20,7 +20,7 @@ struct foo { };
template <class T>
class class_requires_test
{
BOOST_CONCEPT_ASSERT((boost::EqualityComparableConcept<foo>));
BOOST_CONCEPT_ASSERT((boost::EqualityComparable<foo>));
};
int

View File

@@ -238,9 +238,9 @@ Library produces):
<pre>
boost/concept_check.hpp: In method `void LessThanComparableConcept
&lt;_List_iterator&lt;int,int &amp;,int *&gt; &gt;::constraints()':
&lt;_List_iterator&lt;int,int &amp;,int *&gt; &gt;::~LessThanComparableConcept()':
boost/concept_check.hpp:334: instantiated from `RandomAccessIteratorConcept
&lt;_List_iterator&lt;int,int &amp;,int *&gt; &gt;::constraints()'
&lt;_List_iterator&lt;int,int &amp;,int *&gt; &gt;::~RandomAccessIteratorConcept()'
bad_error_eg.cpp:6: instantiated from `stable_sort&lt;_List_iterator
&lt;int,int &amp;,int *&gt; &gt;(_List_iterator&lt;int,int &amp;,int *&gt;,
_List_iterator&lt;int,int &amp;,int *&gt;)'
@@ -260,10 +260,9 @@ href="http://www.sgi.com/tech/stl/RandomAccessIterator.html">
RandomAccessIterator</a>).
<LI> The error message is now much shorter and does not reveal
internal STL functions.
<LI> The presence of <tt>concept_check.hpp</tt> and
<tt>constraints()</tt> in the error message alerts the user to the
fact that the error lies in the user code and not in the library
implementation.
<LI> The presence of <tt>concept_check.hpp</tt> in the error message
alerts the user to the fact that the error lies in the user code and
not in the library implementation.
</UL>
<h2><a name="history">History</a></h2>

View File

@@ -21,6 +21,6 @@ struct foo { };
int
main()
{
BOOST_CONCEPT_ASSERT((boost::EqualityComparableConcept<foo>));
BOOST_CONCEPT_ASSERT((boost::EqualityComparable<foo>));
return 0;
}

View File

@@ -25,76 +25,76 @@ main()
// Basic Concepts
{
typedef default_constructible_archetype<> foo;
function_requires< DefaultConstructibleConcept<foo> >();
function_requires< DefaultConstructible<foo> >();
}
{
typedef assignable_archetype<> foo;
function_requires< AssignableConcept<foo> >();
function_requires< Assignable<foo> >();
}
{
typedef copy_constructible_archetype<> foo;
function_requires< CopyConstructibleConcept<foo> >();
function_requires< CopyConstructible<foo> >();
}
{
typedef sgi_assignable_archetype<> foo;
function_requires< SGIAssignableConcept<foo> >();
function_requires< SGIAssignable<foo> >();
}
{
typedef copy_constructible_archetype<> foo;
typedef convertible_to_archetype<foo> convertible_to_foo;
function_requires< ConvertibleConcept<convertible_to_foo, foo> >();
function_requires< Convertible<convertible_to_foo, foo> >();
}
{
function_requires< ConvertibleConcept<boolean_archetype, bool> >();
function_requires< Convertible<boolean_archetype, bool> >();
}
{
typedef equality_comparable_archetype<> foo;
function_requires< EqualityComparableConcept<foo> >();
function_requires< EqualityComparable<foo> >();
}
{
typedef less_than_comparable_archetype<> foo;
function_requires< LessThanComparableConcept<foo> >();
function_requires< LessThanComparable<foo> >();
}
{
typedef comparable_archetype<> foo;
function_requires< ComparableConcept<foo> >();
function_requires< Comparable<foo> >();
}
{
typedef equal_op_first_archetype<> First;
typedef equal_op_second_archetype<> Second;
function_requires< EqualOpConcept<First, Second> >();
function_requires< EqualOp<First, Second> >();
}
{
typedef not_equal_op_first_archetype<> First;
typedef not_equal_op_second_archetype<> Second;
function_requires< NotEqualOpConcept<First, Second> >();
function_requires< NotEqualOp<First, Second> >();
}
{
typedef less_than_op_first_archetype<> First;
typedef less_than_op_second_archetype<> Second;
function_requires< LessThanOpConcept<First, Second> >();
function_requires< LessThanOp<First, Second> >();
}
{
typedef less_equal_op_first_archetype<> First;
typedef less_equal_op_second_archetype<> Second;
function_requires< LessEqualOpConcept<First, Second> >();
function_requires< LessEqualOp<First, Second> >();
}
{
typedef greater_than_op_first_archetype<> First;
typedef greater_than_op_second_archetype<> Second;
function_requires< GreaterThanOpConcept<First, Second> >();
function_requires< GreaterThanOp<First, Second> >();
}
{
typedef greater_equal_op_first_archetype<> First;
typedef greater_equal_op_second_archetype<> Second;
function_requires< GreaterEqualOpConcept<First, Second> >();
function_requires< GreaterEqualOp<First, Second> >();
}
{
typedef copy_constructible_archetype<> Return;
typedef plus_op_first_archetype<Return> First;
typedef plus_op_second_archetype<Return> Second;
function_requires< PlusOpConcept<Return, First, Second> >();
function_requires< PlusOp<Return, First, Second> >();
}
//===========================================================================
@@ -102,70 +102,70 @@ main()
{
typedef generator_archetype<null_archetype<> > foo;
function_requires< GeneratorConcept<foo, null_archetype<> > >();
function_requires< Generator<foo, null_archetype<> > >();
}
#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<int, int> F;
function_requires< UnaryFunctionConcept<F, int, int> >();
function_requires< UnaryFunction<F, int, int> >();
}
{
typedef binary_function_archetype<int, int, int> F;
function_requires< BinaryFunctionConcept<F, int, int, int> >();
function_requires< BinaryFunction<F, int, int, int> >();
}
{
typedef unary_predicate_archetype<int> F;
function_requires< UnaryPredicateConcept<F, int> >();
function_requires< UnaryPredicate<F, int> >();
}
{
typedef binary_predicate_archetype<int, int> F;
function_requires< BinaryPredicateConcept<F, int, int> >();
function_requires< BinaryPredicate<F, int, int> >();
}
//===========================================================================
// Iterator Concepts
{
typedef input_iterator_archetype<null_archetype<> > Iter;
function_requires< InputIteratorConcept<Iter> >();
function_requires< InputIterator<Iter> >();
}
{
typedef output_iterator_archetype<int> Iter;
function_requires< OutputIteratorConcept<Iter, int> >();
function_requires< OutputIterator<Iter, int> >();
}
{
typedef input_output_iterator_archetype<int> Iter;
function_requires< InputIteratorConcept<Iter> >();
function_requires< OutputIteratorConcept<Iter, int> >();
function_requires< InputIterator<Iter> >();
function_requires< OutputIterator<Iter, int> >();
}
{
typedef forward_iterator_archetype<null_archetype<> > Iter;
function_requires< ForwardIteratorConcept<Iter> >();
function_requires< ForwardIterator<Iter> >();
}
{
typedef mutable_forward_iterator_archetype<assignable_archetype<> > Iter;
function_requires< Mutable_ForwardIteratorConcept<Iter> >();
function_requires< Mutable_ForwardIterator<Iter> >();
}
{
typedef bidirectional_iterator_archetype<null_archetype<> > Iter;
function_requires< BidirectionalIteratorConcept<Iter> >();
function_requires< BidirectionalIterator<Iter> >();
}
{
typedef mutable_bidirectional_iterator_archetype<assignable_archetype<> >
Iter;
function_requires< Mutable_BidirectionalIteratorConcept<Iter> >();
function_requires< Mutable_BidirectionalIterator<Iter> >();
}
{
typedef random_access_iterator_archetype<null_archetype<> > Iter;
function_requires< RandomAccessIteratorConcept<Iter> >();
function_requires< RandomAccessIterator<Iter> >();
}
{
typedef mutable_random_access_iterator_archetype<assignable_archetype<> >
Iter;
function_requires< Mutable_RandomAccessIteratorConcept<Iter> >();
function_requires< Mutable_RandomAccessIterator<Iter> >();
}
//===========================================================================

View File

@@ -5,7 +5,7 @@
# define BOOST_LIBS_CONCEPT_CHECK_FAKE_SORT_DWA2006430_HPP
# include <boost/detail/iterator.hpp>
# include <boost/concept_check/where.hpp>
# include <boost/concept/where.hpp>
# include <boost/concept_check.hpp>
namespace fake
@@ -14,8 +14,8 @@ namespace fake
template<typename RanIter>
BOOST_CONCEPT_WHERE(
((Mutable_RandomAccessIteratorConcept<RanIter>))
((LessThanComparableConcept<typename Mutable_RandomAccessIteratorConcept<RanIter>::value_type>))
((Mutable_RandomAccessIterator<RanIter>))
((LessThanComparable<typename Mutable_RandomAccessIterator<RanIter>::value_type>))
, (void))
sort(RanIter,RanIter)

View File

@@ -21,6 +21,6 @@ struct foo { };
int
main()
{
boost::function_requires< boost::EqualityComparableConcept<foo> >();
boost::function_requires< boost::EqualityComparable<foo> >();
return 0;
}

View File

@@ -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 <boost/preprocessor/comma_if.hpp>
# include <boost/preprocessor/seq/for_each_i.hpp>
# include <boost/preprocessor/seq/enum.hpp>
#endif // BOOST_CONCEPT_DETAIL_CONCEPT_DEF_DWA200651_HPP
// BOOST_concept(SomeName, (p1)(p2)...(pN))
//
// Expands to "template <class p1, class p2, ...class pN> 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

View File

@@ -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

File diff suppressed because it is too large Load Diff

View File

@@ -20,7 +20,7 @@
#include <vector>
#include <list>
#include <deque>
#ifndef BOOST_NO_SLIST
#if 0
#include <slist>
#endif
@@ -43,27 +43,27 @@ main()
typedef std::list<int> List;
// VC++ missing pointer and const_pointer typedefs
function_requires< Mutable_RandomAccessContainerConcept<Vector> >();
function_requires< BackInsertionSequenceConcept<Vector> >();
function_requires< Mutable_RandomAccessContainer<Vector> >();
function_requires< BackInsertionSequence<Vector> >();
#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<Deque> >();
function_requires< Mutable_RandomAccessContainer<Deque> >();
#endif
// warnings about signed and unsigned in old deque version
function_requires< FrontInsertionSequenceConcept<Deque> >();
function_requires< BackInsertionSequenceConcept<Deque> >();
function_requires< FrontInsertionSequence<Deque> >();
function_requires< BackInsertionSequence<Deque> >();
#endif
// VC++ missing pointer and const_pointer typedefs
function_requires< Mutable_ReversibleContainerConcept<List> >();
function_requires< FrontInsertionSequenceConcept<List> >();
function_requires< BackInsertionSequenceConcept<List> >();
function_requires< Mutable_ReversibleContainer<List> >();
function_requires< FrontInsertionSequence<List> >();
function_requires< BackInsertionSequence<List> >();
#ifndef BOOST_NO_SLIST
#if 0
typedef BOOST_STD_EXTENSION_NAMESPACE::slist<int> SList;
function_requires< FrontInsertionSequenceConcept<SList> >();
function_requires< FrontInsertionSequence<SList> >();
#endif
typedef std::set<int> Set;
@@ -71,21 +71,21 @@ main()
typedef std::map<int,int> Map;
typedef std::multimap<int,int> MultiMap;
function_requires< SortedAssociativeContainerConcept<Set> >();
function_requires< SimpleAssociativeContainerConcept<Set> >();
function_requires< UniqueAssociativeContainerConcept<Set> >();
function_requires< SortedAssociativeContainer<Set> >();
function_requires< SimpleAssociativeContainer<Set> >();
function_requires< UniqueAssociativeContainer<Set> >();
function_requires< SortedAssociativeContainerConcept<MultiSet> >();
function_requires< SimpleAssociativeContainerConcept<MultiSet> >();
function_requires< MultipleAssociativeContainerConcept<MultiSet> >();
function_requires< SortedAssociativeContainer<MultiSet> >();
function_requires< SimpleAssociativeContainer<MultiSet> >();
function_requires< MultipleAssociativeContainer<MultiSet> >();
function_requires< SortedAssociativeContainerConcept<Map> >();
function_requires< UniqueAssociativeContainerConcept<Map> >();
function_requires< PairAssociativeContainerConcept<Map> >();
function_requires< SortedAssociativeContainer<Map> >();
function_requires< UniqueAssociativeContainer<Map> >();
function_requires< PairAssociativeContainer<Map> >();
function_requires< SortedAssociativeContainerConcept<MultiMap> >();
function_requires< MultipleAssociativeContainerConcept<MultiMap> >();
function_requires< PairAssociativeContainerConcept<MultiMap> >();
function_requires< SortedAssociativeContainer<MultiMap> >();
function_requires< MultipleAssociativeContainer<MultiMap> >();
function_requires< PairAssociativeContainer<MultiMap> >();
#endif
return 0;

View File

@@ -177,7 +177,7 @@ main()
typedef equal_op_first_archetype<> Left;
typedef input_iterator_archetype<Left> InIter;
InIter in;
function_requires< InputIteratorConcept<InIter> >();
function_requires< InputIterator<InIter> >();
equal_op_second_archetype<> value(dummy_cons);
std::iterator_traits<InIter>::difference_type
n = std::count(in, in, value);