Date: Sat, 21 Sep 2024 16:12:29 +0200
Hi! I developed a library a while ago with the initial goal of creating
true named argument capabilities to c++ (i.e. out of order, optional
arguments etc.), and while that particular feature of the library did not
turn out as well as I had hoped, a few parts became tools that I felt
compelled to reach for when struggling with certain library API:s. And one
of them is the "string index tuple" or "named_tuple" as it was called in
the library. As I just recently felt it was the best fit to solve a
particular design issue I had, I felt that I at least had to ask in this
forum if there could be an interest in such a feature large enough to
motivate for a proposal or at least further work.
You can look up the library at github.com/doocman/dooc-np but in short it
allowed one to create and access elements in tuples like this:
using namespace dooc::tuple_literals;
auto my_tuple = dooc::named_tuple("Element 1"_na = 5, "Element 2"_na =
32.5f);
auto& e1 = dooc::get<"Element 1">(my_tuple);
auto& e2 = "Element 2"_from(my_tuple);
The named argument part works quite well for the caller, but it was not so
nice to set up for the function implementer.
// Robin
true named argument capabilities to c++ (i.e. out of order, optional
arguments etc.), and while that particular feature of the library did not
turn out as well as I had hoped, a few parts became tools that I felt
compelled to reach for when struggling with certain library API:s. And one
of them is the "string index tuple" or "named_tuple" as it was called in
the library. As I just recently felt it was the best fit to solve a
particular design issue I had, I felt that I at least had to ask in this
forum if there could be an interest in such a feature large enough to
motivate for a proposal or at least further work.
You can look up the library at github.com/doocman/dooc-np but in short it
allowed one to create and access elements in tuples like this:
using namespace dooc::tuple_literals;
auto my_tuple = dooc::named_tuple("Element 1"_na = 5, "Element 2"_na =
32.5f);
auto& e1 = dooc::get<"Element 1">(my_tuple);
auto& e2 = "Element 2"_from(my_tuple);
The named argument part works quite well for the caller, but it was not so
nice to set up for the function implementer.
// Robin
Received on 2024-09-21 14:13:19