Quantcast
Channel: Why do C++ sequence containers have an "assign" method but associative containers do not? - Stack Overflow
Browsing all 2 articles
Browse latest View live

Answer by JaMiT for Why do C++ sequence containers have an "assign" method...

In particular, my initial guess for why sequence containers have assign is it avoids creating a temporary in the applicable circumstance, but the same reasoning would apply to the associative...

View Article


Why do C++ sequence containers have an "assign" method but associative...

The C++ sequence containers(vector, forward_list, list, and deque)all have an assign method. For example, std::vector has(quoting cppreference.com):void assign( size_type count, const T& value...

View Article

Browsing all 2 articles
Browse latest View live


<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>