TPIE

11a2c2d
tpie::tiny::map< Key, T, Comp, Alloc > Class Template Reference

A std::map compatible map, useful when we do not have many elements (less then 512) More...

#include <tpie/tiny.h>

Inherits tpie::tiny::set_impl< std::pair< Key, T >, T, bits::PairExtract< Key, T >, std::less< Key >, std::allocator< std::pair< Key, T > >, bits::SingleInsertHelp >.

Public Types

typedef std::pair< Key, T > value_type
 
typedef T key_type
 
typedef Inner::iterator iterator
 
typedef Inner::const_iterator const_iterator
 
typedef Inner::reverse_iterator reverse_iterator
 
typedef Inner::const_reverse_iterator const_reverse_iterator
 
typedef std::less< Key > key_compare
 
typedef std::allocator< std::pair< Key, T > > allocator_type
 
typedef IH::result insert_result
 

Public Member Functions

 map (const Comp &comp, const Alloc &alloc=Alloc())
 
 map (const Alloc &alloc)
 
 map (const map &other)
 
 map (const map &other, const Alloc &alloc)
 
 map (map &&other)
 
 map (map &&other, const Alloc &alloc)
 
template<class InputIterator >
 map (InputIterator first, InputIterator last, const Comp &comp=Comp(), const Alloc &alloc=Alloc())
 
 map (std::initializer_list< typename P::value_type > init, const Comp &comp=Comp(), const Alloc &alloc=Alloc())
 
T & operator[] (const Key &key)
 Returns a reference to the value that is mapped to a key equivalent to key, performing an insertion if such key does not already exist. More...
 
T & operator[] (Key &&key)
 Returns a reference to the value that is mapped to a key equivalent to key, performing an insertion if such key does not already exist. More...
 
T & at (const Key &key)
 Returns a reference to the mapped value of the element with key equivalent to key. More...
 
const T & at (const Key &key) const
 Returns a reference to the mapped value of the element with key equivalent to key. More...
 
iterator begin () noexcept
 Returns an iterator to the first element of the container. More...
 
const_iterator begin () const noexcept
 Returns an iterator to the first element of the container. More...
 
const_iterator cbegin () const noexcept
 Returns an iterator to the first element of the container. More...
 
reverse_iterator rbegin () noexcept
 Returns a reverse iterator to the first element of the reversed container. More...
 
const_reverse_iterator rbegin () const noexcept
 Returns a reverse iterator to the first element of the reversed container. More...
 
const_reverse_iterator crbegin () const noexcept
 Returns a reverse iterator to the first element of the reversed container. More...
 
iterator end () noexcept
 Returns an iterator to the element following the last element of the container. More...
 
const_iterator end () const noexcept
 Returns an iterator to the element following the last element of the container. More...
 
const_iterator cend () const noexcept
 Returns an iterator to the element following the last element of the container. More...
 
reverse_iterator rend () noexcept
 Returns a reverse iterator to the element following the last element of the reversed container. More...
 
const_reverse_iterator rend () const noexcept
 Returns a reverse iterator to the element following the last element of the reversed container. More...
 
const_reverse_iterator crend () const noexcept
 Returns a reverse iterator to the element following the last element of the reversed container. More...
 
bool empty () const noexcept
 Checks if the container has no elements, i.e. More...
 
size_t size () const noexcept
 Returns the number of elements in the container, i.e. More...
 
size_t max_size () const noexcept
 Returns the maximum number of elements the container is able to hold due to system or library implementation limitations. More...
 
void clear ()
 Removes all elements from the container. More...
 
iterator erase (iterator pos)
 Removes the element at pos. More...
 
iterator erase (iterator first, iterator last)
 Removes the elements in the range [first; last), which must be a valid range in *this. More...
 
size_t erase (const T &key)
 Removes all elements with the key value key. More...
 
void swap (set_impl &o)
 Exchanges the contents of the container with those of other. More...
 
iterator find (const T &key) noexcept
 Finds an element with key equivalent to key. More...
 
const_iterator find (const T &key) const noexcept
 Finds an element with key equivalent to key. More...
 
std::pair< iterator, iterator > equal_range (const T &key) noexcept
 Returns a range containing all elements with the given key in the container. More...
 
std::pair< const_iterator, const_iterator > equal_range (const T &key) const noexcept
 Returns a range containing all elements with the given key in the container. More...
 
iterator lower_bound (const T &key) noexcept
 Returns an iterator pointing to the first element that is not less than key. More...
 
const_iterator lower_bound (const T &key) const noexcept
 Returns an iterator pointing to the first element that is not less than key. More...
 
iterator lower_bound (const K &key) noexcept
 Returns an iterator pointing to the first element that is not less than key. More...
 
const_iterator lower_bound (const K &key) const noexcept
 Returns an iterator pointing to the first element that is not less than key. More...
 
iterator upper_bound (const T &key) noexcept
 Returns an iterator pointing to the first element that is greater than key. More...
 
const_iterator upper_bound (const T &key) const noexcept
 Returns an iterator pointing to the first element that is greater than key. More...
 
iterator upper_bound (const K &key) noexcept
 Returns an iterator pointing to the first element that is greater than key. More...
 
const_iterator upper_bound (const K &key) const noexcept
 Returns an iterator pointing to the first element that is greater than key. More...
 
key_compare key_comp () const noexcept
 Returns the function object that compares the keys, which is a copy of this container's constructor argument comp. More...
 
value_compare value_comp () const noexcept
 Returns a function object that compares objects of type std::map::value_type (key-value pairs) by using key_comp to compare the first components of the pairs. More...
 
allocator_type get_allocator () const
 Returns the allocator associated with the container. More...
 
size_t count (const T k) const noexcept
 Returns the number of elements with key k. More...
 
insert_result insert (const std::pair< Key, T > &t)
 Inserts element(s) into the container, if the container doesn't already contain an element with an equivalent key. More...
 
insert_result insert (TT &&t)
 Inserts element(s) into the container, if the container doesn't already contain an element with an equivalent key. More...
 
insert_result insert (const_iterator, const std::pair< Key, T > &t)
 Does the same as normal insert, we ignore the hint. More...
 
insert_result insert (const_iterator, TT &&t)
 Does the same as normal insert, we ignore the hint. More...
 
void insert (InputIt first, InputIt last)
 Inserts elements from range [first, last). More...
 
void insert (std::initializer_list< value_type > list)
 Inserts elements from initializer list ilist. More...
 
insert_result emplace (Args &&... args)
 Inserts a new element into the container by constructing it in-place with the given args if there is no element with the key in the container. More...
 
insert_result emplace_hint (const_iterator, Args &&... args)
 Do the same as emplace, and ignore the hint. More...
 
void reserve (size_t new_cap)
 Increase the capacity of the container to a value that's greater or equal to new_cap. More...
 
void shrink_to_fit ()
 Requests the removal of unused capacity. More...
 
size_t capacity () const noexcept
 Returns the number of elements that the container has currently allocated space for. More...
 

Protected Types

typedef std::vector< std::pair< Key, T >, std::allocator< std::pair< Key, T > > > Inner
 
typedef bits::SingleInsertHelp ::template type< Inner > IH
 

Protected Attributes

value_compare comp
 
std::vector< value_type, std::allocator< std::pair< Key, T > > > inner
 

Detailed Description

template<typename Key, typename T, typename Comp = std::less<Key>, typename Alloc = std::allocator<std::pair<Key, T> >>
class tpie::tiny::map< Key, T, Comp, Alloc >

A std::map compatible map, useful when we do not have many elements (less then 512)

Definition at line 713 of file tiny.h.

Member Function Documentation

◆ at() [1/2]

template<typename Key , typename T , typename Comp = std::less<Key>, typename Alloc = std::allocator<std::pair<Key, T> >>
T& tpie::tiny::map< Key, T, Comp, Alloc >::at ( const Key &  key)
inline

Returns a reference to the mapped value of the element with key equivalent to key.

If no such element exists, an exception of type std::out_of_range is thrown.

Definition at line 758 of file tiny.h.

758  {
759  typename P::iterator x=P::lower_bound(key);
760  if (x == P::end() || P::comp(key, *x)) throw std::out_of_range("tiny::map::at");
761  return x->second;
762  }

References tpie::tiny::set_impl< T, Key, KeyExtract, Comp, Alloc, InsertHelp >::end(), and tpie::tiny::set_impl< T, Key, KeyExtract, Comp, Alloc, InsertHelp >::lower_bound().

◆ at() [2/2]

template<typename Key , typename T , typename Comp = std::less<Key>, typename Alloc = std::allocator<std::pair<Key, T> >>
const T& tpie::tiny::map< Key, T, Comp, Alloc >::at ( const Key &  key) const
inline

Returns a reference to the mapped value of the element with key equivalent to key.

If no such element exists, an exception of type std::out_of_range is thrown.

Definition at line 769 of file tiny.h.

769  {
770  typename P::const_iterator x=P::lower_bound(key);
771  if (x == P::end() || P::comp(key, *x)) throw std::out_of_range("tiny::map::at");
772  return x->second;
773  }

References tpie::tiny::set_impl< T, Key, KeyExtract, Comp, Alloc, InsertHelp >::end(), and tpie::tiny::set_impl< T, Key, KeyExtract, Comp, Alloc, InsertHelp >::lower_bound().

◆ begin() [1/2]

const_iterator tpie::tiny::set_impl< std::pair< Key, T > , T , bits::PairExtract< Key, T > , std::less< Key > , std::allocator< std::pair< Key, T > > , bits::SingleInsertHelp >::begin
inlinenoexceptinherited

Returns an iterator to the first element of the container.

Definition at line 224 of file tiny.h.

224 {return inner.cbegin();}

◆ begin() [2/2]

iterator tpie::tiny::set_impl< std::pair< Key, T > , T , bits::PairExtract< Key, T > , std::less< Key > , std::allocator< std::pair< Key, T > > , bits::SingleInsertHelp >::begin
inlinenoexceptinherited

Returns an iterator to the first element of the container.

Definition at line 219 of file tiny.h.

219 {return inner.begin();}

◆ capacity()

size_t tpie::tiny::set_impl< std::pair< Key, T > , T , bits::PairExtract< Key, T > , std::less< Key > , std::allocator< std::pair< Key, T > > , bits::SingleInsertHelp >::capacity
inlinenoexceptinherited

Returns the number of elements that the container has currently allocated space for.

Definition at line 675 of file tiny.h.

675 {return inner.capacity();}

◆ cbegin()

const_iterator tpie::tiny::set_impl< std::pair< Key, T > , T , bits::PairExtract< Key, T > , std::less< Key > , std::allocator< std::pair< Key, T > > , bits::SingleInsertHelp >::cbegin
inlinenoexceptinherited

Returns an iterator to the first element of the container.

Definition at line 229 of file tiny.h.

229 {return inner.cbegin();}

◆ cend()

const_iterator tpie::tiny::set_impl< std::pair< Key, T > , T , bits::PairExtract< Key, T > , std::less< Key > , std::allocator< std::pair< Key, T > > , bits::SingleInsertHelp >::cend
inlinenoexceptinherited

Returns an iterator to the element following the last element of the container.

Definition at line 259 of file tiny.h.

259 {return inner.cend();}

◆ clear()

void tpie::tiny::set_impl< std::pair< Key, T > , T , bits::PairExtract< Key, T > , std::less< Key > , std::allocator< std::pair< Key, T > > , bits::SingleInsertHelp >::clear
inlineinherited

Removes all elements from the container.

Definition at line 300 of file tiny.h.

300 {inner.clear(); }

◆ count()

size_t tpie::tiny::set_impl< std::pair< Key, T > , T , bits::PairExtract< Key, T > , std::less< Key > , std::allocator< std::pair< Key, T > > , bits::SingleInsertHelp >::count ( const T  k) const
inlinenoexceptinherited

Returns the number of elements with key k.

Definition at line 563 of file tiny.h.

563  {
564  if (IH::multi) {
565  auto x=equal_range(k);
566  return x.second - x.first;
567  } else {
568  auto x=lower_bound(k);
569  if (x == end() || comp(k, *x)) return 0;
570  return 1;
571  }
572  }

◆ crbegin()

const_reverse_iterator tpie::tiny::set_impl< std::pair< Key, T > , T , bits::PairExtract< Key, T > , std::less< Key > , std::allocator< std::pair< Key, T > > , bits::SingleInsertHelp >::crbegin
inlinenoexceptinherited

Returns a reverse iterator to the first element of the reversed container.

Definition at line 244 of file tiny.h.

244 {return inner.rbegin();}

◆ crend()

const_reverse_iterator tpie::tiny::set_impl< std::pair< Key, T > , T , bits::PairExtract< Key, T > , std::less< Key > , std::allocator< std::pair< Key, T > > , bits::SingleInsertHelp >::crend
inlinenoexceptinherited

Returns a reverse iterator to the element following the last element of the reversed container.

Definition at line 277 of file tiny.h.

277 {return inner.rend();}

◆ emplace()

insert_result tpie::tiny::set_impl< std::pair< Key, T > , T , bits::PairExtract< Key, T > , std::less< Key > , std::allocator< std::pair< Key, T > > , bits::SingleInsertHelp >::emplace ( Args &&...  args)
inlineinherited

Inserts a new element into the container by constructing it in-place with the given args if there is no element with the key in the container.


Returns
Returns a pair consisting of an iterator to the inserted element, or the already-existing element if no insertion happened, and a bool denoting whether the insertion took place.

Definition at line 645 of file tiny.h.

645  {
646  inner.emplace_back(std::forward<Args>(args)...);
647  return IH::handle(inner, comp);
648  }

◆ emplace_hint()

insert_result tpie::tiny::set_impl< std::pair< Key, T > , T , bits::PairExtract< Key, T > , std::less< Key > , std::allocator< std::pair< Key, T > > , bits::SingleInsertHelp >::emplace_hint ( const_iterator  ,
Args &&...  args 
)
inlineinherited

Do the same as emplace, and ignore the hint.

Definition at line 654 of file tiny.h.

654  {
655  return emplace(std::forward<Args>(args)...);
656  }

◆ empty()

bool tpie::tiny::set_impl< std::pair< Key, T > , T , bits::PairExtract< Key, T > , std::less< Key > , std::allocator< std::pair< Key, T > > , bits::SingleInsertHelp >::empty
inlinenoexceptinherited

Checks if the container has no elements, i.e.

whether begin() == end().

Definition at line 283 of file tiny.h.

283 {return inner.empty();}

◆ end() [1/2]

const_iterator tpie::tiny::set_impl< std::pair< Key, T > , T , bits::PairExtract< Key, T > , std::less< Key > , std::allocator< std::pair< Key, T > > , bits::SingleInsertHelp >::end
inlinenoexceptinherited

Returns an iterator to the element following the last element of the container.

Definition at line 254 of file tiny.h.

254 {return inner.cend();}

◆ end() [2/2]

iterator tpie::tiny::set_impl< std::pair< Key, T > , T , bits::PairExtract< Key, T > , std::less< Key > , std::allocator< std::pair< Key, T > > , bits::SingleInsertHelp >::end
inlinenoexceptinherited

Returns an iterator to the element following the last element of the container.

Definition at line 249 of file tiny.h.

249 {return inner.end();}

◆ equal_range() [1/2]

std::pair<const_iterator, const_iterator> tpie::tiny::set_impl< std::pair< Key, T > , T , bits::PairExtract< Key, T > , std::less< Key > , std::allocator< std::pair< Key, T > > , bits::SingleInsertHelp >::equal_range ( const T &  key) const
inlinenoexceptinherited

Returns a range containing all elements with the given key in the container.

The range is defined by two iterators, one pointing to the first element that is not less than key and another pointing to the first element greater than key.

Definition at line 380 of file tiny.h.

380  {
381  return std::equal_range(inner.begin(), inner.end(), key, comp);
382  }

◆ equal_range() [2/2]

std::pair<iterator, iterator> tpie::tiny::set_impl< std::pair< Key, T > , T , bits::PairExtract< Key, T > , std::less< Key > , std::allocator< std::pair< Key, T > > , bits::SingleInsertHelp >::equal_range ( const T &  key)
inlinenoexceptinherited

Returns a range containing all elements with the given key in the container.

The range is defined by two iterators, one pointing to the first element that is not less than key and another pointing to the first element greater than key.

Definition at line 370 of file tiny.h.

370  {
371  return std::equal_range(inner.begin(), inner.end(), key, comp);
372  }

◆ erase() [1/3]

size_t tpie::tiny::set_impl< std::pair< Key, T > , T , bits::PairExtract< Key, T > , std::less< Key > , std::allocator< std::pair< Key, T > > , bits::SingleInsertHelp >::erase ( const T &  key)
inlineinherited

Removes all elements with the key value key.

Returns
Number of elements removed.

Definition at line 327 of file tiny.h.

327  {
328  auto x=equal_range(key);
329  auto res = x.second - x.first;
330  erase(x.first, x.second);
331  return res;
332  }

◆ erase() [2/3]

iterator tpie::tiny::set_impl< std::pair< Key, T > , T , bits::PairExtract< Key, T > , std::less< Key > , std::allocator< std::pair< Key, T > > , bits::SingleInsertHelp >::erase ( iterator  first,
iterator  last 
)
inlineinherited

Removes the elements in the range [first; last), which must be a valid range in *this.

Returns
Iterator following the last removed element.

Definition at line 317 of file tiny.h.

317  {
318  std::rotate(first, last, inner.end());
319  inner.resize(size() - (last-first));
320  return begin();
321  }

◆ erase() [3/3]

iterator tpie::tiny::set_impl< std::pair< Key, T > , T , bits::PairExtract< Key, T > , std::less< Key > , std::allocator< std::pair< Key, T > > , bits::SingleInsertHelp >::erase ( iterator  pos)
inlineinherited

Removes the element at pos.

Returns
Iterator following the last removed element.

Definition at line 306 of file tiny.h.

306  {
307  std::rotate(pos, std::next(pos), inner.end());
308  inner.pop_back();
309  return pos;
310  }

◆ find() [1/2]

const_iterator tpie::tiny::set_impl< std::pair< Key, T > , T , bits::PairExtract< Key, T > , std::less< Key > , std::allocator< std::pair< Key, T > > , bits::SingleInsertHelp >::find ( const T &  key) const
inlinenoexceptinherited

Finds an element with key equivalent to key.

If no such element is found, past-the-end iterator is returned.

Definition at line 358 of file tiny.h.

358  {
359  const_iterator x=lower_bound(key);
360  if (x == end() || comp(key, *x)) return end();
361  return x;
362  }

◆ find() [2/2]

iterator tpie::tiny::set_impl< std::pair< Key, T > , T , bits::PairExtract< Key, T > , std::less< Key > , std::allocator< std::pair< Key, T > > , bits::SingleInsertHelp >::find ( const T &  key)
inlinenoexceptinherited

Finds an element with key equivalent to key.

If no such element is found, past-the-end iterator is returned.

Definition at line 348 of file tiny.h.

348  {
349  iterator x=lower_bound(key);
350  if (x == end() || comp(key, *x)) return end();
351  return x;
352  }

◆ get_allocator()

allocator_type tpie::tiny::set_impl< std::pair< Key, T > , T , bits::PairExtract< Key, T > , std::less< Key > , std::allocator< std::pair< Key, T > > , bits::SingleInsertHelp >::get_allocator
inlineinherited

Returns the allocator associated with the container.

Definition at line 473 of file tiny.h.

473  {
474  return inner.get_allocator();
475  }

◆ insert() [1/6]

insert_result tpie::tiny::set_impl< std::pair< Key, T > , T , bits::PairExtract< Key, T > , std::less< Key > , std::allocator< std::pair< Key, T > > , bits::SingleInsertHelp >::insert ( const std::pair< Key, T > &  t)
inlineinherited

Inserts element(s) into the container, if the container doesn't already contain an element with an equivalent key.

Returns
Returns a pair consisting of an iterator to the inserted element (or to the element that prevented the insertion) and a bool denoting whether the insertion took place.

Definition at line 583 of file tiny.h.

583  {
584  inner.push_back(t);
585  return IH::handle(inner, comp);
586  }

◆ insert() [2/6]

insert_result tpie::tiny::set_impl< std::pair< Key, T > , T , bits::PairExtract< Key, T > , std::less< Key > , std::allocator< std::pair< Key, T > > , bits::SingleInsertHelp >::insert ( const_iterator  ,
const std::pair< Key, T > &  t 
)
inlineinherited

Does the same as normal insert, we ignore the hint.

Definition at line 605 of file tiny.h.

605  {
606  return insert(t);
607  }

◆ insert() [3/6]

insert_result tpie::tiny::set_impl< std::pair< Key, T > , T , bits::PairExtract< Key, T > , std::less< Key > , std::allocator< std::pair< Key, T > > , bits::SingleInsertHelp >::insert ( const_iterator  ,
TT &&  t 
)
inlineinherited

Does the same as normal insert, we ignore the hint.

Definition at line 613 of file tiny.h.

613  {
614  return insert(std::forward<TT>(t));
615  }

◆ insert() [4/6]

void tpie::tiny::set_impl< std::pair< Key, T > , T , bits::PairExtract< Key, T > , std::less< Key > , std::allocator< std::pair< Key, T > > , bits::SingleInsertHelp >::insert ( InputIt  first,
InputIt  last 
)
inlineinherited

Inserts elements from range [first, last).

Definition at line 621 of file tiny.h.

621  {
622  inner.reserve(size() + last-first);
623  for (InputIt i=first; i != last; ++i)
624  insert(*i);
625  }

◆ insert() [5/6]

void tpie::tiny::set_impl< std::pair< Key, T > , T , bits::PairExtract< Key, T > , std::less< Key > , std::allocator< std::pair< Key, T > > , bits::SingleInsertHelp >::insert ( std::initializer_list< value_type >  list)
inlineinherited

Inserts elements from initializer list ilist.

Definition at line 630 of file tiny.h.

630  {
631  insert(list.begin(), list.end());
632  }

◆ insert() [6/6]

insert_result tpie::tiny::set_impl< std::pair< Key, T > , T , bits::PairExtract< Key, T > , std::less< Key > , std::allocator< std::pair< Key, T > > , bits::SingleInsertHelp >::insert ( TT &&  t)
inlineinherited

Inserts element(s) into the container, if the container doesn't already contain an element with an equivalent key.

Returns
Returns a pair consisting of an iterator to the inserted element (or to the element that prevented the insertion) and a bool denoting whether the insertion took place.

Definition at line 598 of file tiny.h.

598  {
599  return emplace(std::forward<TT>(t));
600  }

◆ key_comp()

key_compare tpie::tiny::set_impl< std::pair< Key, T > , T , bits::PairExtract< Key, T > , std::less< Key > , std::allocator< std::pair< Key, T > > , bits::SingleInsertHelp >::key_comp
inlinenoexceptinherited

Returns the function object that compares the keys, which is a copy of this container's constructor argument comp.

Definition at line 457 of file tiny.h.

457  {
458  return comp.comp;
459  }

◆ lower_bound() [1/4]

const_iterator tpie::tiny::set_impl< std::pair< Key, T > , T , bits::PairExtract< Key, T > , std::less< Key > , std::allocator< std::pair< Key, T > > , bits::SingleInsertHelp >::lower_bound ( const K &  key) const
inlinenoexceptinherited

Returns an iterator pointing to the first element that is not less than key.

Definition at line 430 of file tiny.h.

430  {
431  return std::lower_bound(inner.begin(), inner.end(), key, comp);
432  }

◆ lower_bound() [2/4]

iterator tpie::tiny::set_impl< std::pair< Key, T > , T , bits::PairExtract< Key, T > , std::less< Key > , std::allocator< std::pair< Key, T > > , bits::SingleInsertHelp >::lower_bound ( const K &  key)
inlinenoexceptinherited

Returns an iterator pointing to the first element that is not less than key.

Definition at line 421 of file tiny.h.

421  {
422  return std::lower_bound(inner.begin(), inner.end(), key, comp);
423  }

◆ lower_bound() [3/4]

const_iterator tpie::tiny::set_impl< std::pair< Key, T > , T , bits::PairExtract< Key, T > , std::less< Key > , std::allocator< std::pair< Key, T > > , bits::SingleInsertHelp >::lower_bound ( const T &  key) const
inlinenoexceptinherited

Returns an iterator pointing to the first element that is not less than key.

Definition at line 396 of file tiny.h.

396  {
397  return std::lower_bound(inner.begin(), inner.end(), key, comp);
398  }

◆ lower_bound() [4/4]

iterator tpie::tiny::set_impl< std::pair< Key, T > , T , bits::PairExtract< Key, T > , std::less< Key > , std::allocator< std::pair< Key, T > > , bits::SingleInsertHelp >::lower_bound ( const T &  key)
inlinenoexceptinherited

Returns an iterator pointing to the first element that is not less than key.

Definition at line 388 of file tiny.h.

388  {
389  return std::lower_bound(inner.begin(), inner.end(), key, comp);
390  }

◆ max_size()

size_t tpie::tiny::set_impl< std::pair< Key, T > , T , bits::PairExtract< Key, T > , std::less< Key > , std::allocator< std::pair< Key, T > > , bits::SingleInsertHelp >::max_size
inlinenoexceptinherited

Returns the maximum number of elements the container is able to hold due to system or library implementation limitations.

Definition at line 295 of file tiny.h.

295 {return inner.max_size();}

◆ operator[]() [1/2]

template<typename Key , typename T , typename Comp = std::less<Key>, typename Alloc = std::allocator<std::pair<Key, T> >>
T& tpie::tiny::map< Key, T, Comp, Alloc >::operator[] ( const Key &  key)
inline

Returns a reference to the value that is mapped to a key equivalent to key, performing an insertion if such key does not already exist.

Definition at line 740 of file tiny.h.

740  {
741  return this->emplace(key, T()).first->second;
742  }

References tpie::tiny::set_impl< std::pair< Key, T >, T, bits::PairExtract< Key, T >, std::less< Key >, std::allocator< std::pair< Key, T > >, bits::SingleInsertHelp >::emplace().

◆ operator[]() [2/2]

template<typename Key , typename T , typename Comp = std::less<Key>, typename Alloc = std::allocator<std::pair<Key, T> >>
T& tpie::tiny::map< Key, T, Comp, Alloc >::operator[] ( Key &&  key)
inline

Returns a reference to the value that is mapped to a key equivalent to key, performing an insertion if such key does not already exist.

Definition at line 749 of file tiny.h.

749  {
750  return this->emplace(std::move(key), T()).first->second;
751  }

References tpie::tiny::set_impl< std::pair< Key, T >, T, bits::PairExtract< Key, T >, std::less< Key >, std::allocator< std::pair< Key, T > >, bits::SingleInsertHelp >::emplace().

◆ rbegin() [1/2]

const_reverse_iterator tpie::tiny::set_impl< std::pair< Key, T > , T , bits::PairExtract< Key, T > , std::less< Key > , std::allocator< std::pair< Key, T > > , bits::SingleInsertHelp >::rbegin
inlinenoexceptinherited

Returns a reverse iterator to the first element of the reversed container.

Definition at line 239 of file tiny.h.

239 {return inner.rbegin();}

◆ rbegin() [2/2]

reverse_iterator tpie::tiny::set_impl< std::pair< Key, T > , T , bits::PairExtract< Key, T > , std::less< Key > , std::allocator< std::pair< Key, T > > , bits::SingleInsertHelp >::rbegin
inlinenoexceptinherited

Returns a reverse iterator to the first element of the reversed container.

Definition at line 234 of file tiny.h.

234 {return inner.rbegin();}

◆ rend() [1/2]

const_reverse_iterator tpie::tiny::set_impl< std::pair< Key, T > , T , bits::PairExtract< Key, T > , std::less< Key > , std::allocator< std::pair< Key, T > > , bits::SingleInsertHelp >::rend
inlinenoexceptinherited

Returns a reverse iterator to the element following the last element of the reversed container.

Definition at line 271 of file tiny.h.

271 {return inner.rend();}

◆ rend() [2/2]

reverse_iterator tpie::tiny::set_impl< std::pair< Key, T > , T , bits::PairExtract< Key, T > , std::less< Key > , std::allocator< std::pair< Key, T > > , bits::SingleInsertHelp >::rend
inlinenoexceptinherited

Returns a reverse iterator to the element following the last element of the reversed container.

Definition at line 265 of file tiny.h.

265 {return inner.rend();}

◆ reserve()

void tpie::tiny::set_impl< std::pair< Key, T > , T , bits::PairExtract< Key, T > , std::less< Key > , std::allocator< std::pair< Key, T > > , bits::SingleInsertHelp >::reserve ( size_t  new_cap)
inlineinherited

Increase the capacity of the container to a value that's greater or equal to new_cap.

If new_cap is greater than the current capacity(), new storage is allocated, otherwise the method does nothing.

Definition at line 664 of file tiny.h.

664 {inner.reserve(new_cap);}

◆ shrink_to_fit()

void tpie::tiny::set_impl< std::pair< Key, T > , T , bits::PairExtract< Key, T > , std::less< Key > , std::allocator< std::pair< Key, T > > , bits::SingleInsertHelp >::shrink_to_fit
inlineinherited

Requests the removal of unused capacity.

Definition at line 669 of file tiny.h.

669 {inner.shrink_to_fit();}

◆ size()

size_t tpie::tiny::set_impl< std::pair< Key, T > , T , bits::PairExtract< Key, T > , std::less< Key > , std::allocator< std::pair< Key, T > > , bits::SingleInsertHelp >::size
inlinenoexceptinherited

Returns the number of elements in the container, i.e.

std::distance(begin(), end())

Definition at line 288 of file tiny.h.

288 {return inner.size();}

◆ swap()

void tpie::tiny::set_impl< std::pair< Key, T > , T , bits::PairExtract< Key, T > , std::less< Key > , std::allocator< std::pair< Key, T > > , bits::SingleInsertHelp >::swap ( set_impl< std::pair< Key, T >, T, bits::PairExtract< Key, T >, std::less< Key >, std::allocator< std::pair< Key, T > >, bits::SingleInsertHelp > &  o)
inlineinherited

Exchanges the contents of the container with those of other.

Does not invoke any move, copy, or swap operations on individual elements.

Definition at line 339 of file tiny.h.

339  {
340  std::swap(comp, o.comp);
341  std::swap(inner, o.inner);
342  }

◆ upper_bound() [1/4]

const_iterator tpie::tiny::set_impl< std::pair< Key, T > , T , bits::PairExtract< Key, T > , std::less< Key > , std::allocator< std::pair< Key, T > > , bits::SingleInsertHelp >::upper_bound ( const K &  key) const
inlinenoexceptinherited

Returns an iterator pointing to the first element that is greater than key.

Definition at line 448 of file tiny.h.

448  {
449  return std::upper_bound(inner.begin(), inner.end(), key, comp);
450  }

◆ upper_bound() [2/4]

iterator tpie::tiny::set_impl< std::pair< Key, T > , T , bits::PairExtract< Key, T > , std::less< Key > , std::allocator< std::pair< Key, T > > , bits::SingleInsertHelp >::upper_bound ( const K &  key)
inlinenoexceptinherited

Returns an iterator pointing to the first element that is greater than key.

Definition at line 439 of file tiny.h.

439  {
440  return std::upper_bound(inner.begin(), inner.end(), key, comp);
441  }

◆ upper_bound() [3/4]

const_iterator tpie::tiny::set_impl< std::pair< Key, T > , T , bits::PairExtract< Key, T > , std::less< Key > , std::allocator< std::pair< Key, T > > , bits::SingleInsertHelp >::upper_bound ( const T &  key) const
inlinenoexceptinherited

Returns an iterator pointing to the first element that is greater than key.

Definition at line 412 of file tiny.h.

412  {
413  return std::upper_bound(inner.begin(), inner.end(), key, comp);
414  }

◆ upper_bound() [4/4]

iterator tpie::tiny::set_impl< std::pair< Key, T > , T , bits::PairExtract< Key, T > , std::less< Key > , std::allocator< std::pair< Key, T > > , bits::SingleInsertHelp >::upper_bound ( const T &  key)
inlinenoexceptinherited

Returns an iterator pointing to the first element that is greater than key.

Definition at line 404 of file tiny.h.

404  {
405  return std::upper_bound(inner.begin(), inner.end(), key, comp);
406  }

◆ value_comp()

value_compare tpie::tiny::set_impl< std::pair< Key, T > , T , bits::PairExtract< Key, T > , std::less< Key > , std::allocator< std::pair< Key, T > > , bits::SingleInsertHelp >::value_comp
inlinenoexceptinherited

Returns a function object that compares objects of type std::map::value_type (key-value pairs) by using key_comp to compare the first components of the pairs.

Definition at line 466 of file tiny.h.

466  {
467  return comp;
468  }

The documentation for this class was generated from the following file:
tpie::tiny::set_impl< std::pair< Key, T >, T, bits::PairExtract< Key, T >, std::less< Key >, std::allocator< std::pair< Key, T > >, bits::SingleInsertHelp >::size
size_t size() const noexcept
Returns the number of elements in the container, i.e.
Definition: tiny.h:288
tpie::tiny::set_impl::end
iterator end() noexcept
Returns an iterator to the element following the last element of the container.
Definition: tiny.h:249
tpie::tiny::set_impl< std::pair< Key, T >, T, bits::PairExtract< Key, T >, std::less< Key >, std::allocator< std::pair< Key, T > >, bits::SingleInsertHelp >::emplace
insert_result emplace(Args &&... args)
Inserts a new element into the container by constructing it in-place with the given args if there is ...
Definition: tiny.h:645
tpie::tiny::set_impl< std::pair< Key, T >, T, bits::PairExtract< Key, T >, std::less< Key >, std::allocator< std::pair< Key, T > >, bits::SingleInsertHelp >::begin
iterator begin() noexcept
Returns an iterator to the first element of the container.
Definition: tiny.h:219
tpie::tiny::set_impl< std::pair< Key, T >, T, bits::PairExtract< Key, T >, std::less< Key >, std::allocator< std::pair< Key, T > >, bits::SingleInsertHelp >::insert
insert_result insert(const std::pair< Key, T > &t)
Inserts element(s) into the container, if the container doesn't already contain an element with an eq...
Definition: tiny.h:583
tpie::tiny::set_impl< std::pair< Key, T >, T, bits::PairExtract< Key, T >, std::less< Key >, std::allocator< std::pair< Key, T > >, bits::SingleInsertHelp >::equal_range
std::pair< iterator, iterator > equal_range(const T &key) noexcept
Returns a range containing all elements with the given key in the container.
Definition: tiny.h:370
tpie::tiny::set_impl< std::pair< Key, T >, T, bits::PairExtract< Key, T >, std::less< Key >, std::allocator< std::pair< Key, T > >, bits::SingleInsertHelp >::erase
iterator erase(iterator pos)
Removes the element at pos.
Definition: tiny.h:306
std::swap
void swap(tpie::uncompressed_stream< T > &a, tpie::uncompressed_stream< T > &b)
Enable std::swapping two tpie::file_streams.
Definition: uncompressed_stream.h:182
tpie::tiny::set_impl::lower_bound
iterator lower_bound(const Key &key) noexcept
Returns an iterator pointing to the first element that is not less than key.
Definition: tiny.h:388