iterator/include/boost/indirect_reference.hpp
Dave Abrahams e600d3f65b 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]
2014-06-05 01:33:54 +03:00

41 lines
1.1 KiB
C++
Executable File

// Copyright David Abrahams 2004. Use, modification and distribution is
// subject to 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 INDIRECT_REFERENCE_DWA200415_HPP
# define INDIRECT_REFERENCE_DWA200415_HPP
// dereferenceable_traits provides access to the value_type and
// reference of a Dereferenceable type.
# include <boost/detail/is_incrementable.hpp>
# include <boost/iterator/iterator_traits.hpp>
# include <boost/type_traits/remove_cv.hpp>
# include <boost/mpl/apply_if.hpp>
namespace boost {
namespace detail
{
template <class P>
struct smart_ptr_reference
{
typedef typename P::element_type& type;
};
}
template <class P>
struct indirect_reference
{
typedef typename remove_cv<P>::type stripped;
typedef typename mpl::apply_if<
detail::is_incrementable<stripped>
, iterator_reference<stripped>
, detail::smart_ptr_reference<stripped>
>::type type;
};
} // namespace boost
#endif // INDIRECT_REFERENCE_DWA200415_HPP