diff --git a/README.md b/README.md index d76e464..3f59c2b 100644 --- a/README.md +++ b/README.md @@ -105,56 +105,56 @@ Synopsis [Algorithms for *optional lite*](#algorithms-for-optional-lite) [Macros to control alignment](#macros-to-control-alignment) -### Types in namespace nonstd - -| Purpose | Type | Object | -|-----------------------|------|--------| -| To be, or not | template< typename T >
class optional; | | -| Disengaging | struct nullopt_t; | nullopt_t nullopt; | -| Error reporting | class bad_optional_access; |  | -| In-place construction | struct in_place_tag |   | -|   | in_place | select type or index for in-place construction | -|   | in_place_type | select type for in-place construction | -|  (variant) | in_place_index | select index for in-place construction | -|   | nonstd_lite_in_place_type_t( T) | macro for alias template in_place_type_t<T> | -|  (variant) | nonstd_lite_in_place_index_t( T )| macro for alias template in_place_index_t<T> | +### Types and values in namespace nonstd + +| Purpose | Type / value | Object | +|-----------------------|--------------|--------| +| To be, or not | template< typename T >
class **optional**; | | +| Disengaging | struct **nullopt_t**; | nullopt_t nullopt; | +| Error reporting | class **bad_optional_access**; |  | +| In-place construction | struct **in_place_tag** |   | +|   | **in_place** | select type or index for in-place construction | +|   | **in_place_type** | select type for in-place construction | +|  (variant) | **in_place_index** | select index for in-place construction | +|   | **nonstd_lite_in_place_type_t**( T) | macro for alias template in_place_type_t<T> | +|  (variant) | **nonstd_lite_in_place_index_t**( T )| macro for alias template in_place_index_t<T> | ### Interface of *optional lite* | Kind | Std | Method | Result | |--------------|------|---------------------------------------------|--------| -| Construction | | optional() noexcept | default construct a nulled object | -|   | | optional( nullopt_t ) noexcept | explicitly construct a nulled object | -|   | | optional( optional const & rhs ) | move-construct from an other optional | -|   | C++11| optional( optional && rhs ) noexcept(...) | move-construct from an other optional | -|   | | optional( value_type const & value ) | copy-construct from a value | -|   | C++11| optional( value_type && value ) | move-construct from a value | -|   | C++11| explicit optional( in_place_type_t<T>, Args&&... args ) | in-place-construct type T | -|   | C++11| explicit optional( in_place_type_t<T>, std::initializer_list<U> il, Args&&... args ) | in-place-construct type T | -| Destruction | | ~optional() | destruct current content, if any | -| Assignment | | optional & operator=( nullopt_t ) | null the object;
destruct current content, if any | -|   | | optional & operator=( optional const & rhs ) | copy-assign from other optional;
destruct current content, if any | -|   | C++11| optional & operator=( optional && rhs ) | move-assign from other optional;
destruct current content, if any | -|   | C++11| template< class U, ...>
optional & operator=( U && v ) | move-assign from a value;
destruct current content, if any | -|   | C++11| template< class... Args >
void emplace( Args&&... args ) | emplace type T | -|   | C++11| template< class U, class... Args >
void emplace( std::initializer_list<U> il, Args&&... args ) | emplace type T | -| Swap | | void swap( optional & rhs ) noexcept(...) | swap with rhs | -| Content | | value_type const * operator ->() const | pointer to current content (const);
must contain value | -|   | | value_type * operator ->() | pointer to current content (non-const);
must contain value | -|   | | value_type const & operator *() & | the current content (const ref);
must contain value | -|   | | value_type & operator *() & | the current content (non-const ref);
must contain value | -|   | C++11| value_type const & operator *() && | the current content (const ref);
must contain value | -|   | C++11| value_type & operator *() && | the current content (non-const ref);
must contain value | -| State | | operator bool() const | true if content is present | -|   | | bool has_value() const | true if content is present | -|   | | value_type const & value() & | the current content (const ref);
throws bad_optional_access if nulled | -|   | | value_type & value() & | the current content (non-const ref);
throws bad_optional_access if nulled | -|   | C++11| value_type const & value() && | the current content (const ref);
throws bad_optional_access if nulled | -|   | C++11| value_type & value() && | the current content (non-const ref);
throws bad_optional_access if nulled | -|   |value_type must be copy-constructible | -|   | C++11| value_type value_or( value_type && default_value ) & | the value, or default_value if nulled
value_type must be copy-constructible | -|   | C++11| value_type value_or( value_type && default_value ) && | the value, or default_value if nulled
value_type must be copy-constructible | -| Modifiers | | void reset() noexcept | make empty | +| Construction | | **optional**() noexcept | default construct a nulled object | +|   | | **optional**( nullopt_t ) noexcept | explicitly construct a nulled object | +|   | | **optional**( optional const & rhs ) | move-construct from an other optional | +|   | C++11| **optional**( optional && rhs ) noexcept(...) | move-construct from an other optional | +|   | | **optional**( value_type const & value ) | copy-construct from a value | +|   | C++11| **optional**( value_type && value ) | move-construct from a value | +|   | C++11| **explicit optional**( in_place_type_t<T>, Args&&... args ) | in-place-construct type T | +|   | C++11| **explicit optional**( in_place_type_t<T>, std::initializer_list<U> il, Args&&... args ) | in-place-construct type T | +| Destruction | | **~optional**() | destruct current content, if any | +| Assignment | | optional & **operator=**( nullopt_t ) | null the object;
destruct current content, if any | +|   | | optional & **operator=**( optional const & rhs ) | copy-assign from other optional;
destruct current content, if any | +|   | C++11| optional & **operator=**( optional && rhs ) | move-assign from other optional;
destruct current content, if any | +|   | C++11| template< class U, ...>
**optional & operator=( U && v ) | move-assign from a value;
destruct current content, if any | +|   | C++11| template< class... Args >
void **emplace**( Args&&... args ) | emplace type T | +|   | C++11| template< class U, class... Args >
void **emplace**( std::initializer_list<U> il, Args&&... args ) | emplace type T | +| Swap | | void **swap**( optional & rhs ) noexcept(...) | swap with rhs | +| Content | | value_type const \* **operator ->**() const | pointer to current content (const);
must contain value | +|   | | value_type \* **operator ->**() | pointer to current content (non-const);
must contain value | +|   | | value_type const & **operator \***() & | the current content (const ref);
must contain value | +|   | | value_type & **operator \***() & | the current content (non-const ref);
must contain value | +|   | C++11| value_type const & **operator \***() && | the current content (const ref);
must contain value | +|   | C++11| value_type & **operator \***() && | the current content (non-const ref);
must contain value | +| State | | operator **bool**() const | true if content is present | +|   | | bool **has_value**() const | true if content is present | +|   | | value_type const & **value**() & | the current content (const ref);
throws bad_optional_access if nulled | +|   | | value_type & **value**() & | the current content (non-const ref);
throws bad_optional_access if nulled | +|   | C++11| value_type const & **value**() && | the current content (const ref);
throws bad_optional_access if nulled | +|   | C++11| value_type & **value**() && | the current content (non-const ref);
throws bad_optional_access if nulled | +|   |value_type must be copy-constructible | +|   | C++11| value_type **value_or**( value_type && default_value ) & | the value, or default_value if nulled
value_type must be copy-constructible | +|   | C++11| value_type **value_or**( value_type && default_value ) && | the value, or default_value if nulled
value_type must be copy-constructible | +| Modifiers | | void **reset**() noexcept | make empty | ### Algorithms for *optional lite* @@ -162,45 +162,45 @@ Synopsis | Kind | Std | Function | |--------------------------|------|----------| | Relational operators | |   | -| == | | template< typename T >
bool operator==( optional const & x, optional const & y ) | -| != | | template< typename T >
bool operator!=( optional const & x, optional const & y ) | -| < | | template< typename T >
bool operator<( optional const & x, optional const & y ) | -| > | | template< typename T >
bool operator>( optional const & x, optional const & y ) | -| <= | | template< typename T >
bool operator<=( optional const & x, optional const & y ) | -| >= | | template< typename T >
bool operator>=( optional const & x, optional const & y ) | +| == | | template< typename T >
bool **operator==**( optional const & x, optional const & y ) | +| != | | template< typename T >
bool **operator!=**( optional const & x, optional const & y ) | +| < | | template< typename T >
bool **operator<**( optional const & x, optional const & y ) | +| > | | template< typename T >
bool **operator>**( optional const & x, optional const & y ) | +| <= | | template< typename T >
bool **operator<=*( optional const & x, optional const & y ) | +| >= | | template< typename T >
bool **operator>=*( optional const & x, optional const & y ) | | Comparison with nullopt | |   | -| == | | template< typename T >
bool operator==( optional const & x, nullopt_t ) noexcept | -|   | | template< typename T >
bool operator==( nullopt_t, optional const & x ) noexcept | -| != | | template< typename T >
bool operator!=( optional const & x, nullopt_t ) noexcept | -|   | | template< typename T >
bool operator!=( nullopt_t, optional const & x ) noexcept | -| < | | template< typename T >
bool operator<( optional const &, nullopt_t ) noexcept | -|   | | template< typename T >
bool operator<( nullopt_t, optional const & x ) noexcept | -| <= | | template< typename T >
bool operator<=( optional const & x, nullopt_t ) noexcept | -|   | | template< typename T >
bool operator<=( nullopt_t, optional const & ) noexcept | -| > | | template< typename T >
bool operator>( optional const & x, nullopt_t ) noexcept | -|   | | template< typename T >
bool operator>( nullopt_t, optional const & ) noexcept | -| >= | | template< typename T >
bool operator>=( optional const &, nullopt_t ) noexcept | -|   | | template< typename T >
bool operator>=( nullopt_t, optional const & x ) noexcept | +| == | | template< typename T >
bool **operator==**( optional const & x, nullopt_t ) noexcept | +|   | | template< typename T >
bool **operator==**( nullopt_t, optional const & x ) noexcept | +| != | | template< typename T >
bool **operator!=**( optional const & x, nullopt_t ) noexcept | +|   | | template< typename T >
bool **operator!=**( nullopt_t, optional const & x ) noexcept | +| < | | template< typename T >
bool **operator<**( optional const &, nullopt_t ) noexcept | +|   | | template< typename T >
bool **operator<**( nullopt_t, optional const & x ) noexcept | +| <= | | template< typename T >
bool **operator<=**( optional const & x, nullopt_t ) noexcept | +|   | | template< typename T >
bool **operator<=**( nullopt_t, optional const & ) noexcept | +| > | | template< typename T >
bool **operator>**( optional const & x, nullopt_t ) noexcept | +|   | | template< typename T >
bool **operator>**( nullopt_t, optional const & ) noexcept | +| >= | | template< typename T >
bool **operator>=**( optional const &, nullopt_t ) noexcept | +|   | | template< typename T >
bool **operator>=**( nullopt_t, optional const & x ) noexcept | | Comparison with T | |   | -| == | | template< typename T >
bool operator==( optional const & x, const T& v ) | -|   | | template< typename T >
bool operator==( T const & v, optional const & x ) | -| != | | template< typename T >
bool operator!=( optional const & x, const T& v ) | -|   | | template< typename T >
bool operator!=( T const & v, optional const & x ) | -| < | | template< typename T >
bool operator<( optional const & x, const T& v ) | -|   | | template< typename T >
bool operator<( T const & v, optional const & x ) | -| <= | | template< typename T >
bool operator<=( optional const & x, const T& v ) | -|   | | template< typename T >
bool operator<=( T const & v, optional const & x ) | -| > | | template< typename T >
bool operator>( optional const & x, const T& v ) | -|   | | template< typename T >
bool operator>( T const & v, optional const & x ) | -| >= | | template< typename T >
bool operator>=( optional const & x, const T& v ) | -|   | | template< typename T >
bool operator>=( T const & v, optional const & x ) | +| == | | template< typename T >
bool **operator==**( optional const & x, const T& v ) | +|   | | template< typename T >
bool **operator==**( T const & v, optional const & x ) | +| != | | template< typename T >
bool **operator!=**( optional const & x, const T& v ) | +|   | | template< typename T >
bool **operator!=**( T const & v, optional const & x ) | +| < | | template< typename T >
bool **operator<**( optional const & x, const T& v ) | +|   | | template< typename T >
bool **operator<**( T const & v, optional const & x ) | +| <= | | template< typename T >
bool **operator<=**( optional const & x, const T& v ) | +|   | | template< typename T >
bool **operator<=**( T const & v, optional const & x ) | +| > | | template< typename T >
bool **operator>**( optional const & x, const T& v ) | +|   | | template< typename T >
bool **operator>**( T const & v, optional const & x ) | +| >= | | template< typename T >
bool **operator>=**( optional const & x, const T& v ) | +|   | | template< typename T >
bool **operator>=**( T const & v, optional const & x ) | | Specialized algorithms | |   | -| swap | | template< typename T >
void swap( optional & x, optional & y ) noexcept(...) | -| create |
optional<T> make_optional( T const & v ) | -|   | C++11| template< class T >
optional< typename std::decay<T>::type > make_optional( T && v ) | -|   | C++11| template< class T, class...Args >
optional<T> make_optional( Args&&... args ) | -|   | C++11| template< class T, class U, class... Args >
optional<T> make_optional( std::initializer_list<U> il, Args&&... args ) | -| hash | C++11| template< class T >
class hash< nonstd::optional<T> > | +| swap | | template< typename T >
void **swap**( optional & x, optional & y ) noexcept(...) | +| create |
optional<T> **make_optional**( T const & v ) | +|   | C++11| template< class T >
optional< typename std::decay<T>::type > **make_optional**( T && v ) | +|   | C++11| template< class T, class...Args >
optional<T> **make_optional**( Args&&... args ) | +|   | C++11| template< class T, class U, class... Args >
optional<T> **make_optional**( std::initializer_list<U> il, Args&&... args ) | +| hash | C++11| template< class T >
class **hash**< nonstd::optional<T> > | ### Macros to control alignment