📄 map
字号:
typedef _TYPENAME __rep_type::reverse_iterator reverse_iterator;
typedef _TYPENAME __rep_type::const_reverse_iterator const_reverse_iterator;
class value_compare : public binary_function<value_type, value_type, bool>
{
friend class multimap<_Key, _TypeT, _Compare, _Allocator>;
protected:
_Compare comp;
value_compare (_Compare __cmp) : comp (__cmp) { }
public:
bool operator () (const value_type& __x, const value_type& __y) const {
return comp (__x.first, __y.first);
}
};
_EXPLICIT
multimap (const key_compare &__cmp = key_compare (),
const allocator_type &__alloc = allocator_type ())
: _C_rep (__cmp, true, __alloc) { }
#ifndef _RWSTD_NO_MEMBER_TEMPLATES
template<class _InputIter>
multimap (_InputIter __first, _InputIter __last,
const _Compare& __cmp = _Compare (),
const _Allocator& __alloc = _Allocator ())
: _C_rep (__first, __last, __cmp, true, __alloc) { }
#else // if defined (_RWSTD_NO_MEMBER_TEMPLATES)
multimap (const value_type* __first, const value_type* __last,
const key_compare &__cmp = key_compare (),
const allocator_type &__alloc = allocator_type ())
: _C_rep (__first, __last, __cmp, true, __alloc) { }
multimap (const_iterator __first, const_iterator __last,
const key_compare &__cmp = key_compare (),
const allocator_type &__alloc = allocator_type ())
: _C_rep (__first, __last, __cmp, true, __alloc) { }
#endif // _RWSTD_NO_MEMBER_TEMPLATES
multimap (const multimap &__x)
: _C_rep (__x._C_rep, true) { }
multimap& operator= (const multimap &__x) {
_C_rep = __x._C_rep; return *this;
}
allocator_type get_allocator () const {
return _C_rep.get_allocator ();
}
iterator begin () {
return _C_rep.begin ();
}
const_iterator begin () const {
return _C_rep.begin ();
}
iterator end () {
return _C_rep.end ();
}
const_iterator end () const {
return _C_rep.end ();
}
reverse_iterator rbegin () {
return _C_rep.rbegin ();
}
const_reverse_iterator rbegin () const {
return _C_rep.rbegin ();
}
reverse_iterator rend () {
return _C_rep.rend ();
}
const_reverse_iterator rend () const {
return _C_rep.rend ();
}
bool empty () const {
return _C_rep.empty ();
}
size_type size () const {
return _C_rep.size ();
}
size_type max_size () const {
return _C_rep.max_size ();
}
iterator insert (const value_type& __x) {
return _C_rep.insert (__x).first;
}
iterator insert (iterator __it, const value_type& __x) {
return _C_rep.insert (__it, __x);
}
#ifndef _RWSTD_NO_MEMBER_TEMPLATES
template<class _InputIter>
void insert (_InputIter __first, _InputIter __last) {
_C_rep.insert (__first, __last);
}
#else // if defined (_RWSTD_NO_MEMBER_TEMPLATES)
void insert (const value_type* __first, const value_type* __last) {
_C_rep.insert (__first, __last);
}
void insert (const_iterator __first, const_iterator __last) {
_C_rep.insert (__first, __last);
}
#endif // _RWSTD_NO_MEMBER_TEMPLATES
void erase (iterator __it) {
_C_rep.erase (__it);
}
size_type erase (const key_type& __x) {
return _C_rep.erase (__x);
}
void erase (iterator __first, iterator __last) {
_C_rep.erase (__first, __last);
}
void clear () {
erase (begin (),end ());
}
void swap (multimap &__x) {
_C_rep.swap (__x._C_rep);
}
key_compare key_comp () const {
return _C_rep.key_comp ();
}
value_compare value_comp () const {
return value_compare (_C_rep.key_comp ());
}
iterator find (const key_type& __x) {
return _C_rep.find (__x);
}
const_iterator find (const key_type& __x) const {
return _C_rep.find (__x);
}
size_type count (const key_type& __x) const {
return _C_rep.count (__x);
}
iterator lower_bound (const key_type& __x) {
return _C_rep.lower_bound (__x);
}
iterator upper_bound (const key_type& __x) {
return _C_rep.upper_bound (__x);
}
const_iterator lower_bound (const key_type& __x) const {
return _C_rep.lower_bound (__x);
}
const_iterator upper_bound (const key_type& __x) const {
return _C_rep.upper_bound (__x);
}
pair<iterator,iterator> equal_range (const key_type& __x) {
return _C_rep.equal_range (__x);
}
pair<const_iterator,const_iterator>
equal_range (const key_type& __x) const {
return _C_rep.equal_range (__x);
}
};
// 23.1, p5 - table 65
template <class _Key, class _TypeT, class _Compare, class _Allocator>
inline bool operator== (const map<_Key, _TypeT, _Compare, _Allocator> &__x,
const map<_Key, _TypeT, _Compare, _Allocator> &__y)
{
return __x.size () == __y.size ()
&& equal (__x.begin (), __x.end (), __y.begin ());
}
// 23.1, p5 - table 65
template <class _Key, class _TypeT, class _Compare, class _Allocator>
inline bool operator< (const map<_Key, _TypeT, _Compare, _Allocator> &__x,
const map<_Key, _TypeT, _Compare, _Allocator> &__y)
{
return lexicographical_compare (__x.begin (), __x.end (),
__y.begin (), __y.end ());
}
// 23.1, p5 - table 65
template <class _Key, class _TypeT, class _Compare, class _Allocator>
inline bool operator!= (const map<_Key, _TypeT, _Compare, _Allocator> &__x,
const map<_Key, _TypeT, _Compare, _Allocator> &__y)
{
return !(__x == __y);
}
// 23.1, p5 - table 65
template <class _Key, class _TypeT, class _Compare, class _Allocator>
inline bool operator> (const map<_Key, _TypeT, _Compare, _Allocator> &__x,
const map<_Key, _TypeT, _Compare, _Allocator> &__y)
{
return __y < __x;
}
// 23.1, p5 - table 65
template <class _Key, class _TypeT, class _Compare, class _Allocator>
inline bool operator>= (const map<_Key, _TypeT, _Compare, _Allocator> &__x,
const map<_Key, _TypeT, _Compare, _Allocator> &__y)
{
return !(__x < __y);
}
// 23.1, p5 - table 65
template <class _Key, class _TypeT, class _Compare, class _Allocator>
inline bool operator<= (const map<_Key, _TypeT, _Compare, _Allocator> &__x,
const map<_Key, _TypeT, _Compare, _Allocator> &__y)
{
return !(__y < __x);
}
#ifndef _RWSTD_NO_PART_SPEC_OVERLOAD
// 23.3.1.4
template <class _Key, class _TypeT, class _Compare, class _Allocator>
inline void swap (map<_Key, _TypeT, _Compare, _Allocator> &__y,
map<_Key, _TypeT, _Compare, _Allocator> &__x)
{
__x.swap (__y);
}
#endif // _RWSTD_NO_PART_SPEC_OVERLOAD
// 23.1, p5 - table 65
template <class _Key, class _TypeT, class _Compare, class _Allocator>
inline bool
operator== (const multimap<_Key, _TypeT, _Compare, _Allocator> &__x,
const multimap<_Key, _TypeT, _Compare, _Allocator> &__y)
{
return __x.size () == __y.size ()
&& equal (__x.begin (), __x.end (), __y.begin ());
}
// 23.1, p5 - table 65
template <class _Key, class _TypeT, class _Compare, class _Allocator>
inline bool
operator< (const multimap<_Key, _TypeT, _Compare, _Allocator> &__x,
const multimap<_Key, _TypeT, _Compare, _Allocator> &__y)
{
return lexicographical_compare (__x.begin (), __x.end (),
__y.begin (), __y.end ());
}
// 23.1, p5 - table 65
template <class _Key, class _TypeT, class _Compare, class _Allocator>
inline bool
operator!= (const multimap<_Key, _TypeT, _Compare, _Allocator> &__x,
const multimap<_Key, _TypeT, _Compare, _Allocator> &__y)
{
return !(__x == __y);
}
// 23.1, p5 - table 65
template <class _Key, class _TypeT, class _Compare, class _Allocator>
inline bool
operator> (const multimap<_Key, _TypeT, _Compare, _Allocator> &__x,
const multimap<_Key, _TypeT, _Compare, _Allocator> &__y)
{
return __y < __x;
}
// 23.1, p5 - table 65
template <class _Key, class _TypeT, class _Compare, class _Allocator>
inline bool
operator>= (const multimap<_Key, _TypeT, _Compare, _Allocator> &__x,
const multimap<_Key, _TypeT, _Compare, _Allocator> &__y)
{
return !(__x < __y);
}
// 23.1, p5 - table 65
template <class _Key, class _TypeT, class _Compare, class _Allocator>
inline bool
operator<= (const multimap<_Key, _TypeT, _Compare, _Allocator> &__x,
const multimap<_Key, _TypeT, _Compare, _Allocator> &__y)
{
return !(__y < __x);
}
#ifndef _RWSTD_NO_PART_SPEC_OVERLOAD
// 23.3.2.3
template <class _Key, class _TypeT, class _Compare, class _Allocator>
void swap (multimap<_Key, _TypeT, _Compare, _Allocator> &__x,
multimap<_Key, _TypeT, _Compare, _Allocator> &__y)
{
__x.swap (__y);
}
#endif // _RWSTD_NO_PART_SPEC_OVERLOAD
_RWSTD_NAMESPACE_END // std
#endif // _RWSTD_MAP_INCLUDED
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -