【发布时间】:2018-12-14 17:17:27
【问题描述】:
有人知道如何反转 boost::hana::string 吗?
以下不起作用:
#include <boost/hana.hpp>
#include <boost/hana/reverse.hpp>
auto s = BOOST_HANA_STRING("abc");
auto s2 = boost::hana::reverse(s);
带有错误信息:
boost/hana/reverse.hpp:36:9: error: static_assert failed due to requirement
'hana::Sequence<S>::value' "hana::reverse(xs)
requires 'xs' to be a Sequence"
特别是,不应理所当然地认为模板参数是字符。将 hana::string 的内容作为字符常量访问的正确方法是使用 hana::unpack、.c_str() 或 hana::to
所以,我猜看的方向是“如何将 hana::string 转换为 Sequence”
谢谢!
【问题讨论】:
标签: c++ templates boost-hana