11#ifndef INCLUDED_BDLB_NULLABLEVALUE_CPP03
12#define INCLUDED_BDLB_NULLABLEVALUE_CPP03
63#ifdef COMPILING_BDLB_NULLABLEVALUE_H
69class NullableValue_WithAllocator;
72class NullableValue_WithoutAllocator;
78#ifdef BSLS_LIBRARYFEATURES_HAS_CPP20_CONCEPTS
79template <
class t_TYPE>
82template <
class t_TYPE>
83void nullableValue_acceptsStdOptional(
const std::optional<t_TYPE>&);
87template <
class t_TYPE>
88concept NullableValue_ConvertibleToBool =
89 bsl::is_convertible_v<t_TYPE, bool>;
93template <
class t_TYPE>
94concept NullableValue_DerivedFromBslOptional =
95 requires (
const t_TYPE& t) { optional_acceptsBslOptional(t); };
99template <
class t_TYPE>
100concept NullableValue_DerivedFromStdOptional =
101 requires (
const t_TYPE& t) { optional_acceptsStdOptional(t); };
108template <
class t_TYPE>
109concept NullableValue_DerivedFromOptional =
110 NullableValue_DerivedFromBslOptional<t_TYPE> ||
111 NullableValue_DerivedFromStdOptional<t_TYPE>;
157 NoAlloc>::type AllocType;
160 template <
class ANY_TYPE>
165 template <
class t_FUNC>
167 template <
class t_FUNC>
169 template <
class t_FUNC>
234 bsl::is_nothrow_move_constructible<TYPE>::
value);
263 template <class BDE_OTHER_TYPE>
265 typename
bsl::enable_if<
266 bsl::is_convertible<BDE_OTHER_TYPE, TYPE>::
value &&
267 !
bsl::is_convertible<BDE_OTHER_TYPE,
269 EnableType>::type = EnableType());
278 template <class BDE_OTHER_TYPE>
282 typename
bsl::enable_if<
283 bsl::is_convertible<BDE_OTHER_TYPE, TYPE>::
value,
284 EnableType>::type = EnableType());
286 template <class BDE_OTHER_TYPE>
288 typename
bsl::enable_if<
289 bsl::is_convertible<BDE_OTHER_TYPE, TYPE>::
value &&
291 EnableType>::type = EnableType());
293 template <class BDE_OTHER_TYPE>
296 typename
bsl::enable_if<
297 bsl::is_convertible<BDE_OTHER_TYPE, TYPE>::
value &&
299 EnableType>::type = EnableType());
301 template <class BDE_OTHER_TYPE>
304 typename
bsl::enable_if<
305 bsl::is_convertible<BDE_OTHER_TYPE, TYPE>::
value &&
307 EnableType>::type = EnableType());
309 template <class BDE_OTHER_TYPE>
313 typename
bsl::enable_if<
314 bsl::is_convertible<BDE_OTHER_TYPE, TYPE>::
value &&
316 EnableType>::type = EnableType());
318 template <class BDE_OTHER_TYPE>
320 typename
bsl::enable_if<
321 bsl::is_convertible<BDE_OTHER_TYPE, TYPE>::
value &&
323 EnableType>::type = EnableType());
325 template <class BDE_OTHER_TYPE>
329 typename
bsl::enable_if<
330 bsl::is_convertible<BDE_OTHER_TYPE, TYPE>::
value &&
332 EnableType>::type = EnableType());
341 template <class BDE_OTHER_TYPE>
353 template <class BDE_OTHER_TYPE>
393 template <class BDE_OTHER_TYPE>
402 template <class BDE_OTHER_TYPE>
413 template <class BDE_OTHER_TYPE>
414 typename
bsl::enable_if<
bsl::is_convertible<BDE_OTHER_TYPE, TYPE>::
value,
416 operator=(const
bsl::
optional<BDE_OTHER_TYPE>& rhs);
424 template <class BDE_OTHER_TYPE>
425 typename
bsl::enable_if<
bsl::is_convertible<BDE_OTHER_TYPE, TYPE>::
value,
449 template <class BDE_OTHER_TYPE>
469 template <class STREAM>
477 template <class BDE_OTHER_TYPE>
485#if BSLS_COMPILERFEATURES_SIMULATE_VARIADIC_TEMPLATES
488#ifndef BDLB_NULLABLEVALUE_VARIADIC_LIMIT
489#define BDLB_NULLABLEVALUE_VARIADIC_LIMIT 10
491#ifndef BDLB_NULLABLEVALUE_VARIADIC_LIMIT_A
492#define BDLB_NULLABLEVALUE_VARIADIC_LIMIT_A BDLB_NULLABLEVALUE_VARIADIC_LIMIT
495#if BDLB_NULLABLEVALUE_VARIADIC_LIMIT_A >= 0
499#if BDLB_NULLABLEVALUE_VARIADIC_LIMIT_A >= 1
500 template <
class ARGS_01>
504#if BDLB_NULLABLEVALUE_VARIADIC_LIMIT_A >= 2
505 template <
class ARGS_01,
511#if BDLB_NULLABLEVALUE_VARIADIC_LIMIT_A >= 3
512 template <
class ARGS_01,
520#if BDLB_NULLABLEVALUE_VARIADIC_LIMIT_A >= 4
521 template <
class ARGS_01,
531#if BDLB_NULLABLEVALUE_VARIADIC_LIMIT_A >= 5
532 template <
class ARGS_01,
544#if BDLB_NULLABLEVALUE_VARIADIC_LIMIT_A >= 6
545 template <
class ARGS_01,
559#if BDLB_NULLABLEVALUE_VARIADIC_LIMIT_A >= 7
560 template <
class ARGS_01,
576#if BDLB_NULLABLEVALUE_VARIADIC_LIMIT_A >= 8
577 template <
class ARGS_01,
595#if BDLB_NULLABLEVALUE_VARIADIC_LIMIT_A >= 9
596 template <
class ARGS_01,
616#if BDLB_NULLABLEVALUE_VARIADIC_LIMIT_A >= 10
617 template <
class ARGS_01,
643 template <
class... ARGS>
659 const TYPE *
addressOr(
const TYPE *address)
const;
670 template <
class STREAM>
688#ifndef BDE_OMIT_INTERNAL_DEPRECATED
705 bsl::ostream&
print(bsl::ostream& stream,
707 int spacesPerLevel = 4)
const;
713 const TYPE&
value()
const;
727 #if BSLS_DEPRECATE_IS_ACTIVE(BDL, 3, 5)
747template <
class LHS_TYPE,
class RHS_TYPE>
748bool operator==(
const NullableValue<LHS_TYPE>& lhs,
749 const NullableValue<RHS_TYPE>& rhs)
750#ifdef BSLS_LIBRARYFEATURES_HAS_CPP20_CONCEPTS
752 { *
lhs == *
rhs } -> NullableValue_ConvertibleToBool;
756template <
class LHS_TYPE,
class RHS_TYPE>
757bool operator==(
const NullableValue<LHS_TYPE>& lhs,
759#ifdef BSLS_LIBRARYFEATURES_HAS_CPP20_CONCEPTS
761 { *
lhs == *
rhs } -> NullableValue_ConvertibleToBool;
765template <
class LHS_TYPE,
class RHS_TYPE>
767 const NullableValue<RHS_TYPE>& rhs)
768#ifdef BSLS_LIBRARYFEATURES_HAS_CPP20_CONCEPTS
770 { *
lhs == *
rhs } -> NullableValue_ConvertibleToBool;
774#ifdef BSLSTL_OPTIONAL_USES_STD_ALIASES
775template <
class LHS_TYPE,
class RHS_TYPE>
776bool operator==(
const NullableValue<LHS_TYPE>& lhs,
777 const std::optional<RHS_TYPE>& rhs)
778#ifdef BSLS_LIBRARYFEATURES_HAS_CPP20_CONCEPTS
780 { *
lhs == *
rhs } -> NullableValue_ConvertibleToBool;
784template <
class LHS_TYPE,
class RHS_TYPE>
785bool operator==(
const std::optional<LHS_TYPE>& lhs,
786 const NullableValue<RHS_TYPE>& rhs)
787#ifdef BSLS_LIBRARYFEATURES_HAS_CPP20_CONCEPTS
789 { *
lhs == *
rhs } -> NullableValue_ConvertibleToBool;
802template <
class LHS_TYPE,
class RHS_TYPE>
803bool operator!=(
const NullableValue<LHS_TYPE>& lhs,
804 const NullableValue<RHS_TYPE>& rhs)
805#ifdef BSLS_LIBRARYFEATURES_HAS_CPP20_CONCEPTS
807 { *
lhs != *
rhs } -> NullableValue_ConvertibleToBool;
811template <
class LHS_TYPE,
class RHS_TYPE>
813 const NullableValue<RHS_TYPE>& rhs)
814#ifdef BSLS_LIBRARYFEATURES_HAS_CPP20_CONCEPTS
816 { *
lhs != *
rhs } -> NullableValue_ConvertibleToBool;
820template <
class LHS_TYPE,
class RHS_TYPE>
821bool operator!=(
const NullableValue<LHS_TYPE>& lhs,
823#ifdef BSLS_LIBRARYFEATURES_HAS_CPP20_CONCEPTS
825 { *
lhs != *
rhs } -> NullableValue_ConvertibleToBool;
829#ifdef BSLSTL_OPTIONAL_USES_STD_ALIASES
830template <
class LHS_TYPE,
class RHS_TYPE>
831bool operator!=(
const std::optional<LHS_TYPE>& lhs,
832 const NullableValue<RHS_TYPE>& rhs)
833#ifdef BSLS_LIBRARYFEATURES_HAS_CPP20_CONCEPTS
835 { *
lhs != *
rhs } -> NullableValue_ConvertibleToBool;
839template <
class LHS_TYPE,
class RHS_TYPE>
840bool operator!=(
const NullableValue<LHS_TYPE>& lhs,
841 const std::optional<RHS_TYPE>& rhs)
842#ifdef BSLS_LIBRARYFEATURES_HAS_CPP20_CONCEPTS
844 { *
lhs != *
rhs } -> NullableValue_ConvertibleToBool;
857template <
class LHS_TYPE,
class RHS_TYPE>
858bool operator!=(
const NullableValue<LHS_TYPE>& lhs,
860#ifdef BSLS_LIBRARYFEATURES_HAS_CPP20_CONCEPTS
861 requires (!NullableValue_DerivedFromOptional<RHS_TYPE>) &&
862 requires { { *
lhs !=
rhs } -> NullableValue_ConvertibleToBool; }
865template <
class LHS_TYPE,
class RHS_TYPE>
867 const NullableValue<RHS_TYPE>& rhs)
868#ifdef BSLS_LIBRARYFEATURES_HAS_CPP20_CONCEPTS
869 requires (!NullableValue_DerivedFromOptional<LHS_TYPE>) &&
870 requires { {
lhs != *
rhs } -> NullableValue_ConvertibleToBool; }
881template <
class LHS_TYPE,
class RHS_TYPE>
882bool operator==(
const NullableValue<LHS_TYPE>& lhs,
884#ifdef BSLS_LIBRARYFEATURES_HAS_CPP20_CONCEPTS
885 requires (!NullableValue_DerivedFromOptional<RHS_TYPE>) &&
886 requires { { *
lhs ==
rhs } -> NullableValue_ConvertibleToBool; }
889template <
class LHS_TYPE,
class RHS_TYPE>
891 const NullableValue<RHS_TYPE>& rhs)
892#ifdef BSLS_LIBRARYFEATURES_HAS_CPP20_CONCEPTS
893 requires (!NullableValue_DerivedFromOptional<LHS_TYPE>) &&
894 requires { {
lhs == *
rhs } -> NullableValue_ConvertibleToBool; }
906template <
class LHS_TYPE,
class RHS_TYPE>
907bool operator<(
const NullableValue<LHS_TYPE>& lhs,
908 const NullableValue<RHS_TYPE>& rhs)
909#ifdef BSLS_LIBRARYFEATURES_HAS_CPP20_CONCEPTS
911 { *
lhs < *
rhs } -> NullableValue_ConvertibleToBool;
915template <
class LHS_TYPE,
class RHS_TYPE>
917 const NullableValue<RHS_TYPE>& rhs)
918#ifdef BSLS_LIBRARYFEATURES_HAS_CPP20_CONCEPTS
920 { *
lhs < *
rhs } -> NullableValue_ConvertibleToBool;
924template <
class LHS_TYPE,
class RHS_TYPE>
925bool operator<(
const NullableValue<LHS_TYPE>& lhs,
927#ifdef BSLS_LIBRARYFEATURES_HAS_CPP20_CONCEPTS
929 { *
lhs < *
rhs } -> NullableValue_ConvertibleToBool;
933#ifdef BSLSTL_OPTIONAL_USES_STD_ALIASES
934template <
class LHS_TYPE,
class RHS_TYPE>
935bool operator<(
const std::optional<LHS_TYPE>& lhs,
936 const NullableValue<RHS_TYPE>& rhs)
937#ifdef BSLS_LIBRARYFEATURES_HAS_CPP20_CONCEPTS
939 { *
lhs < *
rhs } -> NullableValue_ConvertibleToBool;
943template <
class LHS_TYPE,
class RHS_TYPE>
944bool operator<(
const NullableValue<LHS_TYPE>& lhs,
945 const std::optional<RHS_TYPE>& rhs)
946#ifdef BSLS_LIBRARYFEATURES_HAS_CPP20_CONCEPTS
948 { *
lhs < *
rhs } -> NullableValue_ConvertibleToBool;
957template <
class LHS_TYPE,
class RHS_TYPE>
958bool operator<(
const NullableValue<LHS_TYPE>& lhs,
960#ifdef BSLS_LIBRARYFEATURES_HAS_CPP20_CONCEPTS
961 requires (!NullableValue_DerivedFromOptional<RHS_TYPE>) &&
962 requires { { *
lhs <
rhs } -> NullableValue_ConvertibleToBool; }
969template <
class LHS_TYPE,
class RHS_TYPE>
971 const NullableValue<RHS_TYPE>& rhs)
972#ifdef BSLS_LIBRARYFEATURES_HAS_CPP20_CONCEPTS
973 requires (!NullableValue_DerivedFromOptional<LHS_TYPE>) &&
974 requires { {
lhs < *
rhs } -> NullableValue_ConvertibleToBool; }
986template <
class LHS_TYPE,
class RHS_TYPE>
987bool operator>(
const NullableValue<LHS_TYPE>& lhs,
988 const NullableValue<RHS_TYPE>& rhs)
989#ifdef BSLS_LIBRARYFEATURES_HAS_CPP20_CONCEPTS
991 { *
lhs > *
rhs } -> NullableValue_ConvertibleToBool;
995template <
class LHS_TYPE,
class RHS_TYPE>
997 const NullableValue<RHS_TYPE>& rhs)
998#ifdef BSLS_LIBRARYFEATURES_HAS_CPP20_CONCEPTS
1000 { *
lhs > *
rhs } -> NullableValue_ConvertibleToBool;
1004template <
class LHS_TYPE,
class RHS_TYPE>
1005bool operator>(
const NullableValue<LHS_TYPE>& lhs,
1007#ifdef BSLS_LIBRARYFEATURES_HAS_CPP20_CONCEPTS
1009 { *
lhs > *
rhs } -> NullableValue_ConvertibleToBool;
1013#ifdef BSLSTL_OPTIONAL_USES_STD_ALIASES
1014template <
class LHS_TYPE,
class RHS_TYPE>
1015bool operator>(
const std::optional<LHS_TYPE>& lhs,
1016 const NullableValue<RHS_TYPE>& rhs)
1017#ifdef BSLS_LIBRARYFEATURES_HAS_CPP20_CONCEPTS
1019 { *
lhs > *
rhs } -> NullableValue_ConvertibleToBool;
1023template <
class LHS_TYPE,
class RHS_TYPE>
1024bool operator>(
const NullableValue<LHS_TYPE>& lhs,
1025 const std::optional<RHS_TYPE>& rhs)
1026#ifdef BSLS_LIBRARYFEATURES_HAS_CPP20_CONCEPTS
1028 { *
lhs > *
rhs } -> NullableValue_ConvertibleToBool;
1037template <
class LHS_TYPE,
class RHS_TYPE>
1038bool operator>(
const NullableValue<LHS_TYPE>& lhs,
1039 const RHS_TYPE& rhs)
1040#ifdef BSLS_LIBRARYFEATURES_HAS_CPP20_CONCEPTS
1041 requires (!NullableValue_DerivedFromOptional<RHS_TYPE>) &&
1042 requires { { *
lhs >
rhs } -> NullableValue_ConvertibleToBool; }
1049template <
class LHS_TYPE,
class RHS_TYPE>
1051 const NullableValue<RHS_TYPE>& rhs)
1052#ifdef BSLS_LIBRARYFEATURES_HAS_CPP20_CONCEPTS
1053 requires (!NullableValue_DerivedFromOptional<LHS_TYPE>) &&
1054 requires { {
lhs > *
rhs } -> NullableValue_ConvertibleToBool; }
1065template <
class LHS_TYPE,
class RHS_TYPE>
1066bool operator<=(
const NullableValue<LHS_TYPE>& lhs,
1067 const NullableValue<RHS_TYPE>& rhs)
1068#ifdef BSLS_LIBRARYFEATURES_HAS_CPP20_CONCEPTS
1070 { *
lhs <= *
rhs } -> NullableValue_ConvertibleToBool;
1074template <
class LHS_TYPE,
class RHS_TYPE>
1076 const NullableValue<RHS_TYPE>& rhs)
1077#ifdef BSLS_LIBRARYFEATURES_HAS_CPP20_CONCEPTS
1079 { *
lhs <= *
rhs } -> NullableValue_ConvertibleToBool;
1083template <
class LHS_TYPE,
class RHS_TYPE>
1084bool operator<=(
const NullableValue<LHS_TYPE>& lhs,
1086#ifdef BSLS_LIBRARYFEATURES_HAS_CPP20_CONCEPTS
1088 { *
lhs <= *
rhs } -> NullableValue_ConvertibleToBool;
1092#ifdef BSLSTL_OPTIONAL_USES_STD_ALIASES
1093template <
class LHS_TYPE,
class RHS_TYPE>
1094bool operator<=(
const std::optional<LHS_TYPE>& lhs,
1095 const NullableValue<RHS_TYPE>& rhs)
1096#ifdef BSLS_LIBRARYFEATURES_HAS_CPP20_CONCEPTS
1098 { *
lhs <= *
rhs } -> NullableValue_ConvertibleToBool;
1102template <
class LHS_TYPE,
class RHS_TYPE>
1103bool operator<=(
const NullableValue<LHS_TYPE>& lhs,
1104 const std::optional<RHS_TYPE>& rhs)
1105#ifdef BSLS_LIBRARYFEATURES_HAS_CPP20_CONCEPTS
1107 { *
lhs <= *
rhs } -> NullableValue_ConvertibleToBool;
1116template <
class LHS_TYPE,
class RHS_TYPE>
1117bool operator<=(
const NullableValue<LHS_TYPE>& lhs,
1118 const RHS_TYPE& rhs)
1119#ifdef BSLS_LIBRARYFEATURES_HAS_CPP20_CONCEPTS
1120 requires (!NullableValue_DerivedFromOptional<RHS_TYPE>) &&
1121 requires { { *
lhs <=
rhs } -> NullableValue_ConvertibleToBool; }
1128template <
class LHS_TYPE,
class RHS_TYPE>
1130 const NullableValue<RHS_TYPE>& rhs)
1131#ifdef BSLS_LIBRARYFEATURES_HAS_CPP20_CONCEPTS
1132 requires (!NullableValue_DerivedFromOptional<LHS_TYPE>) &&
1133 requires { {
lhs <= *
rhs } -> NullableValue_ConvertibleToBool; }
1144template <
class LHS_TYPE,
class RHS_TYPE>
1145bool operator>=(
const NullableValue<LHS_TYPE>& lhs,
1146 const NullableValue<RHS_TYPE>& rhs)
1147#ifdef BSLS_LIBRARYFEATURES_HAS_CPP20_CONCEPTS
1149 { *
lhs >= *
rhs } -> NullableValue_ConvertibleToBool;
1153template <
class LHS_TYPE,
class RHS_TYPE>
1155 const NullableValue<RHS_TYPE>& rhs)
1156#ifdef BSLS_LIBRARYFEATURES_HAS_CPP20_CONCEPTS
1158 { *
lhs >= *
rhs } -> NullableValue_ConvertibleToBool;
1162template <
class LHS_TYPE,
class RHS_TYPE>
1163bool operator>=(
const NullableValue<LHS_TYPE>& lhs,
1165#ifdef BSLS_LIBRARYFEATURES_HAS_CPP20_CONCEPTS
1167 { *
lhs >= *
rhs } -> NullableValue_ConvertibleToBool;
1171#ifdef BSLSTL_OPTIONAL_USES_STD_ALIASES
1172template <
class LHS_TYPE,
class RHS_TYPE>
1173bool operator>=(
const std::optional<LHS_TYPE>& lhs,
1174 const NullableValue<RHS_TYPE>& rhs)
1175#ifdef BSLS_LIBRARYFEATURES_HAS_CPP20_CONCEPTS
1177 { *
lhs >= *
rhs } -> NullableValue_ConvertibleToBool;
1181template <
class LHS_TYPE,
class RHS_TYPE>
1182bool operator>=(
const NullableValue<LHS_TYPE>& lhs,
1183 const std::optional<RHS_TYPE>& rhs)
1184#ifdef BSLS_LIBRARYFEATURES_HAS_CPP20_CONCEPTS
1186 { *
lhs >= *
rhs } -> NullableValue_ConvertibleToBool;
1195template <
class LHS_TYPE,
class RHS_TYPE>
1196bool operator>=(
const NullableValue<LHS_TYPE>& lhs,
1197 const RHS_TYPE& rhs)
1198#ifdef BSLS_LIBRARYFEATURES_HAS_CPP20_CONCEPTS
1199 requires (!NullableValue_DerivedFromOptional<RHS_TYPE>) &&
1200 requires { { *
lhs >=
rhs } -> NullableValue_ConvertibleToBool; }
1207template <
class LHS_TYPE,
class RHS_TYPE>
1209 const NullableValue<RHS_TYPE>& rhs)
1210#ifdef BSLS_LIBRARYFEATURES_HAS_CPP20_CONCEPTS
1211 requires (!NullableValue_DerivedFromOptional<LHS_TYPE>) &&
1212 requires { {
lhs >= *
rhs } -> NullableValue_ConvertibleToBool; }
1216#if defined BSLS_COMPILERFEATURES_SUPPORT_THREE_WAY_COMPARISON && \
1217 defined BSLS_LIBRARYFEATURES_HAS_CPP20_CONCEPTS
1222template <
class LHS_TYPE, bsl::three_way_comparable_with<LHS_TYPE> RHS_TYPE>
1223constexpr std::compare_three_way_result_t<LHS_TYPE, RHS_TYPE> operator<=>(
1224 const NullableValue<LHS_TYPE>& lhs,
1225 const NullableValue<RHS_TYPE>& rhs);
1226template <
class LHS_TYPE, bsl::three_way_comparable_with<LHS_TYPE> RHS_TYPE>
1227constexpr std::compare_three_way_result_t<LHS_TYPE, RHS_TYPE> operator<=>(
1228 const NullableValue<LHS_TYPE>& lhs,
1230template <
class LHS_TYPE, bsl::three_way_comparable_with<LHS_TYPE> RHS_TYPE>
1231constexpr std::compare_three_way_result_t<LHS_TYPE, RHS_TYPE> operator<=>(
1232 const NullableValue<LHS_TYPE>& lhs,
1233 const std::optional<RHS_TYPE>& rhs);
1234template <
class LHS_TYPE,
class RHS_TYPE>
1235 requires(!NullableValue_DerivedFromOptional<RHS_TYPE>) &&
1236 bsl::three_way_comparable_with<LHS_TYPE, RHS_TYPE>
1237constexpr std::compare_three_way_result_t<LHS_TYPE, RHS_TYPE>
1238 operator<=>(
const NullableValue<LHS_TYPE>& lhs,
const RHS_TYPE& rhs);
1242template <
class TYPE>
1243constexpr std::strong_ordering
1244 operator<=>(
const NullableValue<TYPE>& value,
1250template <
class TYPE>
1255#ifndef BSLS_COMPILERFEATURES_SUPPORT_THREE_WAY_COMPARISON
1258template <
class TYPE>
1265template <
class TYPE>
1269template <
class TYPE>
1274# ifndef BSLS_LIBRARYFEATURES_HAS_CPP20_CONCEPTS
1279template <
class TYPE>
1288template <
class TYPE>
1295template <
class TYPE>
1302template <
class TYPE>
1308template <
class TYPE>
1314template <
class TYPE>
1320template <
class TYPE>
1326template <
class TYPE>
1343template <
class TYPE>
1344bsl::ostream&
operator<<(bsl::ostream& stream,
1345 const NullableValue<TYPE>&
object);
1353template <
class HASHALG,
class TYPE>
1354void hashAppend(HASHALG& hashAlg,
const NullableValue<TYPE>& input);
1362template <
class TYPE>
1365swap(NullableValue<TYPE>& lhs, NullableValue<TYPE>& rhs);
1366template <
class TYPE>
1369swap(NullableValue<TYPE>& lhs, NullableValue<TYPE>& rhs);
1381template <
class TYPE>
1386template <
class TYPE>
1390: Base(bsl::allocator_arg, allocator)
1393template <
class TYPE>
1396: Base(static_cast<const
bsl::optional<TYPE>&>(original))
1399template <
class TYPE>
1401NullableValue<TYPE>::NullableValue(
const NullableValue& original,
1402 const allocator_type& allocator)
1403: Base(
bsl::allocator_arg,
1405 static_cast<const
bsl::optional<TYPE>&>(original))
1408template <
class TYPE>
1413: Base(MoveUtil::move(
1414 static_cast<
bsl::optional<TYPE>&>(MoveUtil::access(original))))
1417template <
class TYPE>
1420 const allocator_type& allocator)
1421: Base(
bsl::allocator_arg,
1423 MoveUtil::move(static_cast<
bsl::optional<TYPE>&>(
1424 MoveUtil::access(original))))
1427template <
class TYPE>
1428template <
class BDE_OTHER_TYPE>
1430NullableValue<TYPE>::NullableValue(
1439template <
class TYPE>
1440template <
class BDE_OTHER_TYPE>
1442NullableValue<TYPE>::NullableValue(
1444 const allocator_type& allocator,
1447: Base(
bsl::allocator_arg,
1452template <
class TYPE>
1453template <
class BDE_OTHER_TYPE>
1455NullableValue<TYPE>::NullableValue(
1464template <
class TYPE>
1465template <
class BDE_OTHER_TYPE>
1467NullableValue<TYPE>::NullableValue(
1469 const allocator_type& allocator,
1474: Base(
bsl::allocator_arg, allocator, value)
1477template <
class TYPE>
1478template <
class BDE_OTHER_TYPE>
1481 NullableValue<BDE_OTHER_TYPE>) value,
1486: Base(MoveUtil::move(static_cast<
bsl::optional<BDE_OTHER_TYPE>&>(
1487 MoveUtil::access(value))))
1490template <
class TYPE>
1491template <
class BDE_OTHER_TYPE>
1494 NullableValue<BDE_OTHER_TYPE>) value,
1495 const allocator_type& allocator,
1500: Base(
bsl::allocator_arg,
1502 MoveUtil::move(static_cast<
bsl::optional<BDE_OTHER_TYPE>&>(
1503 MoveUtil::access(value))))
1506template <
class TYPE>
1507template <
class BDE_OTHER_TYPE>
1509NullableValue<TYPE>::NullableValue(
1515: Base(MoveUtil::move(value))
1518template <
class TYPE>
1519template <
class BDE_OTHER_TYPE>
1521NullableValue<TYPE>::NullableValue(
1524 const allocator_type& allocator,
1529: Base(
bsl::allocator_arg, allocator, MoveUtil::move(value))
1532template <
class TYPE>
1533template <
class BDE_OTHER_TYPE>
1535NullableValue<TYPE>::NullableValue(
1536 const NullableValue<BDE_OTHER_TYPE>& original)
1537: Base(static_cast<const
bsl::optional<BDE_OTHER_TYPE>&>(original))
1540template <
class TYPE>
1541template <
class BDE_OTHER_TYPE>
1543NullableValue<TYPE>::NullableValue(
1544 const NullableValue<BDE_OTHER_TYPE>& original,
1545 const allocator_type& allocator)
1546: Base(
bsl::allocator_arg,
1548 static_cast<const
bsl::optional<BDE_OTHER_TYPE>&>(original))
1551template <
class TYPE>
1557template <
class TYPE>
1559NullableValue<TYPE>::NullableValue(
1562: Base(bsl::allocator_arg, allocator)
1566template <
class TYPE>
1568NullableValue<TYPE>& NullableValue<TYPE>::operator=(
const NullableValue& rhs)
1574 if (
rhs.has_value()) {
1575 if (this->has_value()) {
1576 this->value() =
rhs.value();
1579 this->emplace(
rhs.value());
1589template <
class TYPE>
1591NullableValue<TYPE>& NullableValue<TYPE>::operator=(
1598 NullableValue& localRhs =
rhs;
1600 if (localRhs.has_value()) {
1601 if (this->has_value()) {
1602 this->value() = MoveUtil::move(localRhs.value());
1605 this->emplace(MoveUtil::move(localRhs.value()));
1615template <
class TYPE>
1616template <
class BDE_OTHER_TYPE>
1617NullableValue<TYPE>& NullableValue<TYPE>::operator=(
1618 const NullableValue<BDE_OTHER_TYPE>& rhs)
1624 if (
rhs.has_value()) {
1625 if (this->has_value()) {
1626 this->value() =
rhs.value();
1629 this->emplace(
rhs.value());
1639template <
class TYPE>
1640template <
class BDE_OTHER_TYPE>
1641NullableValue<TYPE>& NullableValue<TYPE>::operator=(
1648 NullableValue<BDE_OTHER_TYPE>& rhsLocal =
rhs;
1650 if (rhsLocal.has_value()) {
1651 if (this->has_value()) {
1652 this->value() = MoveUtil::move(rhsLocal.value());
1655 this->emplace(MoveUtil::move(rhsLocal.value()));
1665template <
class TYPE>
1666template <
class BDE_OTHER_TYPE>
1668 NullableValue<TYPE>&>::type
1678template <
class TYPE>
1679template <
class BDE_OTHER_TYPE>
1681 NullableValue<TYPE>&>::type
1682NullableValue<TYPE>::operator=(
1687 base = MoveUtil::move(rhs);
1692template <
class TYPE>
1694NullableValue<TYPE>& NullableValue<TYPE>::operator=(
const TYPE& rhs)
1700 if (this->has_value()) {
1701 this->value() =
rhs;
1710template <
class TYPE>
1712NullableValue<TYPE>& NullableValue<TYPE>::operator=(
1719 if (this->has_value()) {
1720 this->value() = MoveUtil::move(rhs);
1723 this->emplace(MoveUtil::move(rhs));
1729template <
class TYPE>
1730template <
class BDE_OTHER_TYPE>
1732NullableValue<TYPE>& NullableValue<TYPE>::operator=(
const BDE_OTHER_TYPE& rhs)
1738 if (this->has_value()) {
1739 this->value() =
rhs;
1748template <
class TYPE>
1750NullableValue<TYPE>& NullableValue<TYPE>::operator=(
1758template <
class TYPE>
1759template <
class STREAM>
1760STREAM& NullableValue<TYPE>::bdexStreamIn(STREAM& stream,
int version)
1766 stream.getInt8(isNull);
1780template <
class TYPE>
1781template <
class BDE_OTHER_TYPE>
1783TYPE& NullableValue<TYPE>::makeValue(
1789template <
class TYPE>
1791TYPE& NullableValue<TYPE>::makeValue()
1793 return this->emplace();
1796#if BSLS_COMPILERFEATURES_SIMULATE_VARIADIC_TEMPLATES
1799#ifndef BDLB_NULLABLEVALUE_VARIADIC_LIMIT
1800#define BDLB_NULLABLEVALUE_VARIADIC_LIMIT 10
1802#ifndef BDLB_NULLABLEVALUE_VARIADIC_LIMIT_B
1803#define BDLB_NULLABLEVALUE_VARIADIC_LIMIT_B BDLB_NULLABLEVALUE_VARIADIC_LIMIT
1805#if BDLB_NULLABLEVALUE_VARIADIC_LIMIT_B >= 0
1806template <
class TYPE>
1808TYPE& NullableValue<TYPE>::makeValueInplace(
1811 return this->emplace();
1815#if BDLB_NULLABLEVALUE_VARIADIC_LIMIT_B >= 1
1816template <
class TYPE>
1817template <
class ARGS_01>
1819TYPE& NullableValue<TYPE>::makeValueInplace(
1826#if BDLB_NULLABLEVALUE_VARIADIC_LIMIT_B >= 2
1827template <
class TYPE>
1828template <
class ARGS_01,
1831TYPE& NullableValue<TYPE>::makeValueInplace(
1840#if BDLB_NULLABLEVALUE_VARIADIC_LIMIT_B >= 3
1841template <
class TYPE>
1842template <
class ARGS_01,
1846TYPE& NullableValue<TYPE>::makeValueInplace(
1857#if BDLB_NULLABLEVALUE_VARIADIC_LIMIT_B >= 4
1858template <
class TYPE>
1859template <
class ARGS_01,
1864TYPE& NullableValue<TYPE>::makeValueInplace(
1877#if BDLB_NULLABLEVALUE_VARIADIC_LIMIT_B >= 5
1878template <
class TYPE>
1879template <
class ARGS_01,
1885TYPE& NullableValue<TYPE>::makeValueInplace(
1900#if BDLB_NULLABLEVALUE_VARIADIC_LIMIT_B >= 6
1901template <
class TYPE>
1902template <
class ARGS_01,
1909TYPE& NullableValue<TYPE>::makeValueInplace(
1926#if BDLB_NULLABLEVALUE_VARIADIC_LIMIT_B >= 7
1927template <
class TYPE>
1928template <
class ARGS_01,
1936TYPE& NullableValue<TYPE>::makeValueInplace(
1955#if BDLB_NULLABLEVALUE_VARIADIC_LIMIT_B >= 8
1956template <
class TYPE>
1957template <
class ARGS_01,
1966TYPE& NullableValue<TYPE>::makeValueInplace(
1987#if BDLB_NULLABLEVALUE_VARIADIC_LIMIT_B >= 9
1988template <
class TYPE>
1989template <
class ARGS_01,
1999TYPE& NullableValue<TYPE>::makeValueInplace(
2022#if BDLB_NULLABLEVALUE_VARIADIC_LIMIT_B >= 10
2023template <
class TYPE>
2024template <
class ARGS_01,
2035TYPE& NullableValue<TYPE>::makeValueInplace(
2063template <
class TYPE>
2064template <
class... ARGS>
2066TYPE& NullableValue<TYPE>::makeValueInplace(
2074template <
class TYPE>
2076TYPE& NullableValue<TYPE>::value()
2078#ifndef BDE_OMIT_INTERNAL_DEPRECATED
2081 return this->dereferenceRaw();
2087template <
class TYPE>
2089const TYPE *NullableValue<TYPE>::addressOr(
const TYPE *address)
const
2091 return this->has_value() ? this-> operator->() : address;
2094template <
class TYPE>
2095template <
class STREAM>
2096STREAM& NullableValue<TYPE>::bdexStreamOut(STREAM& stream,
int version)
const
2100 const bool isNull = !this->has_value();
2102 stream.putInt8(isNull ? 1 : 0);
2111template <
class TYPE>
2115 return !this->has_value();
2118template <
class TYPE>
2120int NullableValue<TYPE>::maxSupportedBdexVersion(
int versionSelector)
const
2132#ifndef BDE_OMIT_INTERNAL_DEPRECATED
2133template <
class TYPE>
2135int NullableValue<TYPE>::maxSupportedBdexVersion()
const
2147template <
class TYPE>
2148bsl::ostream& NullableValue<TYPE>::print(bsl::ostream& stream,
2150 int spacesPerLevel)
const
2152 if (!this->has_value()) {
2160 stream, this->value(), level, spacesPerLevel);
2163template <
class TYPE>
2165const TYPE& NullableValue<TYPE>::value()
const
2167#ifndef BDE_OMIT_INTERNAL_DEPRECATED
2170 return this->dereferenceRaw();
2176template <
class TYPE>
2178TYPE NullableValue<TYPE>::valueOr(
const TYPE& value)
const
2180 return this->value_or(value);
2183template <
class TYPE>
2185const TYPE *NullableValue<TYPE>::valueOr(
const TYPE *value)
const
2187 return this->has_value() ? this-> operator->() : value;
2190template <
class TYPE>
2192const TYPE *NullableValue<TYPE>::valueOrNull()
const
2194 return this->has_value() ? this-> operator->() : 0;
2200template <
class LHS_TYPE,
class RHS_TYPE>
2203 const NullableValue<RHS_TYPE>& rhs)
2204#ifdef BSLS_LIBRARYFEATURES_HAS_CPP20_CONCEPTS
2206 { *
lhs == *
rhs } -> NullableValue_ConvertibleToBool;
2215template <
class LHS_TYPE,
class RHS_TYPE>
2219#ifdef BSLS_LIBRARYFEATURES_HAS_CPP20_CONCEPTS
2221 { *
lhs == *
rhs } -> NullableValue_ConvertibleToBool;
2228template <
class LHS_TYPE,
class RHS_TYPE>
2231 const NullableValue<RHS_TYPE>& rhs)
2232#ifdef BSLS_LIBRARYFEATURES_HAS_CPP20_CONCEPTS
2234 { *
lhs == *
rhs } -> NullableValue_ConvertibleToBool;
2241#ifdef BSLSTL_OPTIONAL_USES_STD_ALIASES
2242template <
class LHS_TYPE,
class RHS_TYPE>
2245 const std::optional<RHS_TYPE>& rhs)
2246#ifdef BSLS_LIBRARYFEATURES_HAS_CPP20_CONCEPTS
2248 { *
lhs == *
rhs } -> NullableValue_ConvertibleToBool;
2255template <
class LHS_TYPE,
class RHS_TYPE>
2258 const NullableValue<RHS_TYPE>& rhs)
2259#ifdef BSLS_LIBRARYFEATURES_HAS_CPP20_CONCEPTS
2261 { *
lhs == *
rhs } -> NullableValue_ConvertibleToBool;
2269template <
class LHS_TYPE,
class RHS_TYPE>
2272 const NullableValue<RHS_TYPE>& rhs)
2273 #ifdef BSLS_LIBRARYFEATURES_HAS_CPP20_CONCEPTS
2275 { *
lhs != *
rhs } -> NullableValue_ConvertibleToBool;
2283template <
class LHS_TYPE,
class RHS_TYPE>
2286 const NullableValue<RHS_TYPE>& rhs)
2287#ifdef BSLS_LIBRARYFEATURES_HAS_CPP20_CONCEPTS
2289 { *
lhs != *
rhs } -> NullableValue_ConvertibleToBool;
2296template <
class LHS_TYPE,
class RHS_TYPE>
2300#ifdef BSLS_LIBRARYFEATURES_HAS_CPP20_CONCEPTS
2302 { *
lhs != *
rhs } -> NullableValue_ConvertibleToBool;
2309#ifdef BSLSTL_OPTIONAL_USES_STD_ALIASES
2310template <
class LHS_TYPE,
class RHS_TYPE>
2313 const NullableValue<RHS_TYPE>& rhs)
2314#ifdef BSLS_LIBRARYFEATURES_HAS_CPP20_CONCEPTS
2316 { *
lhs != *
rhs } -> NullableValue_ConvertibleToBool;
2323template <
class LHS_TYPE,
class RHS_TYPE>
2326 const std::optional<RHS_TYPE>& rhs)
2327#ifdef BSLS_LIBRARYFEATURES_HAS_CPP20_CONCEPTS
2329 { *
lhs != *
rhs } -> NullableValue_ConvertibleToBool;
2337template <
class LHS_TYPE,
class RHS_TYPE>
2339bool bdlb::operator==(
const NullableValue<LHS_TYPE>& lhs,
const RHS_TYPE& rhs)
2340#ifdef BSLS_LIBRARYFEATURES_HAS_CPP20_CONCEPTS
2341 requires (!NullableValue_DerivedFromOptional<RHS_TYPE>) &&
2342 requires { { *
lhs ==
rhs } -> NullableValue_ConvertibleToBool; }
2348template <
class LHS_TYPE,
class RHS_TYPE>
2350bool bdlb::operator==(
const LHS_TYPE& lhs,
const NullableValue<RHS_TYPE>& rhs)
2351#ifdef BSLS_LIBRARYFEATURES_HAS_CPP20_CONCEPTS
2352 requires (!NullableValue_DerivedFromOptional<LHS_TYPE>) &&
2353 requires { {
lhs == *
rhs } -> NullableValue_ConvertibleToBool; }
2359template <
class LHS_TYPE,
class RHS_TYPE>
2361bool bdlb::operator!=(
const NullableValue<LHS_TYPE>& lhs,
const RHS_TYPE& rhs)
2362#ifdef BSLS_LIBRARYFEATURES_HAS_CPP20_CONCEPTS
2363 requires (!NullableValue_DerivedFromOptional<RHS_TYPE>) &&
2364 requires { { *
lhs !=
rhs } -> NullableValue_ConvertibleToBool; }
2370template <
class LHS_TYPE,
class RHS_TYPE>
2372bool bdlb::operator!=(
const LHS_TYPE& lhs,
const NullableValue<RHS_TYPE>& rhs)
2373#ifdef BSLS_LIBRARYFEATURES_HAS_CPP20_CONCEPTS
2374 requires (!NullableValue_DerivedFromOptional<LHS_TYPE>) &&
2375 requires { {
lhs != *
rhs } -> NullableValue_ConvertibleToBool; }
2381template <
class LHS_TYPE,
class RHS_TYPE>
2384 const NullableValue<RHS_TYPE>& rhs)
2385#ifdef BSLS_LIBRARYFEATURES_HAS_CPP20_CONCEPTS
2387 { *
lhs < *
rhs } -> NullableValue_ConvertibleToBool;
2395template <
class LHS_TYPE,
class RHS_TYPE>
2398 const NullableValue<RHS_TYPE>& rhs)
2399#ifdef BSLS_LIBRARYFEATURES_HAS_CPP20_CONCEPTS
2401 { *
lhs < *
rhs } -> NullableValue_ConvertibleToBool;
2405 return lhs < static_cast<const bsl::optional<RHS_TYPE>&>(
rhs);
2408template <
class LHS_TYPE,
class RHS_TYPE>
2412#ifdef BSLS_LIBRARYFEATURES_HAS_CPP20_CONCEPTS
2414 { *
lhs < *
rhs } -> NullableValue_ConvertibleToBool;
2421#ifdef BSLSTL_OPTIONAL_USES_STD_ALIASES
2422template <
class LHS_TYPE,
class RHS_TYPE>
2425 const NullableValue<RHS_TYPE>& rhs)
2426#ifdef BSLS_LIBRARYFEATURES_HAS_CPP20_CONCEPTS
2428 { *
lhs < *
rhs } -> NullableValue_ConvertibleToBool;
2432 return lhs < static_cast<const bsl::optional<RHS_TYPE>&>(
rhs);
2435template <
class LHS_TYPE,
class RHS_TYPE>
2438 const std::optional<RHS_TYPE>& rhs)
2439#ifdef BSLS_LIBRARYFEATURES_HAS_CPP20_CONCEPTS
2441 { *
lhs < *
rhs } -> NullableValue_ConvertibleToBool;
2449template <
class LHS_TYPE,
class RHS_TYPE>
2451bool bdlb::operator<(
const NullableValue<LHS_TYPE>& lhs,
const RHS_TYPE& rhs)
2452#ifdef BSLS_LIBRARYFEATURES_HAS_CPP20_CONCEPTS
2453 requires (!NullableValue_DerivedFromOptional<RHS_TYPE>) &&
2454 requires { { *
lhs <
rhs } -> NullableValue_ConvertibleToBool; }
2460template <
class LHS_TYPE,
class RHS_TYPE>
2462bool bdlb::operator<(
const LHS_TYPE& lhs,
const NullableValue<RHS_TYPE>& rhs)
2463#ifdef BSLS_LIBRARYFEATURES_HAS_CPP20_CONCEPTS
2464 requires (!NullableValue_DerivedFromOptional<LHS_TYPE>) &&
2465 requires { {
lhs < *
rhs } -> NullableValue_ConvertibleToBool; }
2468 return lhs < static_cast<const bsl::optional<RHS_TYPE>&>(
rhs);
2471template <
class LHS_TYPE,
class RHS_TYPE>
2474 const NullableValue<RHS_TYPE>& rhs)
2475#ifdef BSLS_LIBRARYFEATURES_HAS_CPP20_CONCEPTS
2477 { *
lhs > *
rhs } -> NullableValue_ConvertibleToBool;
2485template <
class LHS_TYPE,
class RHS_TYPE>
2488 const NullableValue<RHS_TYPE>& rhs)
2489#ifdef BSLS_LIBRARYFEATURES_HAS_CPP20_CONCEPTS
2491 { *
lhs > *
rhs } -> NullableValue_ConvertibleToBool;
2498template <
class LHS_TYPE,
class RHS_TYPE>
2502#ifdef BSLS_LIBRARYFEATURES_HAS_CPP20_CONCEPTS
2504 { *
lhs > *
rhs } -> NullableValue_ConvertibleToBool;
2511#ifdef BSLSTL_OPTIONAL_USES_STD_ALIASES
2512template <
class LHS_TYPE,
class RHS_TYPE>
2515 const NullableValue<RHS_TYPE>& rhs)
2516#ifdef BSLS_LIBRARYFEATURES_HAS_CPP20_CONCEPTS
2518 { *
lhs > *
rhs } -> NullableValue_ConvertibleToBool;
2525template <
class LHS_TYPE,
class RHS_TYPE>
2528 const std::optional<RHS_TYPE>& rhs)
2529#ifdef BSLS_LIBRARYFEATURES_HAS_CPP20_CONCEPTS
2531 { *
lhs > *
rhs } -> NullableValue_ConvertibleToBool;
2539template <
class LHS_TYPE,
class RHS_TYPE>
2542 const RHS_TYPE& rhs)
2543#ifdef BSLS_LIBRARYFEATURES_HAS_CPP20_CONCEPTS
2544 requires (!NullableValue_DerivedFromOptional<RHS_TYPE>) &&
2545 requires { { *
lhs >
rhs } -> NullableValue_ConvertibleToBool; }
2551template <
class LHS_TYPE,
class RHS_TYPE>
2554 const NullableValue<RHS_TYPE>& rhs)
2555#ifdef BSLS_LIBRARYFEATURES_HAS_CPP20_CONCEPTS
2556 requires (!NullableValue_DerivedFromOptional<LHS_TYPE>) &&
2557 requires { {
lhs > *
rhs } -> NullableValue_ConvertibleToBool; }
2563template <
class LHS_TYPE,
class RHS_TYPE>
2566 const NullableValue<RHS_TYPE>& rhs)
2567#ifdef BSLS_LIBRARYFEATURES_HAS_CPP20_CONCEPTS
2569 { *
lhs <= *
rhs } -> NullableValue_ConvertibleToBool;
2577template <
class LHS_TYPE,
class RHS_TYPE>
2580 const NullableValue<RHS_TYPE>& rhs)
2581#ifdef BSLS_LIBRARYFEATURES_HAS_CPP20_CONCEPTS
2583 { *
lhs <= *
rhs } -> NullableValue_ConvertibleToBool;
2587 return lhs <= static_cast<const bsl::optional<RHS_TYPE>&>(
rhs);
2590template <
class LHS_TYPE,
class RHS_TYPE>
2594#ifdef BSLS_LIBRARYFEATURES_HAS_CPP20_CONCEPTS
2596 { *
lhs <= *
rhs } -> NullableValue_ConvertibleToBool;
2603#ifdef BSLSTL_OPTIONAL_USES_STD_ALIASES
2604template <
class LHS_TYPE,
class RHS_TYPE>
2607 const NullableValue<RHS_TYPE>& rhs)
2608#ifdef BSLS_LIBRARYFEATURES_HAS_CPP20_CONCEPTS
2610 { *
lhs <= *
rhs } -> NullableValue_ConvertibleToBool;
2614 return lhs <= static_cast<const bsl::optional<RHS_TYPE>&>(
rhs);
2617template <
class LHS_TYPE,
class RHS_TYPE>
2620 const std::optional<RHS_TYPE>& rhs)
2621#ifdef BSLS_LIBRARYFEATURES_HAS_CPP20_CONCEPTS
2623 { *
lhs <= *
rhs } -> NullableValue_ConvertibleToBool;
2631template <
class LHS_TYPE,
class RHS_TYPE>
2634 const RHS_TYPE& rhs)
2635#ifdef BSLS_LIBRARYFEATURES_HAS_CPP20_CONCEPTS
2636 requires (!NullableValue_DerivedFromOptional<RHS_TYPE>) &&
2637 requires { { *
lhs <=
rhs } -> NullableValue_ConvertibleToBool; }
2643template <
class LHS_TYPE,
class RHS_TYPE>
2646 const NullableValue<RHS_TYPE>& rhs)
2647#ifdef BSLS_LIBRARYFEATURES_HAS_CPP20_CONCEPTS
2648 requires (!NullableValue_DerivedFromOptional<LHS_TYPE>) &&
2649 requires { {
lhs <= *
rhs } -> NullableValue_ConvertibleToBool; }
2652 return lhs <= static_cast<const bsl::optional<RHS_TYPE>&>(
rhs);
2656template <
class LHS_TYPE,
class RHS_TYPE>
2659 const NullableValue<RHS_TYPE>& rhs)
2660#ifdef BSLS_LIBRARYFEATURES_HAS_CPP20_CONCEPTS
2662 { *
lhs >= *
rhs } -> NullableValue_ConvertibleToBool;
2670template <
class LHS_TYPE,
class RHS_TYPE>
2673 const NullableValue<RHS_TYPE>& rhs)
2674#ifdef BSLS_LIBRARYFEATURES_HAS_CPP20_CONCEPTS
2676 { *
lhs >= *
rhs } -> NullableValue_ConvertibleToBool;
2683template <
class LHS_TYPE,
class RHS_TYPE>
2687#ifdef BSLS_LIBRARYFEATURES_HAS_CPP20_CONCEPTS
2689 { *
lhs >= *
rhs } -> NullableValue_ConvertibleToBool;
2696#ifdef BSLSTL_OPTIONAL_USES_STD_ALIASES
2697template <
class LHS_TYPE,
class RHS_TYPE>
2700 const NullableValue<RHS_TYPE>& rhs)
2701#ifdef BSLS_LIBRARYFEATURES_HAS_CPP20_CONCEPTS
2703 { *
lhs >= *
rhs } -> NullableValue_ConvertibleToBool;
2710template <
class LHS_TYPE,
class RHS_TYPE>
2713 const std::optional<RHS_TYPE>& rhs)
2714#ifdef BSLS_LIBRARYFEATURES_HAS_CPP20_CONCEPTS
2716 { *
lhs >= *
rhs } -> NullableValue_ConvertibleToBool;
2724template <
class LHS_TYPE,
class RHS_TYPE>
2727 const RHS_TYPE& rhs)
2728#ifdef BSLS_LIBRARYFEATURES_HAS_CPP20_CONCEPTS
2729 requires (!NullableValue_DerivedFromOptional<RHS_TYPE>) &&
2730 requires { { *
lhs >=
rhs } -> NullableValue_ConvertibleToBool; }
2736template <
class LHS_TYPE,
class RHS_TYPE>
2739 const NullableValue<RHS_TYPE>& rhs)
2740#ifdef BSLS_LIBRARYFEATURES_HAS_CPP20_CONCEPTS
2741 requires (!NullableValue_DerivedFromOptional<LHS_TYPE>) &&
2742 requires { {
lhs >= *
rhs } -> NullableValue_ConvertibleToBool; }
2749#if defined BSLS_COMPILERFEATURES_SUPPORT_THREE_WAY_COMPARISON && \
2750 defined BSLS_LIBRARYFEATURES_HAS_CPP20_CONCEPTS
2752template <
class LHS_TYPE, bsl::three_way_comparable_with<LHS_TYPE> RHS_TYPE>
2753constexpr std::compare_three_way_result_t<LHS_TYPE, RHS_TYPE>
2754bdlb::operator<=>(
const NullableValue<LHS_TYPE>& lhs,
2755 const NullableValue<RHS_TYPE>& rhs)
2761template <
class LHS_TYPE, bsl::three_way_comparable_with<LHS_TYPE> RHS_TYPE>
2762constexpr std::compare_three_way_result_t<LHS_TYPE, RHS_TYPE>
2763bdlb::operator<=>(
const NullableValue<LHS_TYPE>& lhs,
2769template <
class LHS_TYPE, bsl::three_way_comparable_with<LHS_TYPE> RHS_TYPE>
2770constexpr std::compare_three_way_result_t<LHS_TYPE, RHS_TYPE>
2771bdlb::operator<=>(
const NullableValue<LHS_TYPE>& lhs,
2772 const std::optional<RHS_TYPE>& rhs)
2777template <
class LHS_TYPE,
class RHS_TYPE>
2778 requires(!bdlb::NullableValue_DerivedFromOptional<RHS_TYPE>) &&
2779 bsl::three_way_comparable_with<LHS_TYPE, RHS_TYPE>
2780constexpr std::compare_three_way_result_t<LHS_TYPE, RHS_TYPE>
2781bdlb::operator<=>(
const NullableValue<LHS_TYPE>& lhs,
const RHS_TYPE& rhs)
2786template <
class TYPE>
2787constexpr std::strong_ordering
2788bdlb::operator<=>(
const NullableValue<TYPE>& value,
2791 return (!value.isNull()) <=>
false;
2796template <
class TYPE>
2801 return !value.has_value();
2804#ifndef BSLS_COMPILERFEATURES_SUPPORT_THREE_WAY_COMPARISON
2806template <
class TYPE>
2811 return !value.has_value();
2814template <
class TYPE>
2819 return value.has_value();
2822template <
class TYPE>
2827 return value.has_value();
2830# ifndef BSLS_LIBRARYFEATURES_HAS_CPP20_CONCEPTS
2832template <
class TYPE>
2840template <
class TYPE>
2845 return value.has_value();
2848template <
class TYPE>
2853 return value.has_value();
2856template <
class TYPE>
2864template <
class TYPE>
2869 return !value.has_value();
2872template <
class TYPE>
2880template <
class TYPE>
2888template <
class TYPE>
2893 return !value.has_value();
2899template <
class TYPE>
2902 const NullableValue<TYPE>&
object)
2904 return object.print(stream, 0, -1);
2908template <
class HASHALG,
class TYPE>
2911 if (!input.isNull()) {
2920template <
class TYPE>
2924bdlb::swap(NullableValue<TYPE>& lhs, NullableValue<TYPE>& rhs)
2930template <
class TYPE>
2934bdlb::swap(NullableValue<TYPE>& lhs, NullableValue<TYPE>& rhs)
2941#ifdef BSLSTL_OPTIONAL_CPP20_IS_OPTIONAL_GNU_WORKAROUND_NEEDED
2946template <
typename _Tp>
2947inline constexpr bool __is_optional_v<BloombergLP::bdlb::NullableValue<_Tp>> =
2952#ifdef BSLSTL_OPTIONAL_CPP20_IS_OPTIONAL_MSVC_WORKAROUND_NEEDED
2957template <
typename _Tp>
2959constexpr bool _Is_specialization_v<BloombergLP::bdlb::NullableValue<_Tp>,
2960 std::optional> =
true;
2965# error Not valid except when included from bdlb_nullablevalue.h
#define BSLMF_NESTED_TRAIT_DECLARATION(t_TYPE, t_TRAIT)
Definition bslmf_nestedtraitdeclaration.h:231
#define BSLMF_NESTED_TRAIT_DECLARATION_IF(t_TYPE, t_TRAIT, t_COND)
Definition bslmf_nestedtraitdeclaration.h:243
STREAM & bdexStreamIn(STREAM &stream, int version)
Definition bdlb_nullablevalue.h:1744
bsl::optional< TYPE > Base
Base class of this type.
Definition bdlb_nullablevalue.h:303
bool isNull() const BSLS_KEYWORD_NOEXCEPT
Return true if this object is null, and false otherwise.
Definition bdlb_nullablevalue.h:1829
const TYPE * valueOrNull() const
Definition bdlb_nullablevalue.h:1908
AllocType allocator_type
Definition bdlb_nullablevalue.h:314
TYPE & makeValue()
Definition bdlb_nullablevalue.h:1775
TYPE valueOr(const TYPE &value) const
Definition bdlb_nullablevalue.h:1894
bsl::ostream & print(bsl::ostream &stream, int level=0, int spacesPerLevel=4) const
Definition bdlb_nullablevalue.h:1864
const TYPE * addressOr(const TYPE *address) const
Definition bdlb_nullablevalue.h:1805
TYPE & makeValueInplace(ARGS &&... args)
Definition bdlb_nullablevalue.h:1784
STREAM & bdexStreamOut(STREAM &stream, int version) const
Definition bdlb_nullablevalue.h:1812
int maxSupportedBdexVersion() const
Definition bdlb_nullablevalue.h:1851
friend class NullableValue
Definition bdlb_nullablevalue.h:288
TYPE & value()
Definition bdlb_nullablevalue.h:1792
TYPE ValueType
Definition bdlb_nullablevalue.h:308
Definition bslma_bslallocator.h:588
Definition bslstl_optional.h:2043
BSLSTL_OPTIONAL_CONSTEXPR17 optional() BSLS_KEYWORD_NOEXCEPT
Definition bslstl_optional.h:5142
Definition bslmf_movableref.h:752
#define BSLMF_MOVABLEREF_DEDUCE(...)
Definition bslmf_movableref.h:691
#define BSLS_COMPILERFEATURES_FORWARD_REF(T)
Definition bsls_compilerfeatures.h:2343
#define BSLS_COMPILERFEATURES_FORWARD(T, V)
Definition bsls_compilerfeatures.h:2349
#define BSLS_DEPRECATE
Definition bsls_deprecate.h:720
#define BSLS_KEYWORD_CONSTEXPR
Definition bsls_keyword.h:624
#define BSLS_KEYWORD_DELETED
Definition bsls_keyword.h:651
#define BSLS_KEYWORD_NOEXCEPT
Definition bsls_keyword.h:674
#define BSLS_KEYWORD_NOEXCEPT_SPECIFICATION(...)
Definition bsls_keyword.h:676
#define BSLS_REVIEW_OPT(X)
Definition bsls_review.h:1060
bool operator!=(const FileCleanerConfiguration &lhs, const FileCleanerConfiguration &rhs)
bool operator==(const FileCleanerConfiguration &lhs, const FileCleanerConfiguration &rhs)
void swap(OptionValue &a, OptionValue &b)
bool operator<(const MetricId &lhs, const MetricId &rhs)
STREAM & bdexStreamOut(STREAM &stream, const DayCountConvention::Enum &value, int version)
int maxSupportedBdexVersion(const DayCountConvention::Enum *, int versionSelector)
STREAM & bdexStreamIn(STREAM &stream, DayCountConvention::Enum &variable, int version)
bool isNull(const TYPE &object)
void reset(TYPE *object)
Reset the value of the specified object to its default value.
bsl::ostream & print(bsl::ostream &stream, const TYPE &object, int level=0, int spacesPerLevel=4)
Definition bdlb_printmethods.h:725
Definition bdlb_algorithmworkaroundutil.h:74
bool operator!=(const BigEndianInt16 &lhs, const BigEndianInt16 &rhs)
bsl::ostream & operator<<(bsl::ostream &stream, const BigEndianInt16 &integer)
bool operator>=(const Guid &lhs, const Guid &rhs)
void hashAppend(HASH_ALGORITHM &hashAlgorithm, const BigEndianInt16 &object)
void swap(NullableAllocatedValue< TYPE > &a, NullableAllocatedValue< TYPE > &b)
bool operator<=(const Guid &lhs, const Guid &rhs)
bool operator>(const Guid &lhs, const Guid &rhs)
bool operator<(const Guid &lhs, const Guid &rhs)
bool operator==(const BigEndianInt16 &lhs, const BigEndianInt16 &rhs)
Definition bdlat_valuetypefunctions.h:939
ALLOCATOR const STRING_VIEW_LIKE_TYPE & rhs
Definition bslstl_string.h:3918
ALLOCATOR & lhs
Definition bslstl_string.h:3917
Definition bdlbb_blob.h:579
STREAM & bdexStreamIn(STREAM &stream, VALUE_TYPE &variable)
Definition bslx_instreamfunctions.h:1263
STREAM & bdexStreamOut(STREAM &stream, const TYPE &value)
Definition bslx_outstreamfunctions.h:1004
int maxSupportedBdexVersion(const TYPE *, int versionSelector)
Definition bslx_versionfunctions.h:531
Definition bdldfp_decimal.h:5549
Definition bdlb_printmethods.h:306
Definition bslmf_conditional.h:123
Definition bslmf_enableif.h:530
Definition bslmf_isconvertible.h:875
Definition bslmf_isnothrowmoveconstructible.h:361
Definition bslmf_issame.h:146
Definition bslstl_optional.h:522
Definition bslma_usesbslmaallocator.h:344
Definition bslmf_isbitwisecopyable.h:298
Definition bslmf_isbitwisemoveable.h:718
Definition bslmf_movableref.h:795