Opened 10 years ago

Closed 6 years ago

#7711 closed Feature Requests (duplicate)

python and unique_ptr

Reported by: maxim.yegorushkin@… Owned by: Ralf W. Grosse-Kunstleve
Milestone: To Be Determined Component: python USE GITHUB
Version: Boost 1.51.0 Severity: Problem
Keywords: python, unique_ptr Cc:

Description

boost::python supports holding objects by std::auto_ptr<> but not by std::unique_ptr<>. Would be great if boost::python were updated to support std::unique_ptr<> as well.

Here is a sample:

#include <boost/python.hpp>
#include <memory>

struct Foo {};

BOOST_PYTHON_MODULE(foo) {
    // This compiles fine.
    boost::python::class_<
          Foo
        , std::auto_ptr<Foo>
        , boost::noncopyable
        >("Foo1", boost::python::no_init)
        ;

    // This doesn't compile.
    boost::python::class_<
          Foo
        , std::unique_ptr<Foo>
        , boost::noncopyable
        >("Foo2", boost::python::no_init)
        ;
}

Change History (1)

comment:1 by Stefan Seefeld, 6 years ago

Resolution: duplicate
Status: newclosed
Note: See TracTickets for help on using tickets.