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

What is operator"" that I saw in GoingNative2012

本文关键字:运算符 是什么 GoingNative2012 我在      更新时间:2023-10-16

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

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

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

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

我从来不知道"是可重载的?

尽管我未能使用 VS 2010 进行测试,但这是否是 C++ 中的新功能之一?

提前谢谢。

这是一个

新的 C++11 核心语言功能:用户定义的 litterals