首页
学习
活动
专区
圈层
工具
发布
社区首页 >问答首页 >连接Boost Hana字符串

连接Boost Hana字符串
EN

Stack Overflow用户
提问于 2017-04-24 02:50:12
回答 1查看 446关注 0票数 2

尝试连接Boost Hana编译时字符串会在我的应用程序中出现编译器错误。是否有任何需要激活的特定配置选项或需要包含的标头才能正常工作?

这里有一个例子:

代码语言:javascript
复制
#define BOOST_HANA_CONFIG_ENABLE_STRING_UDL
#include "boost/hana.hpp"

namespace hana = boost::hana;

using namespace hana::literals;

int main() {
  auto t = "left, "_s + "right"_s;
}

这在GCC 6.3.1上失败,并出现错误error: no match for ‘operator+’ (operand types are ‘boost::hana::string<'l', 'e', 'f', 't', ',', ' '>’ and ‘boost::hana::string<'r', 'i', 'g', 'h', 't'>’)。Boost 1.62.0中的Hana

注意,将运算符+替换为hana::plus失败,并显示错误hana::plus(x, y) requires 'x' to be a Monoid

EN

回答 1

Stack Overflow用户

发布于 2017-04-24 23:15:21

正如Jason莱斯所指出的,Boost 1.63中添加了对编译时字符串连接的支持

https://github.com/boostorg/hana/commit/7a3e0480d442c393ed7bcc1ca72a3e1821319ff0

票数 3
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/43575142

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档