分享
 
 
 

C++ young 程序库——y_set.hpp 和 y_map.hpp

王朝c/c++·作者佚名  2006-01-10
窄屏简体版  字體: |||超大  

文件位置:young/y_set.hpp

和标准的set有所不同,主要是加入了modify_key 的功能,其实现在y_red_black_tree.hpp中

/*

The young Library

Copyright (c) 2005 by 杨桓

Permission to use, copy, modify, distribute and sell this software for any

purpose is hereby granted without fee, provided that the above copyright

notice appear in all copies and that both that copyright notice and this

permission notice appear in supporting documentation.

The author make no representations about the suitability of this software

for any purpose. It is provided "as is" without express or implied warranty.

*/

//-----------------------------------------------------------------------------

//-----------------------------------------------------------------------------

#ifndef __MACRO_CPLUSPLUS_YOUNG_LIBRARY_SET_HEADER_FILE__

#define __MACRO_CPLUSPLUS_YOUNG_LIBRARY_SET_HEADER_FILE__

//-----------------------------------------------------------------------------

#include "y_pair.hpp"

#include "y_functional.hpp"

#include "tree/y_red_black_tree.hpp"

#include "algorithm/y_algorithm_compare.hpp"

//-----------------------------------------------------------------------------

__MACRO_CPLUSPLUS_YOUNG_LIBRARY_BEGIN_NAMESPACE__

//-----------------------------------------------------------------------------

//-----------------------------------------------------------------------------

template< typename Key, typename Compare = less<Key>,

typename Allocator = allocator<Key> >

class set

{

private:

typedef rb_tree_node<Key> node;

typedef typename Allocator::rebind<node>::other node_alloc;

typedef rb_tree<Key, Key, identity<Key>, Compare, node_alloc> tree;

// typedef rb_tree<Key, Key, identity<Key>, Compare> tree;

typedef typename tree::iterator tree_iterator;

tree con;

public:

typedef set<Key, Compare, Allocator> self;

typedef typename tree::key_type key_type;

typedef typename tree::value_type value_type;

typedef typename tree::key_compare key_compare;

typedef typename tree::get_key get_key;

typedef typename tree::allocator_type allocator_type;

typedef typename tree::size_type size_type;

typedef typename tree::difference_type difference_type;

typedef typename tree::const_reference reference;

typedef typename tree::const_reference const_reference;

typedef typename tree::const_pointer pointer;

typedef typename tree::const_pointer cons_pointer;

typedef typename tree::const_iterator iterator;

typedef typename tree::const_iterator const_iterator;

typedef typename tree::const_reverse_iterator reverse_iterator;

typedef typename tree::const_reverse_iterator const_reverse_iterator;

set() : con( key_compare() ) {}

explicit set( const key_compare& comp ) : con(comp) {}

template< typename InputIterator >

set( InputIterator first, InputIterator last ) : con( key_compare() )

{ con.insert_unique( first, last ); }

template< typename InputIterator >

set( InputIterator first, InputIterator last, const key_compare& comp )

: con(comp)

{

con.insert_unique( first, last );

}

set( const self& rhs ) : con(rhs.con) {}

self& operator=( const self& rhs )

{ con = rhs.con; return *this; }

key_compare key_comp() const { return con.key_comp(); }

key_compare value_comp() const { return con.key_comp(); }

iterator begin() const { return con.begin(); }

iterator end() const { return con.end(); }

reverse_iterator rbegin() const { return con.rbegin(); }

reverse_iterator rend() const { return con.rend(); }

bool empty() const { return con.empty(); }

size_type size() const { return con.size(); }

size_type max_size() const { return con.max_size(); }

pair<iterator, bool> insert( const value_type& v )

{

pair<tree_iterator, bool> p = con.insert_unique( v );

return pair<iterator, bool>( p.first, p.second );

}

iterator insert( iterator position, const value_type& v )

{ return con.insert_unique( tree_iterator(position), v ); }

template< typename InputIterator >

void insert( InputIterator first, InputIterator last )

{ con.insert_unique( first, last ); }

void erase( iterator position )

{ con.erase( tree_iterator(position) ); }

void erase( iterator first, iterator last )

{ con.erase( tree_iterator(first), tree_iterator(last) ); }

size_type erase( const key_type& k )

{ return con.erase( k ); }

void clear() { con.clear(); }

void swap( self& rhs ) { con.swap( rhs.con ); }

iterator find( const key_type& k ) const { return con.find( k ); }

size_type count( const key_type& k ) const { return con.count( k ); }

iterator lower_bound( const key_type& k ) const

{ return con.lower_bound( k ); }

iterator upper_bound( const key_type& k ) const

{ return con.upper_bound( k ); }

pair<iterator, iterator> equal_range( const key_type& k ) const

{ return con.equal_range( k ); }

bool modify_key( iterator position, const key_type& new_key )

{ return con.modify_key_unique( position, new_key ); }

iterator modify_key( const key_type& k, const key_type& new_key )

{ return con.modify_key_unique( k, new_key ); }

}; //end class

template< typename Key, typename Compare, typename Allocator >

inline void swap( set<Key, Compare, Allocator>& lhs,

set<Key, Compare, Allocator>& rhs )

{

lhs.swap( rhs );

}

template< typename Key, typename Compare, typename Allocator >

inline bool operator==( const set<Key, Compare, Allocator>& lhs,

const set<Key, Compare, Allocator>& rhs )

{

return ( lhs.size() == rhs.size()

&& equal( lhs.begin(), lhs.end(), rhs.begin() ) );

}

template< typename Key, typename Compare, typename Allocator >

inline bool operator!=( const set<Key, Compare, Allocator>& lhs,

const set<Key, Compare, Allocator>& rhs )

{

return !( lhs == rhs );

}

template< typename Key, typename Compare, typename Allocator >

inline bool operator<( const set<Key, Compare, Allocator>& lhs,

const set<Key, Compare, Allocator>& rhs )

{

if( lhs.end() == rhs.end() || lhs.size() > rhs.size() )

return false;

return lexicographical_compare( lhs.begin(), lhs.end(),

rhs.begin(), rhs.end(), lhs.value_comp() );

}

template< typename Key, typename Compare, typename Allocator >

inline bool operator>( const set<Key, Compare, Allocator>& lhs,

const set<Key, Compare, Allocator>& rhs )

{

return ( rhs < lhs );

}

template< typename Key, typename Compare, typename Allocator >

inline bool operator<=( const set<Key, Compare, Allocator>& lhs,

const set<Key, Compare, Allocator>& rhs )

{

return !( rhs < lhs );

}

template< typename Key, typename Compare, typename Allocator >

inline bool operator>=( const set<Key, Compare, Allocator>& lhs,

const set<Key, Compare, Allocator>& rhs )

{

return !( lhs < rhs );

}

//-----------------------------------------------------------------------------

//-----------------------------------------------------------------------------

template< typename Key, typename Compare = less<Key>,

typename Allocator = allocator<Key> >

class multiset

{

private:

typedef rb_tree_node<Key> node;

typedef typename Allocator::rebind<node>::other node_alloc;

typedef rb_tree<Key, Key, identity<Key>, Compare, node_alloc> tree;

// typedef rb_tree<Key, Key, identity<Key>, Compare> tree;

typedef typename tree::iterator tree_iterator;

tree con;

public:

typedef multiset<Key, Compare, Allocator> self;

typedef typename tree::key_type key_type;

typedef typename tree::value_type value_type;

typedef typename tree::key_compare key_compare;

typedef typename tree::get_key get_key;

typedef typename tree::allocator_type allocator_type;

typedef typename tree::size_type size_type;

typedef typename tree::difference_type difference_type;

typedef typename tree::const_reference reference;

typedef typename tree::const_reference const_reference;

typedef typename tree::const_pointer pointer;

typedef typename tree::const_pointer cons_pointer;

typedef typename tree::const_iterator iterator;

typedef typename tree::const_iterator const_iterator;

typedef typename tree::const_reverse_iterator reverse_iterator;

typedef typename tree::const_reverse_iterator const_reverse_iterator;

multiset() : con( key_compare() ) {}

explicit multiset( const key_compare& comp ) : con(comp) {}

template< typename InputIterator >

multiset( InputIterator first, InputIterator last ) : con( key_compare() )

{

con.insert_equal( first, last );

}

template< typename InputIterator >

multiset( InputIterator first, InputIterator last, const key_compare& comp )

: con(comp)

{

con.insert_equal( first, last );

}

multiset( const self& rhs ) : con(rhs.con) {}

self& operator=( const self& rhs )

{ con = rhs.con; return *this; }

key_compare key_comp() const { return con.key_comp(); }

key_compare value_comp() const { return con.key_comp(); }

iterator begin() const { return con.begin(); }

iterator end() const { return con.end(); }

reverse_iterator rbegin() const { return con.rbegin(); }

reverse_iterator rend() const { return con.rend(); }

bool empty() const { return con.empty(); }

size_type size() const { return con.size(); }

size_type max_size() const { return con.max_size(); }

iterator insert( const value_type& v )

{ return con.insert_equal( v ); }

iterator insert( iterator position, const value_type& v )

{ return con.insert_equal( tree_iterator(position), v ); }

template< typename InputIterator >

void insert( InputIterator first, InputIterator last )

{ con.insert_equal( first, last ); }

void erase( iterator position )

{ con.erase( tree_iterator(position) ); }

void erase( iterator first, iterator last )

{ con.erase( tree_iterator(first), tree_iterator(last) ); }

size_type erase( const key_type& k )

{ return con.erase( k ); }

void clear() { con.clear(); }

void swap( self& rhs ) { con.swap( rhs.con ); }

iterator find( const key_type& k ) const { return con.find( k ); }

size_type count( const key_type& k ) const { return con.count( k ); }

iterator lower_bound( const key_type& k ) const

{ return con.lower_bound( k ); }

iterator upper_bound( const key_type& k ) const

{ return con.upper_bound( k ); }

pair<iterator, iterator> equal_range( const key_type& k ) const

{ return con.equal_range( k ); }

bool modify_key( iterator position, const key_type& new_key )

{ return con.modify_key_equal( position, new_key ); }

void modify_key( const key_type& k, const key_type& new_key )

{ con.modify_key_equal( k, new_key ); }

}; //end class

template< typename Key, typename Compare, typename Allocator >

inline void swap( multiset<Key, Compare, Allocator>& lhs,

multiset<Key, Compare, Allocator>& rhs )

{

lhs.swap( rhs );

}

template< typename Key, typename Compare, typename Allocator >

inline bool operator==( const multiset<Key, Compare, Allocator>& lhs,

const multiset<Key, Compare, Allocator>& rhs )

{

return ( lhs.size() == rhs.size()

&& equal( lhs.begin(), lhs.end(), rhs.begin() ) );

}

template< typename Key, typename Compare, typename Allocator >

inline bool operator!=( const multiset<Key, Compare, Allocator>& lhs,

const multiset<Key, Compare, Allocator>& rhs )

{

return !( lhs == rhs );

}

template< typename Key, typename Compare, typename Allocator >

inline bool operator<( const multiset<Key, Compare, Allocator>& lhs,

const multiset<Key, Compare, Allocator>& rhs )

{

if( lhs.end() == rhs.end() || lhs.size() > rhs.size() )

return false;

return lexicographical_compare( lhs.begin(), lhs.end(),

rhs.begin(), rhs.end(), lhs.value_comp() );

}

template< typename Key, typename Compare, typename Allocator >

inline bool operator>( const multiset<Key, Compare, Allocator>& lhs,

const multiset<Key, Compare, Allocator>& rhs )

{

return ( rhs < lhs );

}

template< typename Key, typename Compare, typename Allocator >

inline bool operator<=( const multiset<Key, Compare, Allocator>& lhs,

const multiset<Key, Compare, Allocator>& rhs )

{

return !( rhs < lhs );

}

template< typename Key, typename Compare, typename Allocator >

inline bool operator>=( const multiset<Key, Compare, Allocator>& lhs,

const multiset<Key, Compare, Allocator>& rhs )

{

return !( lhs < rhs );

}

//-----------------------------------------------------------------------------

//-----------------------------------------------------------------------------

__MACRO_CPLUSPLUS_YOUNG_LIBRARY_END_NAMESPACE__

#endif

//-----------------------------------------------------------------------------

//-----------------------------------------------------------------------------

文件位置:young/y_map.hpp

/*

The young Library

Copyright (c) 2005 by 杨桓

Permission to use, copy, modify, distribute and sell this software for any

purpose is hereby granted without fee, provided that the above copyright

notice appear in all copies and that both that copyright notice and this

permission notice appear in supporting documentation.

The author make no representations about the suitability of this software

for any purpose. It is provided "as is" without express or implied warranty.

*/

//-----------------------------------------------------------------------------

//-----------------------------------------------------------------------------

#ifndef __MACRO_CPLUSPLUS_YOUNG_LIBRARY_MAP_HEADER_FILE__

#define __MACRO_CPLUSPLUS_YOUNG_LIBRARY_MAP_HEADER_FILE__

//-----------------------------------------------------------------------------

#include "y_pair.hpp"

#include "y_functional.hpp"

#include "tree/y_red_black_tree.hpp"

#include "algorithm/y_algorithm_compare.hpp"

//-----------------------------------------------------------------------------

__MACRO_CPLUSPLUS_YOUNG_LIBRARY_BEGIN_NAMESPACE__

//-----------------------------------------------------------------------------

//-----------------------------------------------------------------------------

template< typename Key, typename Value, typename Compare = less<Key>,

typename Allocator = allocator<Value> >

class map

{

private:

typedef pair<const Key, Value> value_t;

typedef rb_tree_node<value_t> node;

typedef typename Allocator::rebind<node>::other node_alloc;

typedef rb_tree<Key, value_t, select1st<value_t>, Compare, node_alloc>

tree;

// typedef rb_tree<Key, value_t, select1st<value_t>, Compare> tree;

tree con;

public:

typedef map<Key, Value, Compare, Allocator> self;

typedef Value mapped_type;

typedef typename tree::key_type key_type;

typedef typename tree::value_type value_type;

typedef typename tree::key_compare key_compare;

typedef typename tree::get_key get_key;

typedef typename tree::allocator_type allocator_type;

typedef typename tree::size_type size_type;

typedef typename tree::difference_type difference_type;

typedef typename tree::reference reference;

typedef typename tree::const_reference const_reference;

typedef typename tree::pointer pointer;

typedef typename tree::const_pointer cons_pointer;

typedef typename tree::iterator iterator;

typedef typename tree::const_iterator const_iterator;

typedef typename tree::reverse_iterator reverse_iterator;

typedef typename tree::const_reverse_iterator const_reverse_iterator;

class value_compare : public binary_function<value_type, value_type, bool>

{

private:

key_compare comp;

public:

value_compare( const key_compare& c ) : comp(c) {}

bool operator()( const value_type& lhs, const value_type& rhs ) const

{

return comp( lhs.first, rhs.first );

}

};

public:

map() : con( key_compare() ) {}

explicit map( const key_compare& comp ) : con(comp) {}

template< typename InputIterator >

map( InputIterator first, InputIterator last ) : con( key_compare() )

{

con.insert_unique( first, last );

}

template< typename InputIterator >

map( InputIterator first, InputIterator last, const key_compare& comp )

: con(comp)

{

con.insert_unique( first, last );

}

map( const self& rhs ) : con(rhs.con) {}

self& operator=( const self& rhs )

{ con = rhs.con; return *this; }

key_compare key_comp() const

{ return con.key_comp(); }

value_compare value_comp() const

{ return value_compare( con.key_compare() ); }

iterator begin() { return con.begin(); }

iterator end() { return con.end(); }

const_iterator begin() const { return con.begin(); }

const_iterator end() const { return con.end(); }

reverse_iterator rbegin() { return con.rbegin(); }

reverse_iterator rend() { return con.rend(); }

const_reverse_iterator rbegin() const { return con.rbegin(); }

const_reverse_iterator rend() const { return con.rend(); }

bool empty() const { return con.empty(); }

size_type size() const { return con.size(); }

size_type max_size() const { return con.max_size(); }

pair<iterator, bool> insert( const key_type& k, const mapped_type& d )

{ return con.insert_unique( value_type(k, d) ); }

iterator insert( iterator position, const key_type& k, const mapped_type& d )

{ return con.insert_unique( position, value_type(k, d) ); }

pair<iterator, bool> insert( const value_type& v )

{ return con.insert_unique( v ); }

iterator insert( iterator position, const value_type& v )

{ return con.insert_unique( position, v ); }

template< typename InputIterator >

void insert( InputIterator first, InputIterator last )

{ con.insert_unique( first, last ); }

void erase( iterator position ) { con.erase( position ); }

void erase( iterator first, iterator last ) { con.erase( first, last ); }

size_type erase( const key_type& k ) { return con.erase( k ); }

mapped_type& operator[]( const key_type& k )

{

value_type v( k, mapped_type() );

iterator itr = insert( v ).first;

return itr->second;

}

void clear() { con.clear(); }

void swap( self& rhs ) { con.swap( rhs.con ); }

iterator find( const key_type& k ) { return con.find( k ); }

const_iterator find( const key_type& k ) const { return con.find( k ); }

size_type count( const key_type& k ) const { return con.count( k ); }

iterator lower_bound( const key_type& k )

{ return con.lower_bound( k ); }

const_iterator lower_bound( const key_type& k ) const

{ return con.lower_bound( k ); }

iterator upper_bound( const key_type& k )

{ return con.upper_bound( k ); }

const_iterator upper_bound( const key_type& k ) const

{ return con.upper_bound( k ); }

pair<iterator, iterator> equal_range( const key_type& k )

{ return con.equal_range( k ); }

pair<const_iterator, const_iterator> equal_range( const key_type& k ) const

{ return con.equal_range( k ); }

bool modify_key( iterator position, const key_type& new_key )

{ return con.modify_key_unique( position, new_key ); }

iterator modify_key( const key_type& k, const key_type& new_key )

{ return con.modify_key_unique( k, new_key ); }

}; //end class

template< typename Key, typename Value, typename Compare, typename Allocator >

inline void swap( map<Key, Value, Compare, Allocator>& lhs,

map<Key, Value, Compare, Allocator>& rhs )

{

lhs.swap( rhs );

}

template< typename Key, typename Value, typename Compare, typename Allocator >

inline bool operator==( const map<Key, Value, Compare, Allocator>& lhs,

const map<Key, Value, Compare, Allocator>& rhs )

{

return ( lhs.size() == rhs.size()

&& equal( lhs.begin(), lhs.end(), rhs.begin() ) );

}

template< typename Key, typename Value, typename Compare, typename Allocator >

inline bool operator!=( const map<Key, Value, Compare, Allocator>& lhs,

const map<Key, Value, Compare, Allocator>& rhs )

{

return !( lhs == rhs );

}

template< typename Key, typename Value, typename Compare, typename Allocator >

inline bool operator<( const map<Key, Value, Compare, Allocator>& lhs,

const map<Key, Value, Compare, Allocator>& rhs )

{

if( lhs.end() == rhs.end() || lhs.size() > rhs.size() )

return false;

return lexicographical_compare( lhs.begin(), lhs.end(),

rhs.begin(), rhs.end(), lhs.value_comp() );

}

template< typename Key, typename Value, typename Compare, typename Allocator >

inline bool operator>( const map<Key, Value, Compare, Allocator>& lhs,

const map<Key, Value, Compare, Allocator>& rhs )

{

return ( rhs < lhs );

}

template< typename Key, typename Value, typename Compare, typename Allocator >

inline bool operator<=( const map<Key, Value, Compare, Allocator>& lhs,

const map<Key, Value, Compare, Allocator>& rhs )

{

return !( rhs < lhs );

}

template< typename Key, typename Value, typename Compare, typename Allocator >

inline bool operator>=( const map<Key, Value, Compare, Allocator>& lhs,

const map<Key, Value, Compare, Allocator>& rhs )

{

return !( lhs < rhs );

}

//-----------------------------------------------------------------------------

//-----------------------------------------------------------------------------

template< typename Key, typename Value, typename Compare = less<Key>,

typename Allocator = allocator<Value> >

class multimap

{

private:

typedef pair<const Key, Value> value_t;

typedef rb_tree_node<value_t> node;

typedef typename Allocator::rebind<node>::other node_alloc;

typedef rb_tree<Key, value_t, select1st<value_t>, Compare, node_alloc>

tree;

// typedef rb_tree<Key, value_t, select1st<value_t>, Compare> tree;

tree con;

public:

typedef multimap<Key, Value, Compare, Allocator> self;

typedef Value mapped_type;

typedef typename tree::key_type key_type;

typedef typename tree::value_type value_type;

typedef typename tree::key_compare key_compare;

typedef typename tree::get_key get_key;

typedef typename tree::allocator_type allocator_type;

typedef typename tree::size_type size_type;

typedef typename tree::difference_type difference_type;

typedef typename tree::reference reference;

typedef typename tree::const_reference const_reference;

typedef typename tree::pointer pointer;

typedef typename tree::const_pointer cons_pointer;

typedef typename tree::iterator iterator;

typedef typename tree::const_iterator const_iterator;

typedef typename tree::reverse_iterator reverse_iterator;

typedef typename tree::const_reverse_iterator const_reverse_iterator;

class value_compare : public binary_function<value_type, value_type, bool>

{

private:

key_compare comp;

public:

value_compare( const key_compare& c ) : comp(c) {}

bool operator()( const value_type& lhs, const value_type& rhs ) const

{

return comp( lhs.first, rhs.first );

}

};

public:

multimap() : con( key_compare() ) {}

explicit multimap( const key_compare& comp ) : con(comp) {}

template< typename InputIterator >

multimap( InputIterator first, InputIterator last ) : con( key_compare() )

{

con.insert_equal( first, last );

}

template< typename InputIterator >

multimap( InputIterator first, InputIterator last, const key_compare& comp )

: con(comp)

{

con.insert_equal( first, last );

}

multimap( const self& rhs ) : con(rhs.con) {}

self& operator=( const self& rhs )

{ con = rhs.con; return *this; }

key_compare key_comp() const

{ return con.key_comp(); }

value_compare value_comp() const

{ return value_compare( con.key_compare() ); }

iterator begin() { return con.begin(); }

iterator end() { return con.end(); }

const_iterator begin() const { return con.begin(); }

const_iterator end() const { return con.end(); }

reverse_iterator rbegin() { return con.rbegin(); }

reverse_iterator rend() { return con.rend(); }

const_reverse_iterator rbegin() const { return con.rbegin(); }

const_reverse_iterator rend() const { return con.rend(); }

bool empty() const { return con.empty(); }

size_type size() const { return con.size(); }

size_type max_size() const { return con.max_size(); }

iterator insert( const key_type& k, const mapped_type& d )

{ return con.insert_equal( value_type(k, d) ); }

iterator insert( iterator position, const key_type& k, const mapped_type& d )

{ return con.insert_equal( position, value_type(k, d) ); }

iterator insert( const value_type& v )

{ return con.insert_equal( v ); }

iterator insert( iterator position, const value_type& v )

{ return con.insert_equal( position, v ); }

template< typename InputIterator >

void insert( InputIterator first, InputIterator last )

{ con.insert_equal( first, last ); }

void erase( iterator position ) { con.erase( position ); }

void erase( iterator first, iterator last ) { con.erase( first, last ); }

size_type erase( const key_type& k ) { return con.erase( k ); }

void clear() { con.clear(); }

void swap( self& rhs ) { con.swap( rhs.con ); }

iterator find( const key_type& k ) { return con.find( k ); }

const_iterator find( const key_type& k ) const { return con.find( k ); }

size_type count( const key_type& k ) const { return con.count( k ); }

iterator lower_bound( const key_type& k )

{ return con.lower_bound( k ); }

const_iterator lower_bound( const key_type& k ) const

{ return con.lower_bound( k ); }

iterator upper_bound( const key_type& k )

{ return con.upper_bound( k ); }

const_iterator upper_bound( const key_type& k ) const

{ return con.upper_bound( k ); }

pair<iterator, iterator> equal_range( const key_type& k )

{ return con.equal_range( k ); }

pair<const_iterator, const_iterator> equal_range( const key_type& k ) const

{ return con.equal_range( k ); }

bool modify_key( iterator position, const key_type& new_key )

{ return con.modify_key_equal( position, new_key ); }

void modify_key( const key_type& k, const key_type& new_key )

{ con.modify_key_equal( k, new_key ); }

}; //end class

template< typename Key, typename Value, typename Compare, typename Allocator >

inline void swap( multimap<Key, Value, Compare, Allocator>& lhs,

multimap<Key, Value, Compare, Allocator>& rhs )

{

lhs.swap( rhs );

}

template< typename Key, typename Value, typename Compare, typename Allocator >

inline bool operator==( const multimap<Key, Value, Compare, Allocator>& lhs,

const multimap<Key, Value, Compare, Allocator>& rhs )

{

return ( lhs.size() == rhs.size()

&& equal( lhs.begin(), lhs.end(), rhs.begin() ) );

}

template< typename Key, typename Value, typename Compare, typename Allocator >

inline bool operator!=( const multimap<Key, Value, Compare, Allocator>& lhs,

const multimap<Key, Value, Compare, Allocator>& rhs )

{

return !( lhs == rhs );

}

template< typename Key, typename Value, typename Compare, typename Allocator >

inline bool operator<( const multimap<Key, Value, Compare, Allocator>& lhs,

const multimap<Key, Value, Compare, Allocator>& rhs )

{

if( lhs.end() == rhs.end() || lhs.size() > rhs.size() )

return false;

return lexicographical_compare( lhs.begin(), lhs.end(),

rhs.begin(), rhs.end(), lhs.value_comp() );

}

template< typename Key, typename Value, typename Compare, typename Allocator >

inline bool operator>( const multimap<Key, Value, Compare, Allocator>& lhs,

const multimap<Key, Value, Compare, Allocator>& rhs )

{

return ( rhs < lhs );

}

template< typename Key, typename Value, typename Compare, typename Allocator >

inline bool operator<=( const multimap<Key, Value, Compare, Allocator>& lhs,

const multimap<Key, Value, Compare, Allocator>& rhs )

{

return !( rhs < lhs );

}

template< typename Key, typename Value, typename Compare, typename Allocator >

inline bool operator>=( const multimap<Key, Value, Compare, Allocator>& lhs,

const multimap<Key, Value, Compare, Allocator>& rhs )

{

return !( lhs < rhs );

}

//-----------------------------------------------------------------------------

//-----------------------------------------------------------------------------

__MACRO_CPLUSPLUS_YOUNG_LIBRARY_END_NAMESPACE__

#endif

//-----------------------------------------------------------------------------

//-----------------------------------------------------------------------------

 
 
 
免责声明:本文为网络用户发布,其观点仅代表作者个人观点,与本站无关,本站仅提供信息存储服务。文中陈述内容未经本站证实,其真实性、完整性、及时性本站不作任何保证或承诺,请读者仅作参考,并请自行核实相关内容。
2023年上半年GDP全球前十五强
 百态   2023-10-24
美众议院议长启动对拜登的弹劾调查
 百态   2023-09-13
上海、济南、武汉等多地出现不明坠落物
 探索   2023-09-06
印度或要将国名改为“巴拉特”
 百态   2023-09-06
男子为女友送行,买票不登机被捕
 百态   2023-08-20
手机地震预警功能怎么开?
 干货   2023-08-06
女子4年卖2套房花700多万做美容:不但没变美脸,面部还出现变形
 百态   2023-08-04
住户一楼被水淹 还冲来8头猪
 百态   2023-07-31
女子体内爬出大量瓜子状活虫
 百态   2023-07-25
地球连续35年收到神秘规律性信号,网友:不要回答!
 探索   2023-07-21
全球镓价格本周大涨27%
 探索   2023-07-09
钱都流向了那些不缺钱的人,苦都留给了能吃苦的人
 探索   2023-07-02
倩女手游刀客魅者强控制(强混乱强眩晕强睡眠)和对应控制抗性的关系
 百态   2020-08-20
美国5月9日最新疫情:美国确诊人数突破131万
 百态   2020-05-09
荷兰政府宣布将集体辞职
 干货   2020-04-30
倩女幽魂手游师徒任务情义春秋猜成语答案逍遥观:鹏程万里
 干货   2019-11-12
倩女幽魂手游师徒任务情义春秋猜成语答案神机营:射石饮羽
 干货   2019-11-12
倩女幽魂手游师徒任务情义春秋猜成语答案昆仑山:拔刀相助
 干货   2019-11-12
倩女幽魂手游师徒任务情义春秋猜成语答案天工阁:鬼斧神工
 干货   2019-11-12
倩女幽魂手游师徒任务情义春秋猜成语答案丝路古道:单枪匹马
 干货   2019-11-12
倩女幽魂手游师徒任务情义春秋猜成语答案镇郊荒野:与虎谋皮
 干货   2019-11-12
倩女幽魂手游师徒任务情义春秋猜成语答案镇郊荒野:李代桃僵
 干货   2019-11-12
倩女幽魂手游师徒任务情义春秋猜成语答案镇郊荒野:指鹿为马
 干货   2019-11-12
倩女幽魂手游师徒任务情义春秋猜成语答案金陵:小鸟依人
 干货   2019-11-12
倩女幽魂手游师徒任务情义春秋猜成语答案金陵:千金买邻
 干货   2019-11-12
 
推荐阅读
 
 
 
>>返回首頁<<
 
靜靜地坐在廢墟上,四周的荒凉一望無際,忽然覺得,淒涼也很美
© 2005- 王朝網路 版權所有