BOOST_INTRUSIVE_OPTION_CONSTANT
// In header: <boost/intrusive/pack_options.hpp>
BOOST_INTRUSIVE_OPTION_CONSTANT(OPTION_NAME, TYPE, VALUE, CONSTANT_NAME)
定义一个名为 OPTION_NAME 的选项类,可用于指定类型为 TYPE,值为 VALUE 的常量...
struct OPTION_NAME<TYPE VALUE> { unspecified_content };
...在与 boost::intrusive::pack_options
组合后,将包含一个值为 VALUE 的 CONSTANT_NAME 静态常量。 示例
//[includes and namespaces omitted for brevity] //This macro will create the following class: // template<bool Enabled> // struct incremental // { unspecified_content }; BOOST_INTRUSIVE_OPTION_CONSTANT(incremental, bool, Enabled, is_incremental) struct empty_default{}; const bool is_incremental = pack_options< empty_default, incremental<true> >::type::is_incremental; BOOST_INTRUSIVE_STATIC_ASSERT(( is_incremental == true ));