我正在尝试学习 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 :
所以基本上,这似乎是你的指导:
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/