Function template return type deduction

后端 未结 5 721
南旧
南旧 2020-12-11 02:34

I have some class C with const and non-const getters for some generic type Node:

template 

        
5条回答
  •  隐瞒了意图╮
    2020-12-11 03:01

    I would recommend the:

    template 
    auto AliasGetNode(CType& cobject) -> decltype(cobject.getNode(0))
    {
        return cobject.getNode(0);
    }
    

    This should fairly work since c++11

提交回复
热议问题