This class couples together a pair of values, which may be of different types (T1 and T2). The individual values can be accessed through the public members first and second. The class is defined as: template <class T1, class T2> struct pair { typedef T1 first_type; typedef T2 second_type; T1 first; T2 second; pair() : first(T1()), second(T2()) {} pair(const T1& x, const T2& y) : first(x), second(y) {} template <class U, class V> pair (const pair<U,V> &p) : first(p.first), second(p.second) { } }
Member
first_type, second_type Alises of template parameters T1 and T2 respectively. first, second Data members containing the first and second values stored in the pair. pair() Constructs a pair object with each of its members first and second constructed with their respective default constructors. pair(const T1& x, const T2& y) Constructs a pair object with its members first and second initialized to x and y, respectively. template <class U, class V> pair (const pair<U,V> &p) Constructs a pair object with its members first and second initialized to the corresponding elements in p, which must be of any couple of implicitly-convertible types (including the same types).
Global operator
The header <utility> also overloads the relational operators ==, <, !=, >, >= and <= , so as to be able to compare pair objects of the same type directly: Two pair objects are compared equal if the first elements in both objects compare equal to each other and both second elements also compare equal to each other - they all have to match. In inequality comparisons (<, >), the first elements are compared first, and only if the inequality comparison is not true for them, the second elements are compared.
註冊完Pair後,你需要錄製一段視頻邀請你的戀人。當他(她)接受邀請後,你們便可以在Pair中交流。Pair不僅可以直接傳送文字、照片和視頻,還能共享地理位置信息,同時還可以一鍵表達思念之情——摁下按鈕後,Pair便會默認傳送“在想你”(thinking of you)的信息給對方。此外,Pair還支持手繪圖片,你可以單獨完成一幅畫作後發給對方,也可以邀請對方一起完成你們的大作。