11#ifndef INCLUDED_BDLB_NULLABLEVALUEREF_CPP03
12#define INCLUDED_BDLB_NULLABLEVALUEREF_CPP03
63#ifdef COMPILING_BDLB_NULLABLEVALUEREF_H
69class ConstNullableValueRef;
81class NullableValueRef {
84#ifndef BSLS_COMPILERFEATURES_SUPPORT_OPERATOR_EXPLICIT
91 typedef BloombergLP::bsls::UnspecifiedBool<NullableValueRef>
93 typedef typename UnspecifiedBoolUtil::BoolType UnspecifiedBool;
103 bool d_isTargetOptional;
111 NullableAllocatedValue<TYPE>& getNAV()
const;
124 friend class ConstNullableValueRef<TYPE>;
132 typename bsl::remove_cvref<TYPE>::type>
::value));
201#ifdef BSLS_COMPILERFEATURES_SUPPORT_OPERATOR_EXPLICIT
209 return UnspecifiedBoolUtil::makeValue(
has_value());
218 template <
class ANY_TYPE>
219 TYPE
value_or(
const ANY_TYPE& default_value)
const;
222#if BSLS_COMPILERFEATURES_SIMULATE_VARIADIC_TEMPLATES
225#ifndef BDLB_NULLABLEVALUEREF_VARIADIC_LIMIT
226#define BDLB_NULLABLEVALUEREF_VARIADIC_LIMIT 5
228#ifndef BDLB_NULLABLEVALUEREF_VARIADIC_LIMIT_A
229#define BDLB_NULLABLEVALUEREF_VARIADIC_LIMIT_A BDLB_NULLABLEVALUEREF_VARIADIC_LIMIT
231#if BDLB_NULLABLEVALUEREF_VARIADIC_LIMIT_A >= 0
235#if BDLB_NULLABLEVALUEREF_VARIADIC_LIMIT_A >= 1
236 template <
class ARGS_1>
240#if BDLB_NULLABLEVALUEREF_VARIADIC_LIMIT_A >= 2
241 template <
class ARGS_1,
247#if BDLB_NULLABLEVALUEREF_VARIADIC_LIMIT_A >= 3
248 template <
class ARGS_1,
256#if BDLB_NULLABLEVALUEREF_VARIADIC_LIMIT_A >= 4
257 template <
class ARGS_1,
267#if BDLB_NULLABLEVALUEREF_VARIADIC_LIMIT_A >= 5
268 template <
class ARGS_1,
283 template <
class... ARGS>
306 NullableValueRef<TYPE>&
operator=(
const TYPE& rhs);
315 const NullableAllocatedValue<TYPE>& rhs);
319 NullableValueRef<TYPE>&
operator=(
const NullableValueRef& rhs);
338 "Use 'has_value() ? &value() : address' instead")
339 const TYPE *addressOr(const TYPE *address) const;
341#if BSLS_COMPILERFEATURES_SIMULATE_VARIADIC_TEMPLATES
344#ifndef BDLB_NULLABLEVALUEREF_VARIADIC_LIMIT
345#define BDLB_NULLABLEVALUEREF_VARIADIC_LIMIT 5
347#ifndef BDLB_NULLABLEVALUEREF_VARIADIC_LIMIT_B
348#define BDLB_NULLABLEVALUEREF_VARIADIC_LIMIT_B BDLB_NULLABLEVALUEREF_VARIADIC_LIMIT
351#if BDLB_NULLABLEVALUEREF_VARIADIC_LIMIT_B >= 0
353 "Use 'emplace' instead")
354 TYPE& makeValueInplace();
357#if BDLB_NULLABLEVALUEREF_VARIADIC_LIMIT_B >= 1
358 template <
class ARGS_1>
360 "Use 'emplace' instead")
364#if BDLB_NULLABLEVALUEREF_VARIADIC_LIMIT_B >= 2
365 template <
class ARGS_1,
368 "Use 'emplace' instead")
373#if BDLB_NULLABLEVALUEREF_VARIADIC_LIMIT_B >= 3
374 template <
class ARGS_1,
378 "Use 'emplace' instead")
384#if BDLB_NULLABLEVALUEREF_VARIADIC_LIMIT_B >= 4
385 template <
class ARGS_1,
390 "Use 'emplace' instead")
397#if BDLB_NULLABLEVALUEREF_VARIADIC_LIMIT_B >= 5
398 template <
class ARGS_1,
404 "Use 'emplace' instead")
416 template <
class... ARGS>
418 "Use 'emplace' instead")
429 "Use 'value_or' instead")
430 TYPE valueOr(const TYPE& otherValue) const;
437 const TYPE *valueOrNull() const;
446template <class HASHALG, class TYPE>
447void hashAppend(HASHALG& hashAlg, const NullableValueRef<TYPE>& input);
458template <class LHS_TYPE, class RHS_TYPE>
459bool operator==(const NullableValueRef<LHS_TYPE>& lhs,
460 const NullableValueRef<RHS_TYPE>& rhs);
469template <class LHS_TYPE, class RHS_TYPE>
470bool operator==(const NullableValueRef<LHS_TYPE>& lhs,
471 const RHS_TYPE& rhs);
472template <class LHS_TYPE, class RHS_TYPE>
473bool operator==(const LHS_TYPE& lhs,
474 const NullableValueRef<RHS_TYPE>& rhs);
483template <class LHS_TYPE, class RHS_TYPE>
484bool operator!=(const NullableValueRef<LHS_TYPE>& lhs,
485 const NullableValueRef<RHS_TYPE>& rhs);
494template <class LHS_TYPE, class RHS_TYPE>
495bool operator!=(const NullableValueRef<LHS_TYPE>& lhs,
496 const RHS_TYPE& rhs);
497template <class LHS_TYPE, class RHS_TYPE>
498bool operator!=(const LHS_TYPE& lhs,
499 const NullableValueRef<RHS_TYPE>& rhs);
508template <class LHS_TYPE, class RHS_TYPE>
509bool operator<(const NullableValueRef<LHS_TYPE>& lhs,
510 const NullableValueRef<RHS_TYPE>& rhs);
515template <class LHS_TYPE, class RHS_TYPE>
516bool operator<(const NullableValueRef<LHS_TYPE>& lhs,
517 const RHS_TYPE& rhs);
522template <class LHS_TYPE, class RHS_TYPE>
523bool operator<(const LHS_TYPE& lhs,
524 const NullableValueRef<RHS_TYPE>& rhs);
533template <class LHS_TYPE, class RHS_TYPE>
534bool operator<=(const NullableValueRef<LHS_TYPE>& lhs,
535 const NullableValueRef<RHS_TYPE>& rhs);
542template <class LHS_TYPE, class RHS_TYPE>
543bool operator<=(const NullableValueRef<LHS_TYPE>& lhs,
544 const RHS_TYPE& rhs);
551template <class LHS_TYPE, class RHS_TYPE>
552bool operator<=(const LHS_TYPE& lhs,
553 const NullableValueRef<RHS_TYPE>& rhs);
563template <class LHS_TYPE, class RHS_TYPE>
564bool operator>(const NullableValueRef<LHS_TYPE>& lhs,
565 const NullableValueRef<RHS_TYPE>& rhs);
572template <class LHS_TYPE, class RHS_TYPE>
573bool operator>(const NullableValueRef<LHS_TYPE>& lhs,
574 const RHS_TYPE& rhs);
581template <class LHS_TYPE, class RHS_TYPE>
582bool operator>(const LHS_TYPE& lhs,
583 const NullableValueRef<RHS_TYPE>& rhs);
592template <class LHS_TYPE, class RHS_TYPE>
593bool operator>=(const NullableValueRef<LHS_TYPE>& lhs,
594 const NullableValueRef<RHS_TYPE>& rhs);
601template <class LHS_TYPE, class RHS_TYPE>
602bool operator>=(const NullableValueRef<LHS_TYPE>& lhs,
603 const RHS_TYPE& rhs);
610template <class LHS_TYPE, class RHS_TYPE>
611bool operator>=(const LHS_TYPE& lhs,
612 const NullableValueRef<RHS_TYPE>& rhs);
621bool operator==(const NullableValueRef<TYPE>& lhs, const
bsl::nullopt_t&)
626bool operator==(const
bsl::nullopt_t&, const NullableValueRef<TYPE>& rhs)
631bool operator!=(const NullableValueRef<TYPE>& lhs, const
bsl::nullopt_t&)
637bool operator!=(const
bsl::nullopt_t&, const NullableValueRef<TYPE>& rhs)
643bool operator<(const NullableValueRef<TYPE>&, const
bsl::nullopt_t&)
651bool operator<(const
bsl::nullopt_t&, const NullableValueRef<TYPE>& rhs)
657bool operator>(const NullableValueRef<TYPE>& lhs, const
bsl::nullopt_t&)
663bool operator>(const
bsl::nullopt_t&, const NullableValueRef<TYPE>&)
668bool operator<=(const NullableValueRef<TYPE>& lhs, const
bsl::nullopt_t&)
673bool operator<=(const
bsl::nullopt_t&, const NullableValueRef<TYPE>&)
678bool operator>=(const NullableValueRef<TYPE>&, const
bsl::nullopt_t&)
683bool operator>=(const
bsl::nullopt_t&, const NullableValueRef<TYPE>& rhs)
696class ConstNullableValueRef {
699#ifndef BSLS_COMPILERFEATURES_SUPPORT_OPERATOR_EXPLICIT
706 typedef BloombergLP::bsls::UnspecifiedBool<ConstNullableValueRef>
708 typedef typename UnspecifiedBoolUtil::BoolType UnspecifiedBool;
714 const void *d_target_p;
718 bool d_isTargetOptional;
726 const NullableAllocatedValue<TYPE>& getNAV()
const;
743 typename bsl::remove_cvref<TYPE>::type>
::value));
767 ConstNullableValueRef(
const NullableAllocatedValue<TYPE>& opt);
776 ConstNullableValueRef(
const NullableValueRef<TYPE>& ref);
784 ConstNullableValueRef(
const ConstNullableValueRef& original);
789 ~ConstNullableValueRef();
821#ifdef BSLS_COMPILERFEATURES_SUPPORT_OPERATOR_EXPLICIT
829 return UnspecifiedBoolUtil::makeValue(
has_value());
838 template <
class ANY_TYPE>
839 TYPE
value_or(
const ANY_TYPE& default_value)
const;
848 "Use 'has_value() ? &value() : address' instead")
849 const TYPE *addressOr(const TYPE *address) const;
858 TYPE valueOr(const TYPE& otherValue) const;
865 const TYPE *valueOrNull() const;
875template <class HASHALG, class TYPE>
876void hashAppend(HASHALG& hashAlg, const ConstNullableValueRef<TYPE>& input);
887template <class LHS_TYPE, class RHS_TYPE>
888bool operator==(const ConstNullableValueRef<LHS_TYPE>& lhs,
889 const ConstNullableValueRef<RHS_TYPE>& rhs);
898template <class LHS_TYPE, class RHS_TYPE>
899bool operator==(const ConstNullableValueRef<LHS_TYPE>& lhs,
900 const RHS_TYPE& rhs);
901template <class LHS_TYPE, class RHS_TYPE>
902bool operator==(const LHS_TYPE& lhs,
903 const ConstNullableValueRef<RHS_TYPE>& rhs);
912template <class LHS_TYPE, class RHS_TYPE>
913bool operator!=(const ConstNullableValueRef<LHS_TYPE>& lhs,
914 const ConstNullableValueRef<RHS_TYPE>& rhs);
923template <class LHS_TYPE, class RHS_TYPE>
924bool operator!=(const ConstNullableValueRef<LHS_TYPE>& lhs,
925 const RHS_TYPE& rhs);
926template <class LHS_TYPE, class RHS_TYPE>
927bool operator!=(const LHS_TYPE& lhs,
928 const ConstNullableValueRef<RHS_TYPE>& rhs);
937template <class LHS_TYPE, class RHS_TYPE>
938bool operator<(const ConstNullableValueRef<LHS_TYPE>& lhs,
939 const ConstNullableValueRef<RHS_TYPE>& rhs);
944template <class LHS_TYPE, class RHS_TYPE>
945bool operator<(const ConstNullableValueRef<LHS_TYPE>& lhs,
946 const RHS_TYPE& rhs);
951template <class LHS_TYPE, class RHS_TYPE>
952bool operator<(const LHS_TYPE& lhs,
953 const ConstNullableValueRef<RHS_TYPE>& rhs);
961template <class LHS_TYPE, class RHS_TYPE>
962bool operator<=(const ConstNullableValueRef<LHS_TYPE>& lhs,
963 const ConstNullableValueRef<RHS_TYPE>& rhs);
970template <class LHS_TYPE, class RHS_TYPE>
971bool operator<=(const ConstNullableValueRef<LHS_TYPE>& lhs,
972 const RHS_TYPE& rhs);
979template <class LHS_TYPE, class RHS_TYPE>
980bool operator<=(const LHS_TYPE& lhs,
981 const ConstNullableValueRef<RHS_TYPE>& rhs);
991template <class LHS_TYPE, class RHS_TYPE>
992bool operator>(const ConstNullableValueRef<LHS_TYPE>& lhs,
993 const ConstNullableValueRef<RHS_TYPE>& rhs);
1000template <class LHS_TYPE, class RHS_TYPE>
1001bool operator>(const ConstNullableValueRef<LHS_TYPE>& lhs,
1002 const RHS_TYPE& rhs);
1009template <class LHS_TYPE, class RHS_TYPE>
1010bool operator>(const LHS_TYPE& lhs,
1011 const ConstNullableValueRef<RHS_TYPE>& rhs);
1020template <class LHS_TYPE, class RHS_TYPE>
1021bool operator>=(const ConstNullableValueRef<LHS_TYPE>& lhs,
1022 const ConstNullableValueRef<RHS_TYPE>& rhs);
1029template <class LHS_TYPE, class RHS_TYPE>
1030bool operator>=(const ConstNullableValueRef<LHS_TYPE>& lhs,
1031 const RHS_TYPE& rhs);
1038template <class LHS_TYPE, class RHS_TYPE>
1039bool operator>=(const LHS_TYPE& lhs,
1040 const ConstNullableValueRef<RHS_TYPE>& rhs);
1047template <class TYPE>
1048bool operator==(const ConstNullableValueRef<TYPE>& lhs,
1052template <class TYPE>
1053bool operator==(const
bsl::nullopt_t&,
1057template <class TYPE>
1058bool operator!=(const ConstNullableValueRef<TYPE>& lhs,
1063template <class TYPE>
1064bool operator!=(const
bsl::nullopt_t&,
1069template <class TYPE>
1070bool operator<(const ConstNullableValueRef<TYPE>&, const
bsl::nullopt_t&)
1077template <class TYPE>
1078bool operator<(const
bsl::nullopt_t&,
1083template <class TYPE>
1084bool operator>(const ConstNullableValueRef<TYPE>& lhs,
1089template <class TYPE>
1090bool operator>(const
bsl::nullopt_t&, const ConstNullableValueRef<TYPE>&)
1094template <class TYPE>
1095bool operator<=(const ConstNullableValueRef<TYPE>& lhs,
1099template <class TYPE>
1100bool operator<=(const
bsl::nullopt_t&, const ConstNullableValueRef<TYPE>&)
1104template <class TYPE>
1105bool operator>=(const ConstNullableValueRef<TYPE>&, const
bsl::nullopt_t&)
1109template <class TYPE>
1110bool operator>=(const
bsl::nullopt_t&,
1124template <class LHS_TYPE, class RHS_TYPE>
1125bool operator==(const ConstNullableValueRef<LHS_TYPE>& lhs,
1126 const NullableValueRef<RHS_TYPE>& rhs);
1127template <class LHS_TYPE, class RHS_TYPE>
1128bool operator==(const NullableValueRef<LHS_TYPE>& lhs,
1129 const ConstNullableValueRef<RHS_TYPE>& rhs);
1138template <class LHS_TYPE, class RHS_TYPE>
1139bool operator!=(const ConstNullableValueRef<LHS_TYPE>& lhs,
1140 const NullableValueRef<RHS_TYPE>& rhs);
1141template <class LHS_TYPE, class RHS_TYPE>
1142bool operator!=(const NullableValueRef<LHS_TYPE>& lhs,
1143 const ConstNullableValueRef<RHS_TYPE>& rhs);
1152template <class LHS_TYPE, class RHS_TYPE>
1153bool operator<(const ConstNullableValueRef<LHS_TYPE>& lhs,
1154 const NullableValueRef<RHS_TYPE>& rhs);
1155template <class LHS_TYPE, class RHS_TYPE>
1156bool operator<(const NullableValueRef<LHS_TYPE>& lhs,
1157 const ConstNullableValueRef<RHS_TYPE>& rhs);
1165template <class LHS_TYPE, class RHS_TYPE>
1166bool operator<=(const ConstNullableValueRef<LHS_TYPE>& lhs,
1167 const NullableValueRef<RHS_TYPE>& rhs);
1168template <class LHS_TYPE, class RHS_TYPE>
1169bool operator<=(const NullableValueRef<LHS_TYPE>& lhs,
1170 const ConstNullableValueRef<RHS_TYPE>& rhs);
1180template <class LHS_TYPE, class RHS_TYPE>
1181bool operator>(const ConstNullableValueRef<LHS_TYPE>& lhs,
1182 const NullableValueRef<RHS_TYPE>& rhs);
1183template <class LHS_TYPE, class RHS_TYPE>
1184bool operator>(const NullableValueRef<LHS_TYPE>& lhs,
1185 const ConstNullableValueRef<RHS_TYPE>& rhs);
1194template <class LHS_TYPE, class RHS_TYPE>
1195bool operator>=(const ConstNullableValueRef<LHS_TYPE>& lhs,
1196 const NullableValueRef<RHS_TYPE>& rhs);
1197template <class LHS_TYPE, class RHS_TYPE>
1198bool operator>=(const NullableValueRef<LHS_TYPE>& lhs,
1199 const ConstNullableValueRef<RHS_TYPE>& rhs);
1208template <class TYPE>
1210bdlb::NullableAllocatedValue<TYPE>&
1211bdlb::NullableValueRef<TYPE>::getNAV()
const
1217template <
class TYPE>
1226template <
class TYPE>
1230 return d_isTargetOptional;
1234template <
class TYPE>
1238, d_isTargetOptional(true)
1242template <
class TYPE>
1245 NullableAllocatedValue<TYPE>& opt)
1247, d_isTargetOptional(false)
1251template <
class TYPE>
1254 const NullableValueRef& original)
1255: d_target_p(original.d_target_p)
1256, d_isTargetOptional(original.d_isTargetOptional)
1261template <
class TYPE>
1266 ? getOpt().has_value()
1267 : getNAV().has_value();
1270template <
class TYPE>
1274 return !has_value();
1277template <
class TYPE>
1288template <
class TYPE>
1294 ? getOpt().operator->()
1295 : getNAV().operator->();
1298template <
class TYPE>
1304 ? getOpt().operator*()
1305 : getNAV().operator*();
1308#ifdef BSLS_COMPILERFEATURES_SUPPORT_OPERATOR_EXPLICIT
1309template <
class TYPE>
1316template <
class TYPE>
1317template <
class ANY_TYPE>
1320 const ANY_TYPE& default_value)
const
1327 return default_value;
1332#if BSLS_COMPILERFEATURES_SIMULATE_VARIADIC_TEMPLATES
1335#ifndef BDLB_NULLABLEVALUEREF_VARIADIC_LIMIT
1336#define BDLB_NULLABLEVALUEREF_VARIADIC_LIMIT 5
1338#ifndef BDLB_NULLABLEVALUEREF_VARIADIC_LIMIT_C
1339#define BDLB_NULLABLEVALUEREF_VARIADIC_LIMIT_C BDLB_NULLABLEVALUEREF_VARIADIC_LIMIT
1341#if BDLB_NULLABLEVALUEREF_VARIADIC_LIMIT_C >= 0
1342template <
class TYPE>
1348 ? getOpt().emplace()
1349 : getNAV().emplace();
1353#if BDLB_NULLABLEVALUEREF_VARIADIC_LIMIT_C >= 1
1354template <
class TYPE>
1355template <
class ARGS_1>
1367#if BDLB_NULLABLEVALUEREF_VARIADIC_LIMIT_C >= 2
1368template <
class TYPE>
1369template <
class ARGS_1,
1385#if BDLB_NULLABLEVALUEREF_VARIADIC_LIMIT_C >= 3
1386template <
class TYPE>
1387template <
class ARGS_1,
1407#if BDLB_NULLABLEVALUEREF_VARIADIC_LIMIT_C >= 4
1408template <
class TYPE>
1409template <
class ARGS_1,
1433#if BDLB_NULLABLEVALUEREF_VARIADIC_LIMIT_C >= 5
1434template <
class TYPE>
1435template <
class ARGS_1,
1466template <
class TYPE>
1467template <
class... ARGS>
1479template <
class TYPE>
1485 ? getOpt().operator->()
1486 : getNAV().operator->();
1489template <
class TYPE>
1495 ? getOpt().operator*()
1496 : getNAV().operator*();
1499template <
class TYPE>
1508template <
class TYPE>
1523template <
class TYPE>
1528 if (
rhs.has_value()) {
1529 *
this =
rhs.value();
1537template <
class TYPE>
1541 const NullableAllocatedValue<TYPE>& rhs)
1543 if (
rhs.has_value()) {
1544 *
this =
rhs.value();
1553template <
class TYPE>
1558 if (
rhs.has_value()) {
1559 *
this =
rhs.value();
1568template <
class TYPE>
1580template <
class TYPE>
1591template <
class TYPE>
1596 return has_value() ? &value() : address;
1599#if BSLS_COMPILERFEATURES_SIMULATE_VARIADIC_TEMPLATES
1602#ifndef BDLB_NULLABLEVALUEREF_VARIADIC_LIMIT
1603#define BDLB_NULLABLEVALUEREF_VARIADIC_LIMIT 5
1605#ifndef BDLB_NULLABLEVALUEREF_VARIADIC_LIMIT_D
1606#define BDLB_NULLABLEVALUEREF_VARIADIC_LIMIT_D BDLB_NULLABLEVALUEREF_VARIADIC_LIMIT
1608#if BDLB_NULLABLEVALUEREF_VARIADIC_LIMIT_D >= 0
1609template <
class TYPE>
1618#if BDLB_NULLABLEVALUEREF_VARIADIC_LIMIT_D >= 1
1619template <
class TYPE>
1620template <
class ARGS_1>
1629#if BDLB_NULLABLEVALUEREF_VARIADIC_LIMIT_D >= 2
1630template <
class TYPE>
1631template <
class ARGS_1,
1643#if BDLB_NULLABLEVALUEREF_VARIADIC_LIMIT_D >= 3
1644template <
class TYPE>
1645template <
class ARGS_1,
1660#if BDLB_NULLABLEVALUEREF_VARIADIC_LIMIT_D >= 4
1661template <
class TYPE>
1662template <
class ARGS_1,
1680#if BDLB_NULLABLEVALUEREF_VARIADIC_LIMIT_D >= 5
1681template <
class TYPE>
1682template <
class ARGS_1,
1706template <
class TYPE>
1707template <
class... ARGS>
1717template <
class TYPE>
1721 return value_or(otherValue);
1724template <
class TYPE>
1728 return has_value() ? &value() : 0;
1732template <
class HASHALG,
class TYPE>
1734 const NullableValueRef<TYPE>& input)
1736 using ::BloombergLP::bslh::hashAppend;
1738 if (!input.has_value()) {
1748template <
class LHS_TYPE,
class RHS_TYPE>
1751 const NullableValueRef<RHS_TYPE>& rhs)
1753 if (
lhs.has_value()) {
1754 return rhs.has_value() ?
lhs.value() ==
rhs.value() :
false;
1757 return !
rhs.has_value();
1760template <
class LHS_TYPE,
class RHS_TYPE>
1763 const RHS_TYPE& rhs)
1765 return lhs.has_value() ?
lhs.value() ==
rhs :
false;
1768template <
class LHS_TYPE,
class RHS_TYPE>
1771 const NullableValueRef<RHS_TYPE>& rhs)
1773 return rhs.has_value() ?
lhs ==
rhs.value():
false;
1776template <
class LHS_TYPE,
class RHS_TYPE>
1779 const NullableValueRef<RHS_TYPE>& rhs)
1781 if (
lhs.has_value()) {
1782 return rhs.has_value() ?
lhs.value() !=
rhs.value() :
true;
1785 return rhs.has_value();
1788template <
class LHS_TYPE,
class RHS_TYPE>
1791 const RHS_TYPE& rhs)
1793 return lhs.has_value() ?
lhs.value() !=
rhs :
true;
1796template <
class LHS_TYPE,
class RHS_TYPE>
1799 const NullableValueRef<RHS_TYPE>& rhs)
1801 return rhs.has_value() ?
lhs !=
rhs.value() :
true;
1804template <
class LHS_TYPE,
class RHS_TYPE>
1807 const NullableValueRef<RHS_TYPE>& rhs)
1809 if (!
rhs.has_value()) {
1813 return lhs.has_value() ?
lhs.value() <
rhs.value() :
true;
1816template <
class LHS_TYPE,
class RHS_TYPE>
1819 const RHS_TYPE& rhs)
1821 return lhs.has_value() ?
lhs.value() <
rhs :
true;
1824template <
class LHS_TYPE,
class RHS_TYPE>
1827 const NullableValueRef<RHS_TYPE>& rhs)
1829 return rhs.has_value() ?
lhs <
rhs.value() :
false;
1832template <
class LHS_TYPE,
class RHS_TYPE>
1835 const NullableValueRef<RHS_TYPE>& rhs)
1837 if (!
lhs.has_value()) {
1841 return rhs.has_value() ?
lhs.value() <=
rhs.value() :
false;
1844template <
class LHS_TYPE,
class RHS_TYPE>
1847 const RHS_TYPE& rhs)
1849 return lhs.has_value() ?
lhs.value() <=
rhs :
true;
1852template <
class LHS_TYPE,
class RHS_TYPE>
1855 const NullableValueRef<RHS_TYPE>& rhs)
1857 return rhs.has_value() ?
lhs <=
rhs.value() :
false;
1860template <
class LHS_TYPE,
class RHS_TYPE>
1863 const NullableValueRef<RHS_TYPE>& rhs)
1865 if (!
lhs.has_value()) {
1869 return rhs.has_value() ?
lhs.value() >
rhs.value() :
true;
1872template <
class LHS_TYPE,
class RHS_TYPE>
1875 const RHS_TYPE& rhs)
1877 return lhs.has_value() ?
lhs.value() >
rhs :
false;
1880template <
class LHS_TYPE,
class RHS_TYPE>
1883 const NullableValueRef<RHS_TYPE>& rhs)
1885 return rhs.has_value() ?
lhs >
rhs.value() :
true;
1888template <
class LHS_TYPE,
class RHS_TYPE>
1891 const NullableValueRef<RHS_TYPE>& rhs)
1893 if (!
rhs.has_value()) {
1897 return lhs.has_value() ?
lhs.value() >=
rhs.value() :
false;
1900template <
class LHS_TYPE,
class RHS_TYPE>
1903 const RHS_TYPE& rhs)
1905 return lhs.has_value() ?
lhs.value() >=
rhs :
false;
1908template <
class LHS_TYPE,
class RHS_TYPE>
1911 const NullableValueRef<RHS_TYPE>& rhs)
1913 return rhs.has_value() ?
lhs >=
rhs.value() :
true;
1920template <
class TYPE>
1925 return !
lhs.has_value();
1928template <
class TYPE>
1934 return !
rhs.has_value();
1937template <
class TYPE>
1941 return lhs.has_value();
1944template <
class TYPE>
1950 return rhs.has_value();
1953template <
class TYPE>
1961template <
class TYPE>
1967 return rhs.has_value();
1970template <
class TYPE>
1975 return lhs.has_value();
1978template <
class TYPE>
1986template <
class TYPE>
1991 return !
lhs.has_value();
1994template <
class TYPE>
2003template <
class TYPE>
2011template <
class TYPE>
2017 return !
rhs.has_value();
2025template <
class TYPE>
2031 return *
static_cast<const NullableAllocatedValue<value_type> *
>(
2035template <
class TYPE>
2044template <
class TYPE>
2048 return d_isTargetOptional;
2052template <
class TYPE>
2057, d_isTargetOptional(true)
2061template <
class TYPE>
2064 const NullableAllocatedValue<TYPE>& opt)
2066, d_isTargetOptional(false)
2070template <
class TYPE>
2073 const NullableValueRef<TYPE>& ref)
2074: d_target_p(
ref.d_target_p)
2075, d_isTargetOptional(
ref.d_isTargetOptional)
2079template <
class TYPE>
2082 const ConstNullableValueRef& original)
2083: d_target_p(original.d_target_p)
2084, d_isTargetOptional(original.d_isTargetOptional)
2089template <
class TYPE>
2095 ? getOpt().has_value()
2096 : getNAV().has_value();
2099template <
class TYPE>
2104 return !has_value();
2107template <
class TYPE>
2118template <
class TYPE>
2124 ? getOpt().operator->()
2125 : getNAV().operator->();
2128template <
class TYPE>
2134 ? getOpt().operator*()
2135 : getNAV().operator*();
2138#ifdef BSLS_COMPILERFEATURES_SUPPORT_OPERATOR_EXPLICIT
2139template <
class TYPE>
2146template <
class TYPE>
2147template <
class ANY_TYPE>
2150 const ANY_TYPE& default_value)
const
2157 return default_value;
2161template <
class TYPE>
2166 return has_value() ? &value() : address;
2169template <
class TYPE>
2174 return value_or(otherValue);
2177template <
class TYPE>
2181 return has_value() ? &value() : 0;
2185template <
class HASHALG,
class TYPE>
2187 const ConstNullableValueRef<TYPE>& input)
2189 using ::BloombergLP::bslh::hashAppend;
2191 if (!input.has_value()) {
2201template <
class LHS_TYPE,
class RHS_TYPE>
2204 const ConstNullableValueRef<RHS_TYPE>& rhs)
2206 if (
lhs.has_value()) {
2207 return rhs.has_value() ?
lhs.value() ==
rhs.value() :
false;
2210 return !
rhs.has_value();
2213template <
class LHS_TYPE,
class RHS_TYPE>
2216 const RHS_TYPE& rhs)
2218 return lhs.has_value() ?
lhs.value() ==
rhs :
false;
2221template <
class LHS_TYPE,
class RHS_TYPE>
2224 const ConstNullableValueRef<RHS_TYPE>& rhs)
2226 return rhs.has_value() ?
lhs ==
rhs.value():
false;
2229template <
class LHS_TYPE,
class RHS_TYPE>
2232 const ConstNullableValueRef<RHS_TYPE>& rhs)
2234 if (
lhs.has_value()) {
2235 return rhs.has_value() ?
lhs.value() !=
rhs.value() :
true;
2238 return rhs.has_value();
2241template <
class LHS_TYPE,
class RHS_TYPE>
2244 const RHS_TYPE& rhs)
2246 return lhs.has_value() ?
lhs.value() !=
rhs :
true;
2249template <
class LHS_TYPE,
class RHS_TYPE>
2252 const ConstNullableValueRef<RHS_TYPE>& rhs)
2254 return rhs.has_value() ?
lhs !=
rhs.value() :
true;
2257template <
class LHS_TYPE,
class RHS_TYPE>
2260 const ConstNullableValueRef<RHS_TYPE>& rhs)
2262 if (!
rhs.has_value()) {
2266 return lhs.has_value() ?
lhs.value() <
rhs.value() :
true;
2269template <
class LHS_TYPE,
class RHS_TYPE>
2272 const RHS_TYPE& rhs)
2274 return lhs.has_value() ?
lhs.value() <
rhs :
true;
2277template <
class LHS_TYPE,
class RHS_TYPE>
2280 const ConstNullableValueRef<RHS_TYPE>& rhs)
2282 return rhs.has_value() ?
lhs <
rhs.value() :
false;
2285template <
class LHS_TYPE,
class RHS_TYPE>
2288 const ConstNullableValueRef<RHS_TYPE>& rhs)
2290 if (!
lhs.has_value()) {
2294 return rhs.has_value() ?
lhs.value() <=
rhs.value() :
false;
2297template <
class LHS_TYPE,
class RHS_TYPE>
2300 const RHS_TYPE& rhs)
2302 return lhs.has_value() ?
lhs.value() <=
rhs :
true;
2305template <
class LHS_TYPE,
class RHS_TYPE>
2308 const ConstNullableValueRef<RHS_TYPE>& rhs)
2310 return rhs.has_value() ?
lhs <=
rhs.value() :
false;
2313template <
class LHS_TYPE,
class RHS_TYPE>
2316 const ConstNullableValueRef<RHS_TYPE>& rhs)
2318 if (!
lhs.has_value()) {
2322 return rhs.has_value() ?
lhs.value() >
rhs.value() :
true;
2325template <
class LHS_TYPE,
class RHS_TYPE>
2328 const RHS_TYPE& rhs)
2330 return lhs.has_value() ?
lhs.value() >
rhs :
false;
2333template <
class LHS_TYPE,
class RHS_TYPE>
2336 const ConstNullableValueRef<RHS_TYPE>& rhs)
2338 return rhs.has_value() ?
lhs >
rhs.value() :
true;
2341template <
class LHS_TYPE,
class RHS_TYPE>
2344 const ConstNullableValueRef<RHS_TYPE>& rhs)
2346 if (!
rhs.has_value()) {
2350 return lhs.has_value() ?
lhs.value() >=
rhs.value() :
false;
2353template <
class LHS_TYPE,
class RHS_TYPE>
2356 const RHS_TYPE& rhs)
2358 return lhs.has_value() ?
lhs.value() >=
rhs :
false;
2361template <
class LHS_TYPE,
class RHS_TYPE>
2364 const ConstNullableValueRef<RHS_TYPE>& rhs)
2366 return rhs.has_value() ?
lhs >=
rhs.value() :
true;
2373template <
class TYPE>
2378 return !
lhs.has_value();
2381template <
class TYPE>
2387 return !
rhs.has_value();
2390template <
class TYPE>
2394 return lhs.has_value();
2397template <
class TYPE>
2403 return rhs.has_value();
2406template <
class TYPE>
2414template <
class TYPE>
2420 return rhs.has_value();
2423template <
class TYPE>
2428 return lhs.has_value();
2431template <
class TYPE>
2440template <
class TYPE>
2445 return !
lhs.has_value();
2448template <
class TYPE>
2457template <
class TYPE>
2465template <
class TYPE>
2471 return !
rhs.has_value();
2478template <
class LHS_TYPE,
class RHS_TYPE>
2481 const NullableValueRef<RHS_TYPE>& rhs)
2483 if (
lhs.has_value()) {
2484 return rhs.has_value() ?
lhs.value() ==
rhs.value() :
false;
2487 return !
rhs.has_value();
2490template <
class LHS_TYPE,
class RHS_TYPE>
2493 const ConstNullableValueRef<RHS_TYPE>& rhs)
2495 if (
lhs.has_value()) {
2496 return rhs.has_value() ?
lhs.value() ==
rhs.value() :
false;
2499 return !
rhs.has_value();
2502template <
class LHS_TYPE,
class RHS_TYPE>
2505 const NullableValueRef<RHS_TYPE>& rhs)
2507 if (
lhs.has_value()) {
2508 return rhs.has_value() ?
lhs.value() !=
rhs.value() :
true;
2511 return rhs.has_value();
2514template <
class LHS_TYPE,
class RHS_TYPE>
2517 const ConstNullableValueRef<RHS_TYPE>& rhs)
2519 if (
lhs.has_value()) {
2520 return rhs.has_value() ?
lhs.value() !=
rhs.value() :
true;
2523 return rhs.has_value();
2526template <
class LHS_TYPE,
class RHS_TYPE>
2529 const NullableValueRef<RHS_TYPE>& rhs)
2531 if (!
rhs.has_value()) {
2535 return lhs.has_value() ?
lhs.value() <
rhs.value() :
true;
2538template <
class LHS_TYPE,
class RHS_TYPE>
2541 const ConstNullableValueRef<RHS_TYPE>& rhs)
2543 if (!
rhs.has_value()) {
2547 return lhs.has_value() ?
lhs.value() <
rhs.value() :
true;
2550template <
class LHS_TYPE,
class RHS_TYPE>
2553 const NullableValueRef<RHS_TYPE>& rhs)
2555 if (!
lhs.has_value()) {
2559 return rhs.has_value() ?
lhs.value() <=
rhs.value() :
false;
2562template <
class LHS_TYPE,
class RHS_TYPE>
2565 const ConstNullableValueRef<RHS_TYPE>& rhs)
2567 if (!
lhs.has_value()) {
2571 return rhs.has_value() ?
lhs.value() <=
rhs.value() :
false;
2574template <
class LHS_TYPE,
class RHS_TYPE>
2577 const NullableValueRef<RHS_TYPE>& rhs)
2579 if (!
lhs.has_value()) {
2583 return rhs.has_value() ?
lhs.value() >
rhs.value() :
true;
2586template <
class LHS_TYPE,
class RHS_TYPE>
2589 const ConstNullableValueRef<RHS_TYPE>& rhs)
2591 if (!
lhs.has_value()) {
2595 return rhs.has_value() ?
lhs.value() >
rhs.value() :
true;
2598template <
class LHS_TYPE,
class RHS_TYPE>
2601 const NullableValueRef<RHS_TYPE>& rhs)
2603 if (!
rhs.has_value()) {
2607 return lhs.has_value() ?
lhs.value() >=
rhs.value() :
false;
2610template <
class LHS_TYPE,
class RHS_TYPE>
2613 const ConstNullableValueRef<RHS_TYPE>& rhs)
2615 if (!
rhs.has_value()) {
2619 return lhs.has_value() ?
lhs.value() >=
rhs.value() :
false;
2625# error Not valid except when included from bdlb_nullablevalueref.h
Definition bdlb_nullablevalueref.h:671
TYPE value_type
Definition bdlb_nullablevalueref.h:726
Definition bdlb_nullableallocatedvalue.h:180
Definition bdlb_nullablevalueref.h:169
TYPE & emplace(BSLS_COMPILERFEATURES_FORWARD_REF(ARGS)...)
TYPE value_type
Definition bdlb_nullablevalueref.h:228
Definition bslstl_optional.h:2043
TYPE value_or(const ANY_TYPE &default_value) const
Definition bdlb_nullablevalueref.h:1294
void reset()
Definition bdlb_nullablevalueref.h:1411
TYPE value_or(const ANY_TYPE &default_value) const
Definition bdlb_nullablevalueref.h:1882
const value_type * operator->() const
Definition bdlb_nullablevalueref.h:1266
const value_type * operator->() const
Definition bdlb_nullablevalueref.h:1854
bool has_value() const BSLS_KEYWORD_NOEXCEPT
Return true if the target contains a value, and false otherwise.
Definition bdlb_nullablevalueref.h:1238
NullableValueRef(bsl::optional< TYPE > &opt)
Definition bdlb_nullablevalueref.h:1211
bool has_value() const BSLS_KEYWORD_NOEXCEPT
Return true if the target contains a value, and false otherwise.
Definition bdlb_nullablevalueref.h:1825
const value_type & operator*() const
Definition bdlb_nullablevalueref.h:1864
const value_type & value() const
Definition bdlb_nullablevalueref.h:1255
bool isNull() const BSLS_KEYWORD_NOEXCEPT
Definition bdlb_nullablevalueref.h:1247
bool isNull() const BSLS_KEYWORD_NOEXCEPT
Definition bdlb_nullablevalueref.h:1835
const value_type & operator*() const
Definition bdlb_nullablevalueref.h:1276
NullableValueRef< TYPE > & operator=(const bsl::nullopt_t &)
Definition bdlb_nullablevalueref.h:1343
ConstNullableValueRef(const bsl::optional< TYPE > &opt)
Definition bdlb_nullablevalueref.h:1787
const value_type & value() const
Definition bdlb_nullablevalueref.h:1843
#define BSLMF_ASSERT(expr)
Definition bslmf_assert.h:231
#define BSLS_ASSERT(X)
Definition bsls_assert.h:1976
#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_FEATURE(UOR, FEATURE, MESSAGE)
Definition bsls_deprecatefeature.h:387
#define BSLS_NOTHROW_SPEC
Definition bsls_exceptionutil.h:386
#define BSLS_KEYWORD_EXPLICIT
Definition bsls_keyword.h:683
#define BSLS_KEYWORD_NOEXCEPT
Definition bsls_keyword.h:674
void reset(TYPE *object)
Reset the value of the specified object to its default value.
Definition bdlb_algorithmworkaroundutil.h:74
bool operator!=(const BigEndianInt16 &lhs, const BigEndianInt16 &rhs)
bool operator>=(const Guid &lhs, const Guid &rhs)
void hashAppend(HASH_ALGORITHM &hashAlgorithm, const BigEndianInt16 &object)
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
reference_wrapper< T > ref(T &object)
Return a reference wrapper that represents the specified object.
ALLOCATOR const STRING_VIEW_LIKE_TYPE & rhs
Definition bslstl_string.h:3918
ALLOCATOR & lhs
Definition bslstl_string.h:3917
Definition bslmf_issame.h:146
Definition bslstl_optional.h:522