Date: Sat, 9 Sep 2023 07:14:52 +0000
I noticed the following words in [expr.prim.id.unqual]:
* An implicitly movable entity is a variable of automatic storage duration that is either a non-volatile object or an rvalue reference to a non-volatile object type.
This seems to exclude structured bindings.
C++23 added fold left with iter, returning structured bindings would be easy to happen:
std::string foo()
{
using namespace std::literals;
std::vector rg = { "a"sv, "b"sv, "c"sv };
auto [in, value] = std::ranges::fold_left_with_iter(std::ranges::begin(rg), std::ranges::end(rg), std::string{}, [](auto&& init, auto&& rhs) {
return std::move(init += rhs);
});
if (in == std::ranges::end(rg))
return value;
else
throw my_error_code;
}
* An implicitly movable entity is a variable of automatic storage duration that is either a non-volatile object or an rvalue reference to a non-volatile object type.
This seems to exclude structured bindings.
C++23 added fold left with iter, returning structured bindings would be easy to happen:
std::string foo()
{
using namespace std::literals;
std::vector rg = { "a"sv, "b"sv, "c"sv };
auto [in, value] = std::ranges::fold_left_with_iter(std::ranges::begin(rg), std::ranges::end(rg), std::string{}, [](auto&& init, auto&& rhs) {
return std::move(init += rhs);
});
if (in == std::ranges::end(rg))
return value;
else
throw my_error_code;
}
Received on 2023-09-09 07:14:57