#include <utility>
#include <string>
#include <iostream>
using namespace std;
int main()
{
auto myPair2 = std::make_pair(12, "Twelve");
cout<< myPair2.first << '\n';
cout <<myPair2.second.size() << '\n';
return 0;
}
然后编译器出错
main.cpp: In function ‘int main()’:
main.cpp:22:27: error: request for member ‘size’ in ‘myPair2.std::pair::second’, which is of non-class type ‘const char*’
cout <<myPair2.second.size() << '\n';
【 在 lwp 的大作中提到: 】
: 我擦你别忽悠我,
: With C++17’s new deduction rules, you can forget about the helper function
: templates, and simply write the following:
: ...................
--
修改:mvtec FROM 67.163.48.*
FROM 67.163.48.*