Skip to content

Commit d3c5453

Browse files
committed
Use nested type foreach
1 parent 134dc89 commit d3c5453

1 file changed

Lines changed: 9 additions & 16 deletions

File tree

src/binding/python/Series.cpp

Lines changed: 9 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -108,12 +108,9 @@ struct DefineSeriesConstructorPerPathType
108108
}
109109
#endif
110110

111-
template <typename TupleType>
111+
template <typename PathType, typename JsonCfgType>
112112
static void call(py::class_<Series, Attributable> &py_class)
113113
{
114-
using PathType = typename std::tuple_element<0, TupleType>::type;
115-
using JsonCfgType = typename std::tuple_element<1, TupleType>::type;
116-
117114
py_class
118115
.def(
119116
py::init([](PathType const &filepath,
@@ -368,23 +365,19 @@ not possible once it has been closed.
368365
py::keep_alive<0, 1>());
369366

370367
py::class_<Series, Attributable> cl(m, "Series");
371-
::auxiliary::ForEachType<
368+
369+
::auxiliary::ForEachTypeNested<
372370
::internal::DefineSeriesConstructorPerPathType,
373-
// First tuple components are eligible types for the path argument
374-
// second component for the config argument
375-
// py::object needs to always come last, as a catch-all pattern
376371
#if openPMD_USE_FILESYSTEM_HEADER
377-
std::tuple<std::string, std::string>,
372+
// path argument types
378373
std::tuple<std::string, std::filesystem::path>,
379-
std::tuple<std::string, py::object>,
380-
std::tuple<std::filesystem::path, std::string>,
381-
std::tuple<std::filesystem::path, std::filesystem::path>,
382-
std::tuple<std::filesystem::path, py::object>
374+
// config argument types
375+
std::tuple<std::string, std::filesystem::path, py::object>
383376
#else
384-
std::tuple<std::string, std::string>,
377+
// path argument types
385378
std::tuple<std::string, py::object>,
386-
std::tuple<py::object, std::string>,
387-
std::tuple<py::object, py::object>
379+
// config argument types
380+
std::tuple<std::string, py::object>
388381
#endif
389382
>::template call(cl);
390383

0 commit comments

Comments
 (0)