2
0
mirror of https://github.com/boostorg/python.git synced 2026-01-24 06:02:14 +00:00

Workarounds for gcc versions without the "at" member functions in vector or deque

[SVN r20447]
This commit is contained in:
Raoul Gough
2003-10-21 18:17:51 +00:00
parent 0fd414f8cd
commit 27bc69adbf
3 changed files with 37 additions and 2 deletions

View File

@@ -21,6 +21,7 @@
#include <boost/python/suite/indexing/proxy_iterator.hpp>
#include <boost/python/suite/indexing/shared_proxy_impl.hpp>
#include <boost/python/suite/indexing/element_proxy.hpp>
#include <boost/python/suite/indexing/workaround.hpp>
#include <map>
#include <cassert>
@@ -271,7 +272,7 @@ namespace boost { namespace python { namespace indexing {
::replace (size_type index, raw_value_type const &copy)
{
detach_proxy (index);
raw_container().at(index) = copy;
raw_container().BOOST_INDEXING_AT (index) = copy;
}
template<class Container, class Holder>

View File

@@ -25,6 +25,7 @@
#define BOOST_PYTHON_INDEXING_SHARED_PROXY_IMPL_HPP
#include <memory>
#include <boost/python/suite/indexing/workaround.hpp>
namespace boost { namespace python { namespace indexing {
template<class ContainerProxy>
@@ -85,7 +86,7 @@ namespace boost { namespace python { namespace indexing {
shared_proxy_impl<ContainerProxy>::operator* () const
{
return m_owner_ptr
? m_owner_ptr->raw_container().at (m_index)
? m_owner_ptr->raw_container().BOOST_INDEXING_AT (m_index)
: *m_element_ptr;
}

View File

@@ -0,0 +1,33 @@
// -*- mode:c++ -*-
//
// Header file workaround.hpp
//
// Indexing-specific workarounds for compiler problems.
//
// Copyright (c) 2003 Raoul M. Gough
//
// 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)
//
// History
// =======
// 2003/10/21 rmg File creation
//
// $Id$
//
#ifndef BOOST_PYTHON_INDEXING_WORKAROUND_HPP
#define BOOST_PYTHON_INDEXING_WORKAROUND_HPP
#include <boost/detail/workaround.hpp>
# if (BOOST_WORKAROUND (__GNUC__, < 3))
# // gcc versions before 3 (like 2.95.3) don't have the "at" member
# // function in std::vector or std::deque
# define BOOST_INDEXING_AT operator[]
# else
# define BOOST_INDEXING_AT at
# endif
#endif // BOOST_PYTHON_INDEXING_WORKAROUND_HPP