代码 :
#include <iostream>
int main()
{
auto x = [](int *) {};
auto y = [](int *) {};
std::cout << "x typeid: " << typeid(decltype(x)).name() << std::endl;
std::cout << "y typeid: " << typeid(decltype(y)).name() << std::endl;
}
输出:
x typeid: class <lambda_5ce039d8eebcb2cdcfd08ea27e765fa4>
y typeid: class <lambda_0f30135fad7a0f18ac2e2e72a933e102>