📄 chapter9-35.cpp
字号:
//文件名:CHAPTER9-35.cpp
#include <set>
#include <iostream>
#if _MSC_VER > 1020 // if VC++ version is > 4.2
using namespace std; // std c++ libs implemented in std
#endif
int main( )
{
set <int, less<int> > s1;
set <int, less<int> >::value_compare vc1 = s1.value_comp( );
bool result1 = vc1( 2, 3 );
if( result1 == true )
{
cout << "vc1( 2,3 ) returns value of true, "<< "where vc1 is the function object of s1."<< endl;
}
else
{
cout << "vc1( 2,3 ) returns value of false, "<< "where vc1 is the function object of s1."<< endl;
}
set <int, greater<int> > s2;
set<int, greater<int> >::value_compare vc2 = s2.value_comp( );
bool result2 = vc2( 2, 3 );
if( result2 == true )
{
cout << "vc2( 2,3 ) returns value of true, "<< "where vc2 is the function object of s2."<< endl;
}
else
{
cout << "vc2( 2,3 ) returns value of false, "<< "where vc2 is the function object of s2."<< endl;
}
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -