C++ Standard Library set Sample

Description

set is a container that represents a mathematical set of elements. No duplication is allowed in the set, so that inserting the same element more than once will be ignored. The set is represented in an ordered form, according to the default comparison template less<Key>.

Declaration

	template <class Key, class Cmp = less<Key>,
	    class A = allocator<Key> >
	       class std::set;

Concept

The sample program inserts some elements into a set, checks whether element 5 is in the set, erases element 4, and then displays the resulting set. The output is 1 2 5.

Special Notes:

multiset supports duplicate keys.

Supported
Supported
Supported