连接Boost Hana字符串
问题描述:
尝试连接Boost Hana编译时字符串会在我的应用程序中出现编译器错误。是否有任何特定的配置选项来激活或标题,需要包括这个工作?连接Boost Hana字符串
这里是一个例子:
#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;
}
此失败,错误error: no match for ‘operator+’ (operand types are ‘boost::hana::string<'l', 'e', 'f', 't', ',', ' '>’ and ‘boost::hana::string<'r', 'i', 'g', 'h', 't'>’)
上GCC 6.3.1。与花与Boost 1.62.0
作为一个侧面说明,与hana::plus
更换运营商+
失败,错误hana::plus(x, y) requires 'x' to be a Monoid
答
正如杰森大米,用于编译时字符串连接的支持,指出了加速1.1加入。 63
https://github.com/boostorg/hana/commit/7a3e0480d442c393ed7bcc1ca72a3e1821319ff0
[作品在升压1.63](https://wandbox.org/permlink/LDuI2ykh0b4HC5OC) – chris
是的它是在1.63加入。 https://github.com/boostorg/hana/commit/7a3e0480d442c393ed7bcc1ca72a3e1821319ff0 –
完美,谢谢。 –