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

Optional References

template <class T>
class optional<T&> // specialization for lvalue references
{
public :

    typedef T& value_type;
    typedef T& reference_type;
    typedef T& reference_const_type; // no const propagation
    typedef T& rval_reference_type;
    typedef T* pointer_type;
    typedef T* pointer_const_type;   // no const propagation

    optional () noexcept ; R

    optional ( none_t ) noexcept ; R

    template<class R> optional(R&& r) noexcept ;  R

    template <class R> optional(bool cond, R&& r) noexcept ; R

    optional ( optional const& rhs ) noexcept ; R

    template<class U> explicit optional ( optional<U&> const& rhs ) noexcept ; R

    optional& operator = ( none_t ) noexcept ; R

    optional& operator = ( optional const& rhs ) noexcept; R

    template<class U> optional& operator = ( optional<U&> const& rhs ) noexcept ; R

    template<class R> optional& operator = (R&& r) noexcept ; R

    template<class R> void emplace ( R&& r ) noexcept ; R

    T& get() const ; R
    T& operator *() const ; R

    T* operator ->() const ; R

    T& value() const& ; R

    template<class R> T& value_or( R && r ) const noexcept ; R

    template<class F> T& value_or_eval( F f ) const ; R

    template<class F> auto map( F f ) const -> see below; R

    template<class F> auto flat_map( F f ) const -> see below; R

    T* get_ptr() const noexcept ; R

    bool has_value() const noexcept ; R

    explicit operator bool() const noexcept ; R

    bool operator!() const noexcept ; R

    void reset() noexcept ; R

    // deprecated methods

    // (deprecated)
    template<class R> void reset ( R && r ) noexcept ; R

    // (deprecated)
    bool is_initialized() const noexcept ; R

    // (deprecated)
    template<class R> T& get_value_or( R && r ) constnoexcept; R

private:
    T* ref; // exposition only
};

PrevUpHomeNext