Explain the difference between a set and a list. When might you use one or the other
belongs to book: C++ Primer|Stanley B.Lippman, Josee Lajoie, Barbara E.Moo|5th Edition| Chapter number:11| Question number:6
All Answers
total answers (1)
belongs to book: C++ Primer|Stanley B.Lippman, Josee Lajoie, Barbara E.Moo|5th Edition| Chapter number:11| Question number:6
total answers (1)
A
`set`is an associative container while a`list`is a sequential container. Elements in`list`can be sorted by user while elements in`set`is sorted automatically (except unordered version). A`list`can be ordered while a`set`is un-ordered. We can't enforce an arbitrary order by placing an arbitrary element in an arbitrary position in a`set`.
need an explanation for this answer? contact us directly to get an explanation for this answer