OpenGM  2.3.x
Discrete Graphical Model Library
Public Types | Public Member Functions | List of all members
opengm::RandomAccessSet< Key, Compare, Alloc > Class Template Reference

set with O(n) insert and O(1) access More...

#include <randomaccessset.hxx>

+ Inheritance diagram for opengm::RandomAccessSet< Key, Compare, Alloc >:
+ Collaboration diagram for opengm::RandomAccessSet< Key, Compare, Alloc >:

Public Types

typedef Key key_type
 key type of the set More...
 
typedef Key ValueType
 value type of the set More...
 
typedef Key value_type
 value type of the set More...
 
typedef Compare key_compare
 comperator More...
 
typedef Compare value_compare
 value comperator More...
 
typedef Alloc allocator_type
 acclocator More...
 
typedef Alloc::const_reference const_reference
 const reference type More...
 
typedef VectorType::iterator iterator
 iterator type More...
 
typedef VectorType::const_iterator const_iterator
 const iterator type More...
 
typedef VectorType::size_type size_type
 size type More...
 
typedef VectorType::difference_type difference_type
 difference type More...
 
typedef VectorType::const_pointer const_pointer
 const pointer type More...
 
typedef VectorType::const_reverse_iterator const_reverse_iterator
 const reverse iterator More...
 

Public Member Functions

 RandomAccessSet (const size_t, const Compare &compare=Compare(), const Alloc &alloc=Alloc())
 constructor More...
 
 RandomAccessSet (const Compare &compare=Compare(), const Alloc &alloc=Alloc())
 constructor More...
 
template<class InputIterator >
 RandomAccessSet (InputIterator, InputIterator, const Compare &compare=Compare(), const Alloc &alloc=Alloc())
 constructor More...
 
 RandomAccessSet (const RandomAccessSet &)
 copy constructor More...
 
RandomAccessSetoperator= (const RandomAccessSet &)
 assignment operator More...
 
const value_typeoperator[] (const size_type) const
 const access values More...
 
const_iterator begin () const
 const begin iterator More...
 
const_iterator end () const
 const end iterator More...
 
const_iterator rbegin () const
 reverse const begin iterator More...
 
const_iterator rend () const
 reverse const end iterator More...
 
iterator begin ()
 begin iterator More...
 
iterator end ()
 end iterator More...
 
iterator rbegin ()
 reverse begin iterator More...
 
iterator rend ()
 reverse end iterator More...
 
bool empty () const
 query if the set is empty More...
 
size_type size () const
 number of elements of the set More...
 
size_type max_size () const
 maximum size of the underlying container More...
 
std::pair< const_iterator, boolinsert (const value_type &)
 
template<class InputIterator >
void insert (InputIterator, InputIterator)
 insert a sequence of elements More...
 
const_iterator insert (const_iterator, const value_type &)
 
void erase (iterator position)
 
size_type erase (const key_type &)
 
void erase (const_iterator, const_iterator)
 
void swap (RandomAccessSet &)
 swap random access sets More...
 
void clear ()
 clear the set More...
 
key_compare key_comp () const
 key comparator More...
 
value_compare value_comp () const
 value comparator More...
 
const_iterator find (const key_type &) const
 
iterator find (const key_type &)
 
size_type count (const key_type &) const
 count elements More...
 
const_iterator lower_bound (const key_type &) const
 
const_iterator upper_bound (const key_type &) const
 
std::pair< const_iterator, const_iteratorequal_range (const key_type &) const
 
iterator lower_bound (const key_type &)
 
iterator upper_bound (const key_type &)
 
std::pair< iterator, iteratorequal_range (const key_type &)
 
allocator_type get_allocator () const
 allocators More...
 
void reserve (const size_t size)
 
size_t capacity () const
 
template<class SET >
void assignFromSet (const SET &set)
 

Detailed Description

template<class Key, class Compare = std::less<Key>, class Alloc = std::allocator<Key>>
class opengm::RandomAccessSet< Key, Compare, Alloc >

set with O(n) insert and O(1) access

Template Parameters
Keykey and value type of the set
Allocallocator of the set RandomAccessSet has the same interface as std::set. In addition, there is operator[].
Warning
Values in set must not be changend through the mutable iterator because doing so would potentially change the order of the values \ingroup datastructures

Definition at line 21 of file randomaccessset.hxx.

Member Typedef Documentation

template<class Key, class Compare = std::less<Key>, class Alloc = std::allocator<Key>>
typedef Alloc opengm::RandomAccessSet< Key, Compare, Alloc >::allocator_type

acclocator

Definition at line 39 of file randomaccessset.hxx.

template<class Key, class Compare = std::less<Key>, class Alloc = std::allocator<Key>>
typedef VectorType::const_iterator opengm::RandomAccessSet< Key, Compare, Alloc >::const_iterator

const iterator type

Definition at line 45 of file randomaccessset.hxx.

template<class Key, class Compare = std::less<Key>, class Alloc = std::allocator<Key>>
typedef VectorType::const_pointer opengm::RandomAccessSet< Key, Compare, Alloc >::const_pointer

const pointer type

Definition at line 51 of file randomaccessset.hxx.

template<class Key, class Compare = std::less<Key>, class Alloc = std::allocator<Key>>
typedef Alloc::const_reference opengm::RandomAccessSet< Key, Compare, Alloc >::const_reference

const reference type

Definition at line 41 of file randomaccessset.hxx.

template<class Key, class Compare = std::less<Key>, class Alloc = std::allocator<Key>>
typedef VectorType::const_reverse_iterator opengm::RandomAccessSet< Key, Compare, Alloc >::const_reverse_iterator

const reverse iterator

Definition at line 53 of file randomaccessset.hxx.

template<class Key, class Compare = std::less<Key>, class Alloc = std::allocator<Key>>
typedef VectorType::difference_type opengm::RandomAccessSet< Key, Compare, Alloc >::difference_type

difference type

Definition at line 49 of file randomaccessset.hxx.

template<class Key, class Compare = std::less<Key>, class Alloc = std::allocator<Key>>
typedef VectorType::iterator opengm::RandomAccessSet< Key, Compare, Alloc >::iterator

iterator type

Definition at line 43 of file randomaccessset.hxx.

template<class Key, class Compare = std::less<Key>, class Alloc = std::allocator<Key>>
typedef Compare opengm::RandomAccessSet< Key, Compare, Alloc >::key_compare

comperator

Definition at line 35 of file randomaccessset.hxx.

template<class Key, class Compare = std::less<Key>, class Alloc = std::allocator<Key>>
typedef Key opengm::RandomAccessSet< Key, Compare, Alloc >::key_type

key type of the set

Definition at line 29 of file randomaccessset.hxx.

template<class Key, class Compare = std::less<Key>, class Alloc = std::allocator<Key>>
typedef VectorType::size_type opengm::RandomAccessSet< Key, Compare, Alloc >::size_type

size type

Definition at line 47 of file randomaccessset.hxx.

template<class Key, class Compare = std::less<Key>, class Alloc = std::allocator<Key>>
typedef Compare opengm::RandomAccessSet< Key, Compare, Alloc >::value_compare

value comperator

Definition at line 37 of file randomaccessset.hxx.

template<class Key, class Compare = std::less<Key>, class Alloc = std::allocator<Key>>
typedef Key opengm::RandomAccessSet< Key, Compare, Alloc >::value_type

value type of the set

Definition at line 33 of file randomaccessset.hxx.

template<class Key, class Compare = std::less<Key>, class Alloc = std::allocator<Key>>
typedef Key opengm::RandomAccessSet< Key, Compare, Alloc >::ValueType

value type of the set

Definition at line 31 of file randomaccessset.hxx.

Constructor & Destructor Documentation

template<class Key , class Compare, class Alloc>
opengm::RandomAccessSet< Key, Compare, Alloc >::RandomAccessSet ( const size_t  reserveSize,
const Compare &  compare = Compare(),
const Alloc &  alloc = Alloc() 
)
inline

constructor

Parameters
reserveSizereserve /allocate space
comparecomperator
allocallocator

Definition at line 127 of file randomaccessset.hxx.

template<class Key , class Compare, class Alloc>
opengm::RandomAccessSet< Key, Compare, Alloc >::RandomAccessSet ( const Compare &  compare = Compare(),
const Alloc &  alloc = Alloc() 
)
inline

constructor

Parameters
comparecomperator allocator

Definition at line 156 of file randomaccessset.hxx.

template<class Key , class Compare, class Alloc>
template<class InputIterator >
opengm::RandomAccessSet< Key, Compare, Alloc >::RandomAccessSet ( InputIterator  beginInput,
InputIterator  endInput,
const Compare &  compare = Compare(),
const Alloc &  alloc = Alloc() 
)
inline

constructor

Template Parameters
InputIterator(key/value) input iterator
Parameters
beginInput
endInput

Definition at line 172 of file randomaccessset.hxx.

template<class Key , class Compare, class Alloc>
opengm::RandomAccessSet< Key, Compare, Alloc >::RandomAccessSet ( const RandomAccessSet< Key, Compare, Alloc > &  src)
inline

copy constructor

Parameters
srcother random access set

Definition at line 192 of file randomaccessset.hxx.

Member Function Documentation

template<class Key, class Compare = std::less<Key>, class Alloc = std::allocator<Key>>
template<class SET >
void opengm::RandomAccessSet< Key, Compare, Alloc >::assignFromSet ( const SET &  set)
inline

Definition at line 111 of file randomaccessset.hxx.

template<class Key , class Compare , class Alloc >
RandomAccessSet< Key, Compare, Alloc >::const_iterator opengm::RandomAccessSet< Key, Compare, Alloc >::begin ( ) const
inline

const begin iterator

Returns
begin iterator

Definition at line 219 of file randomaccessset.hxx.

template<class Key , class Compare , class Alloc >
RandomAccessSet< Key, Compare, Alloc >::iterator opengm::RandomAccessSet< Key, Compare, Alloc >::begin ( )
inline

begin iterator

Parameters
beginiterator

Definition at line 254 of file randomaccessset.hxx.

template<class Key, class Compare = std::less<Key>, class Alloc = std::allocator<Key>>
size_t opengm::RandomAccessSet< Key, Compare, Alloc >::capacity ( ) const
inline

Definition at line 106 of file randomaccessset.hxx.

template<class Key , class Compare , class Alloc >
void opengm::RandomAccessSet< Key, Compare, Alloc >::clear ( )
inline

clear the set

erases all elements

Definition at line 435 of file randomaccessset.hxx.

template<class Key, class Compare = std::less<Key>, class Alloc = std::allocator<Key>>
RandomAccessSet< Key, Compare, Alloc >::size_type opengm::RandomAccessSet< Key, Compare, Alloc >::count ( const key_type ) const
inline

count elements

Parameters
element
Returns
zero or one

Definition at line 502 of file randomaccessset.hxx.

template<class Key , class Compare , class Alloc >
bool opengm::RandomAccessSet< Key, Compare, Alloc >::empty ( ) const
inline

query if the set is empty

Returns
true if empty

Definition at line 290 of file randomaccessset.hxx.

template<class Key , class Compare , class Alloc >
RandomAccessSet< Key, Compare, Alloc >::const_iterator opengm::RandomAccessSet< Key, Compare, Alloc >::end ( ) const
inline

const end iterator

Returns
end iterator

Definition at line 228 of file randomaccessset.hxx.

template<class Key , class Compare , class Alloc >
RandomAccessSet< Key, Compare, Alloc >::iterator opengm::RandomAccessSet< Key, Compare, Alloc >::end ( )
inline

end iterator

Parameters
enditerator

Definition at line 263 of file randomaccessset.hxx.

template<class Key, class Compare = std::less<Key>, class Alloc = std::allocator<Key>>
std::pair<const_iterator,const_iterator> opengm::RandomAccessSet< Key, Compare, Alloc >::equal_range ( const key_type ) const
template<class Key, class Compare = std::less<Key>, class Alloc = std::allocator<Key>>
std::pair<iterator,iterator> opengm::RandomAccessSet< Key, Compare, Alloc >::equal_range ( const key_type )
template<class Key, class Compare = std::less<Key>, class Alloc = std::allocator<Key>>
void opengm::RandomAccessSet< Key, Compare, Alloc >::erase ( iterator  position)
template<class Key, class Compare = std::less<Key>, class Alloc = std::allocator<Key>>
size_type opengm::RandomAccessSet< Key, Compare, Alloc >::erase ( const key_type )
template<class Key, class Compare = std::less<Key>, class Alloc = std::allocator<Key>>
void opengm::RandomAccessSet< Key, Compare, Alloc >::erase ( const_iterator  ,
const_iterator   
)
template<class Key, class Compare = std::less<Key>, class Alloc = std::allocator<Key>>
const_iterator opengm::RandomAccessSet< Key, Compare, Alloc >::find ( const key_type ) const
template<class Key, class Compare = std::less<Key>, class Alloc = std::allocator<Key>>
iterator opengm::RandomAccessSet< Key, Compare, Alloc >::find ( const key_type )
template<class Key , class Compare , class Alloc >
RandomAccessSet< Key, Compare, Alloc >::allocator_type opengm::RandomAccessSet< Key, Compare, Alloc >::get_allocator ( ) const
inline

allocators

Returns
allocator

Definition at line 590 of file randomaccessset.hxx.

template<class Key, class Compare = std::less<Key>, class Alloc = std::allocator<Key>>
std::pair< const_iterator,bool> opengm::RandomAccessSet< Key, Compare, Alloc >::insert ( const value_type )
template<class Key , class Compare , class Alloc >
template<class InputIterator >
void opengm::RandomAccessSet< Key, Compare, Alloc >::insert ( InputIterator  first,
InputIterator  last 
)
inline

insert a sequence of elements

Parameters
firstiterator to the first element
lastiterator to the last element

Definition at line 343 of file randomaccessset.hxx.

template<class Key, class Compare = std::less<Key>, class Alloc = std::allocator<Key>>
const_iterator opengm::RandomAccessSet< Key, Compare, Alloc >::insert ( const_iterator  ,
const value_type  
)
template<class Key , class Compare , class Alloc >
RandomAccessSet< Key, Compare, Alloc >::key_compare opengm::RandomAccessSet< Key, Compare, Alloc >::key_comp ( ) const
inline

key comparator

Returns
key comparator

Definition at line 444 of file randomaccessset.hxx.

template<class Key, class Compare = std::less<Key>, class Alloc = std::allocator<Key>>
const_iterator opengm::RandomAccessSet< Key, Compare, Alloc >::lower_bound ( const key_type ) const
template<class Key, class Compare = std::less<Key>, class Alloc = std::allocator<Key>>
iterator opengm::RandomAccessSet< Key, Compare, Alloc >::lower_bound ( const key_type )
template<class Key , class Compare , class Alloc >
RandomAccessSet< Key, Compare, Alloc >::size_type opengm::RandomAccessSet< Key, Compare, Alloc >::max_size ( ) const
inline

maximum size of the underlying container

Returns
the maximum size

Definition at line 308 of file randomaccessset.hxx.

template<class Key , class Compare , class Alloc >
RandomAccessSet< Key, Compare, Alloc > & opengm::RandomAccessSet< Key, Compare, Alloc >::operator= ( const RandomAccessSet< Key, Compare, Alloc > &  src)
inline

assignment operator

Parameters
srcother random access set

Definition at line 204 of file randomaccessset.hxx.

template<class Key, class Compare = std::less<Key>, class Alloc = std::allocator<Key>>
const RandomAccessSet< Key, Compare, Alloc >::value_type & opengm::RandomAccessSet< Key, Compare, Alloc >::operator[] ( const size_type  ) const
inline

const access values

Parameters
indexindex of the value in the set
Returns
value / key at the position index

Definition at line 143 of file randomaccessset.hxx.

template<class Key , class Compare , class Alloc >
RandomAccessSet< Key, Compare, Alloc >::const_iterator opengm::RandomAccessSet< Key, Compare, Alloc >::rbegin ( ) const
inline

reverse const begin iterator

Returns
reverse begin iterator

Definition at line 236 of file randomaccessset.hxx.

template<class Key , class Compare , class Alloc >
RandomAccessSet< Key, Compare, Alloc >::iterator opengm::RandomAccessSet< Key, Compare, Alloc >::rbegin ( )
inline

reverse begin iterator

Parameters
reversebegin iterator

Definition at line 272 of file randomaccessset.hxx.

template<class Key , class Compare , class Alloc >
RandomAccessSet< Key, Compare, Alloc >::const_iterator opengm::RandomAccessSet< Key, Compare, Alloc >::rend ( ) const
inline

reverse const end iterator

Parameters
reverseend iterator

Definition at line 245 of file randomaccessset.hxx.

template<class Key , class Compare , class Alloc >
RandomAccessSet< Key, Compare, Alloc >::iterator opengm::RandomAccessSet< Key, Compare, Alloc >::rend ( )
inline

reverse end iterator

Parameters
reverseend iterator

Definition at line 281 of file randomaccessset.hxx.

template<class Key, class Compare = std::less<Key>, class Alloc = std::allocator<Key>>
void opengm::RandomAccessSet< Key, Compare, Alloc >::reserve ( const size_t  size)
inline

Definition at line 103 of file randomaccessset.hxx.

+ Here is the caller graph for this function:

template<class Key , class Compare , class Alloc >
RandomAccessSet< Key, Compare, Alloc >::size_type opengm::RandomAccessSet< Key, Compare, Alloc >::size ( ) const
inline

number of elements of the set

Returns
number of elements in the set

Definition at line 299 of file randomaccessset.hxx.

template<class Key , class Compare , class Alloc >
void opengm::RandomAccessSet< Key, Compare, Alloc >::swap ( RandomAccessSet< Key, Compare, Alloc > &  rhs)
inline

swap random access sets

Parameters
rhsset to swap with

Definition at line 422 of file randomaccessset.hxx.

template<class Key, class Compare = std::less<Key>, class Alloc = std::allocator<Key>>
const_iterator opengm::RandomAccessSet< Key, Compare, Alloc >::upper_bound ( const key_type ) const
template<class Key, class Compare = std::less<Key>, class Alloc = std::allocator<Key>>
iterator opengm::RandomAccessSet< Key, Compare, Alloc >::upper_bound ( const key_type )
template<class Key , class Compare , class Alloc >
RandomAccessSet< Key, Compare, Alloc >::value_compare opengm::RandomAccessSet< Key, Compare, Alloc >::value_comp ( ) const
inline

value comparator

Returns
value comparator

Definition at line 453 of file randomaccessset.hxx.