11

为什么不编译: a作为返回类型
会不会有问题?string

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

1 回答 1

14

它的构造函数std::string需要一个指向charis not的指针constexpr。在constexpr函数中,您只能使用constexpr.

于 2011-10-15T16:22:02.950 回答