12#ifndef NONSTD_EXPECTED_LITE_HPP
13#define NONSTD_EXPECTED_LITE_HPP
15#define expected_lite_MAJOR 0
16#define expected_lite_MINOR 4
17#define expected_lite_PATCH 0
19#define expected_lite_VERSION expected_STRINGIFY(expected_lite_MAJOR) "." expected_STRINGIFY(expected_lite_MINOR) "." expected_STRINGIFY(expected_lite_PATCH)
21#define expected_STRINGIFY( x ) expected_STRINGIFY_( x )
22#define expected_STRINGIFY_( x ) #x
26#define nsel_EXPECTED_DEFAULT 0
27#define nsel_EXPECTED_NONSTD 1
28#define nsel_EXPECTED_STD 2
30#if !defined( nsel_CONFIG_SELECT_EXPECTED )
31# define nsel_CONFIG_SELECT_EXPECTED ( nsel_HAVE_STD_EXPECTED ? nsel_EXPECTED_STD : nsel_EXPECTED_NONSTD )
57#ifndef nsel_CONFIG_NO_EXCEPTIONS
58# if defined(__cpp_exceptions) || defined(__EXCEPTIONS) || defined(_CPPUNWIND)
59# define nsel_CONFIG_NO_EXCEPTIONS 0
61# define nsel_CONFIG_NO_EXCEPTIONS 1
69# if defined(_MSVC_LANG ) && !defined(__clang__)
70# define nsel_CPLUSPLUS (_MSC_VER == 1900 ? 201103L : _MSVC_LANG )
72# define nsel_CPLUSPLUS __cplusplus
76#define nsel_CPP98_OR_GREATER ( nsel_CPLUSPLUS >= 199711L )
77#define nsel_CPP11_OR_GREATER ( nsel_CPLUSPLUS >= 201103L )
78#define nsel_CPP14_OR_GREATER ( nsel_CPLUSPLUS >= 201402L )
79#define nsel_CPP17_OR_GREATER ( nsel_CPLUSPLUS >= 201703L )
80#define nsel_CPP20_OR_GREATER ( nsel_CPLUSPLUS >= 202000L )
84#if nsel_CPP20_OR_GREATER && defined(__has_include )
85# if __has_include( <expected> )
86# define nsel_HAVE_STD_EXPECTED 1
88# define nsel_HAVE_STD_EXPECTED 0
91# define nsel_HAVE_STD_EXPECTED 0
94#define nsel_USES_STD_EXPECTED ( (nsel_CONFIG_SELECT_EXPECTED == nsel_EXPECTED_STD) || ((nsel_CONFIG_SELECT_EXPECTED == nsel_EXPECTED_DEFAULT) && nsel_HAVE_STD_EXPECTED) )
100#ifndef nonstd_lite_HAVE_IN_PLACE_TYPES
101#define nonstd_lite_HAVE_IN_PLACE_TYPES 1
105#if nsel_CPP17_OR_GREATER
114using std::in_place_t;
115using std::in_place_type_t;
116using std::in_place_index_t;
118#define nonstd_lite_in_place_t( T) std::in_place_t
119#define nonstd_lite_in_place_type_t( T) std::in_place_type_t<T>
120#define nonstd_lite_in_place_index_t(K) std::in_place_index_t<K>
122#define nonstd_lite_in_place( T) std::in_place_t{}
123#define nonstd_lite_in_place_type( T) std::in_place_type_t<T>{}
124#define nonstd_lite_in_place_index(K) std::in_place_index_t<K>{}
138template< std::
size_t K >
151template< std::
size_t K >
163template< std::
size_t K >
171#define nonstd_lite_in_place_t( T) nonstd::in_place_t(&)( nonstd::detail::in_place_type_tag<T> )
172#define nonstd_lite_in_place_type_t( T) nonstd::in_place_t(&)( nonstd::detail::in_place_type_tag<T> )
173#define nonstd_lite_in_place_index_t(K) nonstd::in_place_t(&)( nonstd::detail::in_place_index_tag<K> )
175#define nonstd_lite_in_place( T) nonstd::in_place_type<T>
176#define nonstd_lite_in_place_type( T) nonstd::in_place_type<T>
177#define nonstd_lite_in_place_index(K) nonstd::in_place_index<K>
188#if nsel_USES_STD_EXPECTED
203#include <initializer_list>
206#include <system_error>
207#include <type_traits>
212#if nsel_CONFIG_NO_EXCEPTIONS
220#if nsel_CPP11_OR_GREATER
221# define nsel_constexpr constexpr
223# define nsel_constexpr
226#if nsel_CPP14_OR_GREATER
227# define nsel_constexpr14 constexpr
229# define nsel_constexpr14
232#if nsel_CPP17_OR_GREATER
233# define nsel_inline17 inline
235# define nsel_inline17
252#if defined(_MSC_VER) && !defined(__clang__)
253# define nsel_COMPILER_MSVC_VER (_MSC_VER )
254# define nsel_COMPILER_MSVC_VERSION (_MSC_VER / 10 - 10 * ( 5 + (_MSC_VER < 1900)) )
256# define nsel_COMPILER_MSVC_VER 0
257# define nsel_COMPILER_MSVC_VERSION 0
260#define nsel_COMPILER_VERSION( major, minor, patch ) ( 10 * ( 10 * (major) + (minor) ) + (patch) )
262#if defined(__clang__)
263# define nsel_COMPILER_CLANG_VERSION nsel_COMPILER_VERSION(__clang_major__, __clang_minor__, __clang_patchlevel__)
265# define nsel_COMPILER_CLANG_VERSION 0
268#if defined(__GNUC__) && !defined(__clang__)
269# define nsel_COMPILER_GNUC_VERSION nsel_COMPILER_VERSION(__GNUC__, __GNUC_MINOR__, __GNUC_PATCHLEVEL__)
271# define nsel_COMPILER_GNUC_VERSION 0
279#define nsel_REQUIRES_0(...) \
280 template< bool B = (__VA_ARGS__), typename std::enable_if<B, int>::type = 0 >
282#define nsel_REQUIRES_T(...) \
283 , typename std::enable_if< (__VA_ARGS__), int >::type = 0
285#define nsel_REQUIRES_R(R, ...) \
286 typename std::enable_if< (__VA_ARGS__), R>::type
288#define nsel_REQUIRES_A(...) \
289 , typename std::enable_if< (__VA_ARGS__), void*>::type = nullptr
294# define nsel_HAS_CPP0X _HAS_CPP0X
296# define nsel_HAS_CPP0X 0
304# pragma clang diagnostic push
305#elif defined __GNUC__
306# pragma GCC diagnostic push
309#if nsel_COMPILER_MSVC_VERSION >= 140
310# pragma warning( push )
311# define nsel_DISABLE_MSVC_WARNINGS(codes) __pragma( warning(disable: codes) )
313# define nsel_DISABLE_MSVC_WARNINGS(codes)
317# define nsel_RESTORE_WARNINGS() _Pragma("clang diagnostic pop")
318#elif defined __GNUC__
319# define nsel_RESTORE_WARNINGS() _Pragma("GCC diagnostic pop")
320#elif nsel_COMPILER_MSVC_VERSION >= 140
321# define nsel_RESTORE_WARNINGS() __pragma( warning( pop ) )
323# define nsel_RESTORE_WARNINGS()
335namespace
nonstd {
namespace expected_lite {
341#if nsel_CPP17_OR_GREATER
343using std::conjunction;
344using std::is_swappable;
345using std::is_nothrow_swappable;
355 template< typename T, typename = decltype( swap( std::declval<T&>(), std::declval<T&>() ) ) >
362struct is_nothrow_swappable
366 template<
typename T >
367 static constexpr bool satisfies()
369 return noexcept(
swap( std::declval<T&>(), std::declval<T&>() ) );
372 template<
typename T >
373 static auto test(
int ) -> std::integral_constant<bool, satisfies<T>()>{}
382template<
typename T >
383struct is_swappable : decltype( detail::is_swappable::test<T>(0) ){};
385template<
typename T >
386struct is_nothrow_swappable : decltype( detail::is_nothrow_swappable::test<T>(0) ){};
391template<
typename B1 >
struct conjunction<B1> : B1{};
393template<
typename B1,
typename... Bn >
394struct conjunction<B1, Bn...> : std::conditional<bool(B1::value), conjunction<Bn...>, B1>::type{};
404#if nsel_CPP20_OR_GREATER
406using std::remove_cvref;
410template<
typename T >
413 typedef typename std::remove_cv< typename std::remove_reference<T>::type >::type type;
422template<
typename T,
typename E >
429template<
typename T,
typename E >
432 template<
typename,
typename >
friend class nonstd::expected_lite::expected;
435 using value_type = T;
436 using error_type = E;
442 explicit storage_t_impl(
bool has_value )
443 : m_has_value( has_value )
446 void construct_value( value_type
const & e )
448 new( &m_value ) value_type( e );
451 void construct_value( value_type && e )
453 new( &m_value ) value_type(
std::move( e ) );
456 template<
class... Args >
457 void emplace_value( Args&&... args )
459 new( &m_value ) value_type( std::forward<Args>(args)...);
462 template<
class U,
class... Args >
463 void emplace_value( std::initializer_list<U> il, Args&&... args )
465 new( &m_value ) value_type( il, std::forward<Args>(args)... );
468 void destruct_value()
470 m_value.~value_type();
473 void construct_error( error_type
const & e )
475 new( &m_error ) error_type( e );
478 void construct_error( error_type && e )
480 new( &m_error ) error_type(
std::move( e ) );
483 template<
class... Args >
484 void emplace_error( Args&&... args )
486 new( &m_error ) error_type( std::forward<Args>(args)...);
489 template<
class U,
class... Args >
490 void emplace_error( std::initializer_list<U> il, Args&&... args )
492 new( &m_error ) error_type( il, std::forward<Args>(args)... );
495 void destruct_error()
497 m_error.~error_type();
500 constexpr value_type
const & value()
const &
505 value_type & value() &
510 constexpr value_type
const && value()
const &&
520 value_type
const * value_ptr()
const
525 value_type * value_ptr()
530 error_type
const & error()
const &
535 error_type & error() &
540 constexpr error_type
const && error()
const &&
550 bool has_value()
const
555 void set_has_value(
bool v )
567 bool m_has_value =
false;
572template<
typename E >
573struct storage_t_impl<void, E>
575 template<
typename,
typename >
friend class nonstd::expected_lite::expected;
578 using value_type = void;
579 using error_type = E;
585 explicit storage_t_impl(
bool has_value )
586 : m_has_value( has_value )
589 void construct_error( error_type
const & e )
591 new( &m_error ) error_type( e );
594 void construct_error( error_type && e )
596 new( &m_error ) error_type(
std::move( e ) );
599 template<
class... Args >
600 void emplace_error( Args&&... args )
602 new( &m_error ) error_type( std::forward<Args>(args)...);
605 template<
class U,
class... Args >
606 void emplace_error( std::initializer_list<U> il, Args&&... args )
608 new( &m_error ) error_type( il, std::forward<Args>(args)... );
611 void destruct_error()
613 m_error.~error_type();
616 error_type
const & error()
const &
621 error_type & error() &
626 constexpr error_type
const && error()
const &&
636 bool has_value()
const
641 void set_has_value(
bool v )
653 bool m_has_value =
false;
656template<
typename T,
typename E,
bool isConstructable,
bool isMoveable >
660 storage_t() =
default;
661 ~storage_t() =
default;
663 explicit storage_t(
bool has_value )
664 : storage_t_impl<T, E>( has_value )
667 storage_t( storage_t
const & other ) =
delete;
668 storage_t( storage_t && other ) =
delete;
671template<
typename T,
typename E >
672class storage_t<T, E, true, true> :
public storage_t_impl<T, E>
675 storage_t() =
default;
676 ~storage_t() =
default;
678 explicit storage_t(
bool has_value )
679 : storage_t_impl<T, E>( has_value )
682 storage_t( storage_t
const & other )
683 : storage_t_impl<T, E>( other.has_value() )
685 if ( this->has_value() ) this->construct_value( other.value() );
686 else this->construct_error( other.error() );
689 storage_t(storage_t && other )
690 : storage_t_impl<T, E>( other.has_value() )
692 if ( this->has_value() ) this->construct_value(
std::move( other.value() ) );
693 else this->construct_error(
std::move( other.error() ) );
697template<
typename E >
698class storage_t<void, E, true, true> :
public storage_t_impl<void, E>
701 storage_t() =
default;
702 ~storage_t() =
default;
704 explicit storage_t(
bool has_value )
705 : storage_t_impl<void, E>( has_value )
708 storage_t( storage_t
const & other )
709 : storage_t_impl<void, E>( other.has_value() )
711 if ( this->has_value() ) ;
712 else this->construct_error( other.error() );
715 storage_t(storage_t && other )
716 : storage_t_impl<void, E>( other.has_value() )
718 if ( this->has_value() ) ;
719 else this->construct_error(
std::move( other.error() ) );
723template<
typename T,
typename E >
724class storage_t<T, E, true, false> :
public storage_t_impl<T, E>
727 storage_t() =
default;
728 ~storage_t() =
default;
730 explicit storage_t(
bool has_value )
731 : storage_t_impl<T, E>( has_value )
734 storage_t( storage_t
const & other )
735 : storage_t_impl<T, E>(other.has_value())
737 if ( this->has_value() ) this->construct_value( other.value() );
738 else this->construct_error( other.error() );
741 storage_t( storage_t && other ) =
delete;
744template<
typename E >
745class storage_t<void, E, true, false> :
public storage_t_impl<void, E>
748 storage_t() =
default;
749 ~storage_t() =
default;
751 explicit storage_t(
bool has_value )
752 : storage_t_impl<void, E>( has_value )
755 storage_t( storage_t
const & other )
756 : storage_t_impl<void, E>(other.has_value())
758 if ( this->has_value() ) ;
759 else this->construct_error( other.error() );
762 storage_t( storage_t && other ) =
delete;
765template<
typename T,
typename E >
766class storage_t<T, E, false, true> :
public storage_t_impl<T, E>
769 storage_t() =
default;
770 ~storage_t() =
default;
772 explicit storage_t(
bool has_value )
773 : storage_t_impl<T, E>( has_value )
776 storage_t( storage_t
const & other ) =
delete;
778 storage_t( storage_t && other )
779 : storage_t_impl<T, E>( other.has_value() )
781 if ( this->has_value() ) this->construct_value(
std::move( other.value() ) );
782 else this->construct_error(
std::move( other.error() ) );
786template<
typename E >
787class storage_t<void, E, false, true> :
public storage_t_impl<void, E>
790 storage_t() =
default;
791 ~storage_t() =
default;
793 explicit storage_t(
bool has_value )
794 : storage_t_impl<void, E>( has_value )
797 storage_t( storage_t
const & other ) =
delete;
799 storage_t( storage_t && other )
800 : storage_t_impl<void, E>( other.has_value() )
802 if ( this->has_value() ) ;
803 else this->construct_error(
std::move( other.error() ) );
812template<
typename E = std::exception_ptr >
815template< typename E >
820 using error_type = E;
826 constexpr unexpected_type( unexpected_type
const & ) =
default;
827 constexpr unexpected_type( unexpected_type && ) =
default;
829 template<
typename... Args
831 std::is_constructible<E, Args&&...>::value
835 : m_error( std::forward<Args>( args )...)
838 template<
typename U,
typename... Args
840 std::is_constructible<E, std::initializer_list<U>, Args&&...>::value
843 constexpr explicit unexpected_type(
nonstd_lite_in_place_t(E), std::initializer_list<U> il, Args &&... args )
844 : m_error( il, std::forward<Args>( args )...)
847 template<
typename E2
849 std::is_constructible<E,E2>::value
851 && !std::is_same<
typename std20::remove_cvref<E2>::type, unexpected_type >::value
854 constexpr explicit unexpected_type( E2 && error )
855 : m_error( std::forward<E2>( error ) )
858 template<
typename E2
860 std::is_constructible< E, E2>::value
861 && !std::is_constructible<E, unexpected_type<E2> & >::value
862 && !std::is_constructible<E, unexpected_type<E2> >::value
863 && !std::is_constructible<E, unexpected_type<E2>
const & >::value
864 && !std::is_constructible<E, unexpected_type<E2>
const >::value
865 && !std::is_convertible< unexpected_type<E2> &, E>::value
866 && !std::is_convertible< unexpected_type<E2> , E>::value
867 && !std::is_convertible< unexpected_type<E2>
const &, E>::value
868 && !std::is_convertible< unexpected_type<E2>
const , E>::value
869 && !std::is_convertible< E2 const &, E>::value
872 constexpr explicit unexpected_type( unexpected_type<E2>
const & error )
873 : m_error( E{ error.value() } )
876 template<
typename E2
878 std::is_constructible< E, E2>::value
879 && !std::is_constructible<E, unexpected_type<E2> & >::value
880 && !std::is_constructible<E, unexpected_type<E2> >::value
881 && !std::is_constructible<E, unexpected_type<E2>
const & >::value
882 && !std::is_constructible<E, unexpected_type<E2>
const >::value
883 && !std::is_convertible< unexpected_type<E2> &, E>::value
884 && !std::is_convertible< unexpected_type<E2> , E>::value
885 && !std::is_convertible< unexpected_type<E2>
const &, E>::value
886 && !std::is_convertible< unexpected_type<E2>
const , E>::value
887 && std::is_convertible< E2 const &, E>::value
890 constexpr unexpected_type( unexpected_type<E2>
const & error )
891 : m_error( error.value() )
894 template<
typename E2
896 std::is_constructible< E, E2>::value
897 && !std::is_constructible<E, unexpected_type<E2> & >::value
898 && !std::is_constructible<E, unexpected_type<E2> >::value
899 && !std::is_constructible<E, unexpected_type<E2>
const & >::value
900 && !std::is_constructible<E, unexpected_type<E2>
const >::value
901 && !std::is_convertible< unexpected_type<E2> &, E>::value
902 && !std::is_convertible< unexpected_type<E2> , E>::value
903 && !std::is_convertible< unexpected_type<E2>
const &, E>::value
904 && !std::is_convertible< unexpected_type<E2>
const , E>::value
905 && !std::is_convertible< E2 const &, E>::value
908 constexpr explicit unexpected_type( unexpected_type<E2> && error )
909 : m_error( E{
std::move( error.value() ) } )
912 template<
typename E2
914 std::is_constructible< E, E2>::value
915 && !std::is_constructible<E, unexpected_type<E2> & >::value
916 && !std::is_constructible<E, unexpected_type<E2> >::value
917 && !std::is_constructible<E, unexpected_type<E2>
const & >::value
918 && !std::is_constructible<E, unexpected_type<E2>
const >::value
919 && !std::is_convertible< unexpected_type<E2> &, E>::value
920 && !std::is_convertible< unexpected_type<E2> , E>::value
921 && !std::is_convertible< unexpected_type<E2>
const &, E>::value
922 && !std::is_convertible< unexpected_type<E2>
const , E>::value
923 && std::is_convertible< E2 const &, E>::value
926 constexpr unexpected_type( unexpected_type<E2> && error )
932 nsel_constexpr14 unexpected_type& operator=( unexpected_type
const & ) =
default;
933 nsel_constexpr14 unexpected_type& operator=( unexpected_type && ) =
default;
935 template<
typename E2 = E >
936 nsel_constexpr14 unexpected_type & operator=( unexpected_type<E2>
const & other )
938 unexpected_type{ other.value() }.swap( *
this );
942 template<
typename E2 = E >
943 nsel_constexpr14 unexpected_type & operator=( unexpected_type<E2> && other )
945 unexpected_type{
std::move( other.value() ) }.swap( *
this );
956 constexpr E
const & value()
const &
noexcept
961#if !nsel_COMPILER_GNUC_VERSION || nsel_COMPILER_GNUC_VERSION >= 490
968 constexpr E
const && value()
const &&
noexcept
978 std17::is_swappable<E>::value
980 swap( unexpected_type & other )
noexcept (
981 std17::is_nothrow_swappable<E>::value
985 swap( m_error, other.m_error );
994#if nsel_CPP17_OR_GREATER
998template<
typename E >
999unexpected_type( E ) -> unexpected_type< E >;
1005#if !nsel_CONFIG_NO_EXCEPTIONS
1011class unexpected_type<
std::exception_ptr >
1014 using error_type = std::exception_ptr;
1016 unexpected_type() =
delete;
1018 ~unexpected_type(){}
1020 explicit unexpected_type( std::exception_ptr
const & error )
1024 explicit unexpected_type(std::exception_ptr && error )
1028 template<
typename E >
1029 explicit unexpected_type( E error )
1030 : m_error( std::make_exception_ptr( error ) )
1033 std::exception_ptr
const & value()
const
1038 std::exception_ptr & value()
1044 std::exception_ptr m_error;
1052template<
typename E1,
typename E2 >
1053constexpr bool operator==( unexpected_type<E1>
const & x, unexpected_type<E2>
const & y )
1055 return x.value() == y.value();
1058template<
typename E1,
typename E2 >
1059constexpr bool operator!=( unexpected_type<E1>
const & x, unexpected_type<E2>
const & y )
1061 return ! ( x == y );
1066template<
typename E >
1067constexpr bool operator<( unexpected_type<E>
const & x, unexpected_type<E>
const & y )
1069 return x.value() < y.value();
1072template<
typename E >
1073constexpr bool operator>( unexpected_type<E>
const & x, unexpected_type<E>
const & y )
1078template<
typename E >
1079constexpr bool operator<=( unexpected_type<E>
const & x, unexpected_type<E>
const & y )
1084template<
typename E >
1085constexpr bool operator>=( unexpected_type<E>
const & x, unexpected_type<E>
const & y )
1096 std17::is_swappable<E>::value
1099void swap( unexpected_type<E> & x, unexpected_type<E> & y)
noexcept (
noexcept ( x.swap(y) ) )
1108inline constexpr bool operator<( unexpected_type<std::exception_ptr>
const & , unexpected_type<std::exception_ptr>
const & )
1113inline constexpr bool operator>( unexpected_type<std::exception_ptr>
const & , unexpected_type<std::exception_ptr>
const & )
1118inline constexpr bool operator<=( unexpected_type<std::exception_ptr>
const & x, unexpected_type<std::exception_ptr>
const & y )
1123inline constexpr bool operator>=( unexpected_type<std::exception_ptr>
const & x, unexpected_type<std::exception_ptr>
const & y )
1134template<
typename E>
1137template<
typename E>
1146template<
typename E>
1148make_unexpected( E && value ) -> unexpected_type< typename std::decay<E>::type >
1150 return unexpected_type< typename std::decay<E>::type >( std::forward<E>(value) );
1156make_unexpected_from_current_exception() -> unexpected_type< std::exception_ptr >
1158 return unexpected_type< std::exception_ptr >( std::current_exception() );
1165template<
typename E >
1166class bad_expected_access;
1171class bad_expected_access< void > :
public std::exception
1174 explicit bad_expected_access()
1181#if !nsel_CONFIG_NO_EXCEPTIONS
1183template<
typename E >
1184class bad_expected_access :
public bad_expected_access< void >
1187 using error_type = E;
1189 explicit bad_expected_access( error_type error )
1193 virtual char const * what()
const noexcept override
1195 return "bad_expected_access";
1203 constexpr error_type
const & error()
const &
1208#if !nsel_COMPILER_GNUC_VERSION || nsel_COMPILER_GNUC_VERSION >= 490
1215 constexpr error_type
const && error()
const &&
1231using in_place_unexpected_t = unexpect_t;
1238#if nsel_CONFIG_NO_EXCEPTIONS
1241 bool text(
char const * ) {
return true; }
1243template<
typename Error >
1246 static void rethrow( Error
const & )
1248 assert(
false && detail::text(
"throw bad_expected_access<Error>{ e };") );
1253struct error_traits<
std::exception_ptr >
1255 static void rethrow( std::exception_ptr
const & )
1257 assert(
false && detail::text(
"throw bad_expected_access<std::exception_ptr>{ e };") );
1262struct error_traits<
std::error_code >
1264 static void rethrow( std::error_code
const & )
1266 assert(
false && detail::text(
"throw std::system_error( e );") );
1272template<
typename Error >
1275 static void rethrow( Error
const & e )
1277 throw bad_expected_access<Error>{ e };
1282struct error_traits<
std::exception_ptr >
1284 static void rethrow( std::exception_ptr
const & e )
1286 std::rethrow_exception( e );
1291struct error_traits<
std::error_code >
1293 static void rethrow( std::error_code
const & e )
1295 throw std::system_error( e );
1305using expected_lite::unexpected_type;
1307namespace expected_lite {
1312template<
typename T,
typename E = std::exception_ptr >
1315template< typename T, typename E >
1320 template<
typename,
typename >
friend class expected;
1323 using value_type = T;
1324 using error_type = E;
1325 using unexpected_type = nonstd::unexpected_type<E>;
1327 template<
typename U >
1330 using type = expected<U, error_type>;
1336 std::is_default_constructible<T>::value
1341 contained.construct_value( value_type() );
1347 template<
typename U,
typename G
1349 std::is_constructible< T, U const &>::value
1350 && std::is_constructible<E, G const &>::value
1351 && !std::is_constructible<T, expected<U, G> & >::value
1352 && !std::is_constructible<T, expected<U, G> && >::value
1353 && !std::is_constructible<T, expected<U, G>
const & >::value
1354 && !std::is_constructible<T, expected<U, G>
const && >::value
1355 && !std::is_convertible< expected<U, G> & , T>::value
1356 && !std::is_convertible< expected<U, G> &&, T>::value
1357 && !std::is_convertible< expected<U, G>
const & , T>::value
1358 && !std::is_convertible< expected<U, G>
const &&, T>::value
1359 && (!std::is_convertible<U const &, T>::value || !std::is_convertible<G const &, E>::value )
1363 : contained( other.has_value() )
1365 if ( has_value() ) contained.construct_value( T{ other.contained.value() } );
1366 else contained.construct_error( E{ other.contained.error() } );
1369 template<
typename U,
typename G
1371 std::is_constructible< T, U const &>::value
1372 && std::is_constructible<E, G const &>::value
1373 && !std::is_constructible<T, expected<U, G> & >::value
1374 && !std::is_constructible<T, expected<U, G> && >::value
1375 && !std::is_constructible<T, expected<U, G>
const & >::value
1376 && !std::is_constructible<T, expected<U, G>
const && >::value
1377 && !std::is_convertible< expected<U, G> & , T>::value
1378 && !std::is_convertible< expected<U, G> &&, T>::value
1379 && !std::is_convertible< expected<U, G>
const &, T>::value
1380 && !std::is_convertible< expected<U, G>
const &&, T>::value
1381 && !(!std::is_convertible<U const &, T>::value || !std::is_convertible<G const &, E>::value )
1385 : contained( other.has_value() )
1387 if ( has_value() ) contained.construct_value( other.contained.value() );
1388 else contained.construct_error( other.contained.error() );
1391 template<
typename U,
typename G
1393 std::is_constructible< T, U>::value
1394 && std::is_constructible<E, G>::value
1395 && !std::is_constructible<T, expected<U, G> & >::value
1396 && !std::is_constructible<T, expected<U, G> && >::value
1397 && !std::is_constructible<T, expected<U, G>
const & >::value
1398 && !std::is_constructible<T, expected<U, G>
const && >::value
1399 && !std::is_convertible< expected<U, G> & , T>::value
1400 && !std::is_convertible< expected<U, G> &&, T>::value
1401 && !std::is_convertible< expected<U, G>
const & , T>::value
1402 && !std::is_convertible< expected<U, G>
const &&, T>::value
1403 && (!std::is_convertible<U, T>::value || !std::is_convertible<G, E>::value )
1407 : contained( other.has_value() )
1409 if ( has_value() ) contained.construct_value( T{
std::move( other.contained.value() ) } );
1410 else contained.construct_error( E{
std::move( other.contained.error() ) } );
1413 template<
typename U,
typename G
1415 std::is_constructible< T, U>::value
1416 && std::is_constructible<E, G>::value
1417 && !std::is_constructible<T, expected<U, G> & >::value
1418 && !std::is_constructible<T, expected<U, G> && >::value
1419 && !std::is_constructible<T, expected<U, G>
const & >::value
1420 && !std::is_constructible<T, expected<U, G>
const && >::value
1421 && !std::is_convertible< expected<U, G> & , T>::value
1422 && !std::is_convertible< expected<U, G> &&, T>::value
1423 && !std::is_convertible< expected<U, G>
const & , T>::value
1424 && !std::is_convertible< expected<U, G>
const &&, T>::value
1425 && !(!std::is_convertible<U, T>::value || !std::is_convertible<G, E>::value )
1429 : contained( other.has_value() )
1431 if ( has_value() ) contained.construct_value(
std::move( other.contained.value() ) );
1432 else contained.construct_error(
std::move( other.contained.error() ) );
1435 template<
typename U = T
1437 std::is_copy_constructible<U>::value
1443 contained.construct_value( value );
1446 template<
typename U = T
1448 std::is_constructible<T,U&&>::value
1450 && !std::is_same< expected<T,E> ,
typename std20::remove_cvref<U>::type>::value
1451 && !std::is_same<nonstd::unexpected_type<E>,
typename std20::remove_cvref<U>::type>::value
1452 && !std::is_convertible<U&&,T>::value
1457 std::is_nothrow_move_constructible<U>::value &&
1458 std::is_nothrow_move_constructible<E>::value
1462 contained.construct_value( T{ std::forward<U>( value ) } );
1465 template<
typename U = T
1467 std::is_constructible<T,U&&>::value
1469 && !std::is_same< expected<T,E> ,
typename std20::remove_cvref<U>::type>::value
1470 && !std::is_same<nonstd::unexpected_type<E>,
typename std20::remove_cvref<U>::type>::value
1471 && std::is_convertible<U&&,T>::value
1476 std::is_nothrow_move_constructible<U>::value &&
1477 std::is_nothrow_move_constructible<E>::value
1481 contained.construct_value( std::forward<U>( value ) );
1486 template<
typename G = E
1488 std::is_constructible<E, G const & >::value
1489 && !std::is_convertible< G const &, E>::value
1492 nsel_constexpr14 explicit expected( nonstd::unexpected_type<G>
const & error )
1493 : contained(
false )
1495 contained.construct_error( E{ error.value() } );
1498 template<
typename G = E
1500 std::is_constructible<E, G const & >::value
1501 && std::is_convertible< G const &, E>::value
1505 : contained(
false )
1507 contained.construct_error( error.value() );
1510 template<
typename G = E
1512 std::is_constructible<E, G&& >::value
1513 && !std::is_convertible< G&&, E>::value
1517 : contained(
false )
1519 contained.construct_error( E{
std::move( error.value() ) } );
1522 template<
typename G = E
1524 std::is_constructible<E, G&& >::value
1525 && std::is_convertible< G&&, E>::value
1529 : contained(
false )
1531 contained.construct_error(
std::move( error.value() ) );
1536 template<
typename... Args
1538 std::is_constructible<T, Args&&...>::value
1544 contained.emplace_value( std::forward<Args>( args )... );
1547 template<
typename U,
typename... Args
1549 std::is_constructible<T, std::initializer_list<U>, Args&&...>::value
1555 contained.emplace_value( il, std::forward<Args>( args )... );
1560 template<
typename... Args
1562 std::is_constructible<E, Args&&...>::value
1566 : contained(
false )
1568 contained.emplace_error( std::forward<Args>( args )... );
1571 template<
typename U,
typename... Args
1573 std::is_constructible<E, std::initializer_list<U>, Args&&...>::value
1576 nsel_constexpr14 explicit expected( unexpect_t, std::initializer_list<U> il, Args&&... args )
1577 : contained(
false )
1579 contained.emplace_error( il, std::forward<Args>( args )... );
1590 if ( has_value() ) contained.destruct_value();
1591 else contained.destruct_error();
1596 expected & operator=( expected
const & other )
1598 expected( other ).swap( *
this );
1602 expected & operator=( expected && other )
noexcept
1604 std::is_nothrow_move_constructible< T>::value
1605 && std::is_nothrow_move_assignable< T>::value
1606 && std::is_nothrow_move_constructible<E>::value
1607 && std::is_nothrow_move_assignable< E>::value )
1609 expected(
std::move( other ) ).swap( *
this );
1613 template<
typename U
1615 !std::is_same<expected<T,E>,
typename std20::remove_cvref<U>::type>::value
1616 && std17::conjunction<std::is_scalar<T>, std::is_same<T, std::decay<U>> >::value
1617 && std::is_constructible<T ,U>::value
1618 && std::is_assignable< T&,U>::value
1619 && std::is_nothrow_move_constructible<E>::value )
1621 expected & operator=( U && value )
1623 expected( std::forward<U>( value ) ).swap( *
this );
1627 template<
typename G
1629 std::is_copy_constructible<E>::value
1630 && std::is_copy_assignable<E>::value
1633 expected & operator=( nonstd::unexpected_type<G>
const & error )
1635 expected( unexpect, error.value() ).swap( *
this );
1639 template<
typename G
1641 std::is_move_constructible<E>::value
1642 && std::is_move_assignable<E>::value
1645 expected & operator=( nonstd::unexpected_type<G> && error )
1647 expected( unexpect,
std::move( error.value() ) ).swap( *
this );
1651 template<
typename... Args
1653 std::is_nothrow_constructible<T, Args&&...>::value
1656 value_type & emplace( Args &&... args )
1662 template<
typename U,
typename... Args
1664 std::is_nothrow_constructible<T, std::initializer_list<U>&, Args&&...>::value
1667 value_type & emplace( std::initializer_list<U> il, Args &&... args )
1675 template<
typename U=T,
typename G=E >
1677 std17::is_swappable< U>::value
1678 && std17::is_swappable<G>::value
1679 && ( std::is_move_constructible<U>::value || std::is_move_constructible<G>::value )
1681 swap( expected & other )
noexcept
1683 std::is_nothrow_move_constructible<T>::value && std17::is_nothrow_swappable<T&>::value &&
1684 std::is_nothrow_move_constructible<E>::value && std17::is_nothrow_swappable<E&>::value
1689 if (
bool(*
this) && bool(other) ) {
swap( contained.value(), other.contained.value() ); }
1690 else if ( !
bool(*
this) && !
bool(other) ) {
swap( contained.error(), other.contained.error() ); }
1691 else if (
bool(*
this) && !
bool(other) ) { error_type t(
std::move( other.error() ) );
1692 other.contained.destruct_error();
1693 other.contained.construct_value(
std::move( contained.value() ) );
1694 contained.destruct_value();
1695 contained.construct_error(
std::move( t ) );
1696 bool has_value = contained.has_value();
1697 bool other_has_value = other.has_value();
1698 other.contained.set_has_value(has_value);
1699 contained.set_has_value(other_has_value);
1701 else if ( !
bool(*
this) &&
bool(other) ) { other.swap( *
this ); }
1706 constexpr value_type
const * operator ->()
const
1708 return assert( has_value() ), contained.value_ptr();
1711 value_type * operator ->()
1713 return assert( has_value() ), contained.value_ptr();
1716 constexpr value_type
const & operator *()
const &
1718 return assert( has_value() ), contained.value();
1721 value_type & operator *() &
1723 return assert( has_value() ), contained.value();
1726#if !nsel_COMPILER_GNUC_VERSION || nsel_COMPILER_GNUC_VERSION >= 490
1728 constexpr value_type
const && operator *()
const &&
1730 return assert( has_value() ),
std::move( contained.value() );
1735 return assert( has_value() ),
std::move( contained.value() );
1740 constexpr explicit operator bool()
const noexcept
1745 constexpr bool has_value()
const noexcept
1747 return contained.has_value();
1750 constexpr value_type
const & value()
const &
1753 ? ( contained.value() )
1754 : ( error_traits<error_type>::rethrow( contained.error() ), contained.value() );
1757 value_type & value() &
1760 ? ( contained.value() )
1761 : ( error_traits<error_type>::rethrow( contained.error() ), contained.value() );
1764#if !nsel_COMPILER_GNUC_VERSION || nsel_COMPILER_GNUC_VERSION >= 490
1766 constexpr value_type
const && value()
const &&
1769 ? ( contained.value() )
1770 : ( error_traits<error_type>::rethrow( contained.error() ), contained.value() ) );
1776 ? ( contained.value() )
1777 : ( error_traits<error_type>::rethrow( contained.error() ), contained.value() ) );
1782 constexpr error_type
const & error()
const &
1784 return assert( ! has_value() ), contained.error();
1787 error_type & error() &
1789 return assert( ! has_value() ), contained.error();
1792#if !nsel_COMPILER_GNUC_VERSION || nsel_COMPILER_GNUC_VERSION >= 490
1794 constexpr error_type
const && error()
const &&
1796 return assert( ! has_value() ),
std::move( contained.error() );
1799 error_type && error() &&
1801 return assert( ! has_value() ),
std::move( contained.error() );
1806 constexpr unexpected_type get_unexpected()
const
1808 return make_unexpected( contained.error() );
1811 template<
typename Ex >
1812 bool has_exception()
const
1814 using ContainedEx =
typename std::remove_reference<
decltype( get_unexpected().value() ) >::type;
1815 return ! has_value() && std::is_base_of< Ex, ContainedEx>::value;
1818 template<
typename U
1820 std::is_copy_constructible< T>::value
1821 && std::is_convertible<U&&, T>::value
1824 value_type
value_or( U && v )
const &
1828 :
static_cast<T
>( std::forward<U>( v ) );
1831 template<
typename U
1833 std::is_move_constructible< T>::value
1834 && std::is_convertible<U&&, T>::value
1841 :
static_cast<T
>( std::forward<U>( v ) );
1880 , std::is_copy_constructible<T>::value && std::is_copy_constructible<E>::value
1881 , std::is_move_constructible<T>::value && std::is_move_constructible<E>::value
1888template<
typename E >
1889class expected<void, E>
1892 template<
typename,
typename >
friend class expected;
1895 using value_type = void;
1896 using error_type = E;
1897 using unexpected_type = nonstd::unexpected_type<E>;
1901 constexpr expected() noexcept
1912 template<
typename G = E
1914 !std::is_convertible<G const &, E>::value
1917 nsel_constexpr14 explicit expected( nonstd::unexpected_type<G>
const & error )
1918 : contained(
false )
1920 contained.construct_error( E{ error.value() } );
1923 template<
typename G = E
1925 std::is_convertible<G const &, E>::value
1929 : contained(
false )
1931 contained.construct_error( error.value() );
1934 template<
typename G = E
1936 !std::is_convertible<G&&, E>::value
1940 : contained(
false )
1942 contained.construct_error( E{
std::move( error.value() ) } );
1945 template<
typename G = E
1947 std::is_convertible<G&&, E>::value
1951 : contained(
false )
1953 contained.construct_error(
std::move( error.value() ) );
1956 template<
typename... Args
1958 std::is_constructible<E, Args&&...>::value
1962 : contained(
false )
1964 contained.emplace_error( std::forward<Args>( args )... );
1967 template<
typename U,
typename... Args
1969 std::is_constructible<E, std::initializer_list<U>, Args&&...>::value
1972 nsel_constexpr14 explicit expected( unexpect_t, std::initializer_list<U> il, Args&&... args )
1973 : contained(
false )
1975 contained.emplace_error( il, std::forward<Args>( args )... );
1982 if ( ! has_value() )
1984 contained.destruct_error();
1990 expected & operator=( expected
const & other )
1992 expected( other ).swap( *
this );
1996 expected & operator=( expected && other )
noexcept
1998 std::is_nothrow_move_assignable<E>::value &&
1999 std::is_nothrow_move_constructible<E>::value )
2001 expected(
std::move( other ) ).swap( *
this );
2007 expected().swap( *
this );
2012 template<
typename G = E >
2014 std17::is_swappable<G>::value
2015 && std::is_move_constructible<G>::value
2017 swap( expected & other )
noexcept
2019 std::is_nothrow_move_constructible<E>::value && std17::is_nothrow_swappable<E&>::value
2024 if ( !
bool(*
this) && ! bool(other) ) {
swap( contained.error(), other.contained.error() ); }
2025 else if (
bool(*
this) && !
bool(other) ) { contained.construct_error(
std::move( other.error() ) );
2026 bool has_value = contained.has_value();
2027 bool other_has_value = other.has_value();
2028 other.contained.set_has_value(has_value);
2029 contained.set_has_value(other_has_value);
2031 else if ( !
bool(*
this) &&
bool(other) ) { other.swap( *
this ); }
2036 constexpr explicit operator bool()
const noexcept
2041 constexpr bool has_value()
const noexcept
2043 return contained.has_value();
2048 if ( ! has_value() )
2050 error_traits<error_type>::rethrow( contained.error() );
2054 constexpr error_type
const & error()
const &
2056 return assert( ! has_value() ), contained.error();
2059 error_type & error() &
2061 return assert( ! has_value() ), contained.error();
2064#if !nsel_COMPILER_GNUC_VERSION || nsel_COMPILER_GNUC_VERSION >= 490
2066 constexpr error_type
const && error()
const &&
2068 return assert( ! has_value() ),
std::move( contained.error() );
2071 error_type && error() &&
2073 return assert( ! has_value() ),
std::move( contained.error() );
2078 constexpr unexpected_type get_unexpected()
const
2080 return make_unexpected( contained.error() );
2083 template<
typename Ex >
2084 bool has_exception()
const
2086 using ContainedEx =
typename std::remove_reference<
decltype( get_unexpected().value() ) >::type;
2087 return ! has_value() && std::is_base_of< Ex, ContainedEx>::value;
2116 , std::is_copy_constructible<E>::value
2117 , std::is_move_constructible<E>::value
2124template<
typename T1,
typename E1,
typename T2,
typename E2 >
2125constexpr bool operator==( expected<T1,E1>
const & x, expected<T2,E2>
const & y )
2127 return bool(x) != bool(y) ? false : bool(x) ==
false ? x.error() == y.error() : *x == *y;
2130template<
typename T1,
typename E1,
typename T2,
typename E2 >
2131constexpr bool operator!=( expected<T1,E1>
const & x, expected<T2,E2>
const & y )
2136template<
typename E1,
typename E2 >
2137constexpr bool operator==( expected<void,E1>
const & x, expected<void,E1>
const & y )
2139 return bool(x) != bool(y) ? false : bool(x) ==
false ? x.error() == y.error() :
true;
2144template<
typename T,
typename E >
2145constexpr bool operator<( expected<T,E>
const & x, expected<T,E>
const & y )
2147 return (!y) ? false : (!x) ?
true : *x < *y;
2150template<
typename T,
typename E >
2151constexpr bool operator>( expected<T,E>
const & x, expected<T,E>
const & y )
2156template<
typename T,
typename E >
2157constexpr bool operator<=( expected<T,E>
const & x, expected<T,E>
const & y )
2162template<
typename T,
typename E >
2163constexpr bool operator>=( expected<T,E>
const & x, expected<T,E>
const & y )
2172template<
typename T1,
typename E1,
typename T2 >
2173constexpr bool operator==( expected<T1,E1>
const & x,
T2 const & v )
2175 return bool(x) ? *x == v :
false;
2178template<
typename T1,
typename E1,
typename T2 >
2179constexpr bool operator==(
T2 const & v, expected<T1,E1>
const & x )
2181 return bool(x) ? v == *x :
false;
2184template<
typename T1,
typename E1,
typename T2 >
2185constexpr bool operator!=( expected<T1,E1>
const & x,
T2 const & v )
2187 return bool(x) ? *x != v :
true;
2190template<
typename T1,
typename E1,
typename T2 >
2191constexpr bool operator!=(
T2 const & v, expected<T1,E1>
const & x )
2193 return bool(x) ? v != *x :
true;
2198template<
typename T,
typename E >
2199constexpr bool operator<( expected<T,E>
const & x, T
const & v )
2201 return bool(x) ? *x < v :
true;
2204template<
typename T,
typename E >
2205constexpr bool operator<( T
const & v, expected<T,E>
const & x )
2207 return bool(x) ? v < *x :
false;
2210template<
typename T,
typename E >
2211constexpr bool operator>( T
const & v, expected<T,E>
const & x )
2213 return bool(x) ? *x < v :
false;
2216template<
typename T,
typename E >
2217constexpr bool operator>( expected<T,E>
const & x, T
const & v )
2219 return bool(x) ? v < *x :
false;
2222template<
typename T,
typename E >
2223constexpr bool operator<=( T
const & v, expected<T,E>
const & x )
2225 return bool(x) ? ! ( *x < v ) :
false;
2228template<
typename T,
typename E >
2229constexpr bool operator<=( expected<T,E>
const & x, T
const & v )
2231 return bool(x) ? ! ( v < *x ) :
true;
2234template<
typename T,
typename E >
2235constexpr bool operator>=( expected<T,E>
const & x, T
const & v )
2237 return bool(x) ? ! ( *x < v ) :
false;
2240template<
typename T,
typename E >
2241constexpr bool operator>=( T
const & v, expected<T,E>
const & x )
2243 return bool(x) ? ! ( v < *x ) :
true;
2250template<
typename T1,
typename E1 ,
typename E2 >
2251constexpr bool operator==( expected<T1,E1>
const & x, unexpected_type<E2>
const & u )
2253 return (!x) ? x.get_unexpected() == u :
false;
2256template<
typename T1,
typename E1 ,
typename E2 >
2257constexpr bool operator==( unexpected_type<E2>
const & u, expected<T1,E1>
const & x )
2262template<
typename T1,
typename E1 ,
typename E2 >
2263constexpr bool operator!=( expected<T1,E1>
const & x, unexpected_type<E2>
const & u )
2265 return ! ( x == u );
2268template<
typename T1,
typename E1 ,
typename E2 >
2269constexpr bool operator!=( unexpected_type<E2>
const & u, expected<T1,E1>
const & x )
2271 return ! ( x == u );
2276template<
typename T,
typename E >
2277constexpr bool operator<( expected<T,E>
const & x, unexpected_type<E>
const & u )
2279 return (!x) ? ( x.get_unexpected() < u ) :
false;
2282template<
typename T,
typename E >
2283constexpr bool operator<( unexpected_type<E>
const & u, expected<T,E>
const & x )
2285 return (!x) ? ( u < x.get_unexpected() ) :
true ;
2288template<
typename T,
typename E >
2289constexpr bool operator>( expected<T,E>
const & x, unexpected_type<E>
const & u )
2294template<
typename T,
typename E >
2295constexpr bool operator>( unexpected_type<E>
const & u, expected<T,E>
const & x )
2300template<
typename T,
typename E >
2301constexpr bool operator<=( expected<T,E>
const & x, unexpected_type<E>
const & u )
2306template<
typename T,
typename E >
2307constexpr bool operator<=( unexpected_type<E>
const & u, expected<T,E>
const & x)
2312template<
typename T,
typename E >
2313constexpr bool operator>=( expected<T,E>
const & x, unexpected_type<E>
const & u )
2318template<
typename T,
typename E >
2319constexpr bool operator>=( unexpected_type<E>
const & u, expected<T,E>
const & x )
2328template<
typename T,
typename E
2330 ( std::is_void<T>::value || std::is_move_constructible<T>::value )
2331 && std::is_move_constructible<E>::value
2332 && std17::is_swappable<T>::value
2333 && std17::is_swappable<E>::value )
2335void swap( expected<T,E> & x, expected<T,E> & y )
noexcept (
noexcept ( x.swap(y) ) )
2342template<
typename T >
2343constexpr auto make_expected( T && v ) -> expected< typename std::decay<T>::type >
2345 return expected< typename std::decay<T>::type >( std::forward<T>( v ) );
2350auto inline make_expected() -> expected<void>
2355template<
typename T >
2356constexpr auto make_expected_from_current_exception() -> expected<T>
2358 return expected<T>( make_unexpected_from_current_exception() );
2361template<
typename T >
2362auto make_expected_from_exception( std::exception_ptr v ) -> expected<T>
2364 return expected<T>( unexpected_type<std::exception_ptr>( std::forward<std::exception_ptr>( v ) ) );
2367template<
typename T,
typename E >
2368constexpr auto make_expected_from_error( E e ) -> expected<T, typename std::decay<E>::type>
2370 return expected<T, typename std::decay<E>::type>( make_unexpected( e ) );
2374 nsel_REQUIRES_T( ! std::is_same<
typename std::result_of<F()>::type,
void>::value )
2377auto make_expected_from_call( F f ) -> expected<
typename std::result_of<F()>::type >
2381 return make_expected( f() );
2385 return make_unexpected_from_current_exception();
2390 nsel_REQUIRES_T( std::is_same<
typename std::result_of<F()>::type,
void>::value )
2393auto make_expected_from_call( F f ) -> expected<void>
2398 return make_expected();
2402 return make_unexpected_from_current_exception();
2410using namespace expected_lite;
2421template<
typename T,
typename E >
2429 return arg ? std::hash<T>{}(*arg) :
result_type{};
2434template<
typename T,
typename E >
2442 return arg ? std::hash<T>{}(*arg) :
result_type{};
2451template<
typename E >
2462#if nsel_CPP17_OR_GREATER || nsel_COMPILER_MSVC_VERSION > 141
2463template<
typename E >
2464using unexpected = unexpected_type<E>;
2470#undef nsel_REQUIRES_0
2471#undef nsel_REQUIRES_T
bool_constant< false > false_type
bool_constant< true > true_type
optional_constexpr bool operator>(optional< T > const &x, optional< U > const &y)
void swap(optional< T > &x, optional< T > &y)
optional_constexpr bool operator>=(optional< T > const &x, optional< U > const &y)
in_place_t in_place_type(detail::in_place_type_tag< T >=detail::in_place_type_tag< T >())
in_place_t in_place_index(detail::in_place_index_tag< K >=detail::in_place_index_tag< K >())
in_place_t in_place(detail::in_place_type_tag< T >=detail::in_place_type_tag< T >())
in_place_t in_place(detail::in_place_index_tag< K >=detail::in_place_index_tag< K >())
RESTINIO_NODISCARD bool operator==(const character_t &a, const character_t &b) noexcept
RESTINIO_NODISCARD bool operator!=(const character_t &a, const character_t &b) noexcept
RESTINIO_NODISCARD bool operator<(const qvalue_t &a, const qvalue_t &b) noexcept
RESTINIO_NODISCARD bool operator<=(const qvalue_t &a, const qvalue_t &b) noexcept
std::enable_if< std::is_same< Parameter_Container, query_string_params_t >::value||std::is_same< Parameter_Container, router::route_params_t >::value, Value_Type >::type value_or(const Parameter_Container ¶ms, string_view_t key, Value_Type default_value)
Get parameter value or a given default.
nonstd::expected< T, E > argument_type
constexpr result_type operator()(argument_type const &arg) const
nonstd::expected< T &, E > argument_type
constexpr result_type operator()(argument_type const &arg) const
#define nsel_REQUIRES_T(...)
#define nsel_RESTORE_WARNINGS()
#define nonstd_lite_in_place( T)
#define nsel_REQUIRES_0(...)
#define nonstd_lite_in_place_t( T)
#define nsel_REQUIRES_R(R,...)
#define nsel_DISABLE_MSVC_WARNINGS(codes)