Deleted Added
sdiff udiff text old ( 11986:c12e4625ab56 ) new ( 12037:d28054ac6ec9 )
full compact
1/*
2 tests/pybind11_tests.cpp -- pybind example plugin
3
4 Copyright (c) 2016 Wenzel Jakob <wenzel.jakob@epfl.ch>
5
6 All rights reserved. Use of this source code is governed by a
7 BSD-style license that can be found in the LICENSE file.
8*/
9
10#include "pybind11_tests.h"
11#include "constructor_stats.h"
12
13std::list<std::function<void(py::module &)>> &initializers() {
14 static std::list<std::function<void(py::module &)>> inits;
15 return inits;
16}
17
18test_initializer::test_initializer(std::function<void(py::module &)> initializer) {
19 initializers().push_back(std::move(initializer));
20}

--- 6 unchanged lines hidden (view full) ---

27 .def_readwrite("copy_assignments", &ConstructorStats::copy_assignments)
28 .def_readwrite("move_assignments", &ConstructorStats::move_assignments)
29 .def_readwrite("copy_constructions", &ConstructorStats::copy_constructions)
30 .def_readwrite("move_constructions", &ConstructorStats::move_constructions)
31 .def_static("get", (ConstructorStats &(*)(py::object)) &ConstructorStats::get, py::return_value_policy::reference_internal);
32}
33
34PYBIND11_PLUGIN(pybind11_tests) {
35 py::module m("pybind11_tests", "pybind example plugin");
36
37 bind_ConstructorStats(m);
38
39 for (const auto &initializer : initializers())
40 initializer(m);
41
42 if (!py::hasattr(m, "have_eigen")) m.attr("have_eigen") = false;
43
44 return m.ptr();
45}