mirror of
https://github.com/boostorg/iterator.git
synced 2025-05-09 23:23:54 +00:00
Modernized iterator_traits.hpp.
Added *_t type traits and removed an oudated macro that was used with ancient compilers.
This commit is contained in:
parent
6e60ea7a88
commit
baf6d06cc2
@ -3,49 +3,56 @@
|
|||||||
// 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 ITERATOR_TRAITS_DWA200347_HPP
|
#ifndef ITERATOR_TRAITS_DWA200347_HPP
|
||||||
# define ITERATOR_TRAITS_DWA200347_HPP
|
#define ITERATOR_TRAITS_DWA200347_HPP
|
||||||
|
|
||||||
# include <boost/detail/workaround.hpp>
|
|
||||||
|
|
||||||
#include <iterator>
|
#include <iterator>
|
||||||
|
|
||||||
namespace boost {
|
namespace boost {
|
||||||
namespace iterators {
|
namespace iterators {
|
||||||
|
|
||||||
// Macro for supporting old compilers, no longer needed but kept
|
template< typename Iterator >
|
||||||
// for backwards compatibility (it was documented).
|
using iterator_value_t = typename std::iterator_traits< Iterator >::value_type;
|
||||||
#define BOOST_ITERATOR_CATEGORY iterator_category
|
|
||||||
|
|
||||||
|
template< typename Iterator >
|
||||||
template <class Iterator>
|
|
||||||
struct iterator_value
|
struct iterator_value
|
||||||
{
|
{
|
||||||
typedef typename std::iterator_traits<Iterator>::value_type type;
|
using type = iterator_value_t< Iterator >;
|
||||||
};
|
};
|
||||||
|
|
||||||
template <class Iterator>
|
template< typename Iterator >
|
||||||
|
using iterator_reference_t = typename std::iterator_traits< Iterator >::reference;
|
||||||
|
|
||||||
|
template< typename Iterator >
|
||||||
struct iterator_reference
|
struct iterator_reference
|
||||||
{
|
{
|
||||||
typedef typename std::iterator_traits<Iterator>::reference type;
|
using type = iterator_reference_t< Iterator >;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
template< typename Iterator >
|
||||||
|
using iterator_pointer_t = typename std::iterator_traits< Iterator >::pointer;
|
||||||
|
|
||||||
template <class Iterator>
|
template< typename Iterator >
|
||||||
struct iterator_pointer
|
struct iterator_pointer
|
||||||
{
|
{
|
||||||
typedef typename std::iterator_traits<Iterator>::pointer type;
|
using type = iterator_pointer_t< Iterator >;
|
||||||
};
|
};
|
||||||
|
|
||||||
template <class Iterator>
|
template< typename Iterator >
|
||||||
|
using iterator_difference_t = typename std::iterator_traits< Iterator >::difference_type;
|
||||||
|
|
||||||
|
template< typename Iterator >
|
||||||
struct iterator_difference
|
struct iterator_difference
|
||||||
{
|
{
|
||||||
typedef typename std::iterator_traits<Iterator>::difference_type type;
|
using type = iterator_difference_t< Iterator >;
|
||||||
};
|
};
|
||||||
|
|
||||||
template <class Iterator>
|
template< typename Iterator >
|
||||||
|
using iterator_category_t = typename std::iterator_traits< Iterator >::iterator_category;
|
||||||
|
|
||||||
|
template< typename Iterator >
|
||||||
struct iterator_category
|
struct iterator_category
|
||||||
{
|
{
|
||||||
typedef typename std::iterator_traits<Iterator>::iterator_category type;
|
using type = iterator_category_t< Iterator >;
|
||||||
};
|
};
|
||||||
|
|
||||||
} // namespace iterators
|
} // namespace iterators
|
||||||
|
Loading…
x
Reference in New Issue
Block a user