Boost.Python: Jak ujawnić std :: unique_ptr

Jestem dość nowy, aby zwiększyć.python i próbować ujawnić wartość zwracaną przez funkcję do python.

Sygnatura funkcji wygląda tak:

 std::unique_ptr<Message> someFunc(const std::string &str) const;

Podczas wywoływania funkcji w pythonie pojawia się następujący błąd:

TypeError: No to_python (by-value) converter found for C++ type: std::unique_ptr<Message, std::default_delete<Message> >

Moje wywołanie funkcji w pythonie wygląda tak:

a = mymodule.MyClass()
a.someFunc("some string here") # error here

Próbowałem ujawnić std :: unique_ptr, ale po prostu nie mogę go uruchomić. Czy ktoś wie, jak poprawnie ujawnić klasę wskaźnika? Dzięki!

Edytować: Próbowałem:

class_<std::unique_ptr<Message, std::default_delete<Message>>, bost::noncopyable ("Message", init<>())

;

Ten przykład się kompiluje, ale nadal pojawia się błąd opisany powyżej. Próbowałem też ujawnić klasęMessage samo

class_<Message>("Message", init<unsigned>())

        .def(init<unsigned, unsigned>()) 
        .def("f", &Message::f)
;

questionAnswers(4)

yourAnswerToTheQuestion