【发布时间】:2018-07-10 09:32:18
【问题描述】:
我在 boost.hana 邮件列表中看到了以下示例,但无法编译:
#include <boost/hana.hpp>
#include <string>
namespace hana = boost::hana;
int main(int argc, char **argv) {
constexpr auto m1 = hana::make_map(
hana::make_pair("key1"_s, hana::type_c<std::string>),
hana::make_pair("key2"_s, hana::type_c<std::string>)
);
}
我在 GCC 7.3.0 -std=c++14 上收到以下错误:
error: unable to find string literal operator ‘operator""_s’ with ‘const char [5]’, ‘long unsigned int’ arguments
hana::make_pair("key1"_s, hana::type_c<std::string>),
^~~~~~~~
顺便问一下,字符串字面量的«_s»后缀是什么?
【问题讨论】:
标签: c++ boost boost-hana