CHAPTER10-37.cpp
上传用户:fjc899
上传日期:2007-07-03
资源大小:187k
文件大小:1k
- //文件名:CHAPTER10-37.cpp
- #include <map>
- #include <iostream>
- #if _MSC_VER > 1020 // if VC++ version is > 4.2
- using namespace std; // std c++ libs implemented in std
- #endif
- void main( )
- {
- map <int, int, less<int> > m1;
- map <int, int, less<int> >::value_compare vc1 = m1.value_comp( );
- pair< map<int,int>::iterator, bool > pr1, pr2;
-
- pr1= m1.insert ( map <int, int> :: value_type ( 1, 10 ) );
- pr2= m1.insert ( map <int, int> :: value_type ( 2, 5 ) );
- if( vc1( *pr1.first, *pr2.first ) == true )
- { cout << "The element ( 1,10 ) precedes the element ( 2,5 )."<< endl; }
- else
- { cout << "The element ( 1,10 ) does not precede the element ( 2,5 )."
- << endl;
- }
- if(vc1( *pr2.first, *pr1.first ) == true )
- { cout << "The element ( 2,5 ) precedes the element ( 1,10 )."<< endl; }
- else
- { cout << "The element ( 2,5 ) does not precede the element ( 1,10 )."
- << endl; }
- }