1. 04 Dec, 2020 1 commit
  2. 15 Sep, 2020 1 commit
  3. 10 Sep, 2020 1 commit
  4. 29 Jun, 2020 2 commits
  5. 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
  6. 09 Nov, 2018 2 commits
  7. 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
  8. 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
  9. 10 Sep, 2017 1 commit
  10. 25 Aug, 2017 1 commit
  11. 12 Aug, 2017 1 commit
    • Dean Moldovan's avatar
      Add support for boost::variant in C++11 mode · 7918bcc9
      Dean Moldovan authored
      In C++11 mode, `boost::apply_visitor` requires an explicit `result_type`.
      This also adds optional tests for `boost::variant` in C++11/14, if boost
      is available. In C++17 mode, `std::variant` is tested instead.
      7918bcc9
  12. 05 Aug, 2017 1 commit
    • Jason Rhinelander's avatar
      Update all remaining tests to new test styles · 391c7544
      Jason Rhinelander authored
      This udpates all the remaining tests to the new test suite code and
      comment styles started in #898.  For the most part, the test coverage
      here is unchanged, with a few minor exceptions as noted below.
      
      - test_constants_and_functions: this adds more overload tests with
        overloads with different number of arguments for more comprehensive
        overload_cast testing.  The test style conversion broke the overload
        tests under MSVC 2015, prompting the additional tests while looking
        for a workaround.
      
      - test_eigen: this dropped the unused functions `get_cm_corners` and
        `get_cm_corners_const`--these same tests were duplicates of the same
        things provided (and used) via ReturnTester methods.
      
      - test_opaque_types: this test had a hidden dependence on ExampleMandA
        which is now fixed by using the global UserType which suffices for the
        relevant test.
      
      - test_methods_and_attributes: this required some additions to UserType
        to make it usable as a replacement for the test's previous SimpleType:
        UserType gained a value mutator, and the `value` property is not
        mutable (it was previously readonly).  Some overload tests were also
        added to better test overload_cast (as described above).
      
      - test_numpy_array: removed the untemplated mutate_data/mutate_data_t:
        the templated versions with an empty parameter pack expand to the same
        thing.
      
      - test_stl: this was already mostly in the new style; this just tweaks
        things a bit, localizing a class, and adding some missing
        `// test_whatever` comments.
      
      - test_virtual_functions: like `test_stl`, this was mostly in the new
        test style already, but needed some `// test_whatever` comments.
        This commit also moves the inherited virtual example code to the end
        of the file, after the main set of tests (since it is less important
        than the other tests, and rather length); it also got renamed to
        `test_inherited_virtuals` (from `test_inheriting_repeat`) because it
        tests both inherited virtual approaches, not just the repeat approach.
      391c7544
  13. 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
  14. 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
  15. 27 Jun, 2017 2 commits