operator> <tuple>
比較較大的 tuple 物件。
template<class T1, class T2, ..., class TN,
class U1, class U2, ..., class UN>
bool operator>(const tuple<T1, T2, ..., TN>& tpl1,
const tuple<U1, U2, ..., UN>& tpl2);
參數
- TN
第 n 個 Tuple 項目的型別。
備註
函式會傳回 tpl2 < tpl1。
範例
// std_tr1__tuple__operator_gt.cpp
// compile with: /EHsc
#include <tuple>
#include <iostream>
typedef std::tuple<int, double, int, double> Mytuple;
int main()
{
Mytuple c0(0, 1, 2, 3);
// display contents " 0 1 2 3"
std::cout << " " << std::get<0>(c0);
std::cout << " " << std::get<1>(c0);
std::cout << " " << std::get<2>(c0);
std::cout << " " << std::get<3>(c0);
std::cout << std::endl;
Mytuple c1 = std::make_tuple(4, 5, 6, 7);
// display contents " 4 5 6 7"
std::cout << " " << std::get<0>(c0);
std::cout << " " << std::get<1>(c0);
std::cout << " " << std::get<2>(c0);
std::cout << " " << std::get<3>(c0);
std::cout << std::endl;
// display results of comparisons
std::cout << std::boolalpha << " " << (c0 > c0);
std::cout << std::endl;
std::cout << std::boolalpha << " " << (c1 > c0);
std::cout << std::endl;
return (0);
}
需求
標題: <Tuple>
命名空間: std