Namespaces
Variants
Views
Actions

Template talk:cpp/container/operator=

From cppreference.com

[edit] Newly-added example

Newly-added example doesn't apply to std::forward_list because it has no size() --Cubbi 07:24, 13 June 2012 (PDT)

Thanks for pointing that out. I didn't realize how widely shared that template was. I've restricted it to vector, deque, and list for now, and I'll try to come up with solutions for the other types that include that template later. --Nate 18:57, 13 June 2012 (PDT)

[edit] Linear complexity

The complexity of all container assignment operators (including those of std::basic_string) is always linear in the size of the receiving container, as the existing elements must be destroyed (via the allocator) or assigned to. Chortos-2 (talk) 06:29, 17 May 2016 (PDT)

indeed, table 103 container requirements says "linear" for a = rv (and we say the same in concept/Container), updating the move assignment complexity. --Cubbi (talk) 07:19, 17 May 2016 (PDT)