mirror of
https://github.com/boostorg/iterator.git
synced 2025-05-10 07:33:53 +00:00
Extracted and unified default template parameter handling helpers.
The new eval_if_default helper replaces both ia_dflt_help and ia_eval_if_default helpers. Additionally, added a new if_default helper, which expands to the type or the default parameter directly. The new helpers are placed in separate headers which can be used without the iterator_adaptor template.
This commit is contained in:
parent
cb81a1dfc3
commit
6e60ea7a88
@ -2,8 +2,8 @@
|
|||||||
// Distributed under the Boost Software License, Version 1.0. (See
|
// Distributed under the Boost Software License, Version 1.0. (See
|
||||||
// accompanying file LICENSE_1_0.txt or copy at
|
// accompanying file LICENSE_1_0.txt or copy at
|
||||||
// http://www.boost.org/LICENSE_1_0.txt)
|
// http://www.boost.org/LICENSE_1_0.txt)
|
||||||
#ifndef COUNTING_ITERATOR_DWA200348_HPP
|
#ifndef BOOST_ITERATOR_COUNTING_ITERATOR_DWA200348_HPP
|
||||||
#define COUNTING_ITERATOR_DWA200348_HPP
|
#define BOOST_ITERATOR_COUNTING_ITERATOR_DWA200348_HPP
|
||||||
|
|
||||||
#include <limits>
|
#include <limits>
|
||||||
#include <type_traits>
|
#include <type_traits>
|
||||||
@ -13,15 +13,17 @@
|
|||||||
#include <boost/detail/numeric_traits.hpp>
|
#include <boost/detail/numeric_traits.hpp>
|
||||||
#include <boost/iterator/iterator_adaptor.hpp>
|
#include <boost/iterator/iterator_adaptor.hpp>
|
||||||
#include <boost/iterator/iterator_categories.hpp>
|
#include <boost/iterator/iterator_categories.hpp>
|
||||||
|
#include <boost/iterator/detail/if_default.hpp>
|
||||||
|
#include <boost/iterator/detail/eval_if_default.hpp>
|
||||||
#include <boost/iterator/detail/type_traits/type_identity.hpp>
|
#include <boost/iterator/detail/type_traits/type_identity.hpp>
|
||||||
|
|
||||||
namespace boost {
|
namespace boost {
|
||||||
namespace iterators {
|
namespace iterators {
|
||||||
|
|
||||||
template<
|
template<
|
||||||
class Incrementable,
|
typename Incrementable,
|
||||||
class CategoryOrTraversal,
|
typename CategoryOrTraversal,
|
||||||
class Difference
|
typename Difference
|
||||||
>
|
>
|
||||||
class counting_iterator;
|
class counting_iterator;
|
||||||
|
|
||||||
@ -29,7 +31,7 @@ namespace detail {
|
|||||||
|
|
||||||
// Try to detect numeric types at compile time in ways compatible
|
// Try to detect numeric types at compile time in ways compatible
|
||||||
// with the limitations of the compiler and library.
|
// with the limitations of the compiler and library.
|
||||||
template <class T>
|
template< typename T >
|
||||||
struct is_numeric :
|
struct is_numeric :
|
||||||
public std::integral_constant< bool, std::numeric_limits< T >::is_specialized >
|
public std::integral_constant< bool, std::numeric_limits< T >::is_specialized >
|
||||||
{};
|
{};
|
||||||
@ -62,7 +64,7 @@ struct is_numeric<wchar_t> :
|
|||||||
public std::true_type
|
public std::true_type
|
||||||
{};
|
{};
|
||||||
|
|
||||||
template <class T>
|
template< typename T >
|
||||||
struct numeric_difference
|
struct numeric_difference
|
||||||
{
|
{
|
||||||
using type = typename boost::detail::numeric_traits< T >::difference_type;
|
using type = typename boost::detail::numeric_traits< T >::difference_type;
|
||||||
@ -83,26 +85,38 @@ struct numeric_difference<boost::uint128_type>
|
|||||||
};
|
};
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
template <class Incrementable, class CategoryOrTraversal, class Difference>
|
template< typename Incrementable, typename CategoryOrTraversal, typename Difference, bool IsNumeric = is_numeric< Incrementable >::value >
|
||||||
|
struct counting_iterator_types
|
||||||
|
{
|
||||||
|
using traversal = detail::eval_if_default_t<
|
||||||
|
CategoryOrTraversal,
|
||||||
|
iterator_traversal< Incrementable >
|
||||||
|
>;
|
||||||
|
|
||||||
|
using difference = detail::eval_if_default_t<
|
||||||
|
Difference,
|
||||||
|
iterator_difference< Incrementable >
|
||||||
|
>;
|
||||||
|
};
|
||||||
|
|
||||||
|
template< typename Incrementable, typename CategoryOrTraversal, typename Difference >
|
||||||
|
struct counting_iterator_types< Incrementable, CategoryOrTraversal, Difference, true >
|
||||||
|
{
|
||||||
|
using traversal = detail::if_default_t<
|
||||||
|
CategoryOrTraversal,
|
||||||
|
random_access_traversal_tag
|
||||||
|
>;
|
||||||
|
|
||||||
|
using difference = detail::eval_if_default_t<
|
||||||
|
Difference,
|
||||||
|
numeric_difference< Incrementable >
|
||||||
|
>;
|
||||||
|
};
|
||||||
|
|
||||||
|
template< typename Incrementable, typename CategoryOrTraversal, typename Difference >
|
||||||
struct counting_iterator_base
|
struct counting_iterator_base
|
||||||
{
|
{
|
||||||
using traversal = typename detail::ia_dflt_help<
|
using iterator_types = counting_iterator_types< Incrementable, CategoryOrTraversal, Difference >;
|
||||||
CategoryOrTraversal,
|
|
||||||
typename std::conditional<
|
|
||||||
is_numeric<Incrementable>::value,
|
|
||||||
iterators::detail::type_identity<random_access_traversal_tag>,
|
|
||||||
iterator_traversal<Incrementable>
|
|
||||||
>::type
|
|
||||||
>::type;
|
|
||||||
|
|
||||||
using difference = typename detail::ia_dflt_help<
|
|
||||||
Difference,
|
|
||||||
typename std::conditional<
|
|
||||||
is_numeric<Incrementable>::value,
|
|
||||||
numeric_difference<Incrementable>,
|
|
||||||
iterator_difference<Incrementable>
|
|
||||||
>::type
|
|
||||||
>::type;
|
|
||||||
|
|
||||||
using type = iterator_adaptor<
|
using type = iterator_adaptor<
|
||||||
counting_iterator< Incrementable, CategoryOrTraversal, Difference >, // self
|
counting_iterator< Incrementable, CategoryOrTraversal, Difference >, // self
|
||||||
@ -112,14 +126,14 @@ struct counting_iterator_base
|
|||||||
// criterion (see boost/iterator/detail/facade_iterator_category.hpp)
|
// criterion (see boost/iterator/detail/facade_iterator_category.hpp)
|
||||||
#endif
|
#endif
|
||||||
Incrementable, // Value
|
Incrementable, // Value
|
||||||
traversal,
|
typename iterator_types::traversal,
|
||||||
Incrementable const&, // reference
|
Incrementable const&, // reference
|
||||||
difference
|
typename iterator_types::difference
|
||||||
>;
|
>;
|
||||||
};
|
};
|
||||||
|
|
||||||
// A distance calculation policy for wrapped iterators
|
// A distance calculation policy for wrapped iterators
|
||||||
template <class Difference, class Incrementable1, class Incrementable2>
|
template< typename Difference, typename Incrementable1, typename Incrementable2 >
|
||||||
struct iterator_distance
|
struct iterator_distance
|
||||||
{
|
{
|
||||||
static Difference distance(Incrementable1 x, Incrementable2 y)
|
static Difference distance(Incrementable1 x, Incrementable2 y)
|
||||||
@ -129,7 +143,7 @@ struct iterator_distance
|
|||||||
};
|
};
|
||||||
|
|
||||||
// A distance calculation policy for wrapped numbers
|
// A distance calculation policy for wrapped numbers
|
||||||
template <class Difference, class Incrementable1, class Incrementable2>
|
template< typename Difference, typename Incrementable1, typename Incrementable2 >
|
||||||
struct number_distance
|
struct number_distance
|
||||||
{
|
{
|
||||||
static Difference distance(Incrementable1 x, Incrementable2 y)
|
static Difference distance(Incrementable1 x, Incrementable2 y)
|
||||||
@ -141,19 +155,20 @@ struct number_distance
|
|||||||
} // namespace detail
|
} // namespace detail
|
||||||
|
|
||||||
template<
|
template<
|
||||||
class Incrementable,
|
typename Incrementable,
|
||||||
class CategoryOrTraversal = use_default,
|
typename CategoryOrTraversal = use_default,
|
||||||
class Difference = use_default
|
typename Difference = use_default
|
||||||
>
|
>
|
||||||
class counting_iterator :
|
class counting_iterator :
|
||||||
public detail::counting_iterator_base< Incrementable, CategoryOrTraversal, Difference >::type
|
public detail::counting_iterator_base< Incrementable, CategoryOrTraversal, Difference >::type
|
||||||
{
|
{
|
||||||
|
friend class iterator_core_access;
|
||||||
|
|
||||||
|
private:
|
||||||
using super_t = typename detail::counting_iterator_base<
|
using super_t = typename detail::counting_iterator_base<
|
||||||
Incrementable, CategoryOrTraversal, Difference
|
Incrementable, CategoryOrTraversal, Difference
|
||||||
>::type;
|
>::type;
|
||||||
|
|
||||||
friend class iterator_core_access;
|
|
||||||
|
|
||||||
public:
|
public:
|
||||||
using reference = typename super_t::reference;
|
using reference = typename super_t::reference;
|
||||||
using difference_type = typename super_t::difference_type;
|
using difference_type = typename super_t::difference_type;
|
||||||
@ -174,7 +189,7 @@ private:
|
|||||||
return this->base_reference();
|
return this->base_reference();
|
||||||
}
|
}
|
||||||
|
|
||||||
template <class OtherIncrementable>
|
template< typename OtherIncrementable >
|
||||||
difference_type
|
difference_type
|
||||||
distance_to(counting_iterator< OtherIncrementable, CategoryOrTraversal, Difference > const& y) const
|
distance_to(counting_iterator< OtherIncrementable, CategoryOrTraversal, Difference > const& y) const
|
||||||
{
|
{
|
||||||
@ -189,7 +204,7 @@ private:
|
|||||||
};
|
};
|
||||||
|
|
||||||
// Manufacture a counting iterator for an arbitrary incrementable type
|
// Manufacture a counting iterator for an arbitrary incrementable type
|
||||||
template <class Incrementable>
|
template< typename Incrementable >
|
||||||
inline counting_iterator< Incrementable > make_counting_iterator(Incrementable x)
|
inline counting_iterator< Incrementable > make_counting_iterator(Incrementable x)
|
||||||
{
|
{
|
||||||
return counting_iterator< Incrementable >(x);
|
return counting_iterator< Incrementable >(x);
|
||||||
@ -202,4 +217,4 @@ using iterators::make_counting_iterator;
|
|||||||
|
|
||||||
} // namespace boost
|
} // namespace boost
|
||||||
|
|
||||||
#endif // COUNTING_ITERATOR_DWA200348_HPP
|
#endif // BOOST_ITERATOR_COUNTING_ITERATOR_DWA200348_HPP
|
||||||
|
44
include/boost/iterator/detail/eval_if_default.hpp
Normal file
44
include/boost/iterator/detail/eval_if_default.hpp
Normal file
@ -0,0 +1,44 @@
|
|||||||
|
/*
|
||||||
|
* Distributed under the Boost Software License, Version 1.0.
|
||||||
|
* (See accompanying file LICENSE_1_0.txt or copy at
|
||||||
|
* https://www.boost.org/LICENSE_1_0.txt)
|
||||||
|
*
|
||||||
|
* Copyright (c) 2025 Andrey Semashev
|
||||||
|
*/
|
||||||
|
|
||||||
|
#ifndef BOOST_ITERATOR_DETAIL_EVAL_IF_DEFAULT_HPP_INCLUDED_
|
||||||
|
#define BOOST_ITERATOR_DETAIL_EVAL_IF_DEFAULT_HPP_INCLUDED_
|
||||||
|
|
||||||
|
#include <boost/core/use_default.hpp>
|
||||||
|
#include <boost/iterator/detail/type_traits/type_identity.hpp>
|
||||||
|
|
||||||
|
namespace boost {
|
||||||
|
namespace iterators {
|
||||||
|
namespace detail {
|
||||||
|
|
||||||
|
// If T is use_default, return the result of invoking
|
||||||
|
// DefaultNullaryFn, otherwise - of NondefaultNullaryFn.
|
||||||
|
// By default, NondefaultNullaryFn returns T, which means
|
||||||
|
// the metafunction can be called with just two parameters
|
||||||
|
// and in that case will return either T or the result of
|
||||||
|
// invoking DefaultNullaryFn.
|
||||||
|
template< typename T, typename DefaultNullaryFn, typename NondefaultNullaryFn = detail::type_identity< T > >
|
||||||
|
struct eval_if_default
|
||||||
|
{
|
||||||
|
using type = typename NondefaultNullaryFn::type;
|
||||||
|
};
|
||||||
|
|
||||||
|
template< typename DefaultNullaryFn, typename NondefaultNullaryFn >
|
||||||
|
struct eval_if_default< use_default, DefaultNullaryFn, NondefaultNullaryFn >
|
||||||
|
{
|
||||||
|
using type = typename DefaultNullaryFn::type;
|
||||||
|
};
|
||||||
|
|
||||||
|
template< typename T, typename DefaultNullaryFn, typename NondefaultNullaryFn = detail::type_identity< T > >
|
||||||
|
using eval_if_default_t = typename eval_if_default< T, DefaultNullaryFn, NondefaultNullaryFn >::type;
|
||||||
|
|
||||||
|
} // namespace detail
|
||||||
|
} // namespace iterators
|
||||||
|
} // namespace boost
|
||||||
|
|
||||||
|
#endif // BOOST_ITERATOR_DETAIL_EVAL_IF_DEFAULT_HPP_INCLUDED_
|
41
include/boost/iterator/detail/if_default.hpp
Normal file
41
include/boost/iterator/detail/if_default.hpp
Normal file
@ -0,0 +1,41 @@
|
|||||||
|
/*
|
||||||
|
* Distributed under the Boost Software License, Version 1.0.
|
||||||
|
* (See accompanying file LICENSE_1_0.txt or copy at
|
||||||
|
* https://www.boost.org/LICENSE_1_0.txt)
|
||||||
|
*
|
||||||
|
* Copyright (c) 2025 Andrey Semashev
|
||||||
|
*/
|
||||||
|
|
||||||
|
#ifndef BOOST_ITERATOR_DETAIL_IF_DEFAULT_HPP_INCLUDED_
|
||||||
|
#define BOOST_ITERATOR_DETAIL_IF_DEFAULT_HPP_INCLUDED_
|
||||||
|
|
||||||
|
#include <boost/core/use_default.hpp>
|
||||||
|
|
||||||
|
namespace boost {
|
||||||
|
namespace iterators {
|
||||||
|
namespace detail {
|
||||||
|
|
||||||
|
// If T is use_default, return Default, otherwise - Nondefault.
|
||||||
|
// By default, Nondefault is T, which means
|
||||||
|
// the metafunction can be called with just two parameters
|
||||||
|
// and in that case will return either T or Default.
|
||||||
|
template< typename T, typename Default, typename Nondefault = T >
|
||||||
|
struct if_default
|
||||||
|
{
|
||||||
|
using type = Nondefault;
|
||||||
|
};
|
||||||
|
|
||||||
|
template< typename Default, typename Nondefault >
|
||||||
|
struct if_default< use_default, Default, Nondefault >
|
||||||
|
{
|
||||||
|
using type = Default;
|
||||||
|
};
|
||||||
|
|
||||||
|
template< typename T, typename Default, typename Nondefault = T >
|
||||||
|
using if_default_t = typename if_default< T, Default, Nondefault >::type;
|
||||||
|
|
||||||
|
} // namespace detail
|
||||||
|
} // namespace iterators
|
||||||
|
} // namespace boost
|
||||||
|
|
||||||
|
#endif // BOOST_ITERATOR_DETAIL_IF_DEFAULT_HPP_INCLUDED_
|
@ -12,6 +12,7 @@
|
|||||||
|
|
||||||
#include <boost/iterator/iterator_adaptor.hpp>
|
#include <boost/iterator/iterator_adaptor.hpp>
|
||||||
#include <boost/iterator/enable_if_convertible.hpp>
|
#include <boost/iterator/enable_if_convertible.hpp>
|
||||||
|
#include <boost/iterator/detail/eval_if_default.hpp>
|
||||||
|
|
||||||
#include <boost/pointee.hpp>
|
#include <boost/pointee.hpp>
|
||||||
#include <boost/indirect_reference.hpp>
|
#include <boost/indirect_reference.hpp>
|
||||||
@ -34,14 +35,14 @@ struct indirect_base
|
|||||||
using type = iterator_adaptor<
|
using type = iterator_adaptor<
|
||||||
indirect_iterator< Iter, Value, Category, Reference, Difference >,
|
indirect_iterator< Iter, Value, Category, Reference, Difference >,
|
||||||
Iter,
|
Iter,
|
||||||
detail::ia_dflt_help_t<
|
detail::eval_if_default_t<
|
||||||
Value,
|
Value,
|
||||||
pointee< dereferenceable >
|
pointee< dereferenceable >
|
||||||
>,
|
>,
|
||||||
Category,
|
Category,
|
||||||
detail::ia_dflt_help_t<
|
detail::eval_if_default_t<
|
||||||
Reference,
|
Reference,
|
||||||
detail::ia_eval_if_default<
|
detail::eval_if_default<
|
||||||
Value,
|
Value,
|
||||||
indirect_reference< dereferenceable >,
|
indirect_reference< dereferenceable >,
|
||||||
std::add_lvalue_reference< Value >
|
std::add_lvalue_reference< Value >
|
||||||
|
@ -15,6 +15,7 @@
|
|||||||
#include <boost/iterator/iterator_facade.hpp>
|
#include <boost/iterator/iterator_facade.hpp>
|
||||||
#include <boost/iterator/iterator_traits.hpp>
|
#include <boost/iterator/iterator_traits.hpp>
|
||||||
#include <boost/iterator/enable_if_convertible.hpp> // for backward compatibility; remove once downstream users are updated
|
#include <boost/iterator/enable_if_convertible.hpp> // for backward compatibility; remove once downstream users are updated
|
||||||
|
#include <boost/iterator/detail/eval_if_default.hpp>
|
||||||
|
|
||||||
#include <boost/iterator/detail/config_def.hpp>
|
#include <boost/iterator/detail/config_def.hpp>
|
||||||
|
|
||||||
@ -26,45 +27,8 @@ namespace iterators {
|
|||||||
// explicitly in order to specify that the default should be used.
|
// explicitly in order to specify that the default should be used.
|
||||||
using boost::use_default;
|
using boost::use_default;
|
||||||
|
|
||||||
//
|
|
||||||
// Default template argument handling for iterator_adaptor
|
|
||||||
//
|
|
||||||
namespace detail {
|
namespace detail {
|
||||||
|
|
||||||
// If T is use_default, return the result of invoking
|
|
||||||
// DefaultNullaryFn, otherwise return T.
|
|
||||||
template< typename T, typename DefaultNullaryFn >
|
|
||||||
struct ia_dflt_help
|
|
||||||
{
|
|
||||||
using type = T;
|
|
||||||
};
|
|
||||||
|
|
||||||
template< typename DefaultNullaryFn >
|
|
||||||
struct ia_dflt_help< use_default, DefaultNullaryFn >
|
|
||||||
{
|
|
||||||
using type = typename DefaultNullaryFn::type;
|
|
||||||
};
|
|
||||||
|
|
||||||
template< typename T, typename DefaultNullaryFn >
|
|
||||||
using ia_dflt_help_t = typename ia_dflt_help< T, DefaultNullaryFn >::type;
|
|
||||||
|
|
||||||
// If T is use_default, return the result of invoking
|
|
||||||
// DefaultNullaryFn, otherwise - of NondefaultNullaryFn.
|
|
||||||
template< typename T, typename DefaultNullaryFn, typename NondefaultNullaryFn >
|
|
||||||
struct ia_eval_if_default
|
|
||||||
{
|
|
||||||
using type = typename NondefaultNullaryFn::type;
|
|
||||||
};
|
|
||||||
|
|
||||||
template< typename DefaultNullaryFn, typename NondefaultNullaryFn >
|
|
||||||
struct ia_eval_if_default< use_default, DefaultNullaryFn, NondefaultNullaryFn >
|
|
||||||
{
|
|
||||||
using type = typename DefaultNullaryFn::type;
|
|
||||||
};
|
|
||||||
|
|
||||||
template< typename T, typename DefaultNullaryFn, typename NondefaultNullaryFn >
|
|
||||||
using ia_eval_if_default_t = typename ia_eval_if_default< T, DefaultNullaryFn, NondefaultNullaryFn >::type;
|
|
||||||
|
|
||||||
// A metafunction which computes an iterator_adaptor's base class,
|
// A metafunction which computes an iterator_adaptor's base class,
|
||||||
// a specialization of iterator_facade.
|
// a specialization of iterator_facade.
|
||||||
template<
|
template<
|
||||||
@ -79,36 +43,36 @@ using iterator_adaptor_base_t = iterator_facade<
|
|||||||
Derived,
|
Derived,
|
||||||
|
|
||||||
#ifdef BOOST_ITERATOR_REF_CONSTNESS_KILLS_WRITABILITY
|
#ifdef BOOST_ITERATOR_REF_CONSTNESS_KILLS_WRITABILITY
|
||||||
detail::ia_dflt_help_t<
|
detail::eval_if_default_t<
|
||||||
Value,
|
Value,
|
||||||
detail::ia_eval_if_default<
|
detail::eval_if_default<
|
||||||
Reference,
|
Reference,
|
||||||
iterator_value< Base >,
|
iterator_value< Base >,
|
||||||
std::remove_reference< Reference >
|
std::remove_reference< Reference >
|
||||||
>
|
>
|
||||||
>,
|
>,
|
||||||
#else
|
#else
|
||||||
detail::ia_dflt_help_t<
|
detail::eval_if_default_t<
|
||||||
Value,
|
Value,
|
||||||
iterator_value< Base >
|
iterator_value< Base >
|
||||||
>,
|
>,
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
detail::ia_dflt_help_t<
|
detail::eval_if_default_t<
|
||||||
Traversal,
|
Traversal,
|
||||||
iterator_traversal< Base >
|
iterator_traversal< Base >
|
||||||
>,
|
>,
|
||||||
|
|
||||||
detail::ia_dflt_help_t<
|
detail::eval_if_default_t<
|
||||||
Reference,
|
Reference,
|
||||||
detail::ia_eval_if_default<
|
detail::eval_if_default<
|
||||||
Value,
|
Value,
|
||||||
iterator_reference< Base >,
|
iterator_reference< Base >,
|
||||||
std::add_lvalue_reference< Value >
|
std::add_lvalue_reference< Value >
|
||||||
>
|
>
|
||||||
>,
|
>,
|
||||||
|
|
||||||
detail::ia_dflt_help_t<
|
detail::eval_if_default_t<
|
||||||
Difference,
|
Difference,
|
||||||
iterator_difference< Base >
|
iterator_difference< Base >
|
||||||
>
|
>
|
||||||
|
@ -13,6 +13,7 @@
|
|||||||
#include <boost/iterator/iterator_adaptor.hpp>
|
#include <boost/iterator/iterator_adaptor.hpp>
|
||||||
#include <boost/iterator/iterator_categories.hpp>
|
#include <boost/iterator/iterator_categories.hpp>
|
||||||
#include <boost/iterator/enable_if_convertible.hpp>
|
#include <boost/iterator/enable_if_convertible.hpp>
|
||||||
|
#include <boost/iterator/detail/eval_if_default.hpp>
|
||||||
|
|
||||||
#include <boost/utility/result_of.hpp>
|
#include <boost/utility/result_of.hpp>
|
||||||
|
|
||||||
@ -35,33 +36,33 @@ namespace iterators {
|
|||||||
private:
|
private:
|
||||||
// By default, dereferencing the iterator yields the same as
|
// By default, dereferencing the iterator yields the same as
|
||||||
// the function.
|
// the function.
|
||||||
typedef typename ia_dflt_help<
|
using reference = detail::eval_if_default_t<
|
||||||
Reference
|
Reference,
|
||||||
#ifdef BOOST_RESULT_OF_USE_TR1
|
#ifdef BOOST_RESULT_OF_USE_TR1
|
||||||
, result_of<const UnaryFunc(typename std::iterator_traits<Iterator>::reference)>
|
result_of<const UnaryFunc(typename std::iterator_traits<Iterator>::reference)>
|
||||||
#else
|
#else
|
||||||
, result_of<const UnaryFunc&(typename std::iterator_traits<Iterator>::reference)>
|
result_of<const UnaryFunc&(typename std::iterator_traits<Iterator>::reference)>
|
||||||
#endif
|
#endif
|
||||||
>::type reference;
|
>;
|
||||||
|
|
||||||
// To get the default for Value: remove any reference on the
|
// To get the default for Value: remove any reference on the
|
||||||
// result type, but retain any constness to signal
|
// result type, but retain any constness to signal
|
||||||
// non-writability. Note that if we adopt Thomas' suggestion
|
// non-writability. Note that if we adopt Thomas' suggestion
|
||||||
// to key non-writability *only* on the Reference argument,
|
// to key non-writability *only* on the Reference argument,
|
||||||
// we'd need to strip constness here as well.
|
// we'd need to strip constness here as well.
|
||||||
typedef typename ia_dflt_help<
|
using cv_value_type = detail::eval_if_default_t<
|
||||||
Value
|
Value,
|
||||||
, remove_reference<reference>
|
remove_reference<reference>
|
||||||
>::type cv_value_type;
|
>;
|
||||||
|
|
||||||
public:
|
public:
|
||||||
typedef iterator_adaptor<
|
using type = iterator_adaptor<
|
||||||
transform_iterator<UnaryFunc, Iterator, Reference, Value>
|
transform_iterator<UnaryFunc, Iterator, Reference, Value>,
|
||||||
, Iterator
|
Iterator,
|
||||||
, cv_value_type
|
cv_value_type,
|
||||||
, use_default // Leave the traversal category alone
|
use_default, // Leave the traversal category alone
|
||||||
, reference
|
reference
|
||||||
> type;
|
>;
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user