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

PrevUpHomeNext

Class visitation_result

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

Synopsis

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


class visitation_result {
public:

  // Error codes for attribute value visitation. 
  enum error_code { ok, value_not_found, value_has_invalid_type };

  // public member functions
  visitation_result(error_code = ok) noexcept;
  explicit operator bool() const noexcept;
  bool operator!() const noexcept;
  error_code code() const noexcept;
};

Description

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 member functions

  1. visitation_result(error_code code = ok) noexcept;

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

  2. explicit operator bool() const noexcept;

    Checks if the visitation was successful.

    Returns:

    true if the value was visited successfully, false otherwise.

  3. bool operator!() const noexcept;

    Checks if the visitation was unsuccessful.

    Returns:

    false if the value was visited successfully, true otherwise.

  4. error_code code() const noexcept;

    Returns:

    The actual result code of value visitation


PrevUpHomeNext