Class boolean_maybe_traits

Synopsis

#include "breeze/vocabulary/maybe.hpp"

class boolean_maybe_traits

Description

The default traits class for maybe. Logically corresponds to a boolean (valid/invalid).

Classes

statusThe type of the status to associate to the maybe value.

Methods

default_invalidSee the maybe documentation.
default_validSee the maybe documentation.
is_validSee the maybe documentation.

Source

Lines 28-63 in breeze/vocabulary/maybe.hpp.

class boolean_maybe_traits
{
public:
    //      status:
    //      =======
    //
    //!     The type of the status to associate to the \c maybe value.
    // -----------------------------------------------------------------------
    class status
    {
    public:
        explicit            status( bool b ) noexcept : value( b ) {}
        bool                value ;
    } ;

    //!     See the \c maybe documentation.
    // -----------------------------------------------------------------------
    static bool         is_valid( status s ) noexcept
    {
        return s.value ;
    }

    //!     See the \c maybe documentation.
    // -----------------------------------------------------------------------
    static status       default_invalid() noexcept
    {
        return status( false ) ;
    }

    //!     See the \c maybe documentation.
    // -----------------------------------------------------------------------
    static status       default_valid() noexcept
    {
        return status( true ) ;
    }
} ;