...one of the most highly
regarded and expertly designed C++ library projects in the
world.
— Herb Sutter and Andrei
Alexandrescu, C++
Coding Standards
Pyste for now has manual support for smart pointers. Suppose:
struct C
{
int value;
};
boost::shared_ptr<C> newC(int value)
{
boost::shared_ptr<C> c( new C() );
c->value = value;
return c;
}
void printC(boost::shared_ptr<C> c)
{
std::cout << c->value << std::endl;
}
To make newC and printC work correctly, you have to tell Pyste that a convertor for boost::shared_ptr<C> is needed.
C = Class('C', 'C.h')
use_shared_ptr(C)
Function('newC', 'C.h')
Function('printC', 'C.h')
For std::auto_ptr's, use the function use_auto_ptr.
This system is temporary, and in the future the converters will automatically be exported if needed, without the need to tell Pyste about them explicitly.
If only the converter for the smart pointers is not enough and you need to specify the smart pointer as the holder for a class, use the functions hold_with_shared_ptr and hold_with_auto_ptr:
C = Class('C', 'C.h')
hold_with_shared_ptr(C)
Function('newC', 'C.h')
Function('printC', 'C.h')
Copyright © 2003 Bruno da Silva de Oliveira
Copyright © 2002-2003 Joel de Guzman
Distributed under
the Boost Software License, Version 1.0. (See accompanying file
LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)