Subject: [Boost-bugs] [Boost C++ Libraries] #7548: Impossible to query for std::vector<double> converter registration
From: Boost C++ Libraries (noreply_at_[hidden])
Date: 2012-10-21 19:20:18
#7548: Impossible to query for std::vector<double> converter registration
-----------------------------------------------+----------------------------
Reporter: Dario Izzo <dario.izzo@â¦> | Owner: rwgk
Type: Bugs | Status: new
Milestone: To Be Determined | Component: Python
Version: Boost Release Branch | Severity: Problem
Keywords: |
-----------------------------------------------+----------------------------
I have been hitting this wall for some months now and produced some
minimalistic code that shows the problem:
{{{
#include <boost/python.hpp>
#include <vector>
#include <iostream>
std::vector<double> list_of_doubles() {
std::vector<double> retval;
retval.push_back(3);
retval.push_back(2);
return retval;
}
// Instantiate the core module.
BOOST_PYTHON_MODULE(boost_debug)
{
//We check if a converter for std::vector has been registered
boost::python::type_info info = boost::python::type_id<std::vector<double>
>();
const boost::python::converter::registration* reg =
boost::python::converter::registry::query(info);
//We output to screen the result (should be NULL)
std::cout << reg << " ";
//We also expose a function that needs such a conversion (to_python)
using namespace boost::python;
def("list_of_doubles",list_of_doubles);
}
}}}
in python:
{{{
import boost_debug
}}}
and the result (which should be zero) is instead an address:
0x7f9bc3c4c600
Even more absurdly, if we comment the line
"def("list_of_doubles",list_of_doubles);" things actually go back to
normality.
-- Ticket URL: <https://svn.boost.org/trac/boost/ticket/7548> Boost C++ Libraries <http://www.boost.org/> Boost provides free peer-reviewed portable C++ source libraries.
This archive was generated by hypermail 2.1.7 : 2017-02-16 18:50:10 UTC