From 5db36b3563d616f180043ddab84f0084ca3d6907 Mon Sep 17 00:00:00 2001 From: Luigi Ballabio Date: Tue, 23 Jul 2024 14:46:41 +0200 Subject: [PATCH 1/5] Remove switches to enable boost::function, boost::bind and boost::tuple --- .ci/userconfig2019.alt.hpp | 11 --------- .ci/userconfig2022.alt.hpp | 11 --------- .github/workflows/linux-full-tests.yml | 2 +- .github/workflows/linux-nondefault.yml | 2 +- .github/workflows/linux.yml | 2 +- .github/workflows/macos-nondefault.yml | 2 +- CMakeLists.txt | 4 --- CMakePresets.json | 4 --- Docs/pages/config.docs | 14 ----------- configure.ac | 34 -------------------------- ql/config.hpp.cfg | 2 -- ql/functional.hpp | 34 -------------------------- ql/tuple.hpp | 12 --------- ql/userconfig.hpp | 11 --------- 14 files changed, 4 insertions(+), 141 deletions(-) diff --git a/.ci/userconfig2019.alt.hpp b/.ci/userconfig2019.alt.hpp index b4a69298964..d91b29c0c90 100644 --- a/.ci/userconfig2019.alt.hpp +++ b/.ci/userconfig2019.alt.hpp @@ -113,17 +113,6 @@ # define QL_USE_STD_SHARED_PTR #endif -/* Undefine this to use boost::function and boost::bind instead of - std::function and std::bind. */ -#ifndef QL_USE_STD_FUNCTION -//# define QL_USE_STD_FUNCTION -#endif - -/* Undefine this to use boost::tuple instead of std::tuple. */ -#ifndef QL_USE_STD_TUPLE -//# define QL_USE_STD_TUPLE -#endif - /* Define this to enable the implementation of Null as template functions. */ #ifndef QL_NULL_AS_FUNCTIONS # define QL_NULL_AS_FUNCTIONS diff --git a/.ci/userconfig2022.alt.hpp b/.ci/userconfig2022.alt.hpp index b4a69298964..d91b29c0c90 100644 --- a/.ci/userconfig2022.alt.hpp +++ b/.ci/userconfig2022.alt.hpp @@ -113,17 +113,6 @@ # define QL_USE_STD_SHARED_PTR #endif -/* Undefine this to use boost::function and boost::bind instead of - std::function and std::bind. */ -#ifndef QL_USE_STD_FUNCTION -//# define QL_USE_STD_FUNCTION -#endif - -/* Undefine this to use boost::tuple instead of std::tuple. */ -#ifndef QL_USE_STD_TUPLE -//# define QL_USE_STD_TUPLE -#endif - /* Define this to enable the implementation of Null as template functions. */ #ifndef QL_NULL_AS_FUNCTIONS # define QL_NULL_AS_FUNCTIONS diff --git a/.github/workflows/linux-full-tests.yml b/.github/workflows/linux-full-tests.yml index e808b1286f8..b7918d00386 100644 --- a/.github/workflows/linux-full-tests.yml +++ b/.github/workflows/linux-full-tests.yml @@ -148,7 +148,7 @@ jobs: tag: rolling cc: gcc cxx: g++ - configureflags: --disable-std-function --disable-std-tuple --enable-std-pointers --enable-std-any --enable-std-optional + configureflags: --enable-std-pointers --enable-std-any --enable-std-optional - name: "Thread-safe observer enabled" shortname: threadsafe tag: rolling diff --git a/.github/workflows/linux-nondefault.yml b/.github/workflows/linux-nondefault.yml index 7b2344ccb85..94e88261840 100644 --- a/.github/workflows/linux-nondefault.yml +++ b/.github/workflows/linux-nondefault.yml @@ -126,7 +126,7 @@ jobs: cc: gcc cxx: g++ cxxflags: "-std=c++17" - configureflags: --disable-std-function --disable-std-tuple --enable-std-pointers --enable-std-any --enable-std-optional + configureflags: --enable-std-pointers --enable-std-any --enable-std-optional - name: "OpenMP enabled" shortname: openmp tag: rolling diff --git a/.github/workflows/linux.yml b/.github/workflows/linux.yml index 169434343d7..d7c74d82b67 100644 --- a/.github/workflows/linux.yml +++ b/.github/workflows/linux.yml @@ -90,7 +90,7 @@ jobs: tag: rolling cc: gcc cxx: g++ - configureflags: --disable-std-function --disable-std-tuple --enable-std-pointers --enable-std-any --enable-std-optional + configureflags: --enable-std-pointers --enable-std-any --enable-std-optional tests: true - name: "Thread-safe observer enabled" shortname: threadsafe diff --git a/.github/workflows/macos-nondefault.yml b/.github/workflows/macos-nondefault.yml index b49093a499c..03c008e9f3c 100644 --- a/.github/workflows/macos-nondefault.yml +++ b/.github/workflows/macos-nondefault.yml @@ -14,7 +14,7 @@ jobs: include: - classes: std cxxflags: "-std=c++17" - configureflags: --disable-std-function --disable-std-tuple --enable-std-pointers --enable-std-optional --enable-std-any + configureflags: --enable-std-pointers --enable-std-optional --enable-std-any steps: - uses: actions/checkout@v4 - name: Setup diff --git a/CMakeLists.txt b/CMakeLists.txt index a0c8817a587..cdb77ef1cde 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -64,10 +64,8 @@ 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" OFF) option(QL_USE_STD_CLASSES "Enable all QL_USE_STD_ options" OFF) -option(QL_USE_STD_FUNCTION "Use std::function and std::bind instead of Boost ones" ON) option(QL_USE_STD_OPTIONAL "Use std::optional instead of boost::optional" OFF) option(QL_USE_STD_SHARED_PTR "Use standard smart pointers instead of Boost ones" OFF) -option(QL_USE_STD_TUPLE "Use std::tuple instead of boost::tuple" ON) set(QL_EXTERNAL_SUBDIRECTORIES "" CACHE STRING "Optional list of external source directories to be added to the build (semicolon-separated)") # set -lpapi here set(QL_EXTRA_LINK_LIBRARIES "" CACHE STRING "Optional extra link libraries to add to QuantLib") @@ -92,9 +90,7 @@ if (QL_USE_STD_CLASSES) set(QL_USE_STD_ANY ON) set(QL_USE_STD_OPTIONAL ON) endif() - set(QL_USE_STD_FUNCTION ON) set(QL_USE_STD_SHARED_PTR ON) - set(QL_USE_STD_TUPLE ON) endif() if (CMAKE_CXX_STANDARD LESS 17) diff --git a/CMakePresets.json b/CMakePresets.json index 632c4ad97b6..16a58c5f636 100644 --- a/CMakePresets.json +++ b/CMakePresets.json @@ -305,8 +305,6 @@ "QL_USE_STD_SHARED_PTR": "ON", "QL_USE_STD_ANY": "ON", "QL_USE_STD_OPTIONAL": "ON", - "QL_USE_STD_FUNCTION": "OFF", - "QL_USE_STD_TUPLE": "OFF", "QL_COMPILE_WARNING_AS_ERROR": "ON" } }, @@ -328,8 +326,6 @@ "QL_USE_STD_SHARED_PTR": "ON", "QL_USE_STD_ANY": "ON", "QL_USE_STD_OPTIONAL": "ON", - "QL_USE_STD_FUNCTION": "OFF", - "QL_USE_STD_TUPLE": "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 11045077c2a..d10cde45bf2 100644 --- a/Docs/pages/config.docs +++ b/Docs/pages/config.docs @@ -127,20 +127,6 @@ default) the Boost facilities are used. Note that `std::shared_ptr` does not check access and can cause segmentation faults. - \code - #define QL_USE_STD_FUNCTION - \endcode - If defined (the default), `std::function`, `std::bind` and related - classes and functions are used. If disabled, the corresponding - Boost facilities are used instead. - - \code - #define QL_USE_STD_TUPLE - \endcode - If defined (the default), `std::tuple` and related classes and - functions are used. If disabled, the corresponding Boost - facilities are used instead.. - \code #define QL_USE_STD_ANY \endcode diff --git a/configure.ac b/configure.ac index efc8cfbe08f..8fa21e7c5da 100644 --- a/configure.ac +++ b/configure.ac @@ -432,36 +432,6 @@ if test "$ql_use_std_pointers" = "yes" ; then fi AC_MSG_RESULT([$ql_use_std_pointers]) -AC_MSG_CHECKING([whether to enable std::function]) -AC_ARG_ENABLE([std-function], - AS_HELP_STRING([--enable-std-function], - [If enabled (the default), std::function - and std::bind will be used. If - disabled, the corresponding Boost - classes will be used instead.]), - [ql_use_std_function=$enableval], - [ql_use_std_function=yes]) -if test "$ql_use_std_function" = "yes" ; then - AC_DEFINE([QL_USE_STD_FUNCTION],[1], - [Define this if you want to use std::function and std::bind.]) -fi -AC_MSG_RESULT([$ql_use_std_function]) - -AC_MSG_CHECKING([whether to enable std::tuple]) -AC_ARG_ENABLE([std-tuple], - AS_HELP_STRING([--enable-std-tuple], - [If enabled (the default), std::tuple and - related functions will be used. If - disabled, the corresponding Boost - facilities will be used instead.]), - [ql_use_std_tuple=$enableval], - [ql_use_std_tuple=yes]) -if test "$ql_use_std_tuple" = "yes" ; then - AC_DEFINE([QL_USE_STD_TUPLE],[1], - [Define this if you want to use std::tuple.]) -fi -AC_MSG_RESULT([$ql_use_std_tuple]) - AC_MSG_CHECKING([whether to enable available std classes]) AC_ARG_ENABLE([std-classes], AS_HELP_STRING([--enable-std-classes], @@ -474,10 +444,6 @@ AC_ARG_ENABLE([std-classes], if test "$ql_use_std_classes" = "yes" ; then AC_DEFINE([QL_USE_STD_SHARED_PTR],[1], [Define this if you want to use standard smart pointers.]) - AC_DEFINE([QL_USE_STD_FUNCTION],[1], - [Define this if you want to use std::function and std::bind.]) - AC_DEFINE([QL_USE_STD_TUPLE],[1], - [Define this if you want to use std::tuple.]) fi AC_MSG_RESULT([$ql_use_std_classes]) diff --git a/ql/config.hpp.cfg b/ql/config.hpp.cfg index a1d2a699c48..d273e95e661 100644 --- a/ql/config.hpp.cfg +++ b/ql/config.hpp.cfg @@ -41,8 +41,6 @@ #cmakedefine QL_USE_STD_ANY 1 #cmakedefine QL_USE_STD_OPTIONAL 1 #cmakedefine QL_USE_STD_SHARED_PTR 1 -#cmakedefine QL_USE_STD_FUNCTION 1 -#cmakedefine QL_USE_STD_TUPLE 1 #cmakedefine QL_NULL_AS_FUNCTIONS 1 #endif diff --git a/ql/functional.hpp b/ql/functional.hpp index b4624ddc223..bf7112ba917 100644 --- a/ql/functional.hpp +++ b/ql/functional.hpp @@ -25,20 +25,12 @@ #define quantlib_functional_hpp #include - -#if defined(QL_USE_STD_FUNCTION) #include -#else -#include -#include -#include -#endif namespace QuantLib { namespace ext { - #if defined(QL_USE_STD_FUNCTION) using std::function; // NOLINT(misc-unused-using-decls) using std::bind; // NOLINT(misc-unused-using-decls) using std::ref; // NOLINT(misc-unused-using-decls) @@ -51,32 +43,6 @@ namespace QuantLib { Deprecated in version 1.32. */ #define QL_NULL_FUNCTION nullptr - #else - using boost::function; // NOLINT(misc-unused-using-decls) - using boost::bind; // NOLINT(misc-unused-using-decls) - using boost::ref; // NOLINT(misc-unused-using-decls) - using boost::cref; // NOLINT(misc-unused-using-decls) - namespace placeholders { - #if BOOST_VERSION >= 106000 - using namespace boost::placeholders; // NOLINT(misc-unused-using-decls) - #else - using ::_1; // NOLINT(misc-unused-using-decls) - using ::_2; // NOLINT(misc-unused-using-decls) - using ::_3; // NOLINT(misc-unused-using-decls) - using ::_4; // NOLINT(misc-unused-using-decls) - using ::_5; // NOLINT(misc-unused-using-decls) - using ::_6; // NOLINT(misc-unused-using-decls) - using ::_7; // NOLINT(misc-unused-using-decls) - using ::_8; // NOLINT(misc-unused-using-decls) - using ::_9; // NOLINT(misc-unused-using-decls) - #endif - } - /*! \deprecated To check if a function is empty, use it in a bool context - instead of comparing it to QL_NULL_FUNCTION. - Deprecated in version 1.32. - */ - #define QL_NULL_FUNCTION 0 - #endif } diff --git a/ql/tuple.hpp b/ql/tuple.hpp index 3fabddf9679..ad0ac61fff4 100644 --- a/ql/tuple.hpp +++ b/ql/tuple.hpp @@ -25,28 +25,16 @@ #define quantlib_tuple_hpp #include - -#if defined(QL_USE_STD_TUPLE) #include -#else -#include -#endif namespace QuantLib { namespace ext { - #if defined(QL_USE_STD_TUPLE) using std::tuple; // NOLINT(misc-unused-using-decls) using std::make_tuple; // NOLINT(misc-unused-using-decls) using std::get; // NOLINT(misc-unused-using-decls) using std::tie; // NOLINT(misc-unused-using-decls) - #else - using boost::tuple; // NOLINT(misc-unused-using-decls) - using boost::make_tuple; // NOLINT(misc-unused-using-decls) - using boost::get; // NOLINT(misc-unused-using-decls) - using boost::tie; // NOLINT(misc-unused-using-decls) - #endif } diff --git a/ql/userconfig.hpp b/ql/userconfig.hpp index 9d2696a008e..c244b0d2899 100644 --- a/ql/userconfig.hpp +++ b/ql/userconfig.hpp @@ -113,17 +113,6 @@ //# define QL_USE_STD_SHARED_PTR #endif -/* Undefine this to use boost::function and boost::bind instead of - std::function and std::bind. */ -#ifndef QL_USE_STD_FUNCTION -# define QL_USE_STD_FUNCTION -#endif - -/* Undefine this to use boost::tuple instead of std::tuple. */ -#ifndef QL_USE_STD_TUPLE -# define QL_USE_STD_TUPLE -#endif - /* Define this to enable the implementation of Null as template functions. */ #ifndef QL_NULL_AS_FUNCTIONS //# define QL_NULL_AS_FUNCTIONS From e7c9149063f3c5b18970d0f14b5ccfec1f99756d Mon Sep 17 00:00:00 2001 From: Luigi Ballabio Date: Tue, 23 Jul 2024 15:25:40 +0200 Subject: [PATCH 2/5] Deprecate ext::function, ext::bind, ext::tuple and family. --- ql/functional.hpp | 25 +++++++++++++++++++++++-- ql/tuple.hpp | 18 +++++++++++++++++- 2 files changed, 40 insertions(+), 3 deletions(-) diff --git a/ql/functional.hpp b/ql/functional.hpp index bf7112ba917..b6f52498fd9 100644 --- a/ql/functional.hpp +++ b/ql/functional.hpp @@ -31,13 +31,34 @@ namespace QuantLib { namespace ext { - using std::function; // NOLINT(misc-unused-using-decls) + /*! \deprecated Use std::function instead. + Deprecated in version 1.36. + */ + template + using function [[deprecated("Use std::function instead")]] = std::function; // NOLINT(misc-unused-using-decls) + + /*! \deprecated Use std::bind instead. + Deprecated in version 1.36. + */ using std::bind; // NOLINT(misc-unused-using-decls) + + /*! \deprecated Use std::ref instead. + Deprecated in version 1.36. + */ using std::ref; // NOLINT(misc-unused-using-decls) + + /*! \deprecated Use std::cref instead. + Deprecated in version 1.36. + */ using std::cref; // NOLINT(misc-unused-using-decls) - namespace placeholders { + + /*! \deprecated Use the std::placeholders namespace instead. + Deprecated in version 1.36. + */ + namespace [[deprecated("Use the std::placeholders namespace instead")]] placeholders { using namespace std::placeholders; // NOLINT(misc-unused-using-decls) } + /*! \deprecated To check if a function is empty, use it in a bool context instead of comparing it to QL_NULL_FUNCTION. Deprecated in version 1.32. diff --git a/ql/tuple.hpp b/ql/tuple.hpp index ad0ac61fff4..0ca95966135 100644 --- a/ql/tuple.hpp +++ b/ql/tuple.hpp @@ -31,9 +31,25 @@ namespace QuantLib { namespace ext { - using std::tuple; // NOLINT(misc-unused-using-decls) + /*! \deprecated Use std::tuple instead. + Deprecated in version 1.36. + */ + template + using tuple [[deprecated("Use std::tuple instead")]] = std::tuple; // NOLINT(misc-unused-using-decls) + + /*! \deprecated Use std::make_tuple instead. + Deprecated in version 1.36. + */ using std::make_tuple; // NOLINT(misc-unused-using-decls) + + /*! \deprecated Use std::get instead. + Deprecated in version 1.36. + */ using std::get; // NOLINT(misc-unused-using-decls) + + /*! \deprecated Use std::tie or structured bindings instead. + Deprecated in version 1.36. + */ using std::tie; // NOLINT(misc-unused-using-decls) } From 860cb5019dc58f3c6437ff5e5d51779431fd5ecf Mon Sep 17 00:00:00 2001 From: Luigi Ballabio Date: Tue, 23 Jul 2024 16:46:14 +0200 Subject: [PATCH 3/5] Add workflow to replace deprecated ext:: classes and functions --- .github/workflows/namespaces.yml | 30 ++++++++++++++++++++++++++++++ 1 file changed, 30 insertions(+) create mode 100644 .github/workflows/namespaces.yml diff --git a/.github/workflows/namespaces.yml b/.github/workflows/namespaces.yml new file mode 100644 index 00000000000..31bb83036f5 --- /dev/null +++ b/.github/workflows/namespaces.yml @@ -0,0 +1,30 @@ +name: Fix deprecated uses of ext namespace +on: + push: + branches: + - '**' +jobs: + namespaces: + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v4 + - name: Check + run: | + shopt -s globstar + sed -i -e 's/ext::function\b/std::function/g' **/*.[hc]pp + sed -i -e 's/ext::bind\b/std::bind/g' **/*.[hc]pp + sed -i -e 's/ext::ref\b/std::ref/g' **/*.[hc]pp + sed -i -e 's/ext::cref\b/std::cref/g' **/*.[hc]pp + sed -i -e 's/ext::placeholders\b/std::placeholders/g' **/*.[hc]pp + sed -i -e 's/ext::tuple\b/std::tuple/g' **/*.[hc]pp + sed -i -e 's/ext::make_tuple\b/std::make_tuple/g' **/*.[hc]pp + sed -i -e 's/ext::get\b/std::get/g' **/*.[hc]pp + sed -i -e 's/ext::tie\b/std::tie/g' **/*.[hc]pp + - uses: peter-evans/create-pull-request@v6 + with: + token: ${{ secrets.GITHUB_TOKEN }} + branch: fix-ext-namespace-${{ github.ref_name }} + delete-branch: true + commit-message: 'Fix deprecated uses of ext namespace' + title: 'Fix deprecated uses of ext namespace' + author: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com> From d45d6c25f53a948a8a5e55464464aba6139a5081 Mon Sep 17 00:00:00 2001 From: "github-actions[bot]" <41898282+github-actions[bot]@users.noreply.github.com> Date: Tue, 23 Jul 2024 15:18:23 +0000 Subject: [PATCH 4/5] Fix deprecated uses of ext namespace --- Examples/GlobalOptimizer/GlobalOptimizer.cpp | 4 +- .../MultidimIntegral/MultidimIntegral.cpp | 2 +- ql/cashflows/conundrumpricer.cpp | 14 +++--- .../perturbativebarrieroptionengine.cpp | 10 ++-- .../callablebonds/callablebond.cpp | 8 ++-- .../credit/randomdefaultlatentmodel.hpp | 8 ++-- .../credit/saddlepointlossmodel.hpp | 40 ++++++++-------- .../finitedifferences/fdmvppstepcondition.hpp | 2 +- ...gaussiannoncentralchisquaredpolynomial.cpp | 8 ++-- ...gaussiannoncentralchisquaredpolynomial.hpp | 2 +- ql/experimental/math/latentmodel.hpp | 18 ++++---- ql/experimental/math/multidimintegrator.hpp | 18 ++++---- ql/experimental/math/multidimquadrature.hpp | 36 +++++++-------- ql/experimental/math/piecewiseintegral.hpp | 8 ++-- .../longstaffschwartzmultipathpricer.hpp | 2 +- ql/experimental/models/normalclvmodel.cpp | 4 +- ql/experimental/models/normalclvmodel.hpp | 4 +- ql/experimental/models/squarerootclvmodel.cpp | 4 +- ql/experimental/models/squarerootclvmodel.hpp | 4 +- .../extendedornsteinuhlenbeckprocess.cpp | 6 +-- .../extendedornsteinuhlenbeckprocess.hpp | 4 +- .../shortrate/generalizedhullwhite.cpp | 12 ++--- .../shortrate/generalizedhullwhite.hpp | 32 ++++++------- .../generalizedornsteinuhlenbeckprocess.cpp | 2 +- .../generalizedornsteinuhlenbeckprocess.hpp | 8 ++-- .../integralhestonvarianceoptionengine.cpp | 2 +- ql/math/integrals/discreteintegrals.cpp | 4 +- ql/math/integrals/discreteintegrals.hpp | 4 +- ql/math/integrals/expsinhintegral.hpp | 8 ++-- ql/math/integrals/filonintegral.cpp | 4 +- ql/math/integrals/filonintegral.hpp | 2 +- ql/math/integrals/gaussianquadratures.cpp | 2 +- ql/math/integrals/gaussianquadratures.hpp | 2 +- ql/math/integrals/gausslobattointegral.cpp | 6 +-- ql/math/integrals/gausslobattointegral.hpp | 6 +-- ql/math/integrals/integral.cpp | 2 +- ql/math/integrals/integral.hpp | 4 +- ql/math/integrals/kronrodintegral.cpp | 6 +-- ql/math/integrals/kronrodintegral.hpp | 6 +-- ql/math/integrals/segmentintegral.hpp | 4 +- ql/math/integrals/simpsonintegral.hpp | 2 +- ql/math/integrals/tanhsinhintegral.hpp | 4 +- ql/math/integrals/trapezoidintegral.hpp | 6 +-- ql/math/integrals/twodimensionalintegral.hpp | 4 +- .../interpolations/chebyshevinterpolation.cpp | 4 +- .../interpolations/chebyshevinterpolation.hpp | 2 +- ql/math/linearleastsquaresregression.hpp | 10 ++-- ql/math/matrixutilities/bicgstab.hpp | 2 +- ql/math/matrixutilities/gmres.hpp | 2 +- ql/math/matrixutilities/tapcorrelations.hpp | 4 +- ql/math/ode/adaptiverungekutta.hpp | 4 +- ql/math/optimization/lmdif.hpp | 2 +- .../stochasticcollocationinvcdf.cpp | 4 +- .../stochasticcollocationinvcdf.hpp | 2 +- ql/math/richardsonextrapolation.cpp | 2 +- ql/math/richardsonextrapolation.hpp | 4 +- .../meshers/concentrating1dmesher.cpp | 8 ++-- .../meshers/concentrating1dmesher.hpp | 2 +- .../operators/nthorderderivativeop.cpp | 2 +- .../operators/numericaldifferentiation.cpp | 4 +- .../operators/numericaldifferentiation.hpp | 6 +-- .../utilities/escroweddividendadjustment.cpp | 2 +- .../utilities/escroweddividendadjustment.hpp | 4 +- .../fdmdiscountdirichletboundary.cpp | 2 +- .../utilities/fdminnervaluecalculator.cpp | 6 +-- .../utilities/fdminnervaluecalculator.hpp | 4 +- .../utilities/fdmmesherintegral.cpp | 2 +- .../utilities/fdmmesherintegral.hpp | 4 +- .../utilities/fdmtimedepdirichletboundary.cpp | 4 +- .../utilities/fdmtimedepdirichletboundary.hpp | 8 ++-- .../montecarlo/earlyexercisepathpricer.hpp | 2 +- .../longstaffschwartzpathpricer.hpp | 2 +- ql/methods/montecarlo/lsmbasissystem.cpp | 4 +- ql/methods/montecarlo/lsmbasissystem.hpp | 4 +- ql/models/equity/hestonslvfdmmodel.cpp | 20 ++++---- .../basket/mcamericanbasketengine.cpp | 2 +- .../basket/mcamericanbasketengine.hpp | 4 +- .../vanilla/analytichestonengine.cpp | 20 ++++---- .../vanilla/analytichestonengine.hpp | 6 +-- .../vanilla/analyticptdhestonengine.cpp | 2 +- .../vanilla/fdcevvanillaengine.cpp | 2 +- .../vanilla/mcamericanengine.cpp | 2 +- .../vanilla/mcamericanengine.hpp | 4 +- ql/termstructures/globalbootstrap.hpp | 16 +++---- .../andreasenhugevolatilityinterpl.cpp | 14 +++--- .../andreasenhugevolatilityinterpl.hpp | 4 +- ql/timeseries.hpp | 4 +- test-suite/andreasenhugevolatilityinterpl.cpp | 8 ++-- test-suite/fdheston.cpp | 24 +++++----- test-suite/fdmlinearop.cpp | 8 ++-- test-suite/fdsabr.cpp | 4 +- test-suite/hestonmodel.cpp | 8 ++-- test-suite/hestonslvmodel.cpp | 46 +++++++++---------- test-suite/integrals.cpp | 2 +- test-suite/interpolations.cpp | 28 +++++------ test-suite/linearleastsquaresregression.cpp | 8 ++-- test-suite/mclongstaffschwartzengine.cpp | 2 +- test-suite/normalclvmodel.cpp | 10 ++-- test-suite/numericaldifferentiation.cpp | 26 +++++------ test-suite/squarerootclvmodel.cpp | 14 +++--- test-suite/swingoption.cpp | 4 +- test-suite/utilities.hpp | 2 +- test-suite/vpp.cpp | 8 ++-- 103 files changed, 376 insertions(+), 376 deletions(-) diff --git a/Examples/GlobalOptimizer/GlobalOptimizer.cpp b/Examples/GlobalOptimizer/GlobalOptimizer.cpp index 31a2e63f0c9..6e74084afb5 100644 --- a/Examples/GlobalOptimizer/GlobalOptimizer.cpp +++ b/Examples/GlobalOptimizer/GlobalOptimizer.cpp @@ -132,8 +132,8 @@ Real printFunction(Problem& p, const Array& x) { class TestFunction : public CostFunction { public: - typedef ext::function RealFunc; - typedef ext::function ArrayFunc; + typedef std::function RealFunc; + typedef std::function ArrayFunc; explicit TestFunction(RealFunc f, ArrayFunc fs = ArrayFunc()) : f_(std::move(f)), fs_(std::move(fs)) {} explicit TestFunction(Real (*f)(const Array&), Array (*fs)(const Array&) = nullptr) diff --git a/Examples/MultidimIntegral/MultidimIntegral.cpp b/Examples/MultidimIntegral/MultidimIntegral.cpp index b6185255408..12ce93b41f8 100644 --- a/Examples/MultidimIntegral/MultidimIntegral.cpp +++ b/Examples/MultidimIntegral/MultidimIntegral.cpp @@ -62,7 +62,7 @@ int main() { Real exactSol = std::pow(std::exp(-.25) * std::sqrt(M_PI), static_cast(dimension)); - ext::function& arg)> f = integrand(); + std::function& arg)> f = integrand(); #ifndef QL_PATCH_SOLARIS GaussianQuadMultidimIntegrator intg(dimension, 15); diff --git a/ql/cashflows/conundrumpricer.cpp b/ql/cashflows/conundrumpricer.cpp index 585c91ea45f..92aa2785cd0 100644 --- a/ql/cashflows/conundrumpricer.cpp +++ b/ql/cashflows/conundrumpricer.cpp @@ -232,7 +232,7 @@ namespace QuantLib { class VariableChange { public: - VariableChange(ext::function& f, + VariableChange(std::function& f, Real a, Real b, Size k) : a_(a), width_(b-a), f_(f), k_(k) {} Real value(Real x) const { @@ -246,13 +246,13 @@ namespace QuantLib { } private: Real a_, width_; - ext::function f_; + std::function f_; Size k_; }; class Spy { public: - explicit Spy(ext::function f) : f_(std::move(f)) {} + explicit Spy(std::function f) : f_(std::move(f)) {} Real value(Real x){ abscissas.push_back(x); Real value = f_(x); @@ -260,7 +260,7 @@ namespace QuantLib { return value; } private: - ext::function f_; + std::function f_; std::vector abscissas; std::vector functionValues; }; @@ -298,7 +298,7 @@ namespace QuantLib { if (b > a) upperBoundary = std::min(upperBoundary, b); - ext::function f; + std::function f; GaussKronrodNonAdaptive gaussKronrodNonAdaptive(precision_, 1000000, 1.0); // if the integration intervall is wide enough we use the @@ -306,13 +306,13 @@ namespace QuantLib { upperBoundary = std::max(a, std::min(upperBoundary, hardUpperLimit_)); if (upperBoundary > 2 * a) { Size k = 3; - ext::function temp = ext::cref(integrand); + std::function temp = std::cref(integrand); VariableChange variableChange(temp, a, upperBoundary, k); f = [&](Real _x) { return variableChange.value(_x); }; result = gaussKronrodNonAdaptive(f, .0, 1.0); } else { - f = ext::cref(integrand); + f = std::cref(integrand); result = gaussKronrodNonAdaptive(f, a, upperBoundary); } diff --git a/ql/experimental/barrieroption/perturbativebarrieroptionengine.cpp b/ql/experimental/barrieroption/perturbativebarrieroptionengine.cpp index a187e2efed7..cb80a9032e0 100644 --- a/ql/experimental/barrieroption/perturbativebarrieroptionengine.cpp +++ b/ql/experimental/barrieroption/perturbativebarrieroptionengine.cpp @@ -83,11 +83,11 @@ namespace QuantLib { Real taumax, int iord, int igm, - const ext::function& integr, - const ext::function& integalpha, - const ext::function& integs, - const ext::function& alpha, - const ext::function& sigmaq) { + const std::function& integr, + const std::function& integalpha, + const std::function& integs, + const std::function& alpha, + const std::function& sigmaq) { Real v0=0.0, v1=0.0, v1p=0.0, v2p=0.0, v2pp=0.0, gm=0.0; int i=0,j=0; Real tmp=0.0, e1=0.0, e2=0.0, e3=0.0, e4=0.0; diff --git a/ql/experimental/callablebonds/callablebond.cpp b/ql/experimental/callablebonds/callablebond.cpp index d16de03e1ee..57115a2eaf0 100644 --- a/ql/experimental/callablebonds/callablebond.cpp +++ b/ql/experimental/callablebonds/callablebond.cpp @@ -157,7 +157,7 @@ namespace QuantLib { class OASHelper { public: - OASHelper(const ext::function& npvhelper, + OASHelper(const std::function& npvhelper, Real targetValue): npvhelper_(npvhelper), targetValue_(targetValue) @@ -169,7 +169,7 @@ namespace QuantLib { return targetValue_ - npvhelper_(x); } private: - const ext::function& npvhelper_; + const std::function& npvhelper_; Real targetValue_; }; @@ -292,7 +292,7 @@ namespace QuantLib { Real dirtyPrice = cleanPrice + accruedAmount(settlement); dirtyPrice /= 100.0 / notional(settlement); - ext::function f = NPVSpreadHelper(*this); + std::function f = NPVSpreadHelper(*this); OASHelper obj(f, dirtyPrice); Brent solver; @@ -328,7 +328,7 @@ namespace QuantLib { compounding, frequency); - ext::function f = NPVSpreadHelper(*this); + std::function f = NPVSpreadHelper(*this); Real P = f(oas) * 100.0 / notional(settlement) - accruedAmount(settlement); diff --git a/ql/experimental/credit/randomdefaultlatentmodel.hpp b/ql/experimental/credit/randomdefaultlatentmodel.hpp index eb45fef55ee..98f8f7b4a3e 100644 --- a/ql/experimental/credit/randomdefaultlatentmodel.hpp +++ b/ql/experimental/credit/randomdefaultlatentmodel.hpp @@ -181,7 +181,7 @@ namespace QuantLib { Real percentile(const Date& d, Real percentile) const override; /*! Returns the VaR value for a given percentile and the 95 confidence interval of that value. */ - virtual ext::tuple percentileAndInterval( + virtual std::tuple percentileAndInterval( const Date& d, Real percentile) const; /*! Distributes the total VaR amount along the portfolio counterparties. The passed loss amount is in loss units. @@ -524,7 +524,7 @@ namespace QuantLib { template