c++ - boost mp11 中 "quoted metafunction"的目的是什么?

标签 c++ boost-mp11

我正在尝试学习 boost::mp11 的基础知识,文档还可以,但我不明白的一件事如下:
引用元函数的目的是什么?
文档是这样说的:

A quoted metafunction is a class with a public metafunction member called fn, for example

struct Q1 { template<class...> using fn = void; };

struct Q2 { template<class T> using fn = T*; };

struct Q3 { template<class... T> using fn =
  std::integral_constant<std::size_t, sizeof...(T)>; };
算法有后缀 _q 的“重载”,将引用的元函数作为参数,但我仍然不明白何时使用 bla 以及何时使用 bla_q。

最佳答案

来自 http://www.pdimov.com/cpp2/mp11_slides.pdf 中的幻灯片 14 :
enter image description here
所以基本上,这似乎是你的指导:

When you get the "can’t expand into a fixed parameter list" error, try quoting the metafunction and using the _q algorithm instead

关于c++ - boost mp11 中 "quoted metafunction"的目的是什么?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/62746705/

相关文章:

c++ - 使用boost mp11有效地打开运行时值(处理函数完成时中断)

c++ - 为什么在函数定义中缺少形式参数名称的 C++ 代码编译时没有警告?

c++ - 模板推导在堆上失败,但在堆栈上有效

c++ - 如何在不进行类型转换的情况下从双端队列中提取?

c++ - 使用隐式转换从字符串流插入

c++ - 错误 C1189 #error : The C++ Standard Library forbids macroizing the keyword "inline"

c++ - 未能尝试定义 Boost::mp11::find_if 谓词