Revision: 21579
Author: gervandiepen
Date: Tue Mar 24 07:55:50 2015 UTC
Log: Fixed clang-3.5 problem with to_list for vector<bool>
https://code.google.com/p/casacore/source/detail?r=21579
Modified:
/branches/nov14/python/Converters/PycBasicData.h
=======================================
--- /branches/nov14/python/Converters/PycBasicData.h Thu Dec 11 12:28:06
2014 UTC
+++ /branches/nov14/python/Converters/PycBasicData.h Tue Mar 24 07:55:50
2015 UTC
@@ -227,6 +227,7 @@
return boost::python::incref(makeobject(c).ptr());
}
};
+ //# Make specialisations for various types.
template <>
struct to_list <casacore::IPosition >
{
@@ -238,6 +239,32 @@
for (int i=c.size()-1; i>=0; --i) {
result.append(c[i]);
}
+ return result;
+ }
+ static PyObject* convert (ContainerType const& c)
+ {
+ return boost::python::incref(makeobject(c).ptr());
+ }
+ };
+ //# This specialisation is needed because on OS-X 10.9 clang-3.5 with
+ //# Boost-Python 1.57 gives a compile error
+ //# /opt/casa/01/include/boost/python/converter/arg_to_python.hpp:209:9:
+ //# error: no matching constructor for initialization of
+ //# 'boost::python::converter::detail::arg_to_python_base'
+ //# : arg_to_python_base(&x, registered<T>::converters)
+ template <>
+ struct to_list <std::vector <bool> >
+ {
+ typedef std::vector <bool> ContainerType;
+ static boost::python::list makeobject (ContainerType const& c)
+ {
+ boost::python::list result;
+ ContainerType::const_iterator i = c.begin();
+ ContainerType::const_iterator iEnd = c.end();
+ for( ; i != iEnd; ++i) {
+ bool b = *i;
+ result.append(b);
+ }
return result;
}
static PyObject* convert (ContainerType const& c)