我如何测试 or_
的计算结果是真还是假?
说我有
typedef boost::mpl::or_<
boost::is_same<ExPolicy,sequential_execution_policy>,
boost::is_same<InIter, std::input_iterator_tag>,
boost::is_same<OutIter, std::output_iterator_tag>
> is_seq;
我将如何测试结果?目前我尝试做
auto h = is_seq();
if(h == boost::mpl::true_::value)
但是当我知道我的程序中至少一个案例为真时,一切都评估为假。我该怎么做才能知道该值?
最佳答案
使用is_seq::value
。例如:
template<typename T>
using type = boost::mpl::or_<
std::is_same<T, char>,
std::is_same<T, int>
>;
int main()
{
std::cout << type<int>::value << std::endl;
std::cout << type<long>::value << std::endl;
}
输出:
1
0
关于c++ - 测试 boost::mpl::or_ 的计算结果是真还是假,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/24048757/