Namespaces
Variants
Views
Actions

Talk:cpp/string/basic string/assign

From cppreference.com

Why does basic_string::assign not have a r-value overload? Something like assign(std::basic_string &&param);

167.220.236.1 21:49, 11 October 2015 (PDT)[email protected]

it does, it's the overload (4) on this page. --Cubbi (talk) 21:59, 11 October 2015 (PDT)

Why does this page say that assign(const basic_string& str) is equivalent to operator= (const basic_string& str) and may propagate allocators? The C++14/17 drafts from http://www.open-std.org appear to say that it is equivalent to assign(str, 0, npos), which in turn calls assign(str.data(), str.size()) which does not even have access to the allocator. I can see that most implementations implement assign(const basic_string&) in terms of operator= (libc++ even has tests for that) but I do not understand why. 80.150.243.190 01:27, 20 August 2019 (PDT)

this comes from http://wg21.link/p1148 --Cubbi (talk) 05:35, 20 August 2019 (PDT)
It's actually LWG issue 2579; I just applied it as a drive-by when applying P1148. T. Canens (talk) 08:32, 20 August 2019 (PDT)