Commit Graph

28 Commits

Author SHA1 Message Date
Erick Matsen
b32b762c60 Fixing minor typo in basics.rst (#1984) 2019-11-14 08:54:46 +01:00
Ivan Smirnov
5cbfda5b68 Update build commands for Linux / OS X in the docs (#907) 2017-08-30 21:58:43 +02:00
Matthew Chan
6223b18cea Update basics.rst
Fix spelling
2017-06-08 16:42:44 -03:00
Dean Moldovan
443ab5946b Replace PYBIND11_PLUGIN with PYBIND11_MODULE
This commit also adds `doc()` to `object_api` as a shortcut for the
`attr("__doc__")` accessor.

The module macro changes from:
```c++
PYBIND11_PLUGIN(example) {
    pybind11::module m("example", "pybind11 example plugin");
    m.def("add", [](int a, int b) { return a + b; });
    return m.ptr();
}
```

to:

```c++
PYBIND11_MODULE(example, m) {
    m.doc() = "pybind11 example plugin";
    m.def("add", [](int a, int b) { return a + b; });
}
```

Using the old macro results in a deprecation warning. The warning
actually points to the `pybind11_init` function (since attributes
don't bind to macros), but the message should be quite clear:
"PYBIND11_PLUGIN is deprecated, use PYBIND11_MODULE".
2017-05-29 03:21:19 +02:00
Jason Rhinelander
05920e363e Change compilation/test target back to check (#566) 2016-12-19 17:33:02 +01:00
Jason Rhinelander
3f1ff3f4d1 Adds automatic casting on assignment of non-pyobject types (#551)
This adds automatic casting when assigning to python types like dict,
list, and attributes.  Instead of:

    dict["key"] = py::cast(val);
    m.attr("foo") = py::cast(true);
    list.append(py::cast(42));

you can now simply write:

    dict["key"] = val;
    m.attr("foo") = true;
    list.append(42);

Casts needing extra parameters (e.g. for a non-default rvp) still
require the py::cast() call. set::add() is also supported.

All usage is channeled through a SFINAE implementation which either just returns or casts. 

Combined non-converting handle and autocasting template methods via a
helper method that either just returns (handle) or casts (C++ type).
2016-12-12 23:42:52 +01:00
Dean Moldovan
67b52d808e Reorganize documentation 2016-10-20 15:21:34 +02:00
Trent Houliston
352149e892 Refactor the chrono cast functions into chrono.h.
Add unit tests and documentation for the chrono cast.
2016-09-13 19:58:05 +10:00
Wenzel Jakob
6f017cf658 basics.rst: minor table update for Eigen types 2016-09-06 14:13:35 +09:00
Wenzel Jakob
fe34241e50 minor doc & style fixes 2016-09-06 13:02:29 +09:00
Dean Moldovan
ec0d38ef25 Update the docs to reflect the new test structure
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.
2016-08-19 13:32:01 +02:00
Dean Moldovan
b3eadfa595 Update docs with _a suffix notation for named arguments 2016-06-03 23:52:56 +02:00
Wenzel Jakob
99279f7107 docs: switched lexer for python console snippets to 'pycon' 2016-06-03 11:19:50 +02:00
Wenzel Jakob
9e0a0568fe transparent conversion of dense and sparse Eigen types 2016-05-05 21:44:29 +02:00
Wenzel Jakob
06f56ee1e9 opaque type redesign 2016-04-28 17:49:46 +02:00
Wenzel Jakob
f64feaf3e4 documentation improvements 2016-04-28 15:32:07 +02:00
Wenzel Jakob
e84f557edf documentation improvements 2016-04-26 23:48:55 +02:00
Wenzel Jakob
76eb607d4e completed type table 2016-03-21 17:53:39 +01:00
Wenzel Jakob
81dfd2c51f Working type casters for wide strings and wide characters 2016-03-08 20:48:07 +01:00
Wenzel Jakob
0880294924 support unordered set/map data structures (fixes #100) 2016-02-13 00:22:26 +01:00
Wenzel Jakob
10c74c6f34 transparent std::array conversion (fixes #97) 2016-02-07 16:36:51 +01:00
Wenzel Jakob
6eb11da94a Very minor documentation fixes, updated logo 2016-01-17 22:31:15 +01:00
John Travers
f7e430292a Add ldflags to compile command
On my system (Mac OS with custom Python installation) I had to add the ldflags argument to python-config to get things working.
2015-12-12 22:58:23 +01:00
Wenzel Jakob
b1b714023a consistent macro naming throughout the project 2015-10-18 16:48:30 +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