mirror of
https://github.com/boostorg/iterator.git
synced 2025-05-12 05:51:37 +00:00
Moved concept checks into a separate class, which makes MSVC better at dealing with them
[SVN r12255]
This commit is contained in:
parent
ebcb4d861a
commit
57251d58cc
@ -12,6 +12,9 @@
|
|||||||
//
|
//
|
||||||
// Revision History:
|
// Revision History:
|
||||||
|
|
||||||
|
// 08 Jan 2001 David Abrahams
|
||||||
|
// Moved concept checks into a separate class, which makes MSVC
|
||||||
|
// better at dealing with them.
|
||||||
// 07 Jan 2001 David Abrahams
|
// 07 Jan 2001 David Abrahams
|
||||||
// Choose proxy for operator->() only if the reference type is not a reference.
|
// Choose proxy for operator->() only if the reference type is not a reference.
|
||||||
// Updated workarounds for __MWERKS__ == 0x2406
|
// Updated workarounds for __MWERKS__ == 0x2406
|
||||||
@ -727,6 +730,29 @@ namespace detail {
|
|||||||
difference_type, pointer, reference> type;
|
difference_type, pointer, reference> type;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
// This is really a partial concept check for iterators. Should it
|
||||||
|
// be moved or done differently?
|
||||||
|
template <class Category, class Value, class Difference, class Pointer, class Reference>
|
||||||
|
struct validator
|
||||||
|
{
|
||||||
|
BOOST_STATIC_CONSTANT(
|
||||||
|
bool, is_input_or_output_iter
|
||||||
|
= (boost::is_convertible<Category*,std::input_iterator_tag*>::value
|
||||||
|
| boost::is_convertible<Category*,std::output_iterator_tag*>::value));
|
||||||
|
|
||||||
|
// Iterators should satisfy one of the known categories
|
||||||
|
BOOST_STATIC_ASSERT(is_input_or_output_iter);
|
||||||
|
|
||||||
|
// Iterators >= ForwardIterator must produce real references
|
||||||
|
// as required by the C++ standard requirements in Table 74.
|
||||||
|
BOOST_STATIC_CONSTANT(
|
||||||
|
bool, forward_iter_with_real_reference
|
||||||
|
= ((!boost::is_convertible<Category*,std::forward_iterator_tag*>::value)
|
||||||
|
| boost::is_same<Reference,Value&>::value
|
||||||
|
| boost::is_same<Reference,typename add_const<Value>::type&>::value));
|
||||||
|
|
||||||
|
BOOST_STATIC_ASSERT(forward_iter_with_real_reference);
|
||||||
|
};
|
||||||
} // namespace detail
|
} // namespace detail
|
||||||
|
|
||||||
|
|
||||||
@ -738,8 +764,6 @@ namespace detail {
|
|||||||
# define BOOST_ARG_DEPENDENT_TYPENAME
|
# define BOOST_ARG_DEPENDENT_TYPENAME
|
||||||
# endif
|
# endif
|
||||||
|
|
||||||
template <class T> struct undefined;
|
|
||||||
|
|
||||||
//============================================================================
|
//============================================================================
|
||||||
//iterator_adaptor - Adapts a generic piece of data as an iterator. Adaptation
|
//iterator_adaptor - Adapts a generic piece of data as an iterator. Adaptation
|
||||||
// is especially easy if the data being adapted is itself an iterator
|
// is especially easy if the data being adapted is itself an iterator
|
||||||
@ -800,25 +824,14 @@ struct iterator_adaptor :
|
|||||||
typedef Policies policies_type;
|
typedef Policies policies_type;
|
||||||
|
|
||||||
private:
|
private:
|
||||||
BOOST_STATIC_CONSTANT(bool, is_input_or_output_iter
|
typedef detail::validator<
|
||||||
= (boost::is_convertible<iterator_category*,std::input_iterator_tag*>::value
|
iterator_category,value_type,difference_type,pointer,reference
|
||||||
| boost::is_convertible<iterator_category*,std::output_iterator_tag*>::value));
|
> concept_check;
|
||||||
|
|
||||||
// Iterators should satisfy one of the known categories
|
|
||||||
BOOST_STATIC_ASSERT(is_input_or_output_iter);
|
|
||||||
|
|
||||||
// Iterators >= ForwardIterator must produce real references
|
|
||||||
// as required by the C++ standard requirements in Table 74.
|
|
||||||
BOOST_STATIC_CONSTANT(bool, forward_iter_with_real_reference
|
|
||||||
= ((!boost::is_convertible<iterator_category*,std::forward_iterator_tag*>::value)
|
|
||||||
| boost::is_same<reference,value_type&>::value
|
|
||||||
| boost::is_same<reference,const value_type&>::value));
|
|
||||||
|
|
||||||
// This check gives incorrect results in iter_traits_gen_test.cpp
|
|
||||||
BOOST_STATIC_ASSERT(forward_iter_with_real_reference);
|
|
||||||
|
|
||||||
public:
|
public:
|
||||||
iterator_adaptor() { }
|
iterator_adaptor()
|
||||||
|
{
|
||||||
|
}
|
||||||
|
|
||||||
explicit
|
explicit
|
||||||
iterator_adaptor(const Base& it, const Policies& p = Policies())
|
iterator_adaptor(const Base& it, const Policies& p = Policies())
|
||||||
|
Loading…
x
Reference in New Issue
Block a user