Boost C++ Libraries Home Libraries People FAQ More

PrevUpHomeNext

概要

namespace boost {

template<class T>
class optional
{
    public :

    // (如果 T 是引用類型,則以引用傳遞的參數和結果變為以值傳遞)
optional () ; R optional ( none_t ) ; R optional ( T const& v ) ; R // [1.34版本中新增]
optional ( bool condition, T const& v ) ; R

optional ( optional const& rhs ) ; R template<class U> explicit optional ( optional<U> const& rhs ) ; R template<class InPlaceFactory> explicit optional ( InPlaceFactory const& f ) ; R template<class TypedInPlaceFactory> explicit optional ( TypedInPlaceFactory const& f ) ; R optional& operator = ( none_t ) ;

optional& operator = ( T const& v ) ; R optional& operator = ( optional const& rhs ) ; R template<class U> optional& operator = ( optional<U> const& rhs ) ; R template<class InPlaceFactory> optional& operator = ( InPlaceFactory const& f ) ;

template<class TypedInPlaceFactory> optional& operator = ( TypedInPlaceFactory const& f ) ;

T const& get() const ; R T& get() ; R // [1.34版本中新增]
T const& get_value_or( T const& default ) const ; R

T const* operator ->() const ; R T* operator ->() ; R T const& operator *() const ; R T& operator *() ; R T const* get_ptr() const ; R T* get_ptr() ; R operator unspecified-bool-type() const ; R bool operator!() const ; R // 被反對的方法
// (被反對的)
void reset() ; R // (被反對的)
void reset ( T const& ) ; R // (被反對的)
bool is_initialized() const ; R }; template<class T> inline bool operator == ( optional<T> const& x, optional<T> const& y ) ; R template<class T> inline bool operator != ( optional<T> const& x, optional<T> const& y ) ; R template<class T> inline bool operator < ( optional<T> const& x, optional<T> const& y ) ; R template<class T> inline bool operator > ( optional<T> const& x, optional<T> const& y ) ; R template<class T> inline bool operator <= ( optional<T> const& x, optional<T> const& y ) ; R template<class T> inline bool operator >= ( optional<T> const& x, optional<T> const& y ) ; R // [1.34版本中新增]
template<class T> inline optional<T> make_optional ( T const& v ) ; R // [1.34版本中新增]
template<class T> inline optional<T> make_optional ( bool condition, T const& v ) ; R // [1.34版本中新增]
template<class T> inline T const& get_optional_value_or ( optional<T> const& opt, T const& default ) ; R

template<class T> inline T const& get ( optional<T> const& opt ) ; R template<class T> inline T& get ( optional<T> & opt ) ; R template<class T> inline T const* get ( optional<T> const* opt ) ; R template<class T> inline T* get ( optional<T>* opt ) ; R template<class T> inline T const* get_pointer ( optional<T> const& opt ) ; R template<class T> inline T* get_pointer ( optional<T> & opt ) ; R template<class T> inline void swap( optional<T>& x, optional<T>& y ) ; R } // namespace boost

PrevUpHomeNext