boost-hana

    2热度

    3回答

    我想问编译器检查一个元组是否只包含“元类型”。 顺便说一句,我是全新的C++概念。 template < typename T > struct Type { using type = T; }; //! A type can be easily check with a small concept template < typename T > concept bool C

    5热度

    1回答

    考虑以下问题,它使用-std=c++14在Clang 3.8上成功编译。 #include <boost/hana.hpp> namespace hana = boost::hana; int main() { constexpr auto indices = hana::range<unsigned, 0, 3>(); hana::for_each(indices,

    1热度

    1回答

    我正在调查Hana,我很惊讶地看到它有一个type(“排序类型的容器,类似于没有实际值的单元组”的概念),但是types(一系列type)是一个实验性功能。 有谁知道为什么?与单一类型的容器相比,类型列表的复杂性如何?

    4热度

    1回答

    我有一些旧代码使用非常类似于str_const描述的here和here来执行一些constexpr字符串操作。 str_const是Scott Schurr描述的一种文字类型,可以从字符串文字构造,因为它具有const char (&)[]的模板构造函数。 我现在也有一些使用boost::hana的新代码。 我希望能够采取hana::string并创建一个引用它的str_const。最简单的方法是

    9热度

    2回答

    我需要构建n个类型的元组。这n个类型是n个其他类型的值类型。考虑这个片断: #include <boost/hana.hpp> namespace hana = boost::hana; template<class... Types> class CartesianProduct { public: CartesianProduct(Types... args) : se

    1热度

    1回答

    我简化了我的代码生成错误,并发现,即使这个简单的计数功能给了我一个错误(见下文): #include <boost/hana/tuple.hpp> #include <boost/hana/fold.hpp> #include <boost/hana/plus.hpp> #include <boost/hana/integral_constant.hpp> int main() {

    3热度

    1回答

    我想用升压花生成这个最终代码: template < typename ... Ts > void foo(Ts ... data) { constexpr auto tuple = hana::make_tuple(data...); //Code that I need to be generate container_c[tuple[0_c]].foo2(

    1热度

    2回答

    在现代C++中面对constexpr修饰符的典型新手问题。 我说对了,即使在C++ 17中也没有办法编写这样的代码(原因为http://www.boost.org/doc/libs/1_63_0/libs/hana/doc/html/index.html#tutorial-appendix-constexpr)? 而且必须使用“值作为类型”成语(在此示例中使用不同类型的打开和关闭文件)? #inc

    2热度

    1回答

    我想知道,不使用典型的递归函数,但使用boost::hana为例,如何用最简单的方式转换工具boost和std工具的一个对象以下类型(例如): std::tuple<int, double, char, double> 到类型的对象: std::tuple<std::pair<int, double>, std::pair<char, double> >; 我一直在寻找的boost::ha

    2热度

    2回答

    我最近下载了最新的boost库以访问的boost ::花与他们的文档page,他们建议使用“FindHana.cmake模块读取将Hana设置为外部项目以供使用。“ 我不知道这一点,所以我刚才设置的编译标志,包括我hana.hpp的头路,但我很想知道如何做到这一点的文档中建议的方式。