繁体   English   中英

返回constexpr的函数无法编译

[英]Function returning constexpr does not compile

为什么不编译:
string作为返回类型会出现问题吗?

constexpr std::string fnc()
{
    return std::string("Yaba");
}

使用指向char的指针的std::string的构造函数不是constexpr constexpr功能,你只能使用那些功能constexpr

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM