2
0
mirror of https://github.com/boostorg/python.git synced 2026-01-23 05:42:30 +00:00

Use boost iterator_traits for portability

[SVN r20446]
This commit is contained in:
Raoul Gough
2003-10-21 16:28:43 +00:00
parent 5fc0aba562
commit 0fd414f8cd
3 changed files with 13 additions and 15 deletions

View File

@@ -23,9 +23,7 @@
#include <boost/python/suite/indexing/element_proxy.hpp>
#include <map>
#include <memory>
#include <cassert>
#include <iterator>
#include <boost/shared_ptr.hpp>
#include <boost/iterator/iterator_traits.hpp>
@@ -62,7 +60,7 @@ namespace boost { namespace python { namespace indexing {
{
typedef container_proxy<Container, Holder> self_type;
typedef typename Container::iterator raw_iterator;
typedef std::iterator_traits<raw_iterator> raw_iterator_traits;
typedef ::boost::detail::iterator_traits<raw_iterator> raw_iterator_traits;
template<class C> friend class shared_proxy_impl;
template<class C> friend class proxy_iterator;
@@ -391,7 +389,7 @@ namespace boost { namespace python { namespace indexing {
::insert (iterator iter, Iter from, Iter to)
{
// Forward insertion to the right overloaded version
typedef typename std::iterator_traits<Iter>::iterator_category category;
typedef typename BOOST_ITERATOR_CATEGORY<Iter>::type category;
insert (iter, from, to, category());
}

View File

@@ -21,11 +21,11 @@
#ifndef BOOST_PYTHON_INDEXING_ITERATOR_PAIR_HPP
#define BOOST_PYTHON_INDEXING_ITERATOR_PAIR_HPP
#include <iterator>
#include <stdexcept>
#include <algorithm>
#include <utility>
#include <boost/type_traits.hpp>
#include <boost/iterator/iterator_traits.hpp>
namespace boost { namespace python { namespace indexing {
template<typename Iterator>
@@ -33,7 +33,7 @@ namespace boost { namespace python { namespace indexing {
{
private:
typedef typename boost::call_traits<Iterator>::param_type iterator_param;
typedef std::iterator_traits<Iterator> std_traits;
typedef ::boost::detail::iterator_traits<Iterator> std_traits;
public:
typedef typename std_traits::reference reference;

View File

@@ -24,9 +24,9 @@
#include <boost/python/suite/indexing/suite_utils.hpp>
#include <iterator>
#include <boost/call_traits.hpp>
#include <boost/type_traits.hpp>
#include <boost/iterator/iterator_traits.hpp>
namespace boost { namespace python { namespace indexing {
#if !BOOST_MSVC
@@ -55,7 +55,7 @@ namespace boost { namespace python { namespace indexing {
struct input_iterator_traits
{
private:
typedef std::iterator_traits<Iterator> std_traits;
typedef ::boost::detail::iterator_traits<Iterator> std_traits;
public:
typedef Iterator iterator;
@@ -65,8 +65,8 @@ namespace boost { namespace python { namespace indexing {
BOOST_STATIC_CONSTANT (bool, has_copyable_iter = false);
BOOST_STATIC_CONSTANT (bool, is_reorderable = false);
BOOST_STATIC_CONSTANT (bool, has_mutable_ref
= is_mutable_ref<reference>::value);
BOOST_STATIC_CONSTANT (
bool, has_mutable_ref = is_mutable_ref<reference>::value);
BOOST_STATIC_CONSTANT (IndexStyle, index_style = index_style_none);
};
@@ -140,14 +140,14 @@ namespace boost { namespace python { namespace indexing {
template<typename Iterator>
class traits_by_category {
typedef typename std::iterator_traits<Iterator>::iterator_category
iterator_category;
typedef typename BOOST_ITERATOR_CATEGORY<Iterator>::type category;
BOOST_STATIC_CONSTANT (size_t, size
= sizeof(sizer(iterator_category())));
BOOST_STATIC_CONSTANT (
size_t, size = sizeof (sizer (category())));
public:
typedef typename traits_by_size<size>::template traits<Iterator>::type type;
typedef typename traits_by_size<size>
::template traits<Iterator>::type type;
};
}