小编myv*_*ang的帖子

为什么它在这里使用void**?

代码从v8-0.2.5中提取

/**
 * Checks whether two handles are the same.
 * Returns true if both are empty, or if the objects
 * to which they refer are identical.
 * The handles' references are not checked.
 */
template <class S> bool operator==(Handle<S> that) {
  void** a = reinterpret_cast<void**>(**this);
  void** b = reinterpret_cast<void**>(*that);
  if (a == 0) return b == 0;
  if (b == 0) return false;
  return *a == *b;
}  
Run Code Online (Sandbox Code Playgroud)

Handle超载运算符*,这样**this和*that返回类型T*.

所以它看起来 …

c++ v8 reinterpret-cast

9
推荐指数
1
解决办法
624
查看次数

标签 统计

c++ ×1

reinterpret-cast ×1

v8 ×1