Added traits:

is_incrementable.hpp: checks whether ++x is well-formed

   pointee.hpp: value_type of iterators or smart pointers

   indirect_reference.hpp: reference type of iterators or smart pointers

indirect_iterator.hpp
indirect_iterator_member_types.cpp

   Use pointee/indirect_reference to select value/reference type.

iterator_concepts.hpp: Fixed interoperable test.  Hardly tests enough, but it's a start

minimum_category.hpp: Better error messages for vc6

indirect_iterator_test.cpp: Workarounds for compilers without SFINAE

static_assert_same.hpp: Informative error reports; added a macro.

zip_iterator_test.hpp: Added missing #include

Jamfile: made zip_iterator test pass with vc6/stlport


[SVN r21514]
This commit is contained in:
Dave Abrahams
2004-01-06 17:35:36 +00:00
parent f716d705c5
commit 20b31d1cca
9 changed files with 177 additions and 104 deletions

View File

@ -12,11 +12,15 @@
#include <boost/iterator.hpp>
#include <boost/iterator/iterator_adaptor.hpp>
#include <boost/iterator/iterator_traits.hpp>
#include <boost/type_traits/remove_cv.hpp>
#include <boost/pointee.hpp>
#include <boost/indirect_reference.hpp>
#include <boost/detail/iterator.hpp>
#include <boost/python/detail/indirect_traits.hpp>
#include <boost/type_traits/is_same.hpp>
#include <boost/type_traits/add_reference.hpp>
#include <boost/mpl/bool.hpp>
#include <boost/mpl/identity.hpp>
#include <boost/mpl/apply_if.hpp>
@ -39,43 +43,6 @@ namespace boost
namespace detail
{
template <class T>
struct iterator_is_mutable
: mpl::not_<
boost::python::detail::is_reference_to_const<
typename iterator_reference<T>::type
>
>
{
};
// If the Value parameter is unspecified, we use this metafunction
// to deduce the default type
template <class Dereferenceable>
struct default_indirect_value
{
typedef typename mpl::if_<
iterator_is_mutable<Dereferenceable>
, typename iterator_value<Dereferenceable>::type
, typename iterator_value<Dereferenceable>::type const
>::type type;
};
// If the Reference parameter is unspecified, we use this metafunction
// to deduce the default type
template <class Dereferenceable, class Value>
struct default_indirect_reference
{
struct use_value_ref { typedef Value& type; };
typedef typename
mpl::apply_if<
is_same<Value, use_default>
, iterator_reference<Dereferenceable>
, use_value_ref
>::type type;
};
template <class Iter, class Value, class Category, class Reference, class Difference>
struct indirect_base
{
@ -85,11 +52,16 @@ namespace boost
indirect_iterator<Iter, Value, Category, Reference, Difference>
, Iter
, typename ia_dflt_help<
Value, default_indirect_value<dereferenceable>
Value, pointee<dereferenceable>
>::type
, Category
, typename ia_dflt_help<
Reference, default_indirect_reference<dereferenceable, Value>
Reference
, mpl::apply_if<
is_same<Value,use_default>
, indirect_reference<dereferenceable>
, add_reference<Value>
>
>::type
, Difference
> type;