Commit Graph

25 Commits

Author SHA1 Message Date
Wenzel Jakob
8d862b37b4 documentation updates (clarified cross-module dependencies, added contributors, improved CSS) 2016-03-06 13:37:22 +01:00
Wenzel Jakob
c769fce280 note about nullptr default args 2016-03-03 12:03:30 +01:00
Wenzel Jakob
de3ad07899 documentation on exporting constants (closes #92) 2016-02-02 11:38:21 +01:00
Wenzel Jakob
61587164ed example on manually vectorizing numpy code (closes #27) 2016-01-18 22:38:52 +01:00
Wenzel Jakob
48548ea4a5 general cleanup of the codebase
- new pybind11::base<> attribute to indicate a subclass relationship
- unified infrastructure for parsing variadic arguments in class_ and cpp_function
- use 'handle' and 'object' more consistently everywhere
2016-01-17 22:31:15 +01:00
Wenzel Jakob
b2c2c79240 improved handling of shared/smart pointers
Previously, pybind11 required classes using std::shared_ptr<> to derive
from std::enable_shared_from_this<> (or compilation failures would ensue).

Everything now also works for classes that don't do this, assuming that
some basic rules are followed (e.g. never passing "raw" pointers of
instances manged by shared pointers). The safer
std::enable_shared_from_this<> approach continues to be supported.
2016-01-17 22:31:15 +01:00
Wenzel Jakob
5f218b3f2c keep_alive call policy (analogous to Boost.Python's with_custodian_and_ward, fixes #62) 2016-01-17 22:31:15 +01:00
Wenzel Jakob
27e8e1066b added new type pybind11::bytes, cleanup of various macros (fixes #49) 2016-01-17 22:31:15 +01:00
Wenzel Jakob
2dfbadee5d documentation on using multiple extension modules 2016-01-17 22:31:15 +01:00
Wenzel Jakob
2ac5044a05 moved processing of cpp_function arguments out of dispatch code
The cpp_function class accepts a variadic argument, which was formerly
processed twice -- once at registration time, and once in the dispatch
lambda function. This is not only unnecessarily slow but also leads to
code bloat since it adds to the object code generated for every bound
function. This change removes the second pass at dispatch time.

One noteworthy change of this commit is that default arguments are now
constructed (and converted to Python objects) right at declaration time.
Consider the following example:

py::class_<MyClass>("MyClass")
    .def("myFunction", py::arg("arg") = SomeType(123));

In this case, the change means that pybind11 must already be set up to
deal with values of the type 'SomeType', or an exception will be thrown.
Another change is that the "preview" of the default argument in the
function signature is generated using the __repr__ special method. If
it is not available in this type, the signature may not be very helpful,
i.e.:

|  myFunction(...)
|      Signature : (MyClass, arg : SomeType = <SomeType object at 0x101b7b080>) -> None

One workaround (other than defining SomeType.__repr__) is to specify the
human-readable preview of the default argument manually using the more
cumbersome arg_t notation:

py::class_<MyClass>("MyClass")
    .def("myFunction", py::arg_t<SomeType>("arg", SomeType(123), "SomeType(123)"));
2016-01-17 22:31:15 +01:00
Jared Casper
6be9e2fff5 Fix typo in STL docs. 2015-12-15 15:56:14 -08:00
Wenzel Jakob
5ef1219030 smart pointer clarifications 2015-12-15 17:07:35 +01:00
Wenzel Jakob
61d67f0462 a few more documentation improvements 2015-12-14 12:53:06 +01:00
Wenzel Jakob
44db04f580 clarification regarding STL container support 2015-12-14 12:40:45 +01:00
Wenzel Jakob
a4caa85fc6 added missing namespace declaration 2015-12-14 12:39:02 +01:00
Wenzel Jakob
ecdd868956 documentation on using the gil 2015-12-07 18:17:58 +01:00
Wenzel Jakob
6e213c9ca0 improved shared pointer support (fixes #14) 2015-11-24 23:18:32 +01:00
Wenzel Jakob
a4175d6ea3 added warning about wrapping wrapped functions 2015-11-17 08:30:34 +01:00
Wenzel Jakob
436b731891 added note about cast operations 2015-10-20 01:04:30 +02:00
Wenzel Jakob
b1b714023a consistent macro naming throughout the project 2015-10-18 16:48:30 +02:00
Wenzel Jakob
1853b65ff1 a bit more documentation on reference counting wrappers 2015-10-18 15:38:50 +02:00
Wenzel Jakob
10e62e168b fixed missing semicolon in documentation 2015-10-15 22:46:07 +02:00
Wenzel Jakob
8f4eb00690 last breaking change: be consistent about the project name 2015-10-15 18:23:56 +02:00
Wenzel Jakob
9329669683 remainder of documentation 2015-10-13 23:21:54 +02:00
Wenzel Jakob
28f98aa298 took a stab at some documentation 2015-10-13 03:16:44 +02:00