79479428

Date: 2025-03-02 17:04:12
Score: 0.5
Natty:
Report link

As @NathanOliver comments, you are trying to use converting operator (5), which requires std::tuple_size > 1.

You can work around this issue by constructing the second tuple from the first's argument: std::tuple<std::any> t2{ std::get<0>(t1) };.

If you are working in some generic code which needs to handle tuple with any number of std::any, then you need a slightly unwieldy:

auto t2 = std::apply([](const auto&& args) {
    return std::make_tuple(std::any{ std::forward(decltype(args)) }... });
}, t1);
Reasons:
  • Long answer (-0.5):
  • Has code block (-0.5):
  • User mentioned (1): @NathanOliver
  • Low reputation (0.5):
Posted by: Dominik Kaszewski