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还支持手绘图片,你可以单独完成一幅画作后发给对方,也可以邀请对方一起完成你们的大作。手绘