Commit Graph

10 Commits

Author SHA1 Message Date
Wenzel Jakob 86d825f330 Redesigned virtual call mechanism and user-facing syntax (breaking change!)
Sergey Lyskov pointed out that the trampoline mechanism used to override
virtual methods from within Python caused unnecessary overheads when
instantiating the original (i.e. non-extended) class.

This commit removes this inefficiency, but some syntax changes were
needed to achieve this. Projects using this features will need to make a
few changes:

In particular, the example below shows the old syntax to instantiate a
class with a trampoline:

class_<TrampolineClass>("MyClass")
    .alias<MyClass>()
    ....

This is what should be used now:

class_<MyClass, std::unique_ptr<MyClass, TrampolineClass>("MyClass")
    ....

Importantly, the trampoline class is now specified as the *third*
argument to the class_ template, and the alias<..>() call is gone. The
second argument with the unique pointer is simply the default holder
type used by pybind11.
2016-05-26 13:36:24 +02:00
Wenzel Jakob 43b09af3a9 example12 clarifications 2016-05-21 01:11:11 +02:00
Wenzel Jakob fc92d82bba added [[noreturn]] attribute to pybind11_fail 2016-04-30 23:55:44 +02:00
Wenzel Jakob 8cb6cb33ef minor cleanups in common.h; updated author info and copyright year 2016-04-18 10:53:38 +02:00
Wenzel Jakob 1dc940d4b7 quenched -pendantic warnings (closes #167) 2016-04-18 10:41:44 +02:00
Wenzel Jakob 4a50fa5cd4 Address issue with handle::cast<bool>(), quench warning in example 12 (fixes #110) 2016-02-23 23:51:01 +01:00
jmabille 9cfa71f411 Example of bug in functions returning bool overriden in python 2016-02-23 23:48:05 +01:00
Wenzel Jakob b1b714023a consistent macro naming throughout the project 2015-10-18 16:48:30 +02:00
Wenzel Jakob 8f4eb00690 last breaking change: be consistent about the project name 2015-10-15 18:23:56 +02:00
Wenzel Jakob a2f6fde0dc support for overriding virtual functions 2015-10-01 17:13:35 +02:00