Skip to content

Commit df7eeb4

Browse files
committed
Avoid some deprecation warnings on VC++15
1 parent c956100 commit df7eeb4

1 file changed

Lines changed: 31 additions & 1 deletion

File tree

ql/math/functional.hpp

Lines changed: 31 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,9 @@ namespace QuantLib {
4141
public:
4242
typedef T argument_type;
4343
typedef U result_type;
44+
QL_DEPRECATED_DISABLE_WARNING
4445
explicit constant(const U& u) : u_(u) {}
46+
QL_DEPRECATED_ENABLE_WARNING
4547
U operator()(const T&) const { return u_; }
4648
private:
4749
U u_;
@@ -105,7 +107,9 @@ namespace QuantLib {
105107
public:
106108
typedef T argument_type;
107109
typedef Real result_type;
110+
QL_DEPRECATED_DISABLE_WARNING
108111
explicit add(Real y) : y(y) {}
112+
QL_DEPRECATED_ENABLE_WARNING
109113
Real operator()(T x) const { return x + y; }
110114
};
111115

@@ -118,7 +122,9 @@ namespace QuantLib {
118122
public:
119123
typedef T argument_type;
120124
typedef Real result_type;
125+
QL_DEPRECATED_DISABLE_WARNING
121126
explicit subtract(Real y) : y(y) {}
127+
QL_DEPRECATED_ENABLE_WARNING
122128
Real operator()(T x) const { return x - y; }
123129
};
124130

@@ -131,7 +137,9 @@ namespace QuantLib {
131137
public:
132138
typedef T argument_type;
133139
typedef Real result_type;
140+
QL_DEPRECATED_DISABLE_WARNING
134141
explicit subtract_from(Real y) : y(y) {}
142+
QL_DEPRECATED_ENABLE_WARNING
135143
Real operator()(T x) const { return y - x; }
136144
};
137145

@@ -144,7 +152,9 @@ namespace QuantLib {
144152
public:
145153
typedef T argument_type;
146154
typedef Real result_type;
155+
QL_DEPRECATED_DISABLE_WARNING
147156
explicit multiply_by(Real y) : y(y) {}
157+
QL_DEPRECATED_ENABLE_WARNING
148158
Real operator()(T x) const { return x * y; }
149159
};
150160

@@ -157,7 +167,9 @@ namespace QuantLib {
157167
public:
158168
typedef T argument_type;
159169
typedef Real result_type;
170+
QL_DEPRECATED_DISABLE_WARNING
160171
explicit divide(Real y) : y(y) {}
172+
QL_DEPRECATED_ENABLE_WARNING
161173
Real operator()(T x) const { return y / x; }
162174
};
163175

@@ -170,7 +182,9 @@ namespace QuantLib {
170182
public:
171183
typedef T argument_type;
172184
typedef Real result_type;
185+
QL_DEPRECATED_DISABLE_WARNING
173186
explicit divide_by(Real y) : y(y) {}
187+
QL_DEPRECATED_ENABLE_WARNING
174188
Real operator()(T x) const { return x / y; }
175189
};
176190

@@ -183,7 +197,9 @@ namespace QuantLib {
183197
public:
184198
typedef T argument_type;
185199
typedef bool result_type;
200+
QL_DEPRECATED_DISABLE_WARNING
186201
explicit less_than(Real y) : y(y) {}
202+
QL_DEPRECATED_ENABLE_WARNING
187203
bool operator()(T x) const { return x < y; }
188204
};
189205

@@ -196,7 +212,9 @@ namespace QuantLib {
196212
public:
197213
typedef T argument_type;
198214
typedef bool result_type;
215+
QL_DEPRECATED_DISABLE_WARNING
199216
explicit greater_than(Real y) : y(y) {}
217+
QL_DEPRECATED_ENABLE_WARNING
200218
bool operator()(T x) const { return x > y; }
201219
};
202220

@@ -209,7 +227,9 @@ namespace QuantLib {
209227
public:
210228
typedef T argument_type;
211229
typedef bool result_type;
230+
QL_DEPRECATED_DISABLE_WARNING
212231
explicit greater_or_equal_to(Real y) : y(y) {}
232+
QL_DEPRECATED_ENABLE_WARNING
213233
bool operator()(T x) const { return x >= y; }
214234
};
215235

@@ -233,10 +253,12 @@ namespace QuantLib {
233253
public:
234254
typedef T argument_type;
235255
typedef bool result_type;
256+
QL_DEPRECATED_DISABLE_WARNING
236257
not_null() : null(Null<T>()) {}
258+
QL_DEPRECATED_ENABLE_WARNING
237259
bool operator()(T x) const { return x != null; }
238260
};
239-
261+
240262
// predicates
241263

242264
/*! \deprecated Use a lambda instead.
@@ -268,7 +290,9 @@ namespace QuantLib {
268290
typedef T first_argument_type;
269291
typedef T second_argument_type;
270292
typedef bool result_type;
293+
QL_DEPRECATED_DISABLE_WARNING
271294
explicit equal_within(const T& eps) : eps_(eps) {}
295+
QL_DEPRECATED_ENABLE_WARNING
272296
bool operator()(const T& a, const T& b) const {
273297
return std::fabs(a-b) <= eps_;
274298
}
@@ -286,7 +310,9 @@ namespace QuantLib {
286310
public:
287311
typedef typename F::argument_type argument_type;
288312
typedef typename F::result_type result_type;
313+
QL_DEPRECATED_DISABLE_WARNING
289314
clipped_function(const F& f, const R& r) : f_(f), r_(r) {}
315+
QL_DEPRECATED_ENABLE_WARNING
290316
result_type operator()(const argument_type& x) const {
291317
return r_(x) ? f_(x) : result_type();
292318
}
@@ -322,7 +348,9 @@ namespace QuantLib {
322348
public:
323349
typedef typename G::argument_type argument_type;
324350
typedef typename F::result_type result_type;
351+
QL_DEPRECATED_DISABLE_WARNING
325352
composed_function(const F& f, G g) : f_(f), g_(std::move(g)) {}
353+
QL_DEPRECATED_ENABLE_WARNING
326354
result_type operator()(const argument_type& x) const {
327355
return f_(g_(x));
328356
}
@@ -359,8 +387,10 @@ namespace QuantLib {
359387
typedef typename G::argument_type first_argument_type;
360388
typedef typename H::argument_type second_argument_type;
361389
typedef typename F::result_type result_type;
390+
QL_DEPRECATED_DISABLE_WARNING
362391
binary_compose3_function(const F& f, const G& g, const H& h)
363392
: f_(f), g_(g), h_(h) {}
393+
QL_DEPRECATED_ENABLE_WARNING
364394
result_type operator()(const first_argument_type& x,
365395
const second_argument_type& y) const {
366396
return f_(g_(x), h_(y));

0 commit comments

Comments
 (0)