Logo Search packages:      
Sourcecode: pan version File versions  Download package

Public Types | Public Member Functions | Protected Member Functions | Protected Attributes | Friends

pan::sorted_vector< K, bNoDuplicates, Pr, A > Class Template Reference

#include <sorted-vector.h>

Inheritance diagram for pan::sorted_vector< K, bNoDuplicates, Pr, A >:
Inheritance graph
Collaboration diagram for pan::sorted_vector< K, bNoDuplicates, Pr, A >:
Collaboration graph

List of all members.

Public Types

typedef Cont::allocator_type allocator_type
typedef Cont::const_iterator const_iterator
typedef Cont::const_reference const_reference
typedef std::vector< K, A > Cont
typedef Cont::difference_type difference_type
typedef Cont::iterator iterator
typedef Pr key_compare
typedef K key_type
typedef sorted_vector< K,
bNoDuplicates, Pr, A > 
typedef std::pair
< const_iterator,
const_iterator > 
typedef std::pair< iterator, bool > Pairib_
typedef std::pair< iterator,
iterator > 
typedef Cont::reference reference
typedef Cont::reverse_iterator reverse_iterator
typedef Cont::size_type size_type
typedef Pr value_compare
typedef Cont::value_type value_type

Public Member Functions

void assign (const_iterator first, const_iterator beyond)
void assign (size_type n, const K &x=K())
reference at (size_type p)
const_reference at (size_type p) const
const_reference back () const
reference back ()
iterator begin ()
const_iterator begin () const
void clear ()
size_type count (const K &k) const
bool empty () const
iterator end ()
const_iterator end () const
bool Eq_ (const Myt_ &x) const
template<class KeyType >
Pairii_ equal_range (const KeyType &k)
template<class KeyType >
Paircc_ equal_range (const KeyType &k) const
iterator erase (iterator p)
iterator erase (iterator first, iterator beyond)
size_type erase (const K &key)
template<class KeyType >
iterator find (const KeyType &k)
template<class KeyType >
const_iterator find (const KeyType &k) const
reference front ()
const_reference front () const
get_allocator () const
Cont & get_container ()
template<class It >
void insert (It first, It beyond)
iterator insert (iterator it, const value_type &x)
Pairib_ insert (const value_type &x)
key_compare key_comp () const
template<class KeyType >
const_iterator lower_bound (const KeyType &k) const
template<class KeyType >
iterator lower_bound (const KeyType &k)
bool Lt_ (const Myt_ &x) const
size_type max_size () const
Myt_operator= (const Myt_ &x)
Myt_operator= (const Cont &x)
reference operator[] (size_type p)
const_reference operator[] (size_type p) const
void pop_back ()
reverse_iterator rbegin ()
const_reverse_iterator rbegin () const
const_reverse_iterator rend () const
reverse_iterator rend ()
void reserve (size_type n)
size_type size () const
void sort ()
 sorted_vector (const Myt_ &x)
template<class It >
 sorted_vector (It first, It beyond, const Pr &pred=Pr(), const A &al=A())
 sorted_vector (const Pr &pred=Pr(), const A &al=A())
void stable_sort ()
void swap (Myt_ &x)
template<class KeyType >
const_iterator upper_bound (const KeyType &k) const
template<class KeyType >
iterator upper_bound (const KeyType &k)
value_compare value_comp () const

Protected Member Functions

iterator InsertImpl_ (iterator p, const value_type &x)
bool KeyCompare_Geq_ (const K &ty0, const K &ty1)
bool KeyCompare_Gt_ (const K &ty0, const K &ty1)
bool KeyCompare_Leq_ (const K &ty0, const K &ty1)
iterator Unique_ ()

Protected Attributes

key_compare key_compare_
Cont vec_


void swap (Myt_ &x, Myt_ &Y_)

Detailed Description

template<class K, bool bNoDuplicates = false, class Pr = std::less<K>, class A = std::allocator<K>>
class pan::sorted_vector< K, bNoDuplicates, Pr, A >

std::set implemented as a sorted vector.

This can give a significant memory improvement over std::set, which is implemented as a tree. The tradeoff is that insertion and removal is slow, so this is best used on sets whose contents rarely change.

This class was written by Martin Holzherr and is in the public domain.

Definition at line 44 of file sorted-vector.h.

The documentation for this class was generated from the following file:

Generated by  Doxygen 1.6.0   Back to index