diff --git a/.ci/userconfig2019.alt.hpp b/.ci/userconfig2019.alt.hpp
index 15ab7ddc97d..b6f882f45ef 100644
--- a/.ci/userconfig2019.alt.hpp
+++ b/.ci/userconfig2019.alt.hpp
@@ -101,11 +101,6 @@
//# define QL_USE_STD_ANY
#endif
-/* Define this to use std::optional instead of boost::optional. */
-#ifndef QL_USE_STD_OPTIONAL
-//# define QL_USE_STD_OPTIONAL
-#endif
-
/* Define this to use standard smart pointers instead of Boost ones.
Note that std::shared_ptr does not check access and can
cause segmentation faults. */
diff --git a/.ci/userconfig2022.alt.hpp b/.ci/userconfig2022.alt.hpp
index e714c4fbf01..b6f882f45ef 100644
--- a/.ci/userconfig2022.alt.hpp
+++ b/.ci/userconfig2022.alt.hpp
@@ -101,11 +101,6 @@
//# define QL_USE_STD_ANY
#endif
-/* Define this to use std::optional instead of boost::optional. */
-#ifndef QL_USE_STD_OPTIONAL
-# define QL_USE_STD_OPTIONAL
-#endif
-
/* Define this to use standard smart pointers instead of Boost ones.
Note that std::shared_ptr does not check access and can
cause segmentation faults. */
diff --git a/.ci/userconfig2026.alt.hpp b/.ci/userconfig2026.alt.hpp
index e714c4fbf01..b6f882f45ef 100644
--- a/.ci/userconfig2026.alt.hpp
+++ b/.ci/userconfig2026.alt.hpp
@@ -101,11 +101,6 @@
//# define QL_USE_STD_ANY
#endif
-/* Define this to use std::optional instead of boost::optional. */
-#ifndef QL_USE_STD_OPTIONAL
-# define QL_USE_STD_OPTIONAL
-#endif
-
/* Define this to use standard smart pointers instead of Boost ones.
Note that std::shared_ptr does not check access and can
cause segmentation faults. */
diff --git a/CMakeLists.txt b/CMakeLists.txt
index f346b7e665c..e4f47a6520d 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -64,7 +64,6 @@ option(QL_USE_CLANG_TIDY "Use clang-tidy when building" OFF)
option(QL_USE_INDEXED_COUPON "Use indexed coupons instead of par coupons" OFF)
option(QL_USE_STD_ANY "Use std::any instead of boost::any" ON)
option(QL_USE_STD_CLASSES "Enable all QL_USE_STD_ options" OFF)
-option(QL_USE_STD_OPTIONAL "Use std::optional instead of boost::optional" ON)
option(QL_USE_STD_SHARED_PTR "Use standard smart pointers instead of Boost ones" OFF)
set(QL_EXTERNAL_SUBDIRECTORIES "" CACHE STRING "Optional list of external source directories to be added to the build (semicolon-separated)")
# set -lpapi here
@@ -87,7 +86,6 @@ endif()
# Convenience option to activate all STD options
if (QL_USE_STD_CLASSES)
set(QL_USE_STD_ANY ON)
- set(QL_USE_STD_OPTIONAL ON)
set(QL_USE_STD_SHARED_PTR ON)
endif()
diff --git a/CMakePresets.json b/CMakePresets.json
index 901270f62a9..59d28bfc7bd 100644
--- a/CMakePresets.json
+++ b/CMakePresets.json
@@ -303,7 +303,6 @@
"QL_USE_INDEXED_COUPON": "ON",
"QL_USE_STD_SHARED_PTR": "ON",
"QL_USE_STD_ANY": "OFF",
- "QL_USE_STD_OPTIONAL": "OFF",
"QL_COMPILE_WARNING_AS_ERROR": "ON"
}
},
@@ -323,7 +322,6 @@
"QL_USE_INDEXED_COUPON": "ON",
"QL_USE_STD_SHARED_PTR": "ON",
"QL_USE_STD_ANY": "OFF",
- "QL_USE_STD_OPTIONAL": "OFF",
"QL_COMPILE_WARNING_AS_ERROR": "ON",
"CMAKE_CXX_COMPILER_LAUNCHER": "sccache"
}
diff --git a/Docs/pages/config.docs b/Docs/pages/config.docs
index c5b4eb82f58..8e85d9c38d9 100644
--- a/Docs/pages/config.docs
+++ b/Docs/pages/config.docs
@@ -125,15 +125,6 @@
functions will be used instead of `boost::any`. If undefined, the
Boost facilities will be used.
- \code
- #define QL_USE_STD_OPTIONAL
- \endcode
- If defined (the default), `std::optional` and related classes and
- functions will be used instead of `boost::optional`. If undefined,
- the Boost facilities will be used; however, be aware that Boost
- 1.91 introduced changes in boost::optional that silently changed
- the behavior of our code and would cause it to work incorrectly.
-
\code
#define QL_USE_STD_SHARED_PTR
\endcode
diff --git a/QuantLib.vcxproj b/QuantLib.vcxproj
index cb7be163068..a327dcb1c18 100644
--- a/QuantLib.vcxproj
+++ b/QuantLib.vcxproj
@@ -1925,7 +1925,6 @@
-
diff --git a/QuantLib.vcxproj.filters b/QuantLib.vcxproj.filters
index 6bb0a73537c..a655fc76e7c 100644
--- a/QuantLib.vcxproj.filters
+++ b/QuantLib.vcxproj.filters
@@ -3824,7 +3824,6 @@
-
diff --git a/configure.ac b/configure.ac
index c9d3701c16c..37150789226 100644
--- a/configure.ac
+++ b/configure.ac
@@ -287,25 +287,6 @@ if test "$ql_use_std_any" = "yes" ; then
fi
AC_MSG_RESULT([$ql_use_std_any])
-AC_MSG_CHECKING([whether to enable std::optional instead of boost::optional])
-AC_ARG_ENABLE([std-optional],
- AS_HELP_STRING([--enable-std-optional],
- [If enabled (the default), std::optional and
- related classes and functions will be used
- instead of boost::optional. If disabled,
- the Boost facilities will be used; however,
- be aware that Boost 1.91 introduced changes
- in boost::optional that silently changed
- the behavior of our code and would cause it
- to work incorrectly.]),
- [ql_use_std_optional=$enableval],
- [ql_use_std_optional=yes])
-if test "$ql_use_std_optional" = "yes" ; then
- AC_DEFINE([QL_USE_STD_OPTIONAL],[1],
- [Define this if you want to use std::optional.])
-fi
-AC_MSG_RESULT([$ql_use_std_optional])
-
AC_MSG_CHECKING([whether to enable standard smart pointers])
AC_ARG_ENABLE([std-pointers],
AS_HELP_STRING([--enable-std-pointers],
@@ -337,8 +318,6 @@ AC_ARG_ENABLE([std-classes],
if test "$ql_use_std_classes" = "yes" ; then
AC_DEFINE([QL_USE_STD_ANY],[1],
[Define this if you want to use std::any.])
- AC_DEFINE([QL_USE_STD_OPTIONAL],[1],
- [Define this if you want to use std::optional.])
AC_DEFINE([QL_USE_STD_SHARED_PTR],[1],
[Define this if you want to use standard smart pointers.])
fi
diff --git a/ql/CMakeLists.txt b/ql/CMakeLists.txt
index 6b375326c19..4eb461c9cc5 100644
--- a/ql/CMakeLists.txt
+++ b/ql/CMakeLists.txt
@@ -1875,7 +1875,6 @@ set(QL_HEADERS
money.hpp
numericalmethod.hpp
option.hpp
- optional.hpp
patterns/curiouslyrecurring.hpp
patterns/lazyobject.hpp
patterns/observable.hpp
diff --git a/ql/Makefile.am b/ql/Makefile.am
index 0727d6060eb..c68245499d3 100644
--- a/ql/Makefile.am
+++ b/ql/Makefile.am
@@ -43,7 +43,6 @@ this_include_HEADERS = \
money.hpp \
numericalmethod.hpp \
option.hpp \
- optional.hpp \
payoff.hpp \
position.hpp \
prices.hpp \
diff --git a/ql/cashflow.cpp b/ql/cashflow.cpp
index 80c9c767034..2da64b349dd 100644
--- a/ql/cashflow.cpp
+++ b/ql/cashflow.cpp
@@ -25,7 +25,7 @@
namespace QuantLib {
bool CashFlow::hasOccurred(const Date& refDate,
- ext::optional includeRefDate) const {
+ std::optional includeRefDate) const {
// easy and quick handling of most cases
if (refDate != Date()) {
@@ -40,7 +40,7 @@ namespace QuantLib {
refDate == Settings::instance().evaluationDate()) {
// today's date; we override the bool with the one
// specified in the settings (if any)
- ext::optional includeToday =
+ std::optional includeToday =
Settings::instance().includeTodaysCashFlows();
if (includeToday.has_value())
includeRefDate = includeToday;
diff --git a/ql/cashflow.hpp b/ql/cashflow.hpp
index 955bd0ad865..82d115190ec 100644
--- a/ql/cashflow.hpp
+++ b/ql/cashflow.hpp
@@ -27,7 +27,7 @@
#include
#include
-#include
+#include
#include
#include
@@ -49,7 +49,7 @@ namespace QuantLib {
Settings::includeTodaysCashflows in account
*/
bool hasOccurred(const Date& refDate = Date(),
- ext::optional includeRefDate = ext::nullopt) const override;
+ std::optional includeRefDate = std::nullopt) const override;
//@}
//! \name LazyObject interface
//@{
diff --git a/ql/cashflows/cashflows.cpp b/ql/cashflows/cashflows.cpp
index 3e4da21601c..6686a8cbd0f 100644
--- a/ql/cashflows/cashflows.cpp
+++ b/ql/cashflows/cashflows.cpp
@@ -64,7 +64,7 @@ namespace QuantLib {
}
bool CashFlows::isExpired(const Leg& leg,
- const ext::optional& includeSettlementDateFlows,
+ const std::optional& includeSettlementDateFlows,
Date settlementDate)
{
if (leg.empty())
@@ -82,7 +82,7 @@ namespace QuantLib {
Leg::const_reverse_iterator
CashFlows::previousCashFlow(const Leg& leg,
- const ext::optional& includeSettlementDateFlows,
+ const std::optional& includeSettlementDateFlows,
Date settlementDate) {
if (leg.empty())
return leg.rend();
@@ -100,7 +100,7 @@ namespace QuantLib {
Leg::const_iterator
CashFlows::nextCashFlow(const Leg& leg,
- const ext::optional& includeSettlementDateFlows,
+ const std::optional& includeSettlementDateFlows,
Date settlementDate) {
if (leg.empty())
return leg.end();
@@ -117,7 +117,7 @@ namespace QuantLib {
}
Date CashFlows::previousCashFlowDate(const Leg& leg,
- const ext::optional& includeSettlementDateFlows,
+ const std::optional& includeSettlementDateFlows,
Date settlementDate) {
Leg::const_reverse_iterator cf;
cf = previousCashFlow(leg, includeSettlementDateFlows, settlementDate);
@@ -129,7 +129,7 @@ namespace QuantLib {
}
Date CashFlows::nextCashFlowDate(const Leg& leg,
- const ext::optional& includeSettlementDateFlows,
+ const std::optional& includeSettlementDateFlows,
Date settlementDate) {
Leg::const_iterator cf;
cf = nextCashFlow(leg, includeSettlementDateFlows, settlementDate);
@@ -141,7 +141,7 @@ namespace QuantLib {
}
Real CashFlows::previousCashFlowAmount(const Leg& leg,
- const ext::optional& includeSettlementDateFlows,
+ const std::optional& includeSettlementDateFlows,
Date settlementDate) {
Leg::const_reverse_iterator cf;
cf = previousCashFlow(leg, includeSettlementDateFlows, settlementDate);
@@ -157,7 +157,7 @@ namespace QuantLib {
}
Real CashFlows::nextCashFlowAmount(const Leg& leg,
- const ext::optional& includeSettlementDateFlows,
+ const std::optional& includeSettlementDateFlows,
Date settlementDate) {
Leg::const_iterator cf;
cf = nextCashFlow(leg, includeSettlementDateFlows, settlementDate);
@@ -212,7 +212,7 @@ namespace QuantLib {
} // anonymous namespace ends here
Rate CashFlows::previousCouponRate(const Leg& leg,
- const ext::optional& includeSettlementDateFlows,
+ const std::optional& includeSettlementDateFlows,
Date settlementDate) {
Leg::const_reverse_iterator cf;
cf = previousCashFlow(leg, includeSettlementDateFlows, settlementDate);
@@ -221,7 +221,7 @@ namespace QuantLib {
}
Rate CashFlows::nextCouponRate(const Leg& leg,
- const ext::optional& includeSettlementDateFlows,
+ const std::optional& includeSettlementDateFlows,
Date settlementDate) {
Leg::const_iterator cf;
cf = nextCashFlow(leg, includeSettlementDateFlows, settlementDate);
@@ -229,7 +229,7 @@ namespace QuantLib {
}
Real CashFlows::nominal(const Leg& leg,
- const ext::optional& includeSettlementDateFlows,
+ const std::optional& includeSettlementDateFlows,
Date settlementDate) {
auto cf = nextCashFlow(leg, includeSettlementDateFlows, settlementDate);
if (cf==leg.end()) return 0.0;
@@ -244,7 +244,7 @@ namespace QuantLib {
}
Date CashFlows::accrualStartDate(const Leg& leg,
- const ext::optional& includeSettlementDateFlows,
+ const std::optional& includeSettlementDateFlows,
Date settlementDate) {
auto cf = nextCashFlow(leg, includeSettlementDateFlows, settlementDate);
if (cf==leg.end())
@@ -260,7 +260,7 @@ namespace QuantLib {
}
Date CashFlows::accrualEndDate(const Leg& leg,
- const ext::optional& includeSettlementDateFlows,
+ const std::optional& includeSettlementDateFlows,
Date settlementDate) {
auto cf = nextCashFlow(leg, includeSettlementDateFlows, settlementDate);
if (cf==leg.end())
@@ -276,7 +276,7 @@ namespace QuantLib {
}
Date CashFlows::referencePeriodStart(const Leg& leg,
- const ext::optional& includeSettlementDateFlows,
+ const std::optional& includeSettlementDateFlows,
Date settlementDate) {
auto cf = nextCashFlow(leg, includeSettlementDateFlows, settlementDate);
if (cf==leg.end())
@@ -292,7 +292,7 @@ namespace QuantLib {
}
Date CashFlows::referencePeriodEnd(const Leg& leg,
- const ext::optional& includeSettlementDateFlows,
+ const std::optional& includeSettlementDateFlows,
Date settlementDate) {
auto cf = nextCashFlow(leg, includeSettlementDateFlows, settlementDate);
if (cf==leg.end())
@@ -308,7 +308,7 @@ namespace QuantLib {
}
Time CashFlows::accrualPeriod(const Leg& leg,
- const ext::optional& includeSettlementDateFlows,
+ const std::optional& includeSettlementDateFlows,
Date settlementDate) {
auto cf = nextCashFlow(leg, includeSettlementDateFlows, settlementDate);
if (cf==leg.end()) return 0;
@@ -323,7 +323,7 @@ namespace QuantLib {
}
Date::serial_type CashFlows::accrualDays(const Leg& leg,
- const ext::optional& includeSettlementDateFlows,
+ const std::optional& includeSettlementDateFlows,
Date settlementDate) {
auto cf = nextCashFlow(leg, includeSettlementDateFlows, settlementDate);
if (cf==leg.end()) return 0;
@@ -338,7 +338,7 @@ namespace QuantLib {
}
Time CashFlows::accruedPeriod(const Leg& leg,
- const ext::optional& includeSettlementDateFlows,
+ const std::optional& includeSettlementDateFlows,
Date settlementDate) {
if (settlementDate == Date())
settlementDate = Settings::instance().evaluationDate();
@@ -356,7 +356,7 @@ namespace QuantLib {
}
Date::serial_type CashFlows::accruedDays(const Leg& leg,
- const ext::optional& includeSettlementDateFlows,
+ const std::optional& includeSettlementDateFlows,
Date settlementDate) {
if (settlementDate == Date())
settlementDate = Settings::instance().evaluationDate();
@@ -374,7 +374,7 @@ namespace QuantLib {
}
Real CashFlows::accruedAmount(const Leg& leg,
- const ext::optional& includeSettlementDateFlows,
+ const std::optional& includeSettlementDateFlows,
Date settlementDate) {
if (settlementDate == Date())
settlementDate = Settings::instance().evaluationDate();
@@ -423,7 +423,7 @@ namespace QuantLib {
Real CashFlows::npv(const Leg& leg,
const YieldTermStructure& discountCurve,
- const ext::optional& includeSettlementDateFlows,
+ const std::optional& includeSettlementDateFlows,
Date settlementDate,
Date npvDate) {
@@ -448,7 +448,7 @@ namespace QuantLib {
Real CashFlows::bps(const Leg& leg,
const YieldTermStructure& discountCurve,
- const ext::optional& includeSettlementDateFlows,
+ const std::optional& includeSettlementDateFlows,
Date settlementDate,
Date npvDate) {
if (leg.empty())
@@ -471,7 +471,7 @@ namespace QuantLib {
std::pair CashFlows::npvbps(const Leg& leg,
const YieldTermStructure& discountCurve,
- const ext::optional& includeSettlementDateFlows,
+ const std::optional& includeSettlementDateFlows,
Date settlementDate,
Date npvDate) {
Real npv = 0.0;
@@ -508,7 +508,7 @@ namespace QuantLib {
Rate CashFlows::atmRate(const Leg& leg,
const YieldTermStructure& discountCurve,
- const ext::optional& includeSettlementDateFlows,
+ const std::optional& includeSettlementDateFlows,
Date settlementDate,
Date npvDate,
Real targetNpv) {
@@ -601,7 +601,7 @@ namespace QuantLib {
Real simpleDuration(const Leg& leg,
const InterestRate& y,
- const ext::optional& includeSettlementDateFlows,
+ const std::optional& includeSettlementDateFlows,
Date settlementDate,
Date npvDate) {
if (leg.empty())
@@ -641,7 +641,7 @@ namespace QuantLib {
Real modifiedDuration(const Leg& leg,
const InterestRate& y,
- const ext::optional& includeSettlementDateFlows,
+ const std::optional& includeSettlementDateFlows,
Date settlementDate,
Date npvDate) {
if (leg.empty())
@@ -708,7 +708,7 @@ namespace QuantLib {
Real macaulayDuration(const Leg& leg,
const InterestRate& y,
- const ext::optional& includeSettlementDateFlows,
+ const std::optional& includeSettlementDateFlows,
Date settlementDate,
Date npvDate) {
@@ -735,7 +735,7 @@ namespace QuantLib {
DayCounter dayCounter,
Compounding comp,
Frequency freq,
- const ext::optional& includeSettlementDateFlows,
+ const std::optional& includeSettlementDateFlows,
Date settlementDate,
Date npvDate)
: leg_(leg), npv_(npv), dayCounter_(std::move(dayCounter)), compounding_(comp),
@@ -812,7 +812,7 @@ namespace QuantLib {
Real CashFlows::npv(const Leg& leg,
const InterestRate& y,
- const ext::optional& includeSettlementDateFlows,
+ const std::optional& includeSettlementDateFlows,
Date settlementDate,
Date npvDate) {
@@ -859,7 +859,7 @@ namespace QuantLib {
const DayCounter& dc,
Compounding comp,
Frequency freq,
- const ext::optional& includeSettlementDateFlows,
+ const std::optional& includeSettlementDateFlows,
Date settlementDate,
Date npvDate) {
return npv(leg, InterestRate(yield, dc, comp, freq),
@@ -869,7 +869,7 @@ namespace QuantLib {
Real CashFlows::bps(const Leg& leg,
const InterestRate& yield,
- const ext::optional& includeSettlementDateFlows,
+ const std::optional& includeSettlementDateFlows,
Date settlementDate,
Date npvDate) {
@@ -894,7 +894,7 @@ namespace QuantLib {
const DayCounter& dc,
Compounding comp,
Frequency freq,
- const ext::optional& includeSettlementDateFlows,
+ const std::optional& includeSettlementDateFlows,
Date settlementDate,
Date npvDate) {
return bps(leg, InterestRate(yield, dc, comp, freq),
@@ -907,7 +907,7 @@ namespace QuantLib {
const DayCounter& dayCounter,
Compounding compounding,
Frequency frequency,
- const ext::optional& includeSettlementDateFlows,
+ const std::optional& includeSettlementDateFlows,
Date settlementDate,
Date npvDate,
Real accuracy,
@@ -926,7 +926,7 @@ namespace QuantLib {
Time CashFlows::duration(const Leg& leg,
const InterestRate& rate,
Duration::Type type,
- const ext::optional& includeSettlementDateFlows,
+ const std::optional& includeSettlementDateFlows,
Date settlementDate,
Date npvDate) {
@@ -963,7 +963,7 @@ namespace QuantLib {
Compounding comp,
Frequency freq,
Duration::Type type,
- const ext::optional& includeSettlementDateFlows,
+ const std::optional& includeSettlementDateFlows,
Date settlementDate,
Date npvDate) {
return duration(leg, InterestRate(yield, dc, comp, freq),
@@ -974,7 +974,7 @@ namespace QuantLib {
Real CashFlows::convexity(const Leg& leg,
const InterestRate& y,
- const ext::optional& includeSettlementDateFlows,
+ const std::optional& includeSettlementDateFlows,
Date settlementDate,
Date npvDate) {
if (leg.empty())
@@ -1048,7 +1048,7 @@ namespace QuantLib {
const DayCounter& dc,
Compounding comp,
Frequency freq,
- const ext::optional& includeSettlementDateFlows,
+ const std::optional& includeSettlementDateFlows,
Date settlementDate,
Date npvDate) {
return convexity(leg, InterestRate(yield, dc, comp, freq),
@@ -1058,7 +1058,7 @@ namespace QuantLib {
Real CashFlows::basisPointValue(const Leg& leg,
const InterestRate& y,
- const ext::optional& includeSettlementDateFlows,
+ const std::optional& includeSettlementDateFlows,
Date settlementDate,
Date npvDate) {
if (leg.empty())
@@ -1095,7 +1095,7 @@ namespace QuantLib {
const DayCounter& dc,
Compounding comp,
Frequency freq,
- const ext::optional& includeSettlementDateFlows,
+ const std::optional& includeSettlementDateFlows,
Date settlementDate,
Date npvDate) {
return basisPointValue(leg, InterestRate(yield, dc, comp, freq),
@@ -1105,7 +1105,7 @@ namespace QuantLib {
Real CashFlows::yieldValueBasisPoint(const Leg& leg,
const InterestRate& y,
- const ext::optional& includeSettlementDateFlows,
+ const std::optional& includeSettlementDateFlows,
Date settlementDate,
Date npvDate) {
if (leg.empty())
@@ -1134,7 +1134,7 @@ namespace QuantLib {
const DayCounter& dc,
Compounding comp,
Frequency freq,
- const ext::optional& includeSettlementDateFlows,
+ const std::optional& includeSettlementDateFlows,
Date settlementDate,
Date npvDate) {
return yieldValueBasisPoint(leg, InterestRate(yield, dc, comp, freq),
@@ -1148,7 +1148,7 @@ namespace QuantLib {
Spread zSpread,
Compounding comp,
Frequency freq,
- const ext::optional& includeSettlementDateFlows,
+ const std::optional& includeSettlementDateFlows,
Date settlementDate,
Date npvDate) {
@@ -1180,7 +1180,7 @@ namespace QuantLib {
const DayCounter&,
Compounding comp,
Frequency freq,
- const ext::optional& includeSettlementDateFlows,
+ const std::optional& includeSettlementDateFlows,
Date settlementDate,
Date npvDate) {
return CashFlows::npv(leg, discountCurve, zSpread, comp, freq,
@@ -1192,7 +1192,7 @@ namespace QuantLib {
const ext::shared_ptr& discount,
Compounding compounding,
Frequency frequency,
- const ext::optional& includeSettlementDateFlows,
+ const std::optional& includeSettlementDateFlows,
Date settlementDate,
Date npvDate,
Real accuracy,
@@ -1230,7 +1230,7 @@ namespace QuantLib {
const DayCounter&,
Compounding compounding,
Frequency frequency,
- const ext::optional& includeSettlementDateFlows,
+ const std::optional& includeSettlementDateFlows,
Date settlementDate,
Date npvDate,
Real accuracy,
diff --git a/ql/cashflows/cashflows.hpp b/ql/cashflows/cashflows.hpp
index 43b661f9cb7..5a094004c1e 100644
--- a/ql/cashflows/cashflows.hpp
+++ b/ql/cashflows/cashflows.hpp
@@ -47,7 +47,7 @@ namespace QuantLib {
DayCounter dayCounter,
Compounding comp,
Frequency freq,
- const ext::optional& includeSettlementDateFlows,
+ const std::optional& includeSettlementDateFlows,
Date settlementDate,
Date npvDate);
@@ -61,7 +61,7 @@ namespace QuantLib {
DayCounter dayCounter_;
Compounding compounding_;
Frequency frequency_;
- ext::optional includeSettlementDateFlows_;
+ std::optional includeSettlementDateFlows_;
Date settlementDate_, npvDate_;
};
public:
@@ -77,7 +77,7 @@ namespace QuantLib {
static Date startDate(const Leg& leg);
static Date maturityDate(const Leg& leg);
static bool isExpired(const Leg& leg,
- const ext::optional& includeSettlementDateFlows = ext::nullopt,
+ const std::optional& includeSettlementDateFlows = std::nullopt,
Date settlementDate = Date());
//@}
@@ -86,28 +86,28 @@ namespace QuantLib {
//! the last cashflow paying before or at the given date
static Leg::const_reverse_iterator
previousCashFlow(const Leg& leg,
- const ext::optional& includeSettlementDateFlows = ext::nullopt,
+ const std::optional& includeSettlementDateFlows = std::nullopt,
Date settlementDate = Date());
//! the first cashflow paying after the given date
static Leg::const_iterator
nextCashFlow(const Leg& leg,
- const ext::optional& includeSettlementDateFlows = ext::nullopt,
+ const std::optional& includeSettlementDateFlows = std::nullopt,
Date settlementDate = Date());
static Date
previousCashFlowDate(const Leg& leg,
- const ext::optional& includeSettlementDateFlows = ext::nullopt,
+ const std::optional& includeSettlementDateFlows = std::nullopt,
Date settlementDate = Date());
static Date
nextCashFlowDate(const Leg& leg,
- const ext::optional& includeSettlementDateFlows = ext::nullopt,
+ const std::optional& includeSettlementDateFlows = std::nullopt,
Date settlementDate = Date());
static Real
previousCashFlowAmount(const Leg& leg,
- const ext::optional& includeSettlementDateFlows = ext::nullopt,
+ const std::optional& includeSettlementDateFlows = std::nullopt,
Date settlementDate = Date());
static Real
nextCashFlowAmount(const Leg& leg,
- const ext::optional& includeSettlementDateFlows = ext::nullopt,
+ const std::optional& includeSettlementDateFlows = std::nullopt,
Date settlementDate = Date());
//@}
@@ -115,52 +115,52 @@ namespace QuantLib {
//@{
static Rate
previousCouponRate(const Leg& leg,
- const ext::optional& includeSettlementDateFlows = ext::nullopt,
+ const std::optional& includeSettlementDateFlows = std::nullopt,
Date settlementDate = Date());
static Rate
nextCouponRate(const Leg& leg,
- const ext::optional& includeSettlementDateFlows = ext::nullopt,
+ const std::optional& includeSettlementDateFlows = std::nullopt,
Date settlementDate = Date());
static Real
nominal(const Leg& leg,
- const ext::optional& includeSettlementDateFlows = ext::nullopt,
+ const std::optional& includeSettlementDateFlows = std::nullopt,
Date settlementDate = Date());
static Date
accrualStartDate(const Leg& leg,
- const ext::optional& includeSettlementDateFlows = ext::nullopt,
+ const std::optional& includeSettlementDateFlows = std::nullopt,
Date settlementDate = Date());
static Date
accrualEndDate(const Leg& leg,
- const ext::optional& includeSettlementDateFlows = ext::nullopt,
+ const std::optional& includeSettlementDateFlows = std::nullopt,
Date settlementDate = Date());
static Date
referencePeriodStart(const Leg& leg,
- const ext::optional& includeSettlementDateFlows = ext::nullopt,
+ const std::optional& includeSettlementDateFlows = std::nullopt,
Date settlementDate = Date());
static Date
referencePeriodEnd(const Leg& leg,
- const ext::optional& includeSettlementDateFlows = ext::nullopt,
+ const std::optional& includeSettlementDateFlows = std::nullopt,
Date settlementDate = Date());
static Time
accrualPeriod(const Leg& leg,
- const ext::optional& includeSettlementDateFlows = ext::nullopt,
+ const std::optional& includeSettlementDateFlows = std::nullopt,
Date settlementDate = Date());
static Date::serial_type
accrualDays(const Leg& leg,
- const ext::optional& includeSettlementDateFlows = ext::nullopt,
+ const std::optional& includeSettlementDateFlows = std::nullopt,
Date settlementDate = Date());
static Time
accruedPeriod(const Leg& leg,
- const ext::optional& includeSettlementDateFlows = ext::nullopt,
+ const std::optional& includeSettlementDateFlows = std::nullopt,
Date settlementDate = Date());
static Date::serial_type
accruedDays(const Leg& leg,
- const ext::optional& includeSettlementDateFlows = ext::nullopt,
+ const std::optional& includeSettlementDateFlows = std::nullopt,
Date settlementDate = Date());
static Real
accruedAmount(const Leg& leg,
- const ext::optional& includeSettlementDateFlows = ext::nullopt,
+ const std::optional& includeSettlementDateFlows = std::nullopt,
Date settlementDate = Date());
//@}
@@ -172,7 +172,7 @@ namespace QuantLib {
*/
static Real npv(const Leg& leg,
const YieldTermStructure& discountCurve,
- const ext::optional& includeSettlementDateFlows = ext::nullopt,
+ const std::optional& includeSettlementDateFlows = std::nullopt,
Date settlementDate = Date(),
Date npvDate = Date());
//! Basis-point sensitivity of the cash flows.
@@ -183,7 +183,7 @@ namespace QuantLib {
*/
static Real bps(const Leg& leg,
const YieldTermStructure& discountCurve,
- const ext::optional& includeSettlementDateFlows = ext::nullopt,
+ const std::optional& includeSettlementDateFlows = std::nullopt,
Date settlementDate = Date(),
Date npvDate = Date());
@@ -193,7 +193,7 @@ namespace QuantLib {
*/
static std::pair npvbps(const Leg& leg,
const YieldTermStructure& discountCurve,
- const ext::optional& includeSettlementDateFlows = ext::nullopt,
+ const std::optional& includeSettlementDateFlows = std::nullopt,
Date settlementDate = Date(),
Date npvDate = Date());
@@ -205,7 +205,7 @@ namespace QuantLib {
*/
static Rate atmRate(const Leg& leg,
const YieldTermStructure& discountCurve,
- const ext::optional& includeSettlementDateFlows = ext::nullopt,
+ const std::optional& includeSettlementDateFlows = std::nullopt,
Date settlementDate = Date(),
Date npvDate = Date(),
Real npv = Null());
@@ -224,7 +224,7 @@ namespace QuantLib {
*/
static Real npv(const Leg& leg,
const InterestRate& yield,
- const ext::optional& includeSettlementDateFlows = ext::nullopt,
+ const std::optional& includeSettlementDateFlows = std::nullopt,
Date settlementDate = Date(),
Date npvDate = Date());
static Real npv(const Leg& leg,
@@ -232,7 +232,7 @@ namespace QuantLib {
const DayCounter& dayCounter,
Compounding compounding,
Frequency frequency,
- const ext::optional& includeSettlementDateFlows = ext::nullopt,
+ const std::optional& includeSettlementDateFlows = std::nullopt,
Date settlementDate = Date(),
Date npvDate = Date());
//! Basis-point sensitivity of the cash flows.
@@ -245,7 +245,7 @@ namespace QuantLib {
*/
static Real bps(const Leg& leg,
const InterestRate& yield,
- const ext::optional& includeSettlementDateFlows = ext::nullopt,
+ const std::optional& includeSettlementDateFlows = std::nullopt,
Date settlementDate = Date(),
Date npvDate = Date());
static Real bps(const Leg& leg,
@@ -253,7 +253,7 @@ namespace QuantLib {
const DayCounter& dayCounter,
Compounding compounding,
Frequency frequency,
- const ext::optional& includeSettlementDateFlows = ext::nullopt,
+ const std::optional& includeSettlementDateFlows = std::nullopt,
Date settlementDate = Date(),
Date npvDate = Date());
//! Implied internal rate of return.
@@ -266,7 +266,7 @@ namespace QuantLib {
const DayCounter& dayCounter,
Compounding compounding,
Frequency frequency,
- const ext::optional& includeSettlementDateFlows = ext::nullopt,
+ const std::optional& includeSettlementDateFlows = std::nullopt,
Date settlementDate = Date(),
Date npvDate = Date(),
Real accuracy = 1.0e-10,
@@ -280,7 +280,7 @@ namespace QuantLib {
const DayCounter& dayCounter,
Compounding compounding,
Frequency frequency,
- const ext::optional& includeSettlementDateFlows = ext::nullopt,
+ const std::optional& includeSettlementDateFlows = std::nullopt,
Date settlementDate = Date(),
Date npvDate = Date(),
Real accuracy = 1.0e-10,
@@ -318,7 +318,7 @@ namespace QuantLib {
static Time duration(const Leg& leg,
const InterestRate& yield,
Duration::Type type,
- const ext::optional& includeSettlementDateFlows = ext::nullopt,
+ const std::optional& includeSettlementDateFlows = std::nullopt,
Date settlementDate = Date(),
Date npvDate = Date());
static Time duration(const Leg& leg,
@@ -327,7 +327,7 @@ namespace QuantLib {
Compounding compounding,
Frequency frequency,
Duration::Type type,
- const ext::optional& includeSettlementDateFlows = ext::nullopt,
+ const std::optional& includeSettlementDateFlows = std::nullopt,
Date settlementDate = Date(),
Date npvDate = Date());
@@ -341,7 +341,7 @@ namespace QuantLib {
*/
static Real convexity(const Leg& leg,
const InterestRate& yield,
- const ext::optional& includeSettlementDateFlows = ext::nullopt,
+ const std::optional& includeSettlementDateFlows = std::nullopt,
Date settlementDate = Date(),
Date npvDate = Date());
static Real convexity(const Leg& leg,
@@ -349,7 +349,7 @@ namespace QuantLib {
const DayCounter& dayCounter,
Compounding compounding,
Frequency frequency,
- const ext::optional& includeSettlementDateFlows = ext::nullopt,
+ const std::optional& includeSettlementDateFlows = std::nullopt,
Date settlementDate = Date(),
Date npvDate = Date());
@@ -359,7 +359,7 @@ namespace QuantLib {
*/
static Real basisPointValue(const Leg& leg,
const InterestRate& yield,
- const ext::optional& includeSettlementDateFlows = ext::nullopt,
+ const std::optional& includeSettlementDateFlows = std::nullopt,
Date settlementDate = Date(),
Date npvDate = Date());
static Real basisPointValue(const Leg& leg,
@@ -367,7 +367,7 @@ namespace QuantLib {
const DayCounter& dayCounter,
Compounding compounding,
Frequency frequency,
- const ext::optional& includeSettlementDateFlows = ext::nullopt,
+ const std::optional& includeSettlementDateFlows = std::nullopt,
Date settlementDate = Date(),
Date npvDate = Date());
@@ -378,7 +378,7 @@ namespace QuantLib {
*/
static Real yieldValueBasisPoint(const Leg& leg,
const InterestRate& yield,
- const ext::optional& includeSettlementDateFlows = ext::nullopt,
+ const std::optional& includeSettlementDateFlows = std::nullopt,
Date settlementDate = Date(),
Date npvDate = Date());
static Real yieldValueBasisPoint(const Leg& leg,
@@ -386,7 +386,7 @@ namespace QuantLib {
const DayCounter& dayCounter,
Compounding compounding,
Frequency frequency,
- const ext::optional& includeSettlementDateFlows = ext::nullopt,
+ const std::optional& includeSettlementDateFlows = std::nullopt,
Date settlementDate = Date(),
Date npvDate = Date());
//@}
@@ -407,7 +407,7 @@ namespace QuantLib {
Spread zSpread,
Compounding compounding,
Frequency frequency,
- const ext::optional& includeSettlementDateFlows = ext::nullopt,
+ const std::optional& includeSettlementDateFlows = std::nullopt,
Date settlementDate = Date(),
Date npvDate = Date());
/*! \deprecated Use the overload without a day counter.
@@ -420,7 +420,7 @@ namespace QuantLib {
const DayCounter& dayCounter,
Compounding compounding,
Frequency frequency,
- const ext::optional& includeSettlementDateFlows = ext::nullopt,
+ const std::optional& includeSettlementDateFlows = std::nullopt,
Date settlementDate = Date(),
Date npvDate = Date());
//! implied Z-spread.
@@ -429,7 +429,7 @@ namespace QuantLib {
const ext::shared_ptr&,
Compounding compounding,
Frequency frequency,
- const ext::optional& includeSettlementDateFlows = ext::nullopt,
+ const std::optional& includeSettlementDateFlows = std::nullopt,
Date settlementDate = Date(),
Date npvDate = Date(),
Real accuracy = 1.0e-10,
@@ -445,7 +445,7 @@ namespace QuantLib {
const DayCounter& dayCounter,
Compounding compounding,
Frequency frequency,
- const ext::optional& includeSettlementDateFlows = ext::nullopt,
+ const std::optional& includeSettlementDateFlows = std::nullopt,
Date settlementDate = Date(),
Date npvDate = Date(),
Real accuracy = 1.0e-10,
diff --git a/ql/cashflows/couponpricer.cpp b/ql/cashflows/couponpricer.cpp
index dcd1288d383..bbfde442fd6 100644
--- a/ql/cashflows/couponpricer.cpp
+++ b/ql/cashflows/couponpricer.cpp
@@ -34,7 +34,7 @@
#include /* internal */
#include
#include
-#include
+#include
#include
namespace QuantLib {
@@ -45,7 +45,7 @@ namespace QuantLib {
IborCouponPricer::IborCouponPricer(
Handle v,
- ext::optional useIndexedCoupon)
+ std::optional useIndexedCoupon)
: capletVol_(std::move(v)),
useIndexedCoupon_(useIndexedCoupon ?
*useIndexedCoupon :
diff --git a/ql/cashflows/couponpricer.hpp b/ql/cashflows/couponpricer.hpp
index 15b54de0056..6075adb2537 100644
--- a/ql/cashflows/couponpricer.hpp
+++ b/ql/cashflows/couponpricer.hpp
@@ -30,7 +30,7 @@
#include
#include
#include
-#include
+#include
#include
#include
#include
@@ -67,7 +67,7 @@ namespace QuantLib {
public:
explicit IborCouponPricer(
Handle v = Handle(),
- ext::optional useIndexedCoupon = ext::nullopt);
+ std::optional useIndexedCoupon = std::nullopt);
bool useIndexedCoupon() const { return useIndexedCoupon_; }
@@ -115,7 +115,7 @@ namespace QuantLib {
const Handle& v = Handle(),
const TimingAdjustment timingAdjustment = Black76,
Handle correlation = Handle(ext::shared_ptr(new SimpleQuote(1.0))),
- const ext::optional useIndexedCoupon = ext::nullopt)
+ const std::optional useIndexedCoupon = std::nullopt)
: IborCouponPricer(v, useIndexedCoupon), timingAdjustment_(timingAdjustment),
correlation_(std::move(correlation)) {
{ // this additional scope seems required to avoid a misleading-indentation warning
diff --git a/ql/cashflows/iborcoupon.cpp b/ql/cashflows/iborcoupon.cpp
index 2fb79e2ec1b..89fd5819770 100644
--- a/ql/cashflows/iborcoupon.cpp
+++ b/ql/cashflows/iborcoupon.cpp
@@ -27,7 +27,7 @@
#include
#include
#include
-#include
+#include
#include
namespace QuantLib {
@@ -264,7 +264,7 @@ namespace QuantLib {
return *this;
}
- IborLeg& IborLeg::withIndexedCoupons(ext::optional b) {
+ IborLeg& IborLeg::withIndexedCoupons(std::optional b) {
useIndexedCoupons_ = b;
return *this;
}
diff --git a/ql/cashflows/iborcoupon.hpp b/ql/cashflows/iborcoupon.hpp
index 7b376d23a30..16922c21f8c 100644
--- a/ql/cashflows/iborcoupon.hpp
+++ b/ql/cashflows/iborcoupon.hpp
@@ -33,7 +33,7 @@
#include
#include
#include
-#include
+#include
namespace QuantLib {
@@ -159,7 +159,7 @@ namespace QuantLib {
BusinessDayConvention,
bool endOfMonth = false);
IborLeg& withFixingConvention(BusinessDayConvention);
- IborLeg& withIndexedCoupons(ext::optional b = true);
+ IborLeg& withIndexedCoupons(std::optional b = true);
IborLeg& withAtParCoupons(bool b = true);
operator Leg() const;
@@ -181,7 +181,7 @@ namespace QuantLib {
Calendar exCouponCalendar_;
BusinessDayConvention exCouponAdjustment_ = Unadjusted;
bool exCouponEndOfMonth_ = false;
- ext::optional useIndexedCoupons_;
+ std::optional useIndexedCoupons_;
};
}
diff --git a/ql/cashflows/overnightindexedcoupon.cpp b/ql/cashflows/overnightindexedcoupon.cpp
index 38695951195..68c16ba32cb 100644
--- a/ql/cashflows/overnightindexedcoupon.cpp
+++ b/ql/cashflows/overnightindexedcoupon.cpp
@@ -523,7 +523,7 @@ namespace QuantLib {
return *this;
}
- OvernightLeg& OvernightLeg::withLastRecentPeriod(const ext::optional& lastRecentPeriod) {
+ OvernightLeg& OvernightLeg::withLastRecentPeriod(const std::optional& lastRecentPeriod) {
lastRecentPeriod_ = lastRecentPeriod;
return *this;
}
diff --git a/ql/cashflows/overnightindexedcoupon.hpp b/ql/cashflows/overnightindexedcoupon.hpp
index cf365e10748..a43fb2a21eb 100644
--- a/ql/cashflows/overnightindexedcoupon.hpp
+++ b/ql/cashflows/overnightindexedcoupon.hpp
@@ -235,7 +235,7 @@ namespace QuantLib {
OvernightLeg& withNakedOption(bool nakedOption);
OvernightLeg& withDailyCapFloor(bool dailyCapFloor = true);
OvernightLeg& inArrears(bool inArrears);
- OvernightLeg& withLastRecentPeriod(const ext::optional& lastRecentPeriod);
+ OvernightLeg& withLastRecentPeriod(const std::optional& lastRecentPeriod);
OvernightLeg& withLastRecentPeriodCalendar(const Calendar& lastRecentPeriodCalendar);
OvernightLeg& withPaymentDates(const std::vector& paymentDates);
OvernightLeg& withCouponPricer(const ext::shared_ptr& couponPricer);
@@ -261,7 +261,7 @@ namespace QuantLib {
bool nakedOption_ = false;
bool dailyCapFloor_ = false;
bool inArrears_ = true;
- ext::optional lastRecentPeriod_;
+ std::optional lastRecentPeriod_;
Calendar lastRecentPeriodCalendar_;
std::vector paymentDates_;
ext::shared_ptr couponPricer_;
diff --git a/ql/config.hpp.cfg b/ql/config.hpp.cfg
index 3f31e1957bb..73a77525d29 100644
--- a/ql/config.hpp.cfg
+++ b/ql/config.hpp.cfg
@@ -39,7 +39,6 @@
#cmakedefine QL_THROW_IN_CYCLES 1
#cmakedefine QL_USE_INDEXED_COUPON 1
#cmakedefine QL_USE_STD_ANY 1
-#cmakedefine QL_USE_STD_OPTIONAL 1
#cmakedefine QL_USE_STD_SHARED_PTR 1
#cmakedefine QL_NULL_AS_FUNCTIONS 1
diff --git a/ql/event.cpp b/ql/event.cpp
index d4145a1eeb8..d8a15cc81df 100644
--- a/ql/event.cpp
+++ b/ql/event.cpp
@@ -20,13 +20,13 @@
#include
#include
-#include
+#include
#include
namespace QuantLib {
bool Event::hasOccurred(const Date& d, // refDate
- ext::optional includeRefDate) const {
+ std::optional includeRefDate) const {
Date refDate =
d != Date() ? d : Settings::instance().evaluationDate();
bool includeRefDateEvent = includeRefDate ? // NOLINT(readability-implicit-bool-conversion)
diff --git a/ql/event.hpp b/ql/event.hpp
index ad6001b616d..0466484b39d 100644
--- a/ql/event.hpp
+++ b/ql/event.hpp
@@ -27,7 +27,7 @@
#include
#include