pybind11/include/pybind11
aimir 9db988013c
Correct class names for KeysView, ValuesView and ItemsView in bind_map (#4353)
* Create templated abstract classes KeysView, ValuesView and ItemsView, and implement them on-the-fly when wrapping any specific map type

* We don't want to wrap different ValuesView objects for double values and const double, for example, as both wrappers will be named ValuesView[float]

* Fallback to C++ names if key or values types are not wrapped

* Added a test for .keys(), .values() and .items() returning the same types for similarly-typed maps

* Fixed wrong use of auto in a declarator list: the two descriptions might have different types

* Fixes for clang-tidy issues: explicit single-argument constructor, using the 'override' keyword when overriding functions

* Bugfix for old versions of clang++, which seem to have trouble with the struct being defined inside a module, which was also needlessly ugly anyway

* Bugfix for clang++, which doesn't have some of the names in runtime uness they are specified to be static

* A fix for clang-tidy performance-inefficient-string-concatenation issues - I personally think this looks uglier, but it's probably worth it for clang-tidy to be happy

* Possible fix for clang++ linking issues - make the descriptions static constexpr to make sure they are known before linking

* Correct names for previously-wrapped types as keys/values of maps

* Bugfix - typo in type info names which caused things to segfault

* Apply suggestions from code review

Co-authored-by: Aaron Gokaslan <skylion.aaron@gmail.com>

* Use detail::remove_cvref_t instead of doing remove_cv and remove_reference separately

* Avoid names with double underscore, as they are reserved

* Improved testing for KeysView, ValuesView and ItemsView: check type names + stricter asserts

* Moved description logic to helper function in type_caster_base.h

* style: pre-commit fixes

* Fix a clang-tidy issue: do not use 'else' after 'return'

* Apply suggestion by @Skylion007, with additional trivial simplification.

Co-authored-by: Amir <aimir@local>
Co-authored-by: aimir <aimir@localhost>
Co-authored-by: Aaron Gokaslan <skylion.aaron@gmail.com>
Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com>
Co-authored-by: Ralf W. Grosse-Kunstleve <rwgk@google.com>
2022-12-08 23:15:11 -08:00
..
detail Correct class names for KeysView, ValuesView and ItemsView in bind_map (#4353) 2022-12-08 23:15:11 -08:00
eigen Fix source comment typo (#4388) 2022-12-06 12:54:15 -05:00
stl feature: support compilers that use std::experimental::filesystem (#3840) 2022-03-31 22:16:10 -07:00
attr.h Fix: 3.11 beta support (#3923) 2022-07-06 16:35:12 -04:00
buffer_info.h Fully-automatic clang-format with include reordering (#3713) 2022-02-10 12:17:07 -08:00
cast.h chore(deps): update pre-commit hooks (#4386) 2022-12-06 10:10:48 -08:00
chrono.h chore: drop Python 3.5 (#3719) 2022-02-11 19:06:16 -05:00
common.h Add a dummy common.h header with a deprecation warning 2017-09-06 15:22:26 +02:00
complex.h Fully-automatic clang-format with include reordering (#3713) 2022-02-10 12:17:07 -08:00
eigen.h First draft of Eigen::Tensor support (#4201) 2022-10-18 16:54:16 -07:00
embed.h scoped_interpreter. overloaded constructor: PyConfig param (#4330) 2022-11-30 21:17:59 -08:00
eval.h fix: missing move in eval.h (#3775) 2022-03-02 15:25:43 -05:00
functional.h Fix functional.h bug + introduce test to verify that it is fixed (#4254) 2022-11-02 11:32:53 -07:00
gil.h Add PYBIND11_SIMPLE_GIL_MANAGEMENT option (cmake, C++ define) (#4216) 2022-10-30 08:57:23 -07:00
iostream.h chore: add err guard to capsule destructor and add a move to iostream (#3958) 2022-05-27 14:32:57 -04:00
numpy.h chore(deps): update pre-commit hooks (#4386) 2022-12-06 10:10:48 -08:00
operators.h Reproducer and fix for issue encountered in smart_holder update. (#4228) 2022-10-09 21:50:35 -07:00
options.h Add option for enable/disable enum members in docstring. (#2768) 2022-12-08 23:10:10 -08:00
pybind11.h Add option for enable/disable enum members in docstring. (#2768) 2022-12-08 23:10:10 -08:00
pytypes.h pybind11::handle inc_ref() & dec_ref() PyGILState_Check() **excluding** nullptr (#4246) 2022-12-08 22:06:51 -08:00
stl_bind.h Correct class names for KeysView, ValuesView and ItemsView in bind_map (#4353) 2022-12-08 23:15:11 -08:00
stl.h Cleanup casters to release none() to avoid ref counting (#4269) 2022-10-21 12:51:26 -04:00