Boost C++ Libraries 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.

Class visitation_result

boost::log::visitation_result — The class represents attribute value visitation result.


// In header: <boost/log/attributes/value_visitation.hpp>

class visitation_result {

  // Error codes for attribute value visitation. 
  enum error_code { ok, value_not_found, value_has_invalid_type };
  // construct/copy/destruct
  visitation_result(error_code = ok) noexcept;

  // public member functions
  explicit operator bool() const noexcept;
  bool operator!() const noexcept;
  error_code code() const noexcept;


The main purpose of this class is to provide a convenient interface for checking whether the attribute value visitation succeeded or not. It also allows to discover the actual cause of failure, should the operation fail.

visitation_result public construct/copy/destruct

  1. visitation_result(error_code code = ok) noexcept;

    Initializing constructor. Creates the result that is equivalent to the specified error code.

visitation_result public member functions

  1. explicit operator bool() const noexcept;

    Checks if the visitation was successful.


    true if the value was visited successfully, false otherwise.

  2. bool operator!() const noexcept;

    Checks if the visitation was unsuccessful.


    false if the value was visited successfully, true otherwise.

  3. error_code code() const noexcept;


    The actual result code of value visitation