https://gcc.gnu.org/bugzilla/show_bug.cgi?id=108645

--- Comment #1 from Evan Teran <eteran at alum dot rit.edu> ---
To further experiment, i factored out `std::accumulate`:

```
#include <vector>
#include <iostream>
#include <string>
#include <iterator>

void print_v(const char *rem, const std::vector<std::string> &v) {
        std::cout << rem;
        for (const std::string &s : v)
                std::cout << '"' << s << '"' << ' ';
        std::cout << '\n';
}

int main() {

        std::vector<std::string> v = {"this", "_", "is", "_", "an", "_",
"example"};

        print_v("Old contents of the vector: ", v);

        std::string concat;
        auto first = std::make_move_iterator(v.begin());
        auto last  = std::make_move_iterator(v.end());
        for (; first != last; ++first) {
#if __cplusplus >= 202002L
                concat = std::move(concat) + *first;
#else
                concat = concat + *first;
#endif
        }


        print_v("New contents of the vector: ", v);
        std::cout << "Concatenated as string: " << '"' << concat << '"' <<
'\n';
}
```

Which results in the same behavior, so it appears to be that the:

```
basic_string operator+(basic_string &&, basic_string &&)
```

Overload doesn't steal the guts of the rhs at all?

But the 

```
basic_string operator+(const basic_string &, basic_string &&)
```

overload does?

Reply via email to