A
arnuld
C++ Primer 4/e says, every pair has 2 members named <first> and <last> but
g++ refuses to accept so. I have just created a pir and trying to print
its both members:
#include<iostream>
#include<string>
#include<utility>
int main()
{
std:air<std::string, int> my_pair;
std::cin >> my_pair.first >> my_pair.last;
std::cout << my_pair.first << "\n"
<< my_pair.last << "\n";
return 0;
}
========= OUTPUT ==============
/home/arnuld/programs $ g++ -ansi -pedantic -Wall -Wextra test.cpp
test.cpp: In function ‘int main()’:
test.cpp:12: error: ‘struct std:air<std::basic_string<char,
std::char_traits<char>, std::allocator<char> >, int>’
has no member named ‘last’
test.cpp:15: error: ‘struct std:air<std::basic_string<char,
std::char_traits<char>,std::allocator<char> >, int>’ has no member named
‘last’ /home/arnuld/programs $
g++ refuses to accept so. I have just created a pir and trying to print
its both members:
#include<iostream>
#include<string>
#include<utility>
int main()
{
std:air<std::string, int> my_pair;
std::cin >> my_pair.first >> my_pair.last;
std::cout << my_pair.first << "\n"
<< my_pair.last << "\n";
return 0;
}
========= OUTPUT ==============
/home/arnuld/programs $ g++ -ansi -pedantic -Wall -Wextra test.cpp
test.cpp: In function ‘int main()’:
test.cpp:12: error: ‘struct std:air<std::basic_string<char,
std::char_traits<char>, std::allocator<char> >, int>’
has no member named ‘last’
test.cpp:15: error: ‘struct std:air<std::basic_string<char,
std::char_traits<char>,std::allocator<char> >, int>’ has no member named
‘last’ /home/arnuld/programs $