- The C Standard Library
- The C Standard Library
- The C++ Standard Library
- C++ Library - Home
- C++ Library - <fstream>
- C++ Library - <iomanip>
- C++ Library - <ios>
- C++ Library - <iosfwd>
- C++ Library - <iostream>
- C++ Library - <istream>
- C++ Library - <ostream>
- C++ Library - <sstream>
- C++ Library - <streambuf>
- C++ Library - <atomic>
- C++ Library - <complex>
- C++ Library - <exception>
- C++ Library - <functional>
- C++ Library - <limits>
- C++ Library - <locale>
- C++ Library - <memory>
- C++ Library - <new>
- C++ Library - <numeric>
- C++ Library - <regex>
- C++ Library - <stdexcept>
- C++ Library - <string>
- C++ Library - <thread>
- C++ Library - <tuple>
- C++ Library - <typeinfo>
- C++ Library - <utility>
- C++ Library - <valarray>
- The C++ STL Library
- C++ Library - <array>
- C++ Library - <bitset>
- C++ Library - <deque>
- C++ Library - <forward_list>
- C++ Library - <list>
- C++ Library - <map>
- C++ Library - <queue>
- C++ Library - <set>
- C++ Library - <stack>
- C++ Library - <unordered_map>
- C++ Library - <unordered_set>
- C++ Library - <vector>
- C++ Library - <algorithm>
- C++ Library - <iterator>
- C++ Programming Resources
- C++ Programming Tutorial
- C++ Useful Resources
- C++ Discussion
C++ Tuple Library - relational operators (tuple)
Description
It contains relational operators for tuple and performs the appropriate comparison operation between the tuple objects lhs and rhs.
Declaration
Following is the declaration for std::relational operators (tuple)
C++98
template<class... TTypes, class... UTypes> bool operator== ( const tuple<TTypes...>& lhs, const tuple<UTypes...>& rhs); template<class... TTypes, class... UTypes> bool operator!= ( const tuple<TTypes...>& lhs, const tuple<UTypes...>& rhs); template<class... TTypes, class... UTypes> bool operator< ( const tuple<TTypes...>& lhs, const tuple<UTypes...>& rhs); template<class... TTypes, class... UTypes> bool operator> ( const tuple<TTypes...>& lhs, const tuple<UTypes...>& rhs); template<class... TTypes, class... UTypes> bool operator>= ( const tuple<TTypes...>& lhs, const tuple<UTypes...>& rhs); template<class... TTypes, class... UTypes> bool operator<= ( const tuple<TTypes...>& lhs, const tuple<UTypes...>& rhs);
C++11
template<class... TTypes, class... UTypes> bool operator== ( const tuple<TTypes...>& lhs, const tuple<UTypes...>& rhs); template<class... TTypes, class... UTypes> bool operator!= ( const tuple<TTypes...>& lhs, const tuple<UTypes...>& rhs); template<class... TTypes, class... UTypes> bool operator< ( const tuple<TTypes...>& lhs, const tuple<UTypes...>& rhs); template<class... TTypes, class... UTypes> bool operator> ( const tuple<TTypes...>& lhs, const tuple<UTypes...>& rhs); template<class... TTypes, class... UTypes> bool operator>= ( const tuple<TTypes...>& lhs, const tuple<UTypes...>& rhs); template<class... TTypes, class... UTypes> bool operator<= ( const tuple<TTypes...>& lhs, const tuple<UTypes...>& rhs); </pre>
Parameters
lhs, rhs − These are tuple objects.
Return Value
It returns true if the condition holds, and false otherwise.
Exceptions
No-throw guarantee − this member function never throws exceptions.
Data races
lhs and rhs, are accessed, and up to all of its members are accessed.
Example
In below example for std::relational operators (tuple).
#include <iostream> #include <tuple> int main () { std::tuple<int,char> a (100,'x'); std::tuple<char,char> b (100,'x'); std::tuple<char,char> c (100,'y'); if (a==b) std::cout << "a and b are equal\n"; if (b!=c) std::cout << "b and c are not equal\n"; if (b<c) std::cout << "b is less than c\n"; if (c>a) std::cout << "c is greater than a\n"; if (a<=c) std::cout << "a is less than or equal to c\n"; if (c>=b) std::cout << "c is greater than or equal to b\n"; return 0; }
The output should be like this −
a and b are equal b and c are not equal b is less than c c is greater than a a is less than or equal to c c is greater than or equal to b
tuple.htm
Advertisements
To Continue Learning Please Login
Login with Google