Skip to content

Commit

Permalink
Merge 8f1cbbd into 372b2f4
Browse files Browse the repository at this point in the history
  • Loading branch information
lballabio committed Apr 20, 2022
2 parents 372b2f4 + 8f1cbbd commit b02d7cc
Show file tree
Hide file tree
Showing 28 changed files with 71 additions and 90 deletions.
6 changes: 3 additions & 3 deletions .appveyor.yml
@@ -1,5 +1,5 @@
image:
- Visual Studio 2013
- Visual Studio 2015
- Visual Studio 2022

platform: x64
Expand All @@ -16,9 +16,9 @@ for:
-
matrix:
only:
- image: Visual Studio 2013
- image: Visual Studio 2015
before_build:
- COPY .appveyor\VS2013.props .\Build.props
- COPY .appveyor\VS2015.props .\Build.props
test_script:
- .\test-suite\bin\QuantLib-test-suite-x64-mt.exe --log_level=message --build_info=yes -- --faster
-
Expand Down
4 changes: 2 additions & 2 deletions .appveyor/VS2013.props → .appveyor/VS2015.props
Expand Up @@ -4,10 +4,10 @@
<PropertyGroup Label="UserMacros" />
<ItemDefinitionGroup>
<ClCompile>
<AdditionalIncludeDirectories>C:\Libraries\boost_1_58_0;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
<AdditionalIncludeDirectories>C:\Libraries\boost_1_69_0;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
</ClCompile>
<Link>
<AdditionalLibraryDirectories>C:\Libraries\boost_1_58_0\lib64-msvc-12.0;%(AdditionalLibraryDirectories)</AdditionalLibraryDirectories>
<AdditionalLibraryDirectories>C:\Libraries\boost_1_69_0\lib64-msvc-14.0;%(AdditionalLibraryDirectories)</AdditionalLibraryDirectories>
</Link>
</ItemDefinitionGroup>
<ItemGroup />
Expand Down
7 changes: 2 additions & 5 deletions ql/config.msvc.hpp
Expand Up @@ -25,8 +25,8 @@
#include <ql/userconfig.hpp>

// first things first
#if (_MSC_VER < 1800)
# error "versions of Visual C++ prior to VC++12.0 (2013) are no longer supported"
#if (_MSC_VER < 1900)
# error "versions of Visual C++ prior to VC++ 2015 are no longer supported"
#endif

/*******************************************
Expand All @@ -47,9 +47,6 @@

// conditionally work around compiler glitches
#define QL_PATCH_MSVC
#if (_MSC_VER < 1900)
# define QL_PATCH_MSVC_2013
#endif

// Compilation on the x64 platform throws a lot of warnings assigning
// QuantLib::Size == size_t (64 bit) to QuantLib::Integer == int (32
Expand Down
2 changes: 1 addition & 1 deletion ql/errors.cpp
Expand Up @@ -97,6 +97,6 @@ namespace QuantLib {
format(file, line, function, message));
}

const char* Error::what() const QL_NOEXCEPT { return message_->c_str(); }
const char* Error::what() const noexcept { return message_->c_str(); }
}

18 changes: 1 addition & 17 deletions ql/errors.hpp
Expand Up @@ -45,14 +45,8 @@ namespace QuantLib {
long line,
const std::string& functionName,
const std::string& message = "");
#ifdef QL_PATCH_MSVC_2013
/*! the automatically generated destructor would
not have the throw specifier.
*/
~Error() throw() override {}
#endif
//! returns the error message.
const char* what() const QL_NOEXCEPT override;
const char* what() const noexcept override;

private:
ext::shared_ptr<std::string> message_;
Expand All @@ -76,27 +70,17 @@ namespace QuantLib {
#endif


/* on MSVC++13 the do { ... } while(false) construct fails inside a
for loop without brackets, so we use a dangling else instead */
#if defined(QL_PATCH_MSVC_2013)
#define QL_MULTILINE_ASSERTION_BEGIN
#else
#define QL_MULTILINE_ASSERTION_BEGIN do {
#endif

/* Disable warning C4127 (conditional expression is constant) when
wrapping macros with the do { ... } while(false) construct on MSVC
*/
#if defined(BOOST_MSVC)
#if defined(QL_PATCH_MSVC_2013)
#define QL_MULTILINE_ASSERTION_END else
#else
#define QL_MULTILINE_ASSERTION_END \
__pragma(warning(push)) \
__pragma(warning(disable:4127)) \
} while(false) \
__pragma(warning(pop))
#endif
#else
#define QL_MULTILINE_ASSERTION_END } while(false)
#endif
Expand Down
Expand Up @@ -65,7 +65,7 @@ namespace QuantLib {
//calculate payoff discount factor assuming continuous compounding
DiscountFactor discount = riskFreeDiscount(t1);
Real result = 0;
QL_CONSTEXPR Real minusInf = -std::numeric_limits<Real>::infinity();
constexpr Real minusInf = -std::numeric_limits<Real>::infinity();

Real y1 = this->y1(payoff->optionType()),
y2 = this->y2(payoff->optionType());
Expand Down
8 changes: 4 additions & 4 deletions ql/math/array.hpp
Expand Up @@ -64,7 +64,7 @@ namespace QuantLib {
*/
Array(Size size, Real value, Real increment);
Array(const Array&);
Array(Array&&) QL_NOEXCEPT;
Array(Array&&) noexcept;
#ifdef QL_USE_DISPOSABLE
Array(const Disposable<Array>&);
#endif
Expand All @@ -74,7 +74,7 @@ namespace QuantLib {
Array(ForwardIterator begin, ForwardIterator end);

Array& operator=(const Array&);
Array& operator=(Array&&) QL_NOEXCEPT;
Array& operator=(Array&&) noexcept;
#ifdef QL_USE_DISPOSABLE
Array& operator=(const Disposable<Array>&);
#endif
Expand Down Expand Up @@ -244,7 +244,7 @@ namespace QuantLib {
std::copy(from.begin(),from.end(),begin());
}

inline Array::Array(Array&& from) QL_NOEXCEPT
inline Array::Array(Array&& from) noexcept
: data_((Real*)nullptr), n_(0) {
swap(from);
}
Expand Down Expand Up @@ -313,7 +313,7 @@ namespace QuantLib {
return *this;
}

inline Array& Array::operator=(Array&& from) QL_NOEXCEPT {
inline Array& Array::operator=(Array&& from) noexcept {
swap(from);
return *this;
}
Expand Down
8 changes: 4 additions & 4 deletions ql/math/matrix.hpp
Expand Up @@ -55,14 +55,14 @@ namespace QuantLib {
template <class Iterator>
Matrix(Size rows, Size columns, Iterator begin, Iterator end);
Matrix(const Matrix&);
Matrix(Matrix&&) QL_NOEXCEPT;
Matrix(Matrix&&) noexcept;
#ifdef QL_USE_DISPOSABLE
Matrix(const Disposable<Matrix>&);
#endif
Matrix(std::initializer_list<std::initializer_list<Real>>);

Matrix& operator=(const Matrix&);
Matrix& operator=(Matrix&&) QL_NOEXCEPT;
Matrix& operator=(Matrix&&) noexcept;
#ifdef QL_USE_DISPOSABLE
Matrix& operator=(const Disposable<Matrix>&);
#endif
Expand Down Expand Up @@ -228,7 +228,7 @@ namespace QuantLib {
std::copy(from.begin(),from.end(),begin());
}

inline Matrix::Matrix(Matrix&& from) QL_NOEXCEPT
inline Matrix::Matrix(Matrix&& from) noexcept
: data_((Real*)nullptr) {
swap(from);
}
Expand Down Expand Up @@ -262,7 +262,7 @@ namespace QuantLib {
return *this;
}

inline Matrix& Matrix::operator=(Matrix&& from) QL_NOEXCEPT {
inline Matrix& Matrix::operator=(Matrix&& from) noexcept {
swap(from);
return *this;
}
Expand Down
2 changes: 1 addition & 1 deletion ql/math/matrixutilities/svd.cpp
Expand Up @@ -514,7 +514,7 @@ namespace QuantLib {
}

Size SVD::rank() const {
QL_CONSTEXPR Real eps = QL_EPSILON;
constexpr Real eps = QL_EPSILON;
Real tol = m_*s_[0]*eps;
Size r = 0;
for (double i : s_) {
Expand Down
8 changes: 4 additions & 4 deletions ql/methods/finitedifferences/operators/ninepointlinearop.hpp
Expand Up @@ -42,12 +42,12 @@ namespace QuantLib {
NinePointLinearOp(Size d0, Size d1,
const ext::shared_ptr<FdmMesher>& mesher);
NinePointLinearOp(const NinePointLinearOp& m);
NinePointLinearOp(NinePointLinearOp&& m) QL_NOEXCEPT;
NinePointLinearOp(NinePointLinearOp&& m) noexcept;
#ifdef QL_USE_DISPOSABLE
NinePointLinearOp(const Disposable<NinePointLinearOp>& m);
#endif
NinePointLinearOp& operator=(const NinePointLinearOp& m);
NinePointLinearOp& operator=(NinePointLinearOp&& m) QL_NOEXCEPT;
NinePointLinearOp& operator=(NinePointLinearOp&& m) noexcept;
#ifdef QL_USE_DISPOSABLE
NinePointLinearOp& operator=(const Disposable<NinePointLinearOp>& m);
#endif
Expand Down Expand Up @@ -83,7 +83,7 @@ namespace QuantLib {
};


inline NinePointLinearOp::NinePointLinearOp(NinePointLinearOp&& m) QL_NOEXCEPT {
inline NinePointLinearOp::NinePointLinearOp(NinePointLinearOp&& m) noexcept {
swap(m);
}

Expand All @@ -93,7 +93,7 @@ namespace QuantLib {
return *this;
}

inline NinePointLinearOp& NinePointLinearOp::operator=(NinePointLinearOp&& m) QL_NOEXCEPT {
inline NinePointLinearOp& NinePointLinearOp::operator=(NinePointLinearOp&& m) noexcept {
swap(m);
return *this;
}
Expand Down
8 changes: 4 additions & 4 deletions ql/methods/finitedifferences/operators/triplebandlinearop.hpp
Expand Up @@ -43,12 +43,12 @@ namespace QuantLib {
const ext::shared_ptr<FdmMesher>& mesher);

TripleBandLinearOp(const TripleBandLinearOp& m);
TripleBandLinearOp(TripleBandLinearOp&& m) QL_NOEXCEPT;
TripleBandLinearOp(TripleBandLinearOp&& m) noexcept;
#ifdef QL_USE_DISPOSABLE
TripleBandLinearOp(const Disposable<TripleBandLinearOp>& m);
#endif
TripleBandLinearOp& operator=(const TripleBandLinearOp& m);
TripleBandLinearOp& operator=(TripleBandLinearOp&& m) QL_NOEXCEPT;
TripleBandLinearOp& operator=(TripleBandLinearOp&& m) noexcept;
#ifdef QL_USE_DISPOSABLE
TripleBandLinearOp& operator=(const Disposable<TripleBandLinearOp>& m);
#endif
Expand Down Expand Up @@ -90,7 +90,7 @@ namespace QuantLib {
};


inline TripleBandLinearOp::TripleBandLinearOp(TripleBandLinearOp&& m) QL_NOEXCEPT {
inline TripleBandLinearOp::TripleBandLinearOp(TripleBandLinearOp&& m) noexcept {
swap(m);
}

Expand All @@ -100,7 +100,7 @@ namespace QuantLib {
return *this;
}

inline TripleBandLinearOp& TripleBandLinearOp::operator=(TripleBandLinearOp&& m) QL_NOEXCEPT {
inline TripleBandLinearOp& TripleBandLinearOp::operator=(TripleBandLinearOp&& m) noexcept {
swap(m);
return *this;
}
Expand Down
8 changes: 4 additions & 4 deletions ql/methods/finitedifferences/tridiagonaloperator.hpp
Expand Up @@ -69,12 +69,12 @@ namespace QuantLib {
const Array& mid,
const Array& high);
TridiagonalOperator(const TridiagonalOperator&) = default;
TridiagonalOperator(TridiagonalOperator&&) QL_NOEXCEPT;
TridiagonalOperator(TridiagonalOperator&&) noexcept;
#ifdef QL_USE_DISPOSABLE
TridiagonalOperator(const Disposable<TridiagonalOperator>&);
#endif
TridiagonalOperator& operator=(const TridiagonalOperator&);
TridiagonalOperator& operator=(TridiagonalOperator&&) QL_NOEXCEPT;
TridiagonalOperator& operator=(TridiagonalOperator&&) noexcept;
#ifdef QL_USE_DISPOSABLE
TridiagonalOperator& operator=(const Disposable<TridiagonalOperator>&);
#endif
Expand Down Expand Up @@ -136,7 +136,7 @@ namespace QuantLib {

// inline definitions

inline TridiagonalOperator::TridiagonalOperator(TridiagonalOperator&& from) QL_NOEXCEPT {
inline TridiagonalOperator::TridiagonalOperator(TridiagonalOperator&& from) noexcept {
swap(from);
}

Expand All @@ -155,7 +155,7 @@ namespace QuantLib {
}

inline TridiagonalOperator&
TridiagonalOperator::operator=(TridiagonalOperator&& from) QL_NOEXCEPT {
TridiagonalOperator::operator=(TridiagonalOperator&& from) noexcept {
swap(from);
return *this;
}
Expand Down
2 changes: 1 addition & 1 deletion ql/pricingengines/asian/mc_discr_geom_av_price.cpp
Expand Up @@ -43,7 +43,7 @@ namespace QuantLib {
product *= path.front();
}
// care must be taken not to overflow product
QL_CONSTEXPR Real maxValue = QL_MAX_REAL;
constexpr Real maxValue = QL_MAX_REAL;
averagePrice = 1.0;
for (Size i=1; i<n+1; i++) {
Real price = path[i];
Expand Down
2 changes: 1 addition & 1 deletion ql/pricingengines/asian/mc_discr_geom_av_price_heston.cpp
Expand Up @@ -44,7 +44,7 @@ namespace QuantLib {
Size fixings = pastFixings_ + fixingIndices_.size();

// care must be taken not to overflow product
QL_CONSTEXPR Real maxValue = QL_MAX_REAL;
constexpr Real maxValue = QL_MAX_REAL;
for (unsigned long fixingIndice : fixingIndices_) {
Real price = path[fixingIndice];
if (product < maxValue/price) {
Expand Down
16 changes: 8 additions & 8 deletions ql/qldefines.hpp
Expand Up @@ -215,15 +215,15 @@
#endif
// clang-format on

/*! \deprecated Use the noexcept keyword instead.
Deprecated in version 1.27.
*/
#define QL_NOEXCEPT noexcept

// until we stop supporting Visual C++ 2013
#if defined(QL_PATCH_MSVC_2013)
# define QL_NOEXCEPT
# define QL_CONSTEXPR
#else
# define QL_NOEXCEPT noexcept
# define QL_CONSTEXPR constexpr
#endif
/*! \deprecated Use the constexpr keyword instead.
Deprecated in version 1.27.
*/
#define QL_CONSTEXPR constexpr


#endif
16 changes: 8 additions & 8 deletions ql/qldefines.hpp.cfg
Expand Up @@ -216,15 +216,15 @@
#endif
// clang-format on

/*! \deprecated Use the noexcept keyword instead.
Deprecated in version 1.27.
*/
#define QL_NOEXCEPT noexcept

// until we stop supporting Visual C++ 2013
#if defined(QL_PATCH_MSVC_2013)
# define QL_NOEXCEPT
# define QL_CONSTEXPR
#else
# define QL_NOEXCEPT noexcept
# define QL_CONSTEXPR constexpr
#endif
/*! \deprecated Use the constexpr keyword instead.
Deprecated in version 1.27.
*/
#define QL_CONSTEXPR constexpr


#endif
Expand Up @@ -111,7 +111,7 @@ namespace QuantLib {
Brent solver;
solver.setMaxEvaluations(10000);
const Volatility guess = std::sqrt(theta);
QL_CONSTEXPR Real accuracy = std::numeric_limits<Real>::epsilon();
constexpr Real accuracy = std::numeric_limits<Real>::epsilon();

return solver.solve([&](Volatility _v) { return blackValue(payoff.optionType(), strike, fwd,
t, _v, df, npv); },
Expand Down
8 changes: 4 additions & 4 deletions ql/utilities/clone.hpp
Expand Up @@ -50,10 +50,10 @@ namespace QuantLib {
#endif
Clone(const T&);
Clone(const Clone<T>&);
Clone(Clone<T>&&) QL_NOEXCEPT;
Clone(Clone<T>&&) noexcept;
Clone<T>& operator=(const T&);
Clone<T>& operator=(const Clone<T>&);
Clone<T>& operator=(Clone<T>&&) QL_NOEXCEPT;
Clone<T>& operator=(Clone<T>&&) noexcept;
T& operator*() const;
T* operator->() const;
bool empty() const;
Expand Down Expand Up @@ -88,7 +88,7 @@ namespace QuantLib {
: ptr_(t.empty() ? (T*)nullptr : t->clone().release()) {}

template <class T>
inline Clone<T>::Clone(Clone<T>&& t) QL_NOEXCEPT {
inline Clone<T>::Clone(Clone<T>&& t) noexcept {
swap(t);
}

Expand All @@ -109,7 +109,7 @@ namespace QuantLib {
}

template <class T>
inline Clone<T>& Clone<T>::operator=(Clone<T>&& t) QL_NOEXCEPT {
inline Clone<T>& Clone<T>::operator=(Clone<T>&& t) noexcept {
swap(t);
return *this;
}
Expand Down

0 comments on commit b02d7cc

Please sign in to comment.