changed to new non-macro style, so don't need different 1..4

arguments versions


[SVN r8277]
This commit is contained in:
Jeremy Siek
2000-11-21 20:16:55 +00:00
parent be077fe131
commit 094da4b2f6
10 changed files with 32 additions and 185 deletions

View File

@@ -16,9 +16,11 @@
struct foo { };
using namespace boost;
class class_requires_test
{
BOOST_CLASS_REQUIRES(foo, EqualityComparableConcept);
typedef class_requires< EqualityComparableConcept<foo> >::check req;
};
int

View File

@@ -1,29 +0,0 @@
// (C) Copyright Jeremy Siek 2000. Permission to copy, use, modify,
// sell and distribute this software is granted provided this
// copyright notice appears in all copies. This software is provided
// "as is" without express or implied warranty, and with no claim as
// to its suitability for any purpose.
#include <boost/pending/concept_checks.hpp>
/*
This file verifies that the BOOST_CLASS_REQUIRES2 macro
of the Boost Concept Checking Library catches errors
when it is suppose to.
*/
struct foo { };
class class_requires_test
{
BOOST_CLASS_REQUIRES2(foo, foo, Comparable2Concept);
};
int
main()
{
class_requires_test x;
return 0;
}

View File

@@ -1,29 +0,0 @@
// (C) Copyright Jeremy Siek 2000. Permission to copy, use, modify,
// sell and distribute this software is granted provided this
// copyright notice appears in all copies. This software is provided
// "as is" without express or implied warranty, and with no claim as
// to its suitability for any purpose.
#include <boost/pending/concept_checks.hpp>
/*
This file verifies that the BOOST_CLASS_REQUIRES3 macro
of the Boost Concept Checking Library catches errors
when it is suppose to.
*/
struct foo { };
class class_requires_test
{
BOOST_CLASS_REQUIRES3(foo, foo, foo, UnaryFunctionConcept);
};
int
main()
{
class_requires_test x;
return 0;
}

View File

@@ -1,27 +0,0 @@
// (C) Copyright Jeremy Siek 2000. Permission to copy, use, modify,
// sell and distribute this software is granted provided this
// copyright notice appears in all copies. This software is provided
// "as is" without express or implied warranty, and with no claim as
// to its suitability for any purpose.
#include <boost/pending/concept_checks.hpp>
/*
This file verifies that the BOOST_CLASS_REQUIRES4 macro
of the Boost Concept Checking Library catches errors
when it is suppose to.
*/
struct foo { };
class class_requires_test
{
BOOST_CLASS_REQUIRES4(foo, foo, foo, foo, BinaryFunctionConcept);
};
int
main()
{
class_requires_test x;
return 0;
}

View File

@@ -8,23 +8,25 @@
/*
This file verifies that the BOOST_CLASS_REQUIRES macros of the
Boost Concept Checking Library do not cause errors when
they are not suppose to.
This file verifies that the boost::class_requires class of the Boost
Concept Checking Library do not cause errors when it is not suppose
to.
*/
struct foo { bool operator()(int) { return true; } };
struct bar { bool operator()(int, char) { return true; } };
using namespace boost;
class class_requires_test
{
BOOST_CLASS_REQUIRES(int, EqualityComparableConcept);
typedef int* int_ptr;
typedef const int* const_int_ptr;
BOOST_CLASS_REQUIRES2(int_ptr, const_int_ptr, Comparable2Concept);
BOOST_CLASS_REQUIRES3(foo, bool, int, UnaryFunctionConcept);
BOOST_CLASS_REQUIRES4(bar, bool, int, char, BinaryFunctionConcept);
typedef class_requires< EqualityComparableConcept<int> >::check req1;
typedef class_requires<EqualityComparableConcept<int> >::check req2;
typedef class_requires<Comparable2Concept<int*, const int*> >::check req3;
typedef class_requires<UnaryFunctionConcept<foo, bool, int> >::check req4;
typedef class_requires<BinaryFunctionConcept<bar, bool, int, char> >::check
req5;
};
int

View File

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

View File

@@ -1,24 +0,0 @@
// (C) Copyright Jeremy Siek 2000. Permission to copy, use, modify,
// sell and distribute this software is granted provided this
// copyright notice appears in all copies. This software is provided
// "as is" without express or implied warranty, and with no claim as
// to its suitability for any purpose.
#include <boost/pending/concept_checks.hpp>
/*
This file verifies that the BOOST_FUNCTION_REQUIRES2 macro
of the Boost Concept Checking Library catches errors
when it is suppose to.
*/
struct foo { };
int
main()
{
BOOST_FUNCTION_REQUIRES2(foo, foo, Comparable2Concept);
return 0;
}

View File

@@ -1,24 +0,0 @@
// (C) Copyright Jeremy Siek 2000. Permission to copy, use, modify,
// sell and distribute this software is granted provided this
// copyright notice appears in all copies. This software is provided
// "as is" without express or implied warranty, and with no claim as
// to its suitability for any purpose.
#include <boost/pending/concept_checks.hpp>
/*
This file verifies that the BOOST_FUNCTION_REQUIRES3 macro
of the Boost Concept Checking Library catches errors
when it is suppose to.
*/
struct foo { };
int
main()
{
BOOST_FUNCTION_REQUIRES3(foo, foo, foo, UnaryFunctionConcept);
return 0;
}

View File

@@ -1,24 +0,0 @@
// (C) Copyright Jeremy Siek 2000. Permission to copy, use, modify,
// sell and distribute this software is granted provided this
// copyright notice appears in all copies. This software is provided
// "as is" without express or implied warranty, and with no claim as
// to its suitability for any purpose.
#include <boost/pending/concept_checks.hpp>
/*
This file verifies that the BOOST_FUNCTION_REQUIRES4 macro
of the Boost Concept Checking Library catches errors
when it is suppose to.
*/
struct foo { };
int
main()
{
BOOST_FUNCTION_REQUIRES4(foo, foo, foo, foo, BinaryFunctionConcept);
return 0;
}

View File

@@ -23,69 +23,69 @@ main()
using namespace boost;
{
typedef default_constructible_archetype<> foo;
BOOST_FUNCTION_REQUIRES(foo, DefaultConstructibleConcept);
function_requires< DefaultConstructibleConcept<foo> >();
}
{
typedef copy_constructible_archetype<> foo;
BOOST_FUNCTION_REQUIRES(foo, CopyConstructibleConcept);
function_requires< CopyConstructibleConcept<foo> >();
}
{
typedef assignable_archetype<> foo;
BOOST_FUNCTION_REQUIRES(foo, AssignableConcept);
function_requires< AssignableConcept<foo> >();
}
{
typedef copy_constructible_archetype<> foo;
typedef convertible_to_archetype<foo> convertible_to_foo;
BOOST_FUNCTION_REQUIRES2(convertible_to_foo, foo, ConvertibleConcept);
function_requires< ConvertibleConcept<convertible_to_foo, foo> >();
}
{
BOOST_FUNCTION_REQUIRES2(boolean_archetype, bool, ConvertibleConcept);
function_requires< ConvertibleConcept<boolean_archetype, bool> >();
}
{
typedef unary_function_archetype<int, int> F;
BOOST_FUNCTION_REQUIRES3(F, int, int, UnaryFunctionConcept);
function_requires< UnaryFunctionConcept<F, int, int> >();
}
{
typedef binary_function_archetype<int, int, int> F;
BOOST_FUNCTION_REQUIRES4(F, int, int, int, BinaryFunctionConcept);
function_requires< BinaryFunctionConcept<F, int, int, int> >();
}
{
typedef unary_predicate_archetype<int> F;
BOOST_FUNCTION_REQUIRES2(F, int, UnaryPredicateConcept);
function_requires< UnaryPredicateConcept<F, int> >();
}
{
typedef binary_predicate_archetype<int, int> F;
BOOST_FUNCTION_REQUIRES3(F, int, int, BinaryPredicateConcept);
function_requires< BinaryPredicateConcept<F, int, int> >();
typedef const_binary_predicate_archetype<int, int> const_F;
BOOST_FUNCTION_REQUIRES3(const_F, int, int, Const_BinaryPredicateConcept);
function_requires< Const_BinaryPredicateConcept<const_F, int, int> >();
}
{
typedef trivial_iterator_archetype<null_archetype> Iter;
BOOST_FUNCTION_REQUIRES(Iter, TrivialIteratorConcept);
function_requires< TrivialIteratorConcept<Iter> >();
}
{
typedef mutable_trivial_iterator_archetype<null_archetype> Iter;
BOOST_FUNCTION_REQUIRES(Iter, Mutable_TrivialIteratorConcept);
function_requires< Mutable_TrivialIteratorConcept<Iter> >();
}
{
typedef input_iterator_archetype<null_archetype> Iter;
BOOST_FUNCTION_REQUIRES(Iter, InputIteratorConcept);
function_requires< InputIteratorConcept<Iter> >();
}
{
typedef output_iterator_archetype Iter;
BOOST_FUNCTION_REQUIRES2(Iter, int, OutputIteratorConcept);
function_requires< OutputIteratorConcept<Iter, int> >();
}
{
typedef forward_iterator_archetype<null_archetype> Iter;
BOOST_FUNCTION_REQUIRES(Iter, ForwardIteratorConcept);
function_requires< ForwardIteratorConcept<Iter> >();
}
{
typedef bidirectional_iterator_archetype<null_archetype> Iter;
BOOST_FUNCTION_REQUIRES(Iter, BidirectionalIteratorConcept);
function_requires< BidirectionalIteratorConcept<Iter> >();
}
{
typedef random_access_iterator_archetype<null_archetype> Iter;
BOOST_FUNCTION_REQUIRES(Iter, RandomAccessIteratorConcept);
function_requires< RandomAccessIteratorConcept<Iter> >();
}
return 0;