|
Boost : |
From: Ivan Matek (libbooze_at_[hidden])
Date: 2024-12-19 17:50:27
On Thu, Dec 19, 2024 at 6:26â¯PM Neil Groves via Boost <boost_at_[hidden]>
wrote:
> One aspect that strikes me about all of our alternatives is that none of
> them work particularly well when we are using multi_ associative
> containers.
>
> If I understand your comment correctly:
"correct" return type is a std::ranges::subrange, equal_range returns
std::pair so you need some helper to "rangify" that pair.
(this example uses biset so you can ignore .get<1>).
EmployeeSet ems{{1, "Alice"}, {2, "Bob"}, {3, "Chad"}, {4, "Alice"}};
for (const Employee& employee : ems.get<1>().equal_range("Alice") | rangify)
{
std::print("{} {}\n", employee.id, employee.name);
}
Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk