【发布时间】:2015-01-17 12:10:46
【问题描述】:
在boost/mpl/assert.hpp,我看到了这样的东西:
template<class Pred>
struct eval_assert {
typedef typename extract_assert_pred<Pred>::type P;
typedef typename P::type p_type;
typedef typename ::boost::mpl::if_c<p_type::value,
AUX778076_ASSERT_ARG(assert<false>),
failed ************ P::************
>::type type;
};
如果第一个************ 可以被视为结构指针失败,那么P::************ 对我来说真的没有任何意义。这是标准的 C++ 吗?
【问题讨论】:
-
指针感知 ...
-
@deviantfan 在生产代码中?你会感到惊讶。 ;) 但是这里的重点是通过尝试引用
P的成员来导致编译失败,并且非常确定它不会存在。 (在 C++11 中,您可能只使用static_assert(false),但当然 Boost 必须可移植到 C++11 之前的版本。) -
旁注:12级指针可能与C标准要求的最小值有关。
-
@PaulDraper 实际上在这里阅读
hunter2hunter2hunter2hunter2 -
指向指针的指针 指向指针的指针 指向指针的指针 指向指针的指针 指向指针的指针 指向指针的指针 指向类型成员的指针P