multiset STL container class in C++: Types of constructors, operators of multi set

A multiset is a set of non unique keys.

A multiset class can be declared as:

template <class Key, class Comp = less<Key>, class Allocator = allocator<Key>> class multiset

Types of multiset constructors:

Type-1: Empty multiset

explicit multiset(const Comp &cmpfn = Comp( ), const Allocator &a = Allocator( ) );

Type-2: multiset having same elements as obj

multiset(const multiset<Key, Comp, Allocator> &obj);

Type-3: multiset having elements in the range i and j

template <class InIter> multiset(InIter i, InIter j, const Comp &cmpfn = Comp( ), const Allocator &a = Allocator( ));

Types of multiset operators: ==, <, <=, !=, >, >=

Leave a Reply