#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;
}

  

posted on 2018-09-30 14:47  陈峰  阅读(581)  评论(0编辑  收藏  举报