$include_dir="/home/hyper-archives/boost-users/include"; include("$include_dir/msg-header.inc") ?>
From: Malte Clasen (news_at_[hidden])
Date: 2006-06-07 19:52:34
Hi,
I usually use shared_ptrs to const as function parameters, such as 
boost::shared_ptr<const A>, to explicitly state that this function does 
not modify the pointee. Now I'm trying to do the same in boost.python:
----- C++
class A {};
void testA(boost::shared_ptr<A> s) {}
void testAc(boost::shared_ptr<const A> s) {}
void register() {
   class_<A, boost::shared_ptr<A> >("A")
   def("testA", testA);
   def("testAc", testAc);
}
void testCPP() {
   boost::shared_ptr<A> a(new A());
   testA(a);
   testAc(a);
}
----- Python
a = A()
testA(a)
testAc(a)
-----
The c++ part compiles and runs just fine, but the python call to 
testAc() fails with the following error message:
-----
testAc(a)
ArgumentError: Python argument types in
     _Map.testAc(A)
did not match C++ signature:
     testAc(class boost::shared_ptr<class Map::A const >)
-----
Is there a way to use the automatic conversion from A to const A in 
boost.python?
     Malte