Boost C++ 库

...世界上最受推崇和精心设计的 C++ 库项目之一。 Herb SutterAndrei Alexandrescu, C++ 编码标准

PrevUpHomeNext

宏 BOOST_INTRUSIVE_OPTION_CONSTANT

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 ));


PrevUpHomeNext