Mẹo Hay

std::set In C++ | STL C++

Rate this post

youtube ►
patreon ►

play list for smart pointers:
play list for STL:
play list for C++14:
play list for Threads In C++:
play list for C++ Interview Questions And Answer:
play list for C++ Tutoria For Beginners:
paly list for Design Patterns:
play list for Linked List Interview Questions:
play list for Data Structures:
play list for Type Casts:
paly list for Sorting Algorithms:

TOPIC: std::set

1. std::set is an Associative Container that contains a sorted set of unique objects of type Key.
2. It is usually implemented using Red-Black Tree.
3. Insertion, Removal, Search have logarithmic complexity.
4. If we want to store user defined data type in set then we will have to provide
compare function so that set can store them in sorted order.
5. We can pass the order of sorting while constructing set object.

It store unique elements and they are stored in sorted order (A/D)


Tag: set c++, set, container, stl, std::set, standard template library, c++, c++ tutorial, stl c++, sorting, associative containers c++, set in c++, how to use set in c++, template in c++, multiset in c++, multiset, c++ programming, sort, data structures, programming, coding, c++ interview, c++ coding, c++ tutorial for beginners

Xem Thêm Bài Viết Về Mẹo Hay Khác: https://meocongnghe.vn/meo-hay

Nguồn: https://meocongnghe.vn


  1. Correct me if i am wrong. If we have raw pointers as data members in our class, then we have to overload "operator==" because if we don't, the compiler will compare the pointer and not what it is pointing to and hence store it in the set, right?

  2. Thank you very much for this explanation. The operation overloading part wasn't so clear but you explained the concept of Set very well. You earned a subscriber and deserve many more. Keep uploading great content, Rupesh!

  3. What is the use of lines 25,26 in the code , and you haven't made any explanation regarding those two lines(not the const part , it is the bool part)! I haven't understood what is being done there….!!! respond ASAP!!!!


Post Comment