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 for the latest Boost documentation.
PrevUpHomeNext

Struct template pointer_plus_bits<T *, NumBits>

boost::intrusive::pointer_plus_bits<T *, NumBits>

Synopsis

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

template<typename T, std::size_t NumBits> 
struct pointer_plus_bits<T *, NumBits> {
  // types
  typedef T * pointer;

  // public static functions
  static pointer get_pointer(pointer);
  static void set_pointer(pointer &, pointer);
  static std::size_t get_bits(pointer);
  static void set_bits(pointer &, std::size_t);

  // public data members
  static const std::size_t Mask;
};

Description

This is the specialization to embed extra bits of information in a raw pointer. The extra bits are stored in the lower bits of the pointer.

pointer_plus_bits public static functions

  1. static pointer get_pointer(pointer n);
  2. static void set_pointer(pointer & n, pointer p);
  3. static std::size_t get_bits(pointer n);
  4. static void set_bits(pointer & n, std::size_t c);

PrevUpHomeNext