哪位高手知道C++中的
谁知道C++中的<map>都包含哪些常用函数以及怎么用么?
谁知道 <map> 是干嘛的吗,还有就是它都包含哪些常用的函数以及怎么用,书上突然就出来这个东西,也不交代一下,请各位给我指点,谢谢拉.
------解决方案--------------------
begin Returns an iterator addressing the first element in the map.
clear Erases all the elements of a map.
count Returns the number of elements in a map whose key matches a parameter-specified key.
empty Tests if a map is empty.
end Returns an iterator that addresses the location succeeding the last element in a map.
equal_range Returns an iterator that addresses the location succeeding the last element in a map.
erase Removes an element or a range of elements in a map from specified positions
find Returns an iterator addressing the location of an element in a map that has a key equivalent to a specified key.
get_allocator Returns a copy of the allocator object used to construct the map.
insert Inserts an element or a range of elements into the map at a specified position.
key_comp Retrieves a copy of the comparison object used to order keys in a map.
lower_bound Returns an iterator to the first element in a map that with a key value that is equal to or greater than that of a specified key.
map Constructs a list of a specific size or with elements of a specific value or with a specific allocator or as a copy of some other map.
max_size Returns the maximum length of the map.
rbegin Returns an iterator addressing the first element in a reversed map.
rend Returns an iterator that addresses the location succeeding the last element in a reversed map.
size Returns the number of elements in the map.
swap Exchanges the elements of two maps.
upper_bound Returns an iterator to the first element in a map that with a key value that is greater than that of a specified key.
value_comp Retrieves a copy of the comparison object used to order element values in a map.
Operators
operator[]
------解决方案--------------------
Constructors
map
Constructs a list of a specific size or with elements of a specific value or with a specific allocator or as a copy of some other map.
Typedefs
allocator_type
A type that represents the allocator class for the map object.
const_iterator
A type that provides a bidirectional iterator that can read a const element in the map.
const_pointer
A type that provides a pointer to a const element in a map.
const_reference
A type that provides a reference to a const element stored in a map for reading and performing const operations.
const_reverse_iterator
A type that provides a bidirectional iterator that can read any const element in the map.
difference_type
A signed integer type that can be used to represent the number of elements of a map in a range between elements pointed to by iterators.
iterator
A type that provides a bidirectional iterator that can read or modify any element in a map.
key_compare
A type that provides a function object that can compare two sort keys to determine the relative order of two elements in the map.
key_type
A type that describes the sort key object which constitutes each element of the map.
mapped_type
A type that represents the data type stored in a map.
pointer
A type that provides a pointer to a const element in a map.
reference
A type that provides a reference to an element stored in a map.
reverse_iterator
A type that provides a bidirectional iterator that can read or modify an element in a reversed map.
size_type
An unsigned integer type that can represent the number of elements in a map
谁知道 <map> 是干嘛的吗,还有就是它都包含哪些常用的函数以及怎么用,书上突然就出来这个东西,也不交代一下,请各位给我指点,谢谢拉.
------解决方案--------------------
begin Returns an iterator addressing the first element in the map.
clear Erases all the elements of a map.
count Returns the number of elements in a map whose key matches a parameter-specified key.
empty Tests if a map is empty.
end Returns an iterator that addresses the location succeeding the last element in a map.
equal_range Returns an iterator that addresses the location succeeding the last element in a map.
erase Removes an element or a range of elements in a map from specified positions
find Returns an iterator addressing the location of an element in a map that has a key equivalent to a specified key.
get_allocator Returns a copy of the allocator object used to construct the map.
insert Inserts an element or a range of elements into the map at a specified position.
key_comp Retrieves a copy of the comparison object used to order keys in a map.
lower_bound Returns an iterator to the first element in a map that with a key value that is equal to or greater than that of a specified key.
map Constructs a list of a specific size or with elements of a specific value or with a specific allocator or as a copy of some other map.
max_size Returns the maximum length of the map.
rbegin Returns an iterator addressing the first element in a reversed map.
rend Returns an iterator that addresses the location succeeding the last element in a reversed map.
size Returns the number of elements in the map.
swap Exchanges the elements of two maps.
upper_bound Returns an iterator to the first element in a map that with a key value that is greater than that of a specified key.
value_comp Retrieves a copy of the comparison object used to order element values in a map.
Operators
operator[]
------解决方案--------------------
Constructors
map
Constructs a list of a specific size or with elements of a specific value or with a specific allocator or as a copy of some other map.
Typedefs
allocator_type
A type that represents the allocator class for the map object.
const_iterator
A type that provides a bidirectional iterator that can read a const element in the map.
const_pointer
A type that provides a pointer to a const element in a map.
const_reference
A type that provides a reference to a const element stored in a map for reading and performing const operations.
const_reverse_iterator
A type that provides a bidirectional iterator that can read any const element in the map.
difference_type
A signed integer type that can be used to represent the number of elements of a map in a range between elements pointed to by iterators.
iterator
A type that provides a bidirectional iterator that can read or modify any element in a map.
key_compare
A type that provides a function object that can compare two sort keys to determine the relative order of two elements in the map.
key_type
A type that describes the sort key object which constitutes each element of the map.
mapped_type
A type that represents the data type stored in a map.
pointer
A type that provides a pointer to a const element in a map.
reference
A type that provides a reference to an element stored in a map.
reverse_iterator
A type that provides a bidirectional iterator that can read or modify an element in a reversed map.
size_type
An unsigned integer type that can represent the number of elements in a map