std::map::empty

bool empty() const; Checks if the container has no elements, i.e. whether begin() == end(). Parameters (none). Return value true if the container is empty, false otherwise. Exceptions (none) (until C++11) noexcept specification: noexcept (since C++11) Complexity Constant. Example The following code uses empty to check if a std::map<int, int> contains any elements: #include <map> #include <iostream> #include <utility> int main() { std::ma

std::map::emplace_hint

template <class... Args> iterator emplace_hint( const_iterator hint, Args&&... args ); (since C++11) Inserts a new element to the container as close as possible to the position just before hint. The element is constructed in-place, i.e. no copy or move operations are performed. The constructor of the element type (value_type, that is, std::pair<const Key, T>) is called with exactly the same arguments as supplied to the function, forwarded with std::forward<Args>

std::map::emplace

template< class... Args > std::pair<iterator,bool> emplace( Args&&... args ); (since C++11) 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. Careful use of emplace allows the new element to be constructed while avoiding unnecessary copy or move operations. The constructor of the new element (i.e. std::pair<const Key, T>) is called with exactly the same arguments as sup

std::map::count

size_type count( const Key& key ) const; (1) template< class K > size_type count( const K& x ) const; (2) (since C++14) 1) Returns the number of elements with key key, which is either 1 or 0 since this container does not allow duplicates 2) Returns the number of elements with key that compares equivalent to the value x. This overload only participates in overload resolution if the qualified-id Compare::is_transparent is valid and denotes a type. They allow calling

std::map::clear

void clear(); Removes all elements from the container. Invalidates any references, pointers, or iterators referring to contained elements. May invalidate any past-the-end iterators. Parameters (none). Return value (none). Exceptions (none) (until C++11) noexcept specification: noexcept (since C++11) Complexity Linear in the size of the container. See also erase erases elements (public member function)

std::map::begin

iterator begin(); const_iterator begin() const; const_iterator cbegin() const; (since C++11) Returns an iterator to the first element of the container. If the container is empty, the returned iterator will be equal to end(). Parameters (none). Return value Iterator to the first element. Exceptions (none) (until C++11) noexcept specification: noexcept (since C++11) Complexity Constant. Example See also end cend returns an iterator to the end (publ

std::map::at

T& at( const Key& key ); (1) (since C++11) const T& at( const Key& key ) const; (2) (since C++11) 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. Parameters key - the key of the element to find Return value Reference to the mapped value of the requested element. Exceptions std::out_of_range if the container does not have an element with t

std::map

Defined in header <map> template< class Key, class T, class Compare = std::less<Key>, class Allocator = std::allocator<std::pair<const Key, T> > > class map; std::map is a sorted associative container that contains key-value pairs with unique keys. Keys are sorted by using the comparison function Compare. Search, removal, and insertion operations have logarithmic complexity. Maps are usually implemented as red-black trees. Everywhere

std::malloc

Defined in header <cstdlib> void* malloc( std::size_t size ); Allocates size bytes of uninitialized storage. If allocation succeeds, returns a pointer to the lowest (first) byte in the allocated memory block that is suitably aligned for any scalar type. If size is zero, the behavior is implementation defined (null pointer may be returned, or some non-null pointer may be returned that may not be used to access storage). Parameters size - number of bytes to allocate

std::make_unsigned

Defined in header <type_traits> template< class T > struct make_unsigned; (since C++11) If T is an integral (except bool) or enumeration type, provides the member typedef type which is the unsigned integer type corresponding to T, with the same cv-qualifiers. Otherwise, the behavior is undefined. Member types Name Definition type the unsigned integer type corresponding to T Helper types template< class T > using make_unsigned_t = typename make_u