Boost C++ Libraries

...one of the most highly regarded and expertly designed C++ library projects in the world. Herb Sutter and Andrei Alexandrescu, C++ Coding Standards

This is the documentation for an old version of Boost. Click here to view this page for the latest version.
PrevUpHomeNext

Struct template pack_options

boost::intrusive::pack_options

Synopsis

// In header: <boost/intrusive/pack_options.hpp>

template<typename DefaultOptions, class... Options> 
struct pack_options {
  // types
  typedef unspecified_type type;
};

Description

This class is a utility that takes:

  • a default options class defining initial static constant and typedefs

  • several options defined with BOOST_INTRUSIVE_OPTION_CONSTANT and BOOST_INTRUSIVE_OPTION_TYPE

and packs them together in a new type that defines all options as member typedefs or static constant values. Given options of form:

BOOST_INTRUSIVE_OPTION_TYPE(my_pointer, VoidPointer, VoidPointer, my_pointer_type)
BOOST_INTRUSIVE_OPTION_CONSTANT(incremental, bool, Enabled, is_incremental)

the following expression

struct default_options
{
  typedef long      int_type;
  static const int  int_constant = -1;
};

pack_options< default_options, my_pointer<void*>, incremental<true> >::type

will create a type that will contain the following typedefs/constants

struct unspecified_type
{
   //Default options
   typedef long      int_type;
   static const int  int_constant  = -1;

   //Packed options (will ovewrite any default option)
   typedef void*     my_pointer_type;
   static const bool is_incremental = true;
};

If an option is specified in the default options argument and later redefined as an option, the last definition will prevail.


PrevUpHomeNext