1. 04 Dec, 2020 2 commits
  2. 16 Oct, 2020 1 commit
  3. 20 Jul, 2020 1 commit
  4. 29 Jun, 2020 1 commit
  5. 10 Jun, 2019 1 commit
  6. 16 Nov, 2018 1 commit
    • voxmea's avatar
      Adds type_caster support for std::deque. (#1609) · 17983e74
      voxmea authored
      * Adds std::deque to the types supported by list_caster in stl.h.
      * Adds a new test_deque test in test_stl.{py,cpp}.
      * Updates the documentation to include std::deque as a default
        supported type.
      17983e74
  7. 09 Nov, 2018 2 commits
  8. 11 Oct, 2018 1 commit
    • Allan Leal's avatar
      Fix for Issue #1258 (#1298) · e76dff77
      Allan Leal authored
      * Fix for Issue #1258
      
      list_caster::load method will now check for a Python string and prevent its automatic conversion to a list.
      This should fix the issue "pybind11/stl.h converts string to vector<string> #1258" (https://github.com/pybind/pybind11/issues/1258)
      
      * Added tests for fix of issue #1258
      
      * Changelog: stl string auto-conversion
      e76dff77
  9. 17 Jul, 2018 1 commit
    • Wenzel Jakob's avatar
      stl.h: propagate return value policies to type-specific casters (#1455) · cbd16a82
      Wenzel Jakob authored
      * stl.h: propagate return value policies to type-specific casters
      
      Return value policies for containers like those handled in in 'stl.h'
      are currently broken.
      
      The problem is that detail::return_value_policy_override<C>::policy()
      always returns 'move' when given a non-pointer/reference type, e.g.
      'std::vector<...>'.
      
      This is sensible behavior for custom types that are exposed via
      'py::class_<>', but it does not make sense for types that are handled by
      other type casters (STL containers, Eigen matrices, etc.).
      
      This commit changes the behavior so that
      detail::return_value_policy_override only becomes active when the type
      caster derives from type_caster_generic.
      
      Furthermore, the override logic is called recursively in STL type
      casters to enable key/value-specific behavior.
      cbd16a82
  10. 27 Dec, 2017 1 commit
    • Antony Lee's avatar
      Add spaces around "=" in signature repr. · 0826b3c1
      Antony Lee authored
      PEP8 indicates (correctly, IMO) that when an annotation is present, the
      signature should include spaces around the equal sign, i.e.
      
          def f(x: int = 1): ...
      
      instead of
      
          def f(x: int=1): ...
      
      (in the latter case the equal appears to bind to the type, not to the
      argument).
      
      pybind11 signatures always includes a type annotation so we can always
      add the spaces.
      0826b3c1
  11. 25 Oct, 2017 1 commit
  12. 12 Sep, 2017 1 commit
    • Dean Moldovan's avatar
      Make TypeErrors more informative when an optional header is missing · 2b4477eb
      Dean Moldovan authored
      E.g. trying to convert a `list` to a `std::vector<int>` without
      including <pybind11/stl.h> will now raise an error with a note that
      suggests checking the headers.
      
      The note is only appended if `std::` is found in the function
      signature. This should only be the case when a header is missing.
      E.g. when stl.h is included, the signature would contain `List[int]`
      instead of `std::vector<int>` while using stl_bind.h would produce
      something like `MyVector`. Similarly for `std::map`/`Dict`, `complex`,
      `std::function`/`Callable`, etc.
      
      There's a possibility for false positives, but it's pretty low.
      2b4477eb
  13. 10 Sep, 2017 1 commit
  14. 16 Jul, 2017 1 commit
    • Jason Rhinelander's avatar
      Fix regression: container pointers not castable · 67a0cc4e
      Jason Rhinelander authored
      PR #936 broke the ability to return a pointer to a stl container (and,
      likewise, to a tuple) because the added deduced type matched a
      non-const pointer argument: the pointer-accepting `cast` in
      PYBIND11_TYPE_CASTER had a `const type *`, which is a worse match for a
      non-const pointer than the universal reference template #936 added.
      
      This changes the provided TYPE_CASTER cast(ptr) to take the pointer by
      template arg (so that it will accept either const or non-const pointer).
      It has two other effects: it slightly reduces .so size (because many
      type casters never actually need the pointer cast at all), and it allows
      type casters to provide their untemplated pointer `cast()` that will
      take precedence over the templated version provided in the macro.
      67a0cc4e
  15. 05 Jul, 2017 1 commit
    • Jason Rhinelander's avatar
      Use rvalue subcasting when casting an rvalue container · b57281bb
      Jason Rhinelander authored
      This updates the std::tuple, std::pair and `stl.h` type casters to
      forward their contained value according to whether the container being
      cast is an lvalue or rvalue reference.  This fixes an issue where
      subcaster casts were always called with a const lvalue which meant
      nested type casters didn't have the desired `cast()` overload invoked.
      For example, this caused Eigen values in a tuple to end up with a
      readonly flag (issue #935) and made it impossible to return a container
      of move-only types (issue #853).
      
      This fixes both issues by adding templated universal reference `cast()`
      methods to the various container types that forward container elements
      according to the container reference type.
      b57281bb
  16. 27 Jun, 2017 2 commits