Skip to content

Commit

Permalink
Update ext::optional for C++17 (#2042)
Browse files Browse the repository at this point in the history
  • Loading branch information
lballabio committed Jul 29, 2024
2 parents 3d45b9a + 403b2e4 commit 66ac60d
Show file tree
Hide file tree
Showing 6 changed files with 4 additions and 40 deletions.
1 change: 0 additions & 1 deletion QuantLib.vcxproj
Original file line number Diff line number Diff line change
Expand Up @@ -2831,7 +2831,6 @@
<ClCompile Include="ql\instrument.cpp" />
<ClCompile Include="ql\interestrate.cpp" />
<ClCompile Include="ql\money.cpp" />
<ClCompile Include="ql\optional.cpp" />
<ClCompile Include="ql\position.cpp" />
<ClCompile Include="ql\prices.cpp" />
<ClCompile Include="ql\rebatedexercise.cpp" />
Expand Down
1 change: 0 additions & 1 deletion QuantLib.vcxproj.filters
Original file line number Diff line number Diff line change
Expand Up @@ -6662,7 +6662,6 @@
<ClCompile Include="ql\instrument.cpp" />
<ClCompile Include="ql\interestrate.cpp" />
<ClCompile Include="ql\money.cpp" />
<ClCompile Include="ql\optional.cpp" />
<ClCompile Include="ql\position.cpp" />
<ClCompile Include="ql\prices.cpp" />
<ClCompile Include="ql\settings.cpp" />
Expand Down
5 changes: 2 additions & 3 deletions ql/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -375,7 +375,7 @@ set(QL_SOURCES
math/integrals/integral.cpp
math/integrals/kronrodintegral.cpp
math/integrals/segmentintegral.cpp
math/interpolations/chebyshevinterpolation.cpp
math/interpolations/chebyshevinterpolation.cpp
math/matrix.cpp
math/matrixutilities/basisincompleteordered.cpp
math/matrixutilities/bicgstab.cpp
Expand Down Expand Up @@ -646,7 +646,6 @@ set(QL_SOURCES
models/volatility/constantestimator.cpp
models/volatility/garch.cpp
money.cpp
optional.cpp
patterns/observable.cpp
position.cpp
prices.cpp
Expand Down Expand Up @@ -1451,7 +1450,7 @@ set(QL_HEADERS
math/interpolations/backwardflatlinearinterpolation.hpp
math/interpolations/bicubicsplineinterpolation.hpp
math/interpolations/bilinearinterpolation.hpp
math/interpolations/chebyshevinterpolation.hpp
math/interpolations/chebyshevinterpolation.hpp
math/interpolations/convexmonotoneinterpolation.hpp
math/interpolations/cubicinterpolation.hpp
math/interpolations/extrapolation.hpp
Expand Down
4 changes: 1 addition & 3 deletions ql/Makefile.am
Original file line number Diff line number Diff line change
Expand Up @@ -75,7 +75,6 @@ cpp_files = \
instrument.cpp \
interestrate.cpp \
money.cpp \
optional.cpp \
position.cpp \
prices.cpp \
rebatedexercise.cpp \
Expand Down Expand Up @@ -103,7 +102,7 @@ else

libQuantLib_la_SOURCES = $(cpp_files)

EXTRA_DIST =
EXTRA_DIST =

endif

Expand Down Expand Up @@ -180,4 +179,3 @@ install-data-hook:
rm .config.hpp
depend:
makedepend $(INCLUDES) -- $(CFLAGS) -- $(SOURCES)

29 changes: 0 additions & 29 deletions ql/optional.cpp

This file was deleted.

4 changes: 1 addition & 3 deletions ql/optional.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -36,12 +36,10 @@ namespace QuantLib::ext {

#if defined(QL_USE_STD_OPTIONAL)
using std::optional; // NOLINT(misc-unused-using-decls)
// here we can assume C++17
inline constexpr const std::nullopt_t& nullopt = std::nullopt;
#else
using boost::optional; // NOLINT(misc-unused-using-decls)
// here we can't
extern const boost::none_t& nullopt;
inline constexpr const boost::none_t& nullopt = boost::none;
#endif

}
Expand Down

0 comments on commit 66ac60d

Please sign in to comment.