- 19 Sep, 2016 1 commit
-
-
Wenzel Jakob authored
-
- 16 Sep, 2016 1 commit
-
-
Jason Rhinelander authored
The custom exception handling added in PR #273 is robust, but is overly complex for declaring the most common simple C++ -> Python exception mapping that needs only to copy `what()`. This add a simpler `py::register_exception<CppExp>(module, "PyExp");` function that greatly simplifies the common basic case of translation of a simple CppException into a simple PythonException, while not removing the more advanced capabilities of defining custom exception handlers.
-
- 11 Sep, 2016 2 commits
-
-
Jason Rhinelander authored
This adds a static local variable (in dead code unless actually needed) in the overload code that is used for storage if the overload is for some convert-by-value type (such as numeric values or std::string). This has limitations (as written up in the advanced doc), but is better than simply not being able to overload reference or pointer methods.
-
Jason Rhinelander authored
"trampoline" is doubled in the first sentence.
-
- 10 Sep, 2016 1 commit
-
-
Wenzel Jakob authored
-
- 09 Sep, 2016 1 commit
-
-
Jason Rhinelander authored
This commit adds support for forcing alias type initialization by defining constructors with `py::init_alias<arg1, arg2>()` instead of `py::init<arg1, arg2>()`. Currently py::init<> only results in Alias initialization if the type is extended in python, or the given arguments can't be used to construct the base type, but can be used to construct the alias. py::init_alias<>, in contrast, always invokes the constructor of the alias type. It looks like this was already the intention of `py::detail::init_alias`, which was forward-declared in 86d825f3, but was apparently never finished: despite the existance of a .def method accepting it, the `detail::init_alias` class isn't actually defined anywhere. This commit completes the feature (or possibly repurposes it), allowing declaration of classes that will always initialize the trampoline which is (as I argued in #397) sometimes useful.
-
- 07 Sep, 2016 1 commit
-
-
Jason Rhinelander authored
This allows a slightly cleaner base type specification of: py::class_<Type, Base>("Type") as an alternative to py::class_<Type>("Type", py::base<Base>()) As with the other template parameters, the order relative to the holder or trampoline types doesn't matter. This also includes a compile-time assertion failure if attempting to specify more than one base class (but is easily extendible to support multiple inheritance, someday, by updating the class_selector::set_bases function to set multiple bases).
-
- 06 Sep, 2016 4 commits
-
-
Jason Rhinelander authored
The current pybind11::class_<Type, Holder, Trampoline> fixed template ordering results in a requirement to repeat the Holder with its default value (std::unique_ptr<Type>) argument, which is a little bit annoying: it needs to be specified not because we want to override the default, but rather because we need to specify the third argument. This commit removes this limitation by making the class_ template take the type name plus a parameter pack of options. It then extracts the first valid holder type and the first subclass type for holder_type and trampoline type_alias, respectively. (If unfound, both fall back to their current defaults, `std::unique_ptr<type>` and `type`, respectively). If any unmatched template arguments are provided, a static assertion fails. What this means is that you can specify or omit the arguments in any order: py::class_<A, PyA> c1(m, "A"); py::class_<B, PyB, std::shared_ptr<B>> c2(m, "B"); py::class_<C, std::shared_ptr<C>, PyB> c3(m, "C"); It also allows future class attributes (such as base types in the next commit) to be passed as class template types rather than needing to use a py::base<> wrapper. -
Dean Moldovan authored
-
Wenzel Jakob authored
-
Wenzel Jakob authored
-
- 05 Sep, 2016 1 commit
-
-
Sergey Lyskov authored
-
- 29 Aug, 2016 1 commit
-
-
Jason Rhinelander authored
The documentation says the string-valued python function name goes after the C++ function, but it actually goes before it.
-
- 28 Aug, 2016 1 commit
-
-
Wenzel Jakob authored
-
- 27 Aug, 2016 1 commit
-
-
Nickolai Belakovski authored
-
- 22 Aug, 2016 1 commit
-
-
Wenzel Jakob authored
-
- 19 Aug, 2016 1 commit
-
-
Dean Moldovan authored
Test compilation instructions for Windows were changed to use the `cmake --build` command line invocation which should be easier than manually setting up using the CMake GUI and Visual Studio.
-
- 18 Aug, 2016 1 commit
-
-
Wenzel Jakob authored
-
- 17 Aug, 2016 1 commit
-
-
Glen Walker authored
For example keep_alive<0,1>() should work where the return value may sometimes be None. At present a "Could not allocate weak reference!" exception is thrown. Update documentation to clarify behaviour of keep_alive when nurse is None or does not support weak references.
-
- 15 Aug, 2016 1 commit
-
-
Dean Moldovan authored
The missing empty line after `.. code-block::` resulted in incorrectly parsed restructuredtext (sphinx warnings) and the code blocks were not generated in the html output. The `exclude_patterns` change just silences the orphaned file warning. [ci skip]
-
- 13 Aug, 2016 6 commits
-
-
Ivan Smirnov authored
-
Ivan Smirnov authored
-
Ivan Smirnov authored
-
Ivan Smirnov authored
-
Ivan Smirnov authored
The format strings that are known at compile time are now accessible via both ::value and ::format(), and format strings for everything else is accessible via ::format(). This makes it backwards compatible.
-
Ivan Smirnov authored
-
- 12 Aug, 2016 1 commit
-
-
Jason Rhinelander authored
This allows exposing a dict-like interface to python code, allowing iteration over keys via: for k in custommapping: ... while still allowing iteration over pairs, so that you can also implement 'dict.items()' functionality which returns a pair iterator, allowing: for k, v in custommapping.items(): ... example-sequences-and-iterators is updated with a custom class providing both types of iteration.
-
- 10 Aug, 2016 2 commits
-
-
Jason Rhinelander authored
reference_internal requires an `instance` field to track the returned reference's parent, but that's just a duplication of what keep_alive<0,1> does, so use a keep alive to do this to eliminate the duplication.
-
Jason Rhinelander authored
It no longer applies since instances are now identified by both address and type.
-
- 05 Aug, 2016 2 commits
-
-
Jason Rhinelander authored
It was already pretty badly intrusive, but it also appears to make MSVC segfault. Rather than investigating and fixing it, it's easier to just remove it.
-
Jason Rhinelander authored
As discussed in #320. The adds a documentation block that mentions that the trampoline classes must provide overrides for both the classes' own virtual methods *and* any inherited virtual methods. It also provides a templated solution to avoiding method duplication. The example includes a third method (only mentioned in the "see also" section of the documentation addition), using multiple inheritance. While this approach works, and avoids code generation in deep hierarchies, it is intrusive by requiring that the wrapped classes use virtual inheritance, which itself is more instrusive if any of the virtual base classes need anything other than default constructors. As per the discussion in #320, it is kept as an example, but not suggested in the documentation.
-
- 04 Aug, 2016 3 commits
-
-
Jason Rhinelander authored
-
Jason Rhinelander authored
-
Jason Rhinelander authored
Functions returning specialized Eigen matrices like Eigen::DiagonalMatrix and Eigen::SelfAdjointView--which inherit from EigenBase but not DenseBase--isn't currently allowed; such classes are explicitly copyable into a Matrix (by definition), and so we can support functions that return them by copying the value into a Matrix then casting that resulting dense Matrix into a numpy.ndarray. This commit does exactly that.
-
- 01 Aug, 2016 1 commit
-
-
Wenzel Jakob authored
-
- 19 Jul, 2016 1 commit
-
-
Wenzel Jakob authored
-
- 18 Jul, 2016 2 commits
-
-
Jason Rhinelander authored
-
Wenzel Jakob authored
-
- 11 Jul, 2016 1 commit
-
-
Pim Schellart authored
-
- 10 Jul, 2016 1 commit
-
-
Wenzel Jakob authored
-