forked from boostorg/iterator
updated to match the changes to the standards proposal
[SVN r21647]
This commit is contained in:
@ -60,19 +60,13 @@ namespace boost_concepts {
|
|||||||
class ReadableIteratorConcept {
|
class ReadableIteratorConcept {
|
||||||
public:
|
public:
|
||||||
typedef BOOST_DEDUCED_TYPENAME boost::detail::iterator_traits<Iterator>::value_type value_type;
|
typedef BOOST_DEDUCED_TYPENAME boost::detail::iterator_traits<Iterator>::value_type value_type;
|
||||||
typedef BOOST_DEDUCED_TYPENAME boost::detail::iterator_traits<Iterator>::reference reference;
|
|
||||||
|
|
||||||
void constraints() {
|
void constraints() {
|
||||||
boost::function_requires< boost::SGIAssignableConcept<Iterator> >();
|
boost::function_requires< boost::AssignableConcept<Iterator> >();
|
||||||
boost::function_requires< boost::EqualityComparableConcept<Iterator> >();
|
boost::function_requires< boost::CopyConstructibleConcept<Iterator> >();
|
||||||
boost::function_requires<
|
|
||||||
boost::DefaultConstructibleConcept<Iterator> >();
|
|
||||||
|
|
||||||
reference r = *i; // or perhaps read(x)
|
value_type v = *i;
|
||||||
value_type v = r;
|
|
||||||
value_type v2 = *i;
|
|
||||||
boost::ignore_unused_variable_warning(v);
|
boost::ignore_unused_variable_warning(v);
|
||||||
boost::ignore_unused_variable_warning(v2);
|
|
||||||
}
|
}
|
||||||
Iterator i;
|
Iterator i;
|
||||||
};
|
};
|
||||||
@ -85,12 +79,8 @@ namespace boost_concepts {
|
|||||||
public:
|
public:
|
||||||
|
|
||||||
void constraints() {
|
void constraints() {
|
||||||
boost::function_requires< boost::SGIAssignableConcept<Iterator> >();
|
boost::function_requires< boost::CopyConstructibleConcept<Iterator> >();
|
||||||
boost::function_requires< boost::EqualityComparableConcept<Iterator> >();
|
*i = v;
|
||||||
boost::function_requires<
|
|
||||||
boost::DefaultConstructibleConcept<Iterator> >();
|
|
||||||
|
|
||||||
*i = v; // a good alternative could be something like write(x, v)
|
|
||||||
}
|
}
|
||||||
ValueType v;
|
ValueType v;
|
||||||
Iterator i;
|
Iterator i;
|
||||||
@ -112,20 +102,11 @@ namespace boost_concepts {
|
|||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
typedef typename boost::detail::iterator_traits<Iterator>::value_type value_type;
|
typedef typename boost::detail::iterator_traits<Iterator>::value_type value_type;
|
||||||
typedef typename boost::detail::iterator_traits<Iterator>::reference reference;
|
|
||||||
|
|
||||||
void constraints()
|
void constraints()
|
||||||
{
|
{
|
||||||
boost::function_requires< ReadableIteratorConcept<Iterator> >();
|
boost::function_requires< ReadableIteratorConcept<Iterator> >();
|
||||||
|
const value_type& v = *i;
|
||||||
typedef boost::mpl::or_<
|
|
||||||
boost::is_same<reference, value_type&>
|
|
||||||
, boost::is_same<reference, value_type const&>
|
|
||||||
> correct_reference;
|
|
||||||
|
|
||||||
BOOST_STATIC_ASSERT(correct_reference::value);
|
|
||||||
|
|
||||||
reference v = *i;
|
|
||||||
boost::ignore_unused_variable_warning(v);
|
boost::ignore_unused_variable_warning(v);
|
||||||
}
|
}
|
||||||
Iterator i;
|
Iterator i;
|
||||||
@ -159,9 +140,8 @@ namespace boost_concepts {
|
|||||||
typedef typename boost::iterator_traversal<Iterator>::type traversal_category;
|
typedef typename boost::iterator_traversal<Iterator>::type traversal_category;
|
||||||
|
|
||||||
void constraints() {
|
void constraints() {
|
||||||
boost::function_requires< boost::SGIAssignableConcept<Iterator> >();
|
boost::function_requires< boost::AssignableConcept<Iterator> >();
|
||||||
boost::function_requires<
|
boost::function_requires< boost::CopyConstructibleConcept<Iterator> >();
|
||||||
boost::DefaultConstructibleConcept<Iterator> >();
|
|
||||||
|
|
||||||
BOOST_STATIC_ASSERT(
|
BOOST_STATIC_ASSERT(
|
||||||
(boost::is_convertible<
|
(boost::is_convertible<
|
||||||
@ -203,6 +183,8 @@ namespace boost_concepts {
|
|||||||
|
|
||||||
void constraints() {
|
void constraints() {
|
||||||
boost::function_requires< SinglePassIteratorConcept<Iterator> >();
|
boost::function_requires< SinglePassIteratorConcept<Iterator> >();
|
||||||
|
boost::function_requires<
|
||||||
|
boost::DefaultConstructibleConcept<Iterator> >();
|
||||||
|
|
||||||
typedef boost::mpl::and_<
|
typedef boost::mpl::and_<
|
||||||
boost::is_integral<difference_type>,
|
boost::is_integral<difference_type>,
|
||||||
|
Reference in New Issue
Block a user