mirror of
https://github.com/boostorg/iterator.git
synced 2025-05-11 05:23:52 +00:00
Removed MPL usage from pointee and indirect_reference.
This commit is contained in:
parent
d6297a553b
commit
bcf94f9e5d
@ -1,5 +1,5 @@
|
|||||||
#ifndef INDIRECT_REFERENCE_DWA200415_HPP
|
#ifndef INDIRECT_REFERENCE_DWA200415_HPP
|
||||||
# define INDIRECT_REFERENCE_DWA200415_HPP
|
#define INDIRECT_REFERENCE_DWA200415_HPP
|
||||||
|
|
||||||
//
|
//
|
||||||
// Copyright David Abrahams 2004. Use, modification and distribution is
|
// Copyright David Abrahams 2004. Use, modification and distribution is
|
||||||
@ -11,29 +11,30 @@
|
|||||||
// http://www.boost.org/libs/iterator/doc/pointee.html
|
// http://www.boost.org/libs/iterator/doc/pointee.html
|
||||||
//
|
//
|
||||||
|
|
||||||
# include <boost/detail/is_incrementable.hpp>
|
#include <boost/detail/is_incrementable.hpp>
|
||||||
# include <boost/iterator/iterator_traits.hpp>
|
#include <boost/iterator/iterator_traits.hpp>
|
||||||
# include <boost/mpl/eval_if.hpp>
|
#include <boost/pointee.hpp>
|
||||||
# include <boost/pointee.hpp>
|
|
||||||
|
#include <type_traits>
|
||||||
|
|
||||||
namespace boost {
|
namespace boost {
|
||||||
|
namespace detail {
|
||||||
|
|
||||||
namespace detail
|
template< typename P >
|
||||||
|
struct smart_ptr_reference
|
||||||
{
|
{
|
||||||
template <class P>
|
using type = typename boost::pointee<P>::type&;
|
||||||
struct smart_ptr_reference
|
};
|
||||||
{
|
|
||||||
typedef typename boost::pointee<P>::type& type;
|
|
||||||
};
|
|
||||||
}
|
|
||||||
|
|
||||||
template <class P>
|
} // namespace detail
|
||||||
struct indirect_reference
|
|
||||||
: mpl::eval_if<
|
template< typename P >
|
||||||
detail::is_incrementable<P>
|
struct indirect_reference :
|
||||||
, iterator_reference<P>
|
std::conditional<
|
||||||
, detail::smart_ptr_reference<P>
|
detail::is_incrementable<P>::value,
|
||||||
>
|
iterator_reference<P>,
|
||||||
|
detail::smart_ptr_reference<P>
|
||||||
|
>::type
|
||||||
{
|
{
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -1,5 +1,5 @@
|
|||||||
#ifndef POINTEE_DWA200415_HPP
|
#ifndef POINTEE_DWA200415_HPP
|
||||||
# define POINTEE_DWA200415_HPP
|
#define POINTEE_DWA200415_HPP
|
||||||
|
|
||||||
//
|
//
|
||||||
// Copyright David Abrahams 2004. Use, modification and distribution is
|
// Copyright David Abrahams 2004. Use, modification and distribution is
|
||||||
@ -13,45 +13,42 @@
|
|||||||
// http://www.boost.org/libs/iterator/doc/pointee.html
|
// http://www.boost.org/libs/iterator/doc/pointee.html
|
||||||
//
|
//
|
||||||
|
|
||||||
# include <boost/detail/is_incrementable.hpp>
|
#include <boost/detail/is_incrementable.hpp>
|
||||||
# include <boost/iterator/iterator_traits.hpp>
|
#include <boost/iterator/iterator_traits.hpp>
|
||||||
# include <boost/mpl/eval_if.hpp>
|
|
||||||
|
|
||||||
#include <iterator>
|
#include <iterator>
|
||||||
#include <type_traits>
|
#include <type_traits>
|
||||||
|
|
||||||
namespace boost {
|
namespace boost {
|
||||||
|
namespace detail {
|
||||||
|
|
||||||
namespace detail
|
template< typename P >
|
||||||
|
struct smart_ptr_pointee
|
||||||
{
|
{
|
||||||
template <class P>
|
using type = typename P::element_type;
|
||||||
struct smart_ptr_pointee
|
};
|
||||||
{
|
|
||||||
typedef typename P::element_type type;
|
|
||||||
};
|
|
||||||
|
|
||||||
template <class Iterator>
|
template< typename Iterator, typename = typename std::remove_reference<decltype(*std::declval<Iterator&>())>::type >
|
||||||
struct iterator_pointee
|
struct iterator_pointee
|
||||||
{
|
{
|
||||||
typedef typename std::iterator_traits<Iterator>::value_type value_type;
|
using type = typename std::iterator_traits<Iterator>::value_type;
|
||||||
|
};
|
||||||
|
|
||||||
typedef typename std::conditional<
|
template< typename Iterator, typename Reference >
|
||||||
std::is_const<
|
struct iterator_pointee< Iterator, const Reference >
|
||||||
typename std::remove_reference<decltype(*std::declval<Iterator&>())>::type
|
{
|
||||||
>::value
|
using type = typename std::add_const<typename std::iterator_traits<Iterator>::value_type>::type;
|
||||||
, typename std::add_const<value_type>::type
|
};
|
||||||
, value_type
|
|
||||||
>::type type;
|
|
||||||
};
|
|
||||||
}
|
|
||||||
|
|
||||||
template <class P>
|
} // namespace detail
|
||||||
struct pointee
|
|
||||||
: mpl::eval_if<
|
template< typename P >
|
||||||
detail::is_incrementable<P>
|
struct pointee :
|
||||||
, detail::iterator_pointee<P>
|
public std::conditional<
|
||||||
, detail::smart_ptr_pointee<P>
|
detail::is_incrementable<P>::value,
|
||||||
>
|
detail::iterator_pointee<P>,
|
||||||
|
detail::smart_ptr_pointee<P>
|
||||||
|
>::type
|
||||||
{
|
{
|
||||||
};
|
};
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user