在 boost MPL 序列中搜索带有 boost 占位符的类型

Search a boost MPL sequence for a type with a boost placeholder

我有一个不同类型的 boost mpl 向量,想知道该向量中是否有一种特定类型。但是那个类型包含一个模板参数,它是一个 boost 占位符(我想在之后替换它)
代码:

#define BOOST_MPL_LIMIT_VECTOR_SIZE 20
#define BOOST_MPL_LIMIT_MAP_SIZE 20
#include <boost/typeof/std/utility.hpp>
#include <boost/mpl/placeholders.hpp>
#include <boost/mpl/vector.hpp>
#include <boost/mpl/contains.hpp>

namespace bmpl = boost::mpl;

template< class In, class Out = bmpl::_1 >
struct BSI{
    typedef typename Out::FrameType FrameType;
};

int main(){
    typedef BSI<float> foot;
    typedef bmpl::vector< int, foot > vec;
    typename bmpl::find_if< vec, bmpl::same_as<foot> >::type x;
}

问题是:Boost 似乎对占位符感到困惑并尝试应用我的占位符。当然,我可以编写自己的占位符和应用程序,但这可以通过 boost 本身实现吗?

重要的是要注意 Boost 占位符不是 Boost MPL 的 "implementation" 细节,但实际上是为使用而设计的:http://www.boost.org/doc/libs/1_58_0/libs/mpl/doc/refmanual/apply.html

然而,这里观察到的行为似乎是意料之中的:http://www.boost.org/doc/libs/1_57_0/libs/mpl/doc/tutorial/placeholders.html他们有一个例子:

mpl::multiplies<
    mpl::plus<_1,_2>,
    mpl::minus<_1,_2>
>

所以解决方案似乎是将有问题的 class 包装在引号中(如评论中所述),例如:

template<class T>
struct Quote{
    using type = T;
}

我仍然不确定 boost MPL 中是否有首选解决方案,例如保护或引用模板,尽管我没有找到合适的使用示例。