• 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
test_stl.cpp 7.99 KB