Boost C++ Libraries of the most highly regarded and expertly designed C++ library projects in the world. Herb Sutter and Andrei Alexandrescu, C++ Coding Standards

This is the documentation for an old version of boost. Click here for the latest Boost documentation.

Even thought Pyste can identify various elements in the C++ code, like virtual member functions, attributes, and so on, one thing that it can't do is to guess the semantics of functions that return pointers or references. In this case, the user must manually specify the policy. Policies are explained in the tutorial.

The policies in Pyste are named exactly as in Boost.Python, only the syntax is slightly different. For instance, this policy:

    return_internal_reference<1, with_custodian_and_ward<1, 2> >()

becomes in Pyste:

    return_internal_reference(1, with_custodian_and_ward(1, 2))

The user can specify policies for functions and virtual member functions with the set_policy function:

    set_policy(f, return_internal_reference())
    set_policy(, return_value_policy(manage_new_object))
What if a function or member function needs a policy and the user doesn't set one?

If a function needs a policy and one was not set, Pyste will issue a error. The user should then go in the interface file and set the policy for it, otherwise the generated cpp won't compile.
Note that for functions that return const T&, the policy return_value_policy<copy_const_reference>() wil be used by default, because that's normally what you want. You can change it to something else if you need to, though.