| Home | Libraries | People | FAQ | More

## Class template any_member_hook

boost::intrusive::any_member_hook

## Synopsis

    // 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;
    };

## Description

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/destruct

1.     any_member_hook();

   Effects: If `link_mode` is or `safe_link` initializes the node to an unlinked state.

   Throws: Nothing.

2.     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.

3.     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.

4.     ~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.

### `any_member_hook` public member functions

1.     bool is_linked() const;

   Precondition: `link_mode` must be `safe_link`.

   Returns: true, if the node belongs to a container, false otherwise. This function can be used to test whether `container::iterator_to` will return a valid iterator.

   Complexity: Constant