pybind11/docs
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
..
_static add extra documentation CSS on RTD 2015-12-07 18:29:17 +01:00
advanced.rst moved processing of cpp_function arguments out of dispatch code 2016-01-17 22:31:15 +01:00
basics.rst Add ldflags to compile command 2015-12-12 22:58:23 +01:00
benchmark.py added benchmark 2015-10-20 00:59:59 +02:00
benchmark.rst added benchmark 2015-10-20 00:59:59 +02:00
classes.rst factored out some common functionality to a non-templated parent class 2015-10-19 23:53:22 +02:00
cmake.rst cmake: robustified search for python 2016-01-17 22:31:15 +01:00
conf.py add extra documentation CSS on RTD 2015-12-07 18:29:17 +01:00
index.rst added benchmark 2015-10-20 00:59:59 +02:00
intro.rst fixed another typo 2015-12-04 23:58:23 +01:00
Makefile took a stab at some documentation 2015-10-13 03:16:44 +02:00
pybind11_vs_boost_python1.svg added benchmark 2015-10-20 00:59:59 +02:00
pybind11_vs_boost_python2.svg added benchmark 2015-10-20 00:59:59 +02:00
reference.rst Merge pull request #52 from tmiasko/const-correctness 2016-01-10 21:34:55 +01:00