#1377 %shared_ptr not working with full namespace

open
nobody
shared_ptr (1)
5
2014-08-21
2014-07-22
Gedi Zheng
No

%shared_ptr(namespace::class) works, but %shared_ptr(::namespace::class) doesn't work.

A simple example:

example.i:

%module example
%include <std_shared_ptr.i>
%shared_ptr(::ns::Class)
%inline %{
#include <memory>
namespace ns {
class Class {
public:
    Class() : num(0) {}
    int get_num() const { return num; }
private:
    int num;
};
} // namespace ns
std::shared_ptr<::ns::Class> new_class() {
    return std::shared_ptr<::ns::Class>(new ::ns::Class());
}
%}

test.py:

import example
ins = example.new_class()
print ins.get_num()

The above code only works correctly when I replace "%shared_ptr(::ns::Class)" by "%shared_ptr (ns::Class)".

Discussion


Log in to post a comment.

Get latest updates about Open Source Projects, Conferences and News.

Sign up for the SourceForge newsletter:





No, thanks