Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 0 additions & 5 deletions .ci/userconfig2019.alt.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -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. */
Expand Down
5 changes: 0 additions & 5 deletions .ci/userconfig2022.alt.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -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. */
Expand Down
5 changes: 0 additions & 5 deletions .ci/userconfig2026.alt.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -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. */
Expand Down
2 changes: 0 additions & 2 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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()

Expand Down
2 changes: 0 additions & 2 deletions CMakePresets.json
Original file line number Diff line number Diff line change
Expand Up @@ -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"
}
},
Expand All @@ -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"
}
Expand Down
9 changes: 0 additions & 9 deletions Docs/pages/config.docs
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
1 change: 1 addition & 0 deletions cmake/GenerateHeaders.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@ function(generate_ql_header source_dir binary_dir)
list(FILTER children_hpp EXCLUDE REGEX "config.*.hpp")
list(FILTER children_hpp EXCLUDE REGEX "mathconstants.hpp")
list(FILTER children_hpp EXCLUDE REGEX "qldefines.hpp")
list(FILTER children_hpp EXCLUDE REGEX "optional.hpp")
list(FILTER children_hpp EXCLUDE REGEX "quantlib.hpp")
list(FILTER children_hpp EXCLUDE REGEX "version.hpp")

Expand Down
21 changes: 0 additions & 21 deletions configure.ac
Original file line number Diff line number Diff line change
Expand Up @@ -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],
Expand Down Expand Up @@ -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
Expand Down
4 changes: 2 additions & 2 deletions ql/cashflow.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@
namespace QuantLib {

bool CashFlow::hasOccurred(const Date& refDate,
ext::optional<bool> includeRefDate) const {
std::optional<bool> includeRefDate) const {

// easy and quick handling of most cases
if (refDate != Date()) {
Expand All @@ -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<bool> includeToday =
std::optional<bool> includeToday =
Settings::instance().includeTodaysCashFlows();
if (includeToday.has_value())
includeRefDate = includeToday;
Expand Down
4 changes: 2 additions & 2 deletions ql/cashflow.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@

#include <ql/event.hpp>
#include <ql/math/comparison.hpp>
#include <ql/optional.hpp>
#include <optional>
#include <ql/patterns/lazyobject.hpp>
#include <vector>

Expand All @@ -49,7 +49,7 @@ namespace QuantLib {
Settings::includeTodaysCashflows in account
*/
bool hasOccurred(const Date& refDate = Date(),
ext::optional<bool> includeRefDate = ext::nullopt) const override;
std::optional<bool> includeRefDate = std::nullopt) const override;
//@}
//! \name LazyObject interface
//@{
Expand Down
Loading