From 87f19854631772ef1990670ad63ae9c0c86f83b9 Mon Sep 17 00:00:00 2001 From: Raoul Gough Date: Wed, 8 Oct 2003 11:20:33 +0000 Subject: [PATCH] Fixes for Compaq Tru64 C++ compiler V6.5-031 [SVN r20300] --- .../boost/python/suite/indexing/algorithms.hpp | 15 +++++++++------ .../python/suite/indexing/container_proxy.hpp | 14 ++++++++++---- .../python/suite/indexing/container_traits.hpp | 10 ++++++---- .../boost/python/suite/indexing/element_proxy.hpp | 10 ++++++++-- .../python/suite/indexing/iterator_traits.hpp | 5 +++-- .../python/suite/indexing/shared_proxy_impl.hpp | 2 +- .../boost/python/suite/indexing/slice_handler.hpp | 1 + 7 files changed, 38 insertions(+), 19 deletions(-) diff --git a/include/boost/python/suite/indexing/algorithms.hpp b/include/boost/python/suite/indexing/algorithms.hpp index 803200a4..edce869a 100755 --- a/include/boost/python/suite/indexing/algorithms.hpp +++ b/include/boost/python/suite/indexing/algorithms.hpp @@ -106,6 +106,7 @@ namespace boost { namespace python { namespace indexing { { private: typedef default_algorithms Parent; + typedef assoc_algorithms self_type; public: typedef typename Parent::iterator iterator; @@ -137,6 +138,7 @@ namespace boost { namespace python { namespace indexing { { private: typedef assoc_algorithms Parent; + typedef set_algorithms self_type; public: typedef typename Parent::container container; @@ -156,6 +158,7 @@ namespace boost { namespace python { namespace indexing { { private: typedef assoc_algorithms Parent; + typedef map_algorithms self_type; public: typedef typename Parent::container container; @@ -449,7 +452,7 @@ namespace boost { namespace python { namespace indexing { typename map_algorithms::reference map_algorithms::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 - + 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::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::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"); diff --git a/include/boost/python/suite/indexing/container_proxy.hpp b/include/boost/python/suite/indexing/container_proxy.hpp index b5753d14..164017cb 100755 --- a/include/boost/python/suite/indexing/container_proxy.hpp +++ b/include/boost/python/suite/indexing/container_proxy.hpp @@ -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 @@ -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 @@ -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 diff --git a/include/boost/python/suite/indexing/container_traits.hpp b/include/boost/python/suite/indexing/container_traits.hpp index a2763f0b..3573ba50 100755 --- a/include/boost/python/suite/indexing/container_traits.hpp +++ b/include/boost/python/suite/indexing/container_traits.hpp @@ -101,8 +101,9 @@ namespace boost { namespace python { namespace indexing { template struct default_container_traits : public base_container_traits { - BOOST_STATIC_CONSTANT (bool, has_insert = is_mutable); - BOOST_STATIC_CONSTANT (bool, has_erase = is_mutable); + typedef default_container_traits 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 struct default_sequence_traits : public default_container_traits { - BOOST_STATIC_CONSTANT (bool, has_pop_back = is_mutable); - BOOST_STATIC_CONSTANT (bool, has_push_back = is_mutable); + typedef default_sequence_traits self_type; + BOOST_STATIC_CONSTANT (bool, has_pop_back = self_type::is_mutable); + BOOST_STATIC_CONSTANT (bool, has_push_back = self_type::is_mutable); }; ///////////////////////////////////////////////////////////////////////// diff --git a/include/boost/python/suite/indexing/element_proxy.hpp b/include/boost/python/suite/indexing/element_proxy.hpp index 58b2fe0a..e8535ea7 100755 --- a/include/boost/python/suite/indexing/element_proxy.hpp +++ b/include/boost/python/suite/indexing/element_proxy.hpp @@ -26,8 +26,6 @@ #include #include -#include -#include namespace boost { namespace python { namespace indexing { template @@ -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 +#include + namespace boost { namespace python { namespace indexing { template struct value_traits > diff --git a/include/boost/python/suite/indexing/iterator_traits.hpp b/include/boost/python/suite/indexing/iterator_traits.hpp index 6a583ef6..1b2a493a 100755 --- a/include/boost/python/suite/indexing/iterator_traits.hpp +++ b/include/boost/python/suite/indexing/iterator_traits.hpp @@ -70,7 +70,8 @@ namespace boost { namespace python { namespace indexing { struct bidirectional_iterator_traits : public forward_iterator_traits { - BOOST_STATIC_CONSTANT (bool, is_reorderable = has_mutable_ref); + typedef bidirectional_iterator_traits self_type; + BOOST_STATIC_CONSTANT (bool, is_reorderable = self_type::has_mutable_ref); }; template @@ -134,7 +135,7 @@ namespace boost { namespace python { namespace indexing { = sizeof(sizer(iterator_category()))); public: - typedef typename traits_by_size::traits::type type; + typedef typename traits_by_size::template traits::type type; }; } diff --git a/include/boost/python/suite/indexing/shared_proxy_impl.hpp b/include/boost/python/suite/indexing/shared_proxy_impl.hpp index 794e2654..19235113 100755 --- a/include/boost/python/suite/indexing/shared_proxy_impl.hpp +++ b/include/boost/python/suite/indexing/shared_proxy_impl.hpp @@ -75,7 +75,7 @@ namespace boost { namespace python { namespace indexing { template shared_proxy_impl::shared_proxy_impl (value_type const &val) : myOwnerPtr (0) - , myIndex (-1) + , myIndex (static_cast(-1)) , myElementPtr (new value_type (val)) { } diff --git a/include/boost/python/suite/indexing/slice_handler.hpp b/include/boost/python/suite/indexing/slice_handler.hpp index 292e7737..56e3665a 100755 --- a/include/boost/python/suite/indexing/slice_handler.hpp +++ b/include/boost/python/suite/indexing/slice_handler.hpp @@ -21,6 +21,7 @@ #include #include #include +#include #include #include