相关疑难解决方法(0)

auto foo(...) - > decltype(this)有一些解决方法吗?

我有下一个类,并尝试声明成员函数,它将返回指向该类型但下一个代码的指针

template<class Key, int b> class b_plus_tree_inner_node {
  auto split() -> decltype(this) {}
};
Run Code Online (Sandbox Code Playgroud)

给了我这样的错误

在顶层无效使用'this'

我可以用另一种方式做到这一点,我现在关于typedef的存在,但是它可能与decltype有关吗?

编辑:

我想完成这个:

b_plus_tree_inner_node<Key, b>* split() {...}
Run Code Online (Sandbox Code Playgroud)

c++ c++11

3
推荐指数
1
解决办法
946
查看次数

标签 统计

c++ ×1

c++11 ×1