#include <iostream> #include <typeinfo> #include <type_traits> using namespace std; class OuterType{ public: struct InnerType {int i; }; InnerType GetInner(); InnerType it; }; //返回类型后置语法,将decltype和auto结果起来完成返回值类型的推导, auto OuterType::GetInner() -> InnerType{ return it; } //返回类型后置语法,将decltype和auto结果起来完成返回值类型的推导, template <typename T, typename U> auto add(T t, U u) -> decltype(t + u) { return t + u; } int main() { return 0; }