什么是我在GoingNative2012中看到的运算符“”

时间:2012-04-07 09:05:02

标签: c++ c++11 operator-keyword

我最近看过GoingNative2012当然是关于C ++ 11。

在Bjarne Stroustrup部分,我发现有一个有趣的运算符函数,如下所示。

constexpr Value<Second> operator""s(long double d)
{
     return Value<Second>(d);
}

好吧,除了在C ++ 11中看起来像新关键字的constexpr之外,

我从来不知道“”是否可以超载?

这是C ++中的新功能之一,虽然我没能使用VS 2010测试它吗?

提前致谢。

1 个答案:

答案 0 :(得分:5)

这是一种新的C++11核心语言功能:user defined litterals