mirror of
https://github.com/pybind/pybind11.git
synced 2026-03-14 20:27:47 +00:00
clang-tidy readability-qualified-auto (#3702)
* Adding readability-qualified-auto to .clang-tidy
Ported from @henryiii's 287527f705
* fix: support Python < 3.6
Co-authored-by: Henry Schreiner <henryschreineriii@gmail.com>
This commit is contained in:
committed by
GitHub
parent
b4f5350d0d
commit
7769e7719c
@@ -41,7 +41,7 @@ public:
|
||||
};
|
||||
|
||||
template <class Container> Container *one_to_n(int n) {
|
||||
auto v = new Container();
|
||||
auto *v = new Container();
|
||||
for (int i = 1; i <= n; i++) {
|
||||
v->emplace_back(i);
|
||||
}
|
||||
@@ -49,7 +49,7 @@ template <class Container> Container *one_to_n(int n) {
|
||||
}
|
||||
|
||||
template <class Map> Map *times_ten(int n) {
|
||||
auto m = new Map();
|
||||
auto *m = new Map();
|
||||
for (int i = 1; i <= n; i++) {
|
||||
m->emplace(int(i), E_nc(10 * i));
|
||||
}
|
||||
@@ -57,7 +57,7 @@ template <class Map> Map *times_ten(int n) {
|
||||
}
|
||||
|
||||
template <class NestMap> NestMap *times_hundred(int n) {
|
||||
auto m = new NestMap();
|
||||
auto *m = new NestMap();
|
||||
for (int i = 1; i <= n; i++) {
|
||||
for (int j = 1; j <= n; j++) {
|
||||
(*m)[i].emplace(int(j * 10), E_nc(100 * j));
|
||||
@@ -99,16 +99,15 @@ TEST_SUBMODULE(stl_binders, m) {
|
||||
m.def("get_umnc", ×_ten<std::unordered_map<int, E_nc>>);
|
||||
// Issue #1885: binding nested std::map<X, Container<E>> with E non-copyable
|
||||
py::bind_map<std::map<int, std::vector<E_nc>>>(m, "MapVecENC");
|
||||
m.def("get_nvnc", [](int n)
|
||||
{
|
||||
auto m = new std::map<int, std::vector<E_nc>>();
|
||||
for (int i = 1; i <= n; i++) {
|
||||
for (int j = 1; j <= n; j++) {
|
||||
(*m)[i].emplace_back(j);
|
||||
}
|
||||
m.def("get_nvnc", [](int n) {
|
||||
auto *m = new std::map<int, std::vector<E_nc>>();
|
||||
for (int i = 1; i <= n; i++) {
|
||||
for (int j = 1; j <= n; j++) {
|
||||
(*m)[i].emplace_back(j);
|
||||
}
|
||||
return m;
|
||||
});
|
||||
}
|
||||
return m;
|
||||
});
|
||||
py::bind_map<std::map<int, std::map<int, E_nc>>>(m, "MapMapENC");
|
||||
m.def("get_nmnc", ×_hundred<std::map<int, std::map<int, E_nc>>>);
|
||||
py::bind_map<std::unordered_map<int, std::unordered_map<int, E_nc>>>(m, "UmapUmapENC");
|
||||
|
||||
Reference in New Issue
Block a user