开发者

Function returning constexpr does not compile

Why doesn't this compile:

Could there be a problem with a string as a return type?

constexpr开发者_开发问答 std::string fnc()
{
    return std::string("Yaba");
}


The constructor of std::string that takes a pointer to char is not constexpr. In constexpr functions you can only use functions that are constexpr.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜