Boost logo

Boost-Commit :

From: dave_at_[hidden]
Date: 2007-11-25 04:02:02


Author: dave
Date: 2007-11-25 04:02:01 EST (Sun, 25 Nov 2007)
New Revision: 41352
URL: http://svn.boost.org/trac/boost/changeset/41352

Log:
Attempt SunPro workaround

Text files modified:
   trunk/boost/python/object_protocol.hpp | 24 +++++++++++++++++-------
   1 files changed, 17 insertions(+), 7 deletions(-)

Modified: trunk/boost/python/object_protocol.hpp
==============================================================================
--- trunk/boost/python/object_protocol.hpp (original)
+++ trunk/boost/python/object_protocol.hpp 2007-11-25 04:02:01 EST (Sun, 25 Nov 2007)
@@ -12,46 +12,56 @@
 
 namespace boost { namespace python { namespace api {
 
+# if BOOST_WORKAROUND(__SUNPRO_CC, <= 0x580)
+// attempt to use SFINAE to prevent functions accepting T const& from
+// coming up as ambiguous with the one taking a char const* when a
+// string literal is passed
+# define BOOST_PYTHON_NO_ARRAY_ARG(T) , T (*)() = 0
+# else
+# define BOOST_PYTHON_NO_ARRAY_ARG(T)
+# endif
+
 template <class Target, class Key>
-object getattr(Target const& target, Key const& key)
+object getattr(Target const& target, Key const& key BOOST_PYTHON_NO_ARRAY_ARG(key))
 {
     return getattr(object(target), object(key));
 }
 
 template <class Target, class Key, class Default>
-object getattr(Target const& target, Key const& key, Default const& default_)
+object getattr(Target const& target, Key const& key, Default const& default_ BOOST_PYTHON_NO_ARRAY_ARG(key))
+)
 {
     return getattr(object(target), object(key), object(default_));
 }
 
 
 template <class Key, class Value>
-void setattr(object const& target, Key const& key, Value const& value)
+void setattr(object const& target, Key const& key, Value const& value BOOST_PYTHON_NO_ARRAY_ARG(key))
 {
     setattr(target, object(key), object(value));
 }
 
 template <class Key>
-void delattr(object const& target, Key const& key)
+void delattr(object const& target, Key const& key BOOST_PYTHON_NO_ARRAY_ARG(key))
 {
     delattr(target, object(key));
 }
 
 template <class Target, class Key>
-object getitem(Target const& target, Key const& key)
+object getitem(Target const& target, Key const& key BOOST_PYTHON_NO_ARRAY_ARG(key))
 {
     return getitem(object(target), object(key));
 }
 
 
 template <class Key, class Value>
-void setitem(object const& target, Key const& key, Value const& value)
+void setitem(object const& target, Key const& key, Value const& value BOOST_PYTHON_NO_ARRAY_ARG(key))
 {
     setitem(target, object(key), object(value));
 }
 
 template <class Key>
-void delitem(object const& target, Key const& key)
+void delitem(object const& target, Key const& key BOOST_PYTHON_NO_ARRAY_ARG(key))
 {
     delitem(target, object(key));
 }


Boost-Commit list run by bdawes at acm.org, david.abrahams at rcn.com, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk