Boost  v1.57.0
doxygen for www.boost.org
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Modules Pages
boost::container::map< Key, T, Compare, Allocator, MapOptions > Class Template Reference

#include <map.hpp>

Inheritance diagram for boost::container::map< Key, T, Compare, Allocator, MapOptions >:

Public Types

typedef Key key_type
 
typedef
::boost::container::allocator_traits
< Allocator > 
allocator_traits_type
 
typedef T mapped_type
 
typedef std::pair< const Key, Tvalue_type
 
typedef
boost::container::allocator_traits
< Allocator >::pointer 
pointer
 
typedef
boost::container::allocator_traits
< Allocator >::const_pointer 
const_pointer
 
typedef
boost::container::allocator_traits
< Allocator >::reference 
reference
 
typedef
boost::container::allocator_traits
< Allocator >::const_reference 
const_reference
 
typedef
boost::container::allocator_traits
< Allocator >::size_type 
size_type
 
typedef
boost::container::allocator_traits
< Allocator >::difference_type 
difference_type
 
typedef Allocator allocator_type
 
typedef Compare key_compare
 
typedef std::pair< key_type,
mapped_type
nonconst_value_type
 

Public Member Functions

typedef BOOST_CONTAINER_IMPDEF (base_t::stored_allocator_type) stored_allocator_type
 
typedef BOOST_CONTAINER_IMPDEF (value_compare_impl) value_compare
 
typedef BOOST_CONTAINER_IMPDEF (base_t::iterator) iterator
 
typedef BOOST_CONTAINER_IMPDEF (base_t::const_iterator) const _iterator
 
typedef BOOST_CONTAINER_IMPDEF (base_t::reverse_iterator) reverse_iterator
 
typedef BOOST_CONTAINER_IMPDEF (base_t::const_reverse_iterator) const _reverse_iterator
 
typedef BOOST_CONTAINER_IMPDEF (movable_value_type_impl) movable_value_type
 
 map ()
 Effects: Default constructs an empty map. More...
 
 map (const Compare &comp, const allocator_type &a=allocator_type())
 Effects: Constructs an empty map using the specified comparison object and allocator. More...
 
 map (const allocator_type &a)
 Effects: Constructs an empty map using the specified allocator. More...
 
template<class InputIterator >
 map (InputIterator first, InputIterator last, const Compare &comp=Compare(), const allocator_type &a=allocator_type())
 Effects: Constructs an empty map using the specified comparison object and allocator, and inserts elements from the range [first ,last ). More...
 
template<class InputIterator >
 map (ordered_unique_range_t, InputIterator first, InputIterator last, const Compare &comp=Compare(), const allocator_type &a=allocator_type())
 Effects: Constructs an empty map using the specified comparison object and allocator, and inserts elements from the ordered unique range [first ,last). More...
 
 map (std::initializer_list< value_type > il, const Compare &comp=Compare(), const allocator_type &a=allocator_type())
 Effects: Constructs an empty map using the specified comparison object and allocator, and inserts elements from the range [il.begin(), il.end()). More...
 
 map (ordered_unique_range_t, std::initializer_list< value_type > il, const Compare &comp=Compare(), const allocator_type &a=allocator_type())
 
 map (const map &x)
 Effects: Copy constructs a map. More...
 
 map (BOOST_RV_REF(map) x)
 Effects: Move constructs a map. More...
 
 map (const map &x, const allocator_type &a)
 Effects: Copy constructs a map using the specified allocator. More...
 
 map (BOOST_RV_REF(map) x, const allocator_type &a)
 Effects: Move constructs a map using the specified allocator. More...
 
mapoperator= (BOOST_COPY_ASSIGN_REF(map) x)
 Effects: Makes *this a copy of x. More...
 
mapoperator= (BOOST_RV_REF(map) x) BOOST_CONTAINER_NOEXCEPT_IF(allocator_traits_type
 Effects: this->swap(x.get()). More...
 
mapoperator= (std::initializer_list< value_type > il)
 Effects: Assign content of il to *this. More...
 
Tat (const key_type &k)
 Returns: Allocator reference to the element whose key is equivalent to x. More...
 
const Tat (const key_type &k) const
 Returns: Allocator reference to the element whose key is equivalent to x. More...
 
std::pair< iterator, bool > insert (const value_type &x)
 Effects: Inserts x if and only if there is no element in the container with key equivalent to the key of x. More...
 
std::pair< iterator, bool > insert (const nonconst_value_type &x)
 Effects: Inserts a new value_type created from the pair if and only if there is no element in the container with key equivalent to the key of x. More...
 
std::pair< iterator, bool > insert (BOOST_RV_REF(nonconst_value_type) x)
 Effects: Inserts a new value_type move constructed from the pair if and only if there is no element in the container with key equivalent to the key of x. More...
 
std::pair< iterator, bool > insert (BOOST_RV_REF(movable_value_type) x)
 Effects: Inserts a new value_type move constructed from the pair if and only if there is no element in the container with key equivalent to the key of x. More...
 
std::pair< iterator, bool > insert (BOOST_RV_REF(value_type) x)
 Effects: Move constructs a new value from x if and only if there is no element in the container with key equivalent to the key of x. More...
 
iterator insert (const_iterator p, const value_type &x)
 Effects: Inserts a copy of x in the container if and only if there is no element in the container with key equivalent to the key of x. More...
 
iterator insert (const_iterator p, BOOST_RV_REF(nonconst_value_type) x)
 Effects: Move constructs a new value from x if and only if there is no element in the container with key equivalent to the key of x. More...
 
iterator insert (const_iterator p, BOOST_RV_REF(movable_value_type) x)
 Effects: Move constructs a new value from x if and only if there is no element in the container with key equivalent to the key of x. More...
 
iterator insert (const_iterator p, const nonconst_value_type &x)
 Effects: Inserts a copy of x in the container. More...
 
iterator insert (const_iterator p, BOOST_RV_REF(value_type) x)
 Effects: Inserts an element move constructed from x in the container. More...
 
template<class InputIterator >
void insert (InputIterator first, InputIterator last)
 Requires: first, last are not iterators into *this. More...
 
void insert (std::initializer_list< value_type > il)
 Effects: inserts each element from the range [il.begin(), il.end()) if and only if there is no element with key equivalent to the key of that element. More...
 
size_type count (const key_type &x) const
 Returns: The number of elements with key equivalent to x. More...
 

Member Typedef Documentation

template<class Key, class T, class Compare, class Allocator , class MapOptions >
typedef ::boost::container::allocator_traits<Allocator> boost::container::map< Key, T, Compare, Allocator, MapOptions >::allocator_traits_type
template<class Key, class T, class Compare, class Allocator , class MapOptions >
typedef Allocator boost::container::map< Key, T, Compare, Allocator, MapOptions >::allocator_type
template<class Key, class T, class Compare, class Allocator , class MapOptions >
typedef boost::container::allocator_traits<Allocator>::const_pointer boost::container::map< Key, T, Compare, Allocator, MapOptions >::const_pointer
template<class Key, class T, class Compare, class Allocator , class MapOptions >
typedef boost::container::allocator_traits<Allocator>::const_reference boost::container::map< Key, T, Compare, Allocator, MapOptions >::const_reference
template<class Key, class T, class Compare, class Allocator , class MapOptions >
typedef boost::container::allocator_traits<Allocator>::difference_type boost::container::map< Key, T, Compare, Allocator, MapOptions >::difference_type
template<class Key, class T, class Compare, class Allocator , class MapOptions >
typedef Compare boost::container::map< Key, T, Compare, Allocator, MapOptions >::key_compare
template<class Key, class T, class Compare, class Allocator , class MapOptions >
typedef Key boost::container::map< Key, T, Compare, Allocator, MapOptions >::key_type
template<class Key, class T, class Compare, class Allocator , class MapOptions >
typedef T boost::container::map< Key, T, Compare, Allocator, MapOptions >::mapped_type
template<class Key, class T, class Compare, class Allocator , class MapOptions >
typedef std::pair<key_type, mapped_type> boost::container::map< Key, T, Compare, Allocator, MapOptions >::nonconst_value_type
template<class Key, class T, class Compare, class Allocator , class MapOptions >
typedef boost::container::allocator_traits<Allocator>::pointer boost::container::map< Key, T, Compare, Allocator, MapOptions >::pointer
template<class Key, class T, class Compare, class Allocator , class MapOptions >
typedef boost::container::allocator_traits<Allocator>::reference boost::container::map< Key, T, Compare, Allocator, MapOptions >::reference
template<class Key, class T, class Compare, class Allocator , class MapOptions >
typedef boost::container::allocator_traits<Allocator>::size_type boost::container::map< Key, T, Compare, Allocator, MapOptions >::size_type
template<class Key, class T, class Compare, class Allocator , class MapOptions >
typedef std::pair<const Key, T> boost::container::map< Key, T, Compare, Allocator, MapOptions >::value_type

Constructor & Destructor Documentation

template<class Key, class T, class Compare, class Allocator , class MapOptions >
boost::container::map< Key, T, Compare, Allocator, MapOptions >::map ( )
inline

Effects: Default constructs an empty map.

Complexity: Constant.

template<class Key, class T, class Compare, class Allocator , class MapOptions >
boost::container::map< Key, T, Compare, Allocator, MapOptions >::map ( const Compare &  comp,
const allocator_type a = allocator_type() 
)
inlineexplicit

Effects: Constructs an empty map using the specified comparison object and allocator.

Complexity: Constant.

template<class Key, class T, class Compare, class Allocator , class MapOptions >
boost::container::map< Key, T, Compare, Allocator, MapOptions >::map ( const allocator_type a)
inlineexplicit

Effects: Constructs an empty map using the specified allocator.

Complexity: Constant.

template<class Key, class T, class Compare, class Allocator , class MapOptions >
template<class InputIterator >
boost::container::map< Key, T, Compare, Allocator, MapOptions >::map ( InputIterator  first,
InputIterator  last,
const Compare &  comp = Compare(),
const allocator_type a = allocator_type() 
)
inline

Effects: Constructs an empty map using the specified comparison object and allocator, and inserts elements from the range [first ,last ).

Complexity: Linear in N if the range [first ,last ) is already sorted using comp and otherwise N logN, where N is last - first.

template<class Key, class T, class Compare, class Allocator , class MapOptions >
template<class InputIterator >
boost::container::map< Key, T, Compare, Allocator, MapOptions >::map ( ordered_unique_range_t  ,
InputIterator  first,
InputIterator  last,
const Compare &  comp = Compare(),
const allocator_type a = allocator_type() 
)
inline

Effects: Constructs an empty map using the specified comparison object and allocator, and inserts elements from the ordered unique range [first ,last).

This function is more efficient than the normal range creation for ordered ranges.

Requires: [first ,last) must be ordered according to the predicate and must be unique values.

Complexity: Linear in N.

Note: Non-standard extension.

template<class Key, class T, class Compare, class Allocator , class MapOptions >
boost::container::map< Key, T, Compare, Allocator, MapOptions >::map ( std::initializer_list< value_type il,
const Compare &  comp = Compare(),
const allocator_type a = allocator_type() 
)
inline

Effects: Constructs an empty map using the specified comparison object and allocator, and inserts elements from the range [il.begin(), il.end()).

Complexity: Linear in N if the range [first ,last ) is already sorted using comp and otherwise N logN, where N is il.first() - il.end().

template<class Key, class T, class Compare, class Allocator , class MapOptions >
boost::container::map< Key, T, Compare, Allocator, MapOptions >::map ( ordered_unique_range_t  ,
std::initializer_list< value_type il,
const Compare &  comp = Compare(),
const allocator_type a = allocator_type() 
)
inline
template<class Key, class T, class Compare, class Allocator , class MapOptions >
boost::container::map< Key, T, Compare, Allocator, MapOptions >::map ( const map< Key, T, Compare, Allocator, MapOptions > &  x)
inline

Effects: Copy constructs a map.

Complexity: Linear in x.size().

template<class Key, class T, class Compare, class Allocator , class MapOptions >
boost::container::map< Key, T, Compare, Allocator, MapOptions >::map ( BOOST_RV_REF(map< Key, T, Compare, Allocator, MapOptions >)  x)
inline

Effects: Move constructs a map.

Constructs *this using x's resources.

Complexity: Constant.

Postcondition: x is emptied.

template<class Key, class T, class Compare, class Allocator , class MapOptions >
boost::container::map< Key, T, Compare, Allocator, MapOptions >::map ( const map< Key, T, Compare, Allocator, MapOptions > &  x,
const allocator_type a 
)
inline

Effects: Copy constructs a map using the specified allocator.

Complexity: Linear in x.size().

template<class Key, class T, class Compare, class Allocator , class MapOptions >
boost::container::map< Key, T, Compare, Allocator, MapOptions >::map ( BOOST_RV_REF(map< Key, T, Compare, Allocator, MapOptions >)  x,
const allocator_type a 
)
inline

Effects: Move constructs a map using the specified allocator.

Constructs *this using x's resources.

Complexity: Constant if x == x.get_allocator(), linear otherwise.

Postcondition: x is emptied.

Member Function Documentation

template<class Key, class T, class Compare, class Allocator , class MapOptions >
T& boost::container::map< Key, T, Compare, Allocator, MapOptions >::at ( const key_type k)
inline

Returns: Allocator reference to the element whose key is equivalent to x.

Throws: An exception object of type out_of_range if no such element is present. Complexity: logarithmic.

template<class Key, class T, class Compare, class Allocator , class MapOptions >
const T& boost::container::map< Key, T, Compare, Allocator, MapOptions >::at ( const key_type k) const
inline

Returns: Allocator reference to the element whose key is equivalent to x.

Throws: An exception object of type out_of_range if no such element is present. Complexity: logarithmic.

template<class Key, class T, class Compare, class Allocator , class MapOptions >
typedef boost::container::map< Key, T, Compare, Allocator, MapOptions >::BOOST_CONTAINER_IMPDEF ( base_t::stored_allocator_type  )
template<class Key, class T, class Compare, class Allocator , class MapOptions >
typedef boost::container::map< Key, T, Compare, Allocator, MapOptions >::BOOST_CONTAINER_IMPDEF ( value_compare_impl  )
template<class Key, class T, class Compare, class Allocator , class MapOptions >
typedef boost::container::map< Key, T, Compare, Allocator, MapOptions >::BOOST_CONTAINER_IMPDEF ( base_t::iterator  )
template<class Key, class T, class Compare, class Allocator , class MapOptions >
typedef boost::container::map< Key, T, Compare, Allocator, MapOptions >::BOOST_CONTAINER_IMPDEF ( base_t::const_iterator  ) const
template<class Key, class T, class Compare, class Allocator , class MapOptions >
typedef boost::container::map< Key, T, Compare, Allocator, MapOptions >::BOOST_CONTAINER_IMPDEF ( base_t::reverse_iterator  )
template<class Key, class T, class Compare, class Allocator , class MapOptions >
typedef boost::container::map< Key, T, Compare, Allocator, MapOptions >::BOOST_CONTAINER_IMPDEF ( base_t::const_reverse_iterator  ) const
template<class Key, class T, class Compare, class Allocator , class MapOptions >
typedef boost::container::map< Key, T, Compare, Allocator, MapOptions >::BOOST_CONTAINER_IMPDEF ( movable_value_type_impl  )
template<class Key, class T, class Compare, class Allocator , class MapOptions >
size_type boost::container::map< Key, T, Compare, Allocator, MapOptions >::count ( const key_type x) const
inline

Returns: The number of elements with key equivalent to x.

Complexity: log(size())+count(k)

template<class Key, class T, class Compare, class Allocator , class MapOptions >
std::pair<iterator,bool> boost::container::map< Key, T, Compare, Allocator, MapOptions >::insert ( const value_type x)
inline

Effects: Inserts x if and only if there is no element in the container with key equivalent to the key of x.

Returns: The bool component of the returned pair is true if and only if the insertion takes place, and the iterator component of the pair points to the element with key equivalent to the key of x.

Complexity: Logarithmic.

template<class Key, class T, class Compare, class Allocator , class MapOptions >
std::pair<iterator,bool> boost::container::map< Key, T, Compare, Allocator, MapOptions >::insert ( const nonconst_value_type x)
inline

Effects: Inserts a new value_type created from the pair if and only if there is no element in the container with key equivalent to the key of x.

Returns: The bool component of the returned pair is true if and only if the insertion takes place, and the iterator component of the pair points to the element with key equivalent to the key of x.

Complexity: Logarithmic.

template<class Key, class T, class Compare, class Allocator , class MapOptions >
std::pair<iterator,bool> boost::container::map< Key, T, Compare, Allocator, MapOptions >::insert ( BOOST_RV_REF(nonconst_value_type x)
inline

Effects: Inserts a new value_type move constructed from the pair if and only if there is no element in the container with key equivalent to the key of x.

Returns: The bool component of the returned pair is true if and only if the insertion takes place, and the iterator component of the pair points to the element with key equivalent to the key of x.

Complexity: Logarithmic.

template<class Key, class T, class Compare, class Allocator , class MapOptions >
std::pair<iterator,bool> boost::container::map< Key, T, Compare, Allocator, MapOptions >::insert ( BOOST_RV_REF(movable_value_type)  x)
inline

Effects: Inserts a new value_type move constructed from the pair if and only if there is no element in the container with key equivalent to the key of x.

Returns: The bool component of the returned pair is true if and only if the insertion takes place, and the iterator component of the pair points to the element with key equivalent to the key of x.

Complexity: Logarithmic.

template<class Key, class T, class Compare, class Allocator , class MapOptions >
std::pair<iterator,bool> boost::container::map< Key, T, Compare, Allocator, MapOptions >::insert ( BOOST_RV_REF(value_type x)
inline

Effects: Move constructs a new value from x if and only if there is no element in the container with key equivalent to the key of x.

Returns: The bool component of the returned pair is true if and only if the insertion takes place, and the iterator component of the pair points to the element with key equivalent to the key of x.

Complexity: Logarithmic.

template<class Key, class T, class Compare, class Allocator , class MapOptions >
iterator boost::container::map< Key, T, Compare, Allocator, MapOptions >::insert ( const_iterator  p,
const value_type x 
)
inline

Effects: Inserts a copy of x in the container if and only if there is no element in the container with key equivalent to the key of x.

p is a hint pointing to where the insert should start to search.

Returns: An iterator pointing to the element with key equivalent to the key of x.

Complexity: Logarithmic in general, but amortized constant if t is inserted right before p.

template<class Key, class T, class Compare, class Allocator , class MapOptions >
iterator boost::container::map< Key, T, Compare, Allocator, MapOptions >::insert ( const_iterator  p,
BOOST_RV_REF(nonconst_value_type x 
)
inline

Effects: Move constructs a new value from x if and only if there is no element in the container with key equivalent to the key of x.

p is a hint pointing to where the insert should start to search.

Returns: An iterator pointing to the element with key equivalent to the key of x.

Complexity: Logarithmic in general, but amortized constant if t is inserted right before p.

template<class Key, class T, class Compare, class Allocator , class MapOptions >
iterator boost::container::map< Key, T, Compare, Allocator, MapOptions >::insert ( const_iterator  p,
BOOST_RV_REF(movable_value_type)  x 
)
inline

Effects: Move constructs a new value from x if and only if there is no element in the container with key equivalent to the key of x.

p is a hint pointing to where the insert should start to search.

Returns: An iterator pointing to the element with key equivalent to the key of x.

Complexity: Logarithmic in general, but amortized constant if t is inserted right before p.

template<class Key, class T, class Compare, class Allocator , class MapOptions >
iterator boost::container::map< Key, T, Compare, Allocator, MapOptions >::insert ( const_iterator  p,
const nonconst_value_type x 
)
inline

Effects: Inserts a copy of x in the container.

p is a hint pointing to where the insert should start to search.

Returns: An iterator pointing to the element with key equivalent to the key of x.

Complexity: Logarithmic.

template<class Key, class T, class Compare, class Allocator , class MapOptions >
iterator boost::container::map< Key, T, Compare, Allocator, MapOptions >::insert ( const_iterator  p,
BOOST_RV_REF(value_type x 
)
inline

Effects: Inserts an element move constructed from x in the container.

p is a hint pointing to where the insert should start to search.

Returns: An iterator pointing to the element with key equivalent to the key of x.

Complexity: Logarithmic.

template<class Key, class T, class Compare, class Allocator , class MapOptions >
template<class InputIterator >
void boost::container::map< Key, T, Compare, Allocator, MapOptions >::insert ( InputIterator  first,
InputIterator  last 
)
inline

Requires: first, last are not iterators into *this.

Effects: inserts each element from the range [first,last) if and only if there is no element with key equivalent to the key of that element.

Complexity: At most N log(size()+N) (N is the distance from first to last)

template<class Key, class T, class Compare, class Allocator , class MapOptions >
void boost::container::map< Key, T, Compare, Allocator, MapOptions >::insert ( std::initializer_list< value_type il)
inline

Effects: inserts each element from the range [il.begin(), il.end()) if and only if there is no element with key equivalent to the key of that element.

Complexity: At most N log(size()+N) (N is the distance from il.begin() to il.end())

template<class Key, class T, class Compare, class Allocator , class MapOptions >
map& boost::container::map< Key, T, Compare, Allocator, MapOptions >::operator= ( BOOST_COPY_ASSIGN_REF(map< Key, T, Compare, Allocator, MapOptions >)  x)
inline

Effects: Makes *this a copy of x.

Complexity: Linear in x.size().

template<class Key, class T, class Compare, class Allocator , class MapOptions >
map& boost::container::map< Key, T, Compare, Allocator, MapOptions >::operator= ( BOOST_RV_REF(map< Key, T, Compare, Allocator, MapOptions >)  x)
inline

Effects: this->swap(x.get()).

Throws: If allocator_traits_type::propagate_on_container_move_assignment is false and (allocation throws or value_type's move constructor throws)

Complexity: Constant if allocator_traits_type:: propagate_on_container_move_assignment is true or this->get>allocator() == x.get_allocator(). Linear otherwise.

template<class Key, class T, class Compare, class Allocator , class MapOptions >
map& boost::container::map< Key, T, Compare, Allocator, MapOptions >::operator= ( std::initializer_list< value_type il)
inline

Effects: Assign content of il to *this.


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