boost-mpl

boost-mpl

文章 0 浏览 3

使用 boost mpl pop_front

有: #include #include #include int main() { typedef boost::mpl::vector v; typedef typename pop_front::type poped; } 问题是 poped 不等于 boo…

蔚蓝源自深海 2024-12-12 21:45:27 0 0

将 mpl lambda 表达式作为模板参数传递

我正在尝试编写一个类似于 boost::mpl::find_if 的元函数,但不同之处在于它将从末尾开始遍历序列。我收到编译错误,我猜这些错误来自作为我的元函数…

眼趣 2024-12-12 14:05:25 0 0

如何交换 mpl::vector 的两个元素?

我正在编写一个模板函数,它应该交换 boost::mpl::vector 的两个元素(类似于 std::swap)。困难的部分是在编译时没有变量的概念。我已经写了一份草稿…

乄_柒ぐ汐 2024-12-12 07:30:34 0 0

Boost.flyweight 和 Boost.MPL

我有一个关于享元选项的问题,给出下面的定义,基于 http://www.boost.org/doc/libs/1_40_0/libs/flyweight/test/test_basic.cpp typedef boost::flyw…

雨巷深深 2024-12-10 19:13:15 0 0

Boost MPL:仅当(成员)函数存在时才调用它

我有一个类 A,它有一个模板参数 T。在某些用例中,类 T 提供了函数 func1(),而在某些用例中,类 T 不提供该函数。 A 中的函数 f() 应该调用 func1()…

北渚 2024-12-08 13:13:47 0 0

使用 boost::mpl::for_each 类型包装器错误(Abrahams & Gurtovoy 书中的第 9.1.1 节)

以下代码几乎是从 David Abrahams 和 Beyond 所著的《C++ Template Metaprogramming: Concepts, Tools, and Techniques from Boost and Beyond》一书…

冷弦 2024-12-06 16:39:19 0 0

“部分应用”对于模板参数

我有以下“主”模板: template < template class S > struct TT { /*...*/ }; 以及我想与 TT: 一起使用的模板: template struct S1 {}; 特别是,我…

千年*琉璃梦 2024-12-05 03:06:45 0 0

在运行时选择 ctor 参数

是否可以解决以下使用 mpl 在运行时选择参数的场景? struct A { A(int number) { /* use number */ } }; struct B { }; template struct A_or_B_Hold…

櫻之舞 2024-12-02 10:51:15 1 0

从任意映射获取mapped_type的指针或引用

编辑:我已经找到并写下了问题的解决方案,但我没有回答这个问题,因为我的解决方案可能仍然不理想。 我正在编写一个小型库,旨在在地图的地图上执行…

不必你懂 2024-12-01 21:57:54 2 0

C++在编译时将整数转换为字符串

我想做这样的事情: template char* foo() { // return a compile-time string containing N, equivalent to doing // ostringstream ostr; // ostr <…

鸢与 2024-11-24 09:58:53 1 0

制作 boost::fusion::result_of::as_set<> “实例不调用它的元素”构造函数

#include #include #include #include #include #include #include #include #include #include #include #include #include /**********definition o…

尐偏执 2024-11-19 15:56:24 5 0

boost::fusion::result_of::as_set(或as_vector)从复杂(嵌套)mpl 序列转换而来

#include #include #include #include #include #include #include #include #include #include #include #include struct node_base { int get() {re…

等风来 2024-11-18 13:22:28 9 0

boost::MPL 和 boost::fusion 之间的区别

我是 boost::fusion 和 boost::mpl 库的新手。谁能告诉我这两个库之间的主要区别? 到目前为止,我只使用 fusion::vector 和其他一些简单的东西。现在…

萧瑟寒风 2024-11-17 01:58:01 5 0

元编程:从 boost mpl::vector 中的每个类继承

我希望继承包含在 boost mpl::vector 中的一组类。这可能吗? 具体来说,我希望为任意多个模板参数扩展 test,并作为 mpl::vector 传递。 template st…

落花浅忆 2024-11-16 10:08:59 3 0

使用 boost mpl inserter 迭代器的意外结果

我原以为以下会给出相同的结果: namespace mpl = boost::mpl; template struct make_vector1 : mpl::copy< mpl::range_c, mpl::inserter< mpl::vecto…

孤独难免 2024-11-15 19:33:27 3 0
更多

推荐作者

苦中寻乐

文章 0 评论 0

lueluelue

文章 0 评论 0

嗼ふ静

文章 0 评论 0

王权女流氓

文章 0 评论 0

与花如笺

文章 0 评论 0

残酷

文章 0 评论 0

更多

友情链接

    我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
    原文