...one of the most highly
regarded and expertly designed C++ library projects in the
world.
— Herb Sutter and Andrei
Alexandrescu, C++
Coding Standards
boost::intrusive::any_member_hook
// In header: <boost/intrusive/any_hook.hpp> template<class... Options> class any_member_hook { public: // construct/copy/destruct any_member_hook(); any_member_hook(const any_member_hook &); any_member_hook& operator=(const any_member_hook &); ~any_member_hook(); // public member functions bool is_linked() const; };
Store this hook in a class to be inserted in an intrusive container.
The hook admits the following options: void_pointer<>
and link_mode<>
.
link_mode<>
will specify the linking mode of the hook (normal_link
or safe_link
).
void_pointer<>
is the pointer type that will be used internally in the hook and the the container configured to use this hook.
any_member_hook
public
construct/copy/destructany_member_hook();
Effects: If link_mode is or safe_link
initializes the node to an unlinked state.
Throws: Nothing.
any_member_hook(const any_member_hook &);
Effects: If link_mode is or safe_link
initializes the node to an unlinked state. The argument is ignored.
Throws: Nothing.
Rationale: Providing a copy-constructor makes classes using the hook STL-compliant without forcing the user to do some additional work. swap
can be used to emulate move-semantics.
any_member_hook& operator=(const any_member_hook &);
Effects: Empty function. The argument is ignored.
Throws: Nothing.
Rationale: Providing an assignment operator makes classes using the hook STL-compliant without forcing the user to do some additional work. swap
can be used to emulate move-semantics.
~any_member_hook();
Effects: If link_mode is normal_link
, the destructor does nothing (ie. no code is generated). If link_mode is safe_link
and the object is stored in a container an assertion is raised.
Throws: Nothing.