mirror of
https://github.com/boostorg/python.git
synced 2026-01-24 06:02:14 +00:00
Fixes for Compaq Tru64 C++ compiler V6.5-031
[SVN r20300]
This commit is contained in:
@@ -106,6 +106,7 @@ namespace boost { namespace python { namespace indexing {
|
||||
{
|
||||
private:
|
||||
typedef default_algorithms<ContainerTraits> Parent;
|
||||
typedef assoc_algorithms<ContainerTraits> self_type;
|
||||
|
||||
public:
|
||||
typedef typename Parent::iterator iterator;
|
||||
@@ -137,6 +138,7 @@ namespace boost { namespace python { namespace indexing {
|
||||
{
|
||||
private:
|
||||
typedef assoc_algorithms<ContainerTraits> Parent;
|
||||
typedef set_algorithms<ContainerTraits> self_type;
|
||||
|
||||
public:
|
||||
typedef typename Parent::container container;
|
||||
@@ -156,6 +158,7 @@ namespace boost { namespace python { namespace indexing {
|
||||
{
|
||||
private:
|
||||
typedef assoc_algorithms<ContainerTraits> Parent;
|
||||
typedef map_algorithms<ContainerTraits> self_type;
|
||||
|
||||
public:
|
||||
typedef typename Parent::container container;
|
||||
@@ -449,7 +452,7 @@ namespace boost { namespace python { namespace indexing {
|
||||
typename map_algorithms<ContainerTraits>::reference
|
||||
map_algorithms<ContainerTraits>::get (container &c, index_param ix)
|
||||
{
|
||||
return find_or_throw (c, ix)->second;
|
||||
return self_type::find_or_throw (c, ix)->second;
|
||||
}
|
||||
|
||||
/////////////////////////////////////////////////////////////////////////
|
||||
@@ -525,8 +528,8 @@ namespace boost { namespace python { namespace indexing {
|
||||
, value_param val)
|
||||
{
|
||||
typedef std::pair
|
||||
<typename container_traits::index_type
|
||||
, typename container_traits::value_type>
|
||||
<typename self_type::container_traits::index_type
|
||||
, typename self_type::container_traits::value_type>
|
||||
pair_type;
|
||||
|
||||
// Can't use std::make_pair, because param types may be references
|
||||
@@ -560,7 +563,7 @@ namespace boost { namespace python { namespace indexing {
|
||||
assoc_algorithms<ContainerTraits>::contains (container &c
|
||||
, key_param key)
|
||||
{
|
||||
return find (c, key) != end(c);
|
||||
return self_type::find (c, key) != self_type::end(c);
|
||||
}
|
||||
|
||||
/////////////////////////////////////////////////////////////////////////
|
||||
@@ -573,9 +576,9 @@ namespace boost { namespace python { namespace indexing {
|
||||
assoc_algorithms<ContainerTraits>::find_or_throw (container &c
|
||||
, index_param ix)
|
||||
{
|
||||
iterator iter = find (c, ix);
|
||||
iterator iter = self_type::find (c, ix);
|
||||
|
||||
if (iter == end(c))
|
||||
if (iter == self_type::end(c))
|
||||
{
|
||||
PyErr_SetString (PyExc_ValueError
|
||||
, "associative container: key not found");
|
||||
|
||||
@@ -91,10 +91,13 @@ namespace boost { namespace python { namespace indexing {
|
||||
typedef value_type reference; // Already has reference semantics
|
||||
|
||||
iterator (container_proxy *p, size_type i) : ptr (p), index (i) { }
|
||||
|
||||
iterator (container_proxy *p, raw_iterator iter)
|
||||
|
||||
iterator (container_proxy *p, raw_iterator iter, int dummy)
|
||||
: ptr (p), index (iter - p->raw_container().begin())
|
||||
{
|
||||
// The dummy parameter seems to be necessary in order to
|
||||
// disambiguate the two constructor overloads on the "Compaq
|
||||
// C++ V6.5-031 for Compaq Tru64 UNIX V5.1 (Rev. 732)" compiler
|
||||
}
|
||||
|
||||
reference operator*() const { return ptr->at(index); }
|
||||
@@ -137,6 +140,8 @@ namespace boost { namespace python { namespace indexing {
|
||||
size_type index;
|
||||
};
|
||||
|
||||
friend struct iterator;
|
||||
|
||||
public:
|
||||
// Constructors
|
||||
container_proxy ();
|
||||
@@ -262,6 +267,7 @@ namespace boost { namespace python { namespace indexing {
|
||||
std::for_each (myMap.begin(), myMap.end(), detach_if_shared);
|
||||
myMap.clear();
|
||||
Holder::assign (myHeldObj, copy.myHeldObj);
|
||||
return *this;
|
||||
}
|
||||
|
||||
template<class Container, class Holder>
|
||||
@@ -371,7 +377,7 @@ namespace boost { namespace python { namespace indexing {
|
||||
= raw_container().erase (raw_container().begin() + from.index
|
||||
, raw_container().begin() + to.index);
|
||||
|
||||
return iterator (this, result);
|
||||
return iterator (this, result, 0);
|
||||
}
|
||||
|
||||
template<class Container, class Holder>
|
||||
@@ -390,7 +396,7 @@ namespace boost { namespace python { namespace indexing {
|
||||
raw_iterator result
|
||||
= raw_container().insert (raw_container().begin() + iter.index, copy);
|
||||
|
||||
return iterator (this, result);
|
||||
return iterator (this, result, 0);
|
||||
}
|
||||
|
||||
template<class Container, class Holder>
|
||||
|
||||
@@ -101,8 +101,9 @@ namespace boost { namespace python { namespace indexing {
|
||||
template<typename Container>
|
||||
struct default_container_traits : public base_container_traits<Container>
|
||||
{
|
||||
BOOST_STATIC_CONSTANT (bool, has_insert = is_mutable);
|
||||
BOOST_STATIC_CONSTANT (bool, has_erase = is_mutable);
|
||||
typedef default_container_traits<Container> self_type;
|
||||
BOOST_STATIC_CONSTANT (bool, has_insert = self_type::is_mutable);
|
||||
BOOST_STATIC_CONSTANT (bool, has_erase = self_type::is_mutable);
|
||||
};
|
||||
|
||||
/////////////////////////////////////////////////////////////////////////
|
||||
@@ -112,8 +113,9 @@ namespace boost { namespace python { namespace indexing {
|
||||
template<typename Container>
|
||||
struct default_sequence_traits : public default_container_traits<Container>
|
||||
{
|
||||
BOOST_STATIC_CONSTANT (bool, has_pop_back = is_mutable);
|
||||
BOOST_STATIC_CONSTANT (bool, has_push_back = is_mutable);
|
||||
typedef default_sequence_traits<Container> self_type;
|
||||
BOOST_STATIC_CONSTANT (bool, has_pop_back = self_type::is_mutable);
|
||||
BOOST_STATIC_CONSTANT (bool, has_push_back = self_type::is_mutable);
|
||||
};
|
||||
|
||||
/////////////////////////////////////////////////////////////////////////
|
||||
|
||||
@@ -26,8 +26,6 @@
|
||||
|
||||
#include <boost/shared_ptr.hpp>
|
||||
#include <boost/get_pointer.hpp>
|
||||
#include <boost/python/implicit.hpp>
|
||||
#include <boost/python/register_ptr_to_python.hpp>
|
||||
|
||||
namespace boost { namespace python { namespace indexing {
|
||||
template<typename ContainerProxy>
|
||||
@@ -171,6 +169,14 @@ namespace boost
|
||||
}
|
||||
}
|
||||
|
||||
// Including more headers here is a little weird, but it seems to fix a problem with
|
||||
// the "Compaq C++ V6.5-031 for Compaq Tru64 UNIX V5.1 (Rev. 732)" compiler, which
|
||||
// doesn't otherwise find our get_pointer overload during the instantiation of
|
||||
// register_ptr_to_python
|
||||
|
||||
#include <boost/python/implicit.hpp>
|
||||
#include <boost/python/register_ptr_to_python.hpp>
|
||||
|
||||
namespace boost { namespace python { namespace indexing {
|
||||
template<typename ContainerProxy>
|
||||
struct value_traits<element_proxy<ContainerProxy> >
|
||||
|
||||
@@ -70,7 +70,8 @@ namespace boost { namespace python { namespace indexing {
|
||||
struct bidirectional_iterator_traits
|
||||
: public forward_iterator_traits<Iterator>
|
||||
{
|
||||
BOOST_STATIC_CONSTANT (bool, is_reorderable = has_mutable_ref);
|
||||
typedef bidirectional_iterator_traits<Iterator> self_type;
|
||||
BOOST_STATIC_CONSTANT (bool, is_reorderable = self_type::has_mutable_ref);
|
||||
};
|
||||
|
||||
template<typename Iterator>
|
||||
@@ -134,7 +135,7 @@ namespace boost { namespace python { namespace indexing {
|
||||
= sizeof(sizer(iterator_category())));
|
||||
|
||||
public:
|
||||
typedef typename traits_by_size<size>::traits<Iterator>::type type;
|
||||
typedef typename traits_by_size<size>::template traits<Iterator>::type type;
|
||||
};
|
||||
}
|
||||
|
||||
|
||||
@@ -75,7 +75,7 @@ namespace boost { namespace python { namespace indexing {
|
||||
template<class ContainerProxy>
|
||||
shared_proxy_impl<ContainerProxy>::shared_proxy_impl (value_type const &val)
|
||||
: myOwnerPtr (0)
|
||||
, myIndex (-1)
|
||||
, myIndex (static_cast<size_t>(-1))
|
||||
, myElementPtr (new value_type (val))
|
||||
{
|
||||
}
|
||||
|
||||
@@ -21,6 +21,7 @@
|
||||
#include <boost/python/object.hpp>
|
||||
#include <boost/python/list.hpp>
|
||||
#include <boost/python/extract.hpp>
|
||||
#include <boost/python/make_function.hpp>
|
||||
#include <boost/mpl/apply.hpp>
|
||||
#include <algorithm>
|
||||
|
||||
|
||||
Reference in New Issue
Block a user