Rajinder Yadav - Windows C++ Development Tools & Resources :Design, Code, Test, Deploy
STL Basics
STL Intro
Big 3 Rule
Namespace
Iterator
STL End Node
Size vs Capacity
Performance
Adaptors
Algorithmn
Functors
Containers
Container Adaptors
STL Reference
vector
list
deque
queue
stack
map
multimap
set
multiset
C++ Standard Type Library

#include <set>
template class Key, 
           
class Traits=less<Key>, 
           
class Allocator=allocator<Key> > class set
Parameters
Key -The key data type.
Traits - Function to compare two element values, argument is optional(default, binary predicate less).
Allocator - Memory allocator/deallocator, optional.

Constructors

set( );

explicit setconst Traits& comp );

explicit setconst Traits& comp, const Allocator& aloc );

set
const set& src );

template
<class InputIterator>
set( InputIterator start, InputIterator end);

template
<class InputIterator>
set( InputIterator start,
     InputIterator end,
     
const Traits& comp );

template
<class InputIterator>
set( InputIterator start,
     InputIterator end,
     
const Traits& comp,
     
const Allocator& aloc );
Parameters
  aloc  - Allocator class
  comp  - Comparison function used to order the elements, defaults is hash_compare.
  src   - Source set  be copied
  start - First element in the range
  end   - Last element in the range

Methods
begin()Returns a random-access iterator to the first element in the container.
clear()Remove all elements.
count()Returns a count of elements with a matching parameter-specified key.
empty()Check if container is empty.
end()Returns a random-access iterator that points just beyond the end of the container.
equal_range()Returns an iterator that addresses the location succeeding the last element in a map.
erase()Removes an element or a range of elements from the specified positions.
find()Returns an iterator to the element with the specified key.
get_allocator()Returns the allocator object.
insert()Inserts element or a number of elements at the specified position.
key_comp()Get a copy of the comparison object for ordering keys.
lower_bound()Get iterator to the first element with a key value that is equal to or greater than the specified key.
max_size()Get the maximum length.
rbegin()Get reverse iterator to the first element.
rend()Get reverse iterator to the end element.
size()Get the count of elements.
swap()Swap elements between two vectors.
upper_bound()Get iterator to the first element with a key value that is greater than the specified key.
value_comp()Get a copy of the comparison object.


Usage
STL Home

Copyright © 2007 Rajinder Yadav, All rights reserved