Boost C++ Libraries

...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.

Holders

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')