C++ 函数名后有两个括号???

时间:2020-03-18 09:22:51   收藏:0   阅读:319
 bool operator()(const Node3D* lhs, const Node3D* rhs)
const {
    return lhs->getC() > rhs->getC();
  }

刚看到的时候有点懵,这是什么用法?

查了资料才知道是一种高级用法,是由于 bool operator()执行完后返回的是函数,而(const Node3D* lhs, const Node3D* rhs)就是返回函数的参数.所以相当于执行了两个函数.

原文:https://www.cnblogs.com/fuhang/p/12515308.html

评论(0
© 2014 bubuko.com 版权所有 - 联系我们:wmxa8@hotmail.com
打开技术之扣,分享程序人生!