Anatomy of a policy

A NoValuePolicy is quite simple. This is a complete policy, only the top two thirds is needed if you never use the policy in an outcome.


struct blank_policy
{
  //! Performs a narrow check of state, used in the assume_value() functions.
  template <class Impl> static constexpr void narrow_value_check(Impl &&self) noexcept;

  //! Performs a narrow check of state, used in the assume_error() functions.
  template <class Impl> static constexpr void narrow_error_check(Impl &&self) noexcept;

  //! Performs a wide check of state, used in the value() functions.
  template <class Impl> static constexpr void wide_value_check(Impl &&self);

  //! Performs a wide check of state, used in the error() functions.
  template <class Impl> static constexpr void wide_error_check(Impl &&self);


  /******** These only used if the policy is used in Outcome ********/

  //! Performs a narrow check of state, used in the assume_exception() functions.
  template <class Impl> static constexpr void narrow_exception_check(Impl &&self) noexcept;

  //! Performs a wide check of state, used in the exception() functions.
  template <class Impl> static constexpr void wide_exception_check(Impl &&self);
};
View this code on Github