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个元组元素的类型。

备注

函数返回true,则 N 大于0和在 tpl1 的第一个不同的值进行比较小于在 tpl2的高版本时相应的值,否则返回false。

示例

 

// std_tr1__tuple__operator_lt.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 << " " << (c0 < c1); 
    std::cout << std::endl; 
 
    return (0); 
    } 
 
  

要求

标头: <tuple>

命名空间: std

请参见

参考

<tuple>

operator== <tuple>

operator!= <tuple>

operator<= <tuple>

operator> <tuple>

operator>= <tuple>