expected.hpp File Reference
`#include <cstddef>`
`#include <cassert>`
`#include <exception>`
`#include <functional>`
`#include <initializer_list>`
`#include <memory>`
`#include <new>`
`#include <system_error>`
`#include <type_traits>`
`#include <utility>`

Go to the source code of this file.

## Classes

struct | nonstd::detail::in_place_type_tag< T >
struct | nonstd::detail::in_place_index_tag< K >
struct | nonstd::in_place_t
struct | std::hash< nonstd::expected< T, E > >
struct | std::hash< nonstd::expected< T &, E > >
struct | std::hash< nonstd::expected< void, E > >

## Namespaces

namespace | nonstd
namespace | nonstd::detail
namespace | std
| STL namespace.

## Macros

#define | expected_lite_MAJOR 0
#define | expected_lite_MINOR 4
#define | expected_lite_PATCH 0
#define | expected_lite_VERSION expected_STRINGIFY(expected_lite_MAJOR) "." expected_STRINGIFY(expected_lite_MINOR) "." expected_STRINGIFY(expected_lite_PATCH)
#define | expected_STRINGIFY( x) expected_STRINGIFY_( x )
#define | expected_STRINGIFY_(x) #x
#define | nsel_EXPECTED_DEFAULT 0
#define | nsel_EXPECTED_NONSTD 1
#define | nsel_EXPECTED_STD 2
#define | nsel_CONFIG_SELECT_EXPECTED ( nsel_HAVE_STD_EXPECTED ? nsel_EXPECTED_STD : nsel_EXPECTED_NONSTD )
#define | nsel_P0323R 7
#define | nsel_CONFIG_NO_EXCEPTIONS 1
#define | nsel_CPLUSPLUS __cplusplus
#define | nsel_CPP98_OR_GREATER ( nsel_CPLUSPLUS >= 199711L )
#define | nsel_CPP11_OR_GREATER ( nsel_CPLUSPLUS >= 201103L )
#define | nsel_CPP14_OR_GREATER ( nsel_CPLUSPLUS >= 201402L )
#define | nsel_CPP17_OR_GREATER ( nsel_CPLUSPLUS >= 201703L )
#define | nsel_CPP20_OR_GREATER ( nsel_CPLUSPLUS >= 202000L )
#define | nsel_HAVE_STD_EXPECTED 0
#define | nsel_USES_STD_EXPECTED ( (nsel_CONFIG_SELECT_EXPECTED == nsel_EXPECTED_STD) || ((nsel_CONFIG_SELECT_EXPECTED == nsel_EXPECTED_DEFAULT) && nsel_HAVE_STD_EXPECTED) )
#define | nonstd_lite_HAVE_IN_PLACE_TYPES 1
#define | nonstd_lite_in_place_t( T) nonstd::in_place_t(&)( nonstd::detail::in_place_type_tag<T> )
#define | nonstd_lite_in_place_type_t(T) nonstd::in_place_t(&)( nonstd::detail::in_place_type_tag<T> )
#define | nonstd_lite_in_place_index_t(K) nonstd::in_place_t(&)( nonstd::detail::in_place_index_tag<K> )
#define | nonstd_lite_in_place( T) nonstd::in_place_type<T>
#define | nonstd_lite_in_place_type(T) nonstd::in_place_type<T>
#define | nonstd_lite_in_place_index(K) nonstd::in_place_index<K>
#define | nsel_constexpr /*constexpr*/
#define | nsel_constexpr14 /*constexpr*/
#define | nsel_inline17 /*inline*/
#define | nsel_COMPILER_MSVC_VER 0
#define | nsel_COMPILER_MSVC_VERSION 0
#define | nsel_COMPILER_VERSION(major, minor, patch) ( 10 * ( 10 * (major) + (minor) ) + (patch) )
#define | nsel_COMPILER_CLANG_VERSION 0
#define | nsel_COMPILER_GNUC_VERSION 0
#define | nsel_REQUIRES_0(...) template< bool B = (__VA_ARGS__), typename std::enable_if<B, int>::type = 0 >
#define | nsel_REQUIRES_T(...) , typename std::enable_if< (__VA_ARGS__), int >::type = 0
#define | nsel_REQUIRES_R(R, ...) typename std::enable_if< (__VA_ARGS__), R>::type
#define | nsel_REQUIRES_A(...) , typename std::enable_if< (__VA_ARGS__), void*>::type = nullptr
#define | nsel_HAS_CPP0X 0
#define | nsel_DISABLE_MSVC_WARNINGS(codes)
#define | nsel_RESTORE_WARNINGS()

## Functions

template<class T >
in_place_t | nonstd::in_place (detail::in_place_type_tag< T >=detail::in_place_type_tag< T >())
template<std::size_t K>
in_place_t | nonstd::in_place (detail::in_place_index_tag< K >=detail::in_place_index_tag< K >())
template<class T >
in_place_t | nonstd::in_place_type (detail::in_place_type_tag< T >=detail::in_place_type_tag< T >())
template<std::size_t K>
in_place_t | nonstd::in_place_index (detail::in_place_index_tag< K >=detail::in_place_index_tag< K >())
| nsel_DISABLE_MSVC_WARNINGS (26409) namespace nonstd

## Macro Definition Documentation

## expected_lite_MAJOR

#define expected_lite_MAJOR 0

Definition at line 15 of file expected.hpp.

## expected_lite_MINOR

#define expected_lite_MINOR 4

Definition at line 16 of file expected.hpp.

## expected_lite_PATCH

#define expected_lite_PATCH 0

Definition at line 17 of file expected.hpp.

## expected_lite_VERSION

#define expected_lite_VERSION expected_STRINGIFY(expected_lite_MAJOR) "." expected_STRINGIFY(expected_lite_MINOR) "." expected_STRINGIFY(expected_lite_PATCH)

Definition at line 19 of file expected.hpp.

## expected_STRINGIFY

#define expected_STRINGIFY | ( |  | x | ) | expected_STRINGIFY_( x )

Definition at line 21 of file expected.hpp.

## expected_STRINGIFY_

#define expected_STRINGIFY_ | ( |  | x | ) | #x

Definition at line 22 of file expected.hpp.

## nonstd_lite_HAVE_IN_PLACE_TYPES

#define nonstd_lite_HAVE_IN_PLACE_TYPES 1

Definition at line 101 of file expected.hpp.

## nonstd_lite_in_place

#define nonstd_lite_in_place | ( |  | T | ) | nonstd::in_place_type<T>

Definition at line 175 of file expected.hpp.

## nonstd_lite_in_place_index

#define nonstd_lite_in_place_index | ( |  | K | ) | nonstd::in_place_index<K>

Definition at line 177 of file expected.hpp.

## nonstd_lite_in_place_index_t

#define nonstd_lite_in_place_index_t | ( |  | K | ) | nonstd::in_place_t(&)( nonstd::detail::in_place_index_tag<K> )

Definition at line 173 of file expected.hpp.

## nonstd_lite_in_place_t

#define nonstd_lite_in_place_t | ( |  | T | ) | nonstd::in_place_t(&)( nonstd::detail::in_place_type_tag<T> )

Definition at line 171 of file expected.hpp.

## nonstd_lite_in_place_type

#define nonstd_lite_in_place_type | ( |  | T | ) | nonstd::in_place_type<T>

Definition at line 176 of file expected.hpp.

## nonstd_lite_in_place_type_t

#define nonstd_lite_in_place_type_t | ( |  | T | ) | nonstd::in_place_t(&)( nonstd::detail::in_place_type_tag<T> )

Definition at line 172 of file expected.hpp.

## nsel_COMPILER_CLANG_VERSION

#define nsel_COMPILER_CLANG_VERSION 0

Definition at line 265 of file expected.hpp.

## nsel_COMPILER_GNUC_VERSION

#define nsel_COMPILER_GNUC_VERSION 0

Definition at line 271 of file expected.hpp.

## nsel_COMPILER_MSVC_VER

#define nsel_COMPILER_MSVC_VER 0

Definition at line 256 of file expected.hpp.

## nsel_COMPILER_MSVC_VERSION

#define nsel_COMPILER_MSVC_VERSION 0

Definition at line 257 of file expected.hpp.

## nsel_COMPILER_VERSION

#define nsel_COMPILER_VERSION | ( |  | major,
|  |  | minor,
|  |  | patch
| ) |  | ( 10 * ( 10 * (major) + (minor) ) + (patch) )

Definition at line 260 of file expected.hpp.

## nsel_CONFIG_NO_EXCEPTIONS

#define nsel_CONFIG_NO_EXCEPTIONS 1

Definition at line 61 of file expected.hpp.

## nsel_CONFIG_SELECT_EXPECTED

#define nsel_CONFIG_SELECT_EXPECTED ( nsel_HAVE_STD_EXPECTED ? nsel_EXPECTED_STD : nsel_EXPECTED_NONSTD )

Definition at line 31 of file expected.hpp.

## nsel_constexpr

#define nsel_constexpr /*constexpr*/

Definition at line 223 of file expected.hpp.

## nsel_constexpr14

#define nsel_constexpr14 /*constexpr*/

Definition at line 229 of file expected.hpp.

## nsel_CPLUSPLUS

#define nsel_CPLUSPLUS __cplusplus

Definition at line 72 of file expected.hpp.

## nsel_CPP11_OR_GREATER

#define nsel_CPP11_OR_GREATER ( nsel_CPLUSPLUS >= 201103L )

Definition at line 77 of file expected.hpp.

## nsel_CPP14_OR_GREATER

#define nsel_CPP14_OR_GREATER ( nsel_CPLUSPLUS >= 201402L )

Definition at line 78 of file expected.hpp.

## nsel_CPP17_OR_GREATER

#define nsel_CPP17_OR_GREATER ( nsel_CPLUSPLUS >= 201703L )

Definition at line 79 of file expected.hpp.

## nsel_CPP20_OR_GREATER

#define nsel_CPP20_OR_GREATER ( nsel_CPLUSPLUS >= 202000L )

Definition at line 80 of file expected.hpp.

## nsel_CPP98_OR_GREATER

#define nsel_CPP98_OR_GREATER ( nsel_CPLUSPLUS >= 199711L )

Definition at line 76 of file expected.hpp.

## nsel_DISABLE_MSVC_WARNINGS

#define nsel_DISABLE_MSVC_WARNINGS | ( |  | codes | ) |

Definition at line 313 of file expected.hpp.

## nsel_EXPECTED_DEFAULT

#define nsel_EXPECTED_DEFAULT 0

Definition at line 26 of file expected.hpp.

## nsel_EXPECTED_NONSTD

#define nsel_EXPECTED_NONSTD 1

Definition at line 27 of file expected.hpp.

## nsel_EXPECTED_STD

#define nsel_EXPECTED_STD 2

Definition at line 28 of file expected.hpp.

## nsel_HAS_CPP0X

#define nsel_HAS_CPP0X 0

Definition at line 296 of file expected.hpp.

## nsel_HAVE_STD_EXPECTED

#define nsel_HAVE_STD_EXPECTED 0

Definition at line 91 of file expected.hpp.

## nsel_inline17

#define nsel_inline17 /*inline*/

Definition at line 235 of file expected.hpp.

## nsel_P0323R

#define nsel_P0323R 7

Definition at line 52 of file expected.hpp.

## nsel_REQUIRES_0

#define nsel_REQUIRES_0 | ( |  | ... | ) | template< bool B = (__VA_ARGS__), typename std::enable_if<B, int>::type = 0 >

Definition at line 279 of file expected.hpp.

## nsel_REQUIRES_A

#define nsel_REQUIRES_A | ( |  | ... | ) | , typename std::enable_if< (__VA_ARGS__), void*>::type = nullptr

Definition at line 288 of file expected.hpp.

## nsel_REQUIRES_R

#define nsel_REQUIRES_R | ( |  | R,
|  |  | ...
| ) |  | typename std::enable_if< (__VA_ARGS__), R>::type

Definition at line 285 of file expected.hpp.

## nsel_REQUIRES_T

#define nsel_REQUIRES_T | ( |  | ... | ) | , typename std::enable_if< (__VA_ARGS__), int >::type = 0

Definition at line 282 of file expected.hpp.

## nsel_RESTORE_WARNINGS

#define nsel_RESTORE_WARNINGS | ( |  | ) |

Definition at line 323 of file expected.hpp.

## nsel_USES_STD_EXPECTED

#define nsel_USES_STD_EXPECTED ( (nsel_CONFIG_SELECT_EXPECTED == nsel_EXPECTED_STD) || ((nsel_CONFIG_SELECT_EXPECTED == nsel_EXPECTED_DEFAULT) && nsel_HAVE_STD_EXPECTED) )

Definition at line 94 of file expected.hpp.

## Function Documentation

## nsel_DISABLE_MSVC_WARNINGS()

nsel_DISABLE_MSVC_WARNINGS | ( | 26409 |  | ) |

discriminated union to hold value or 'error'.

discriminated union to hold only 'error'.

x.x.5 Unexpected object type; unexpected_type; C++17 and later can also use aliased type unexpected.

class unexpected_type, std::exception_ptr specialization (P0323R2)

x.x.4, Unexpected equality operators

x.x.5 Specialized algorithms

x.x.6, x.x.7 expected access error

x.x.7 bad_expected_access<void>: expected access error

x.x.6 bad_expected_access: expected access error

x.x.8 unexpect tag, in_place_unexpected tag: construct an error

class error_traits

class expected

class expected, void specialization

x.x.x Specialized algorithms

Definition at line 329 of file expected.hpp.