种豆资源网

当前位置:首页 > 百科 > 百科综合 / 正文

plus()

(2019-04-26 12:51:53) 百科综合

plus()

返回两个参数的和,等价于符号“+”的作用,如果是累的话,必须重定义。

基本介绍

  • 外文名:plus
plus在C++库中的定义如下:
template<>
struct plus<void>
{ // transparent functor for operator+
typedef int is_transparent;
template<class _Ty1,
class _Ty2>
constexpr auto operator()(_Ty1&& _Left, _Ty2&& _Right) const
-> decltype(static_cast<_Ty1&&>(_Left)
+ static_cast<_Ty2&&>(_Right))
{ // transparently apply operator+ to operands
return (static_cast<_Ty1&&>(_Left)
+ static_cast<_Ty2&&>(_Right));
}
};

标 签

搜索
随机推荐

Powered By 种豆资源网||