-
std::pair< T1, T2 >
is a C++ structure that holds one object of type T1 and another one of type T2:
#include <cassert>
#include <string>
#include <utility>
using namespace std;
int main (int argc, char* argv[])
{
pair< string, string > strstr;
strstr.first = "Hello";
strstr.second = "World";
pair< int, string > intstr;
intstr.first = 1;
intstr.second = "one";
pair< string, int > strint( "two", 2 );
assert( strint.first == "two" );
assert( strint.second == 2 );
return 0;
}
|
|