@@ -285,16 +285,6 @@ class PUBLIC_API Value : public internal::Printable
285
285
Value (bool );
286
286
Value (const DbDoc& doc);
287
287
288
- /*
289
- Note: These overloads are needed to disambiguate constructor
290
- resolution.
291
- */
292
-
293
- Value (int x) : Value((int64_t )x) {}
294
- Value (unsigned x) : Value((uint64_t )x) {}
295
- Value (long x) : Value((int64_t )x) {}
296
- Value (unsigned long x) : Value((uint64_t )x) {}
297
-
298
288
Value (const std::initializer_list<Value> &list)
299
289
: m_type(ARRAY)
300
290
{
@@ -310,6 +300,65 @@ class PUBLIC_API Value : public internal::Printable
310
300
311
301
// /@}
312
302
303
+ /*
304
+ Note: These templates are needed to disambiguate constructor resolution
305
+ for integer types.
306
+ */
307
+
308
+ Value (const Value&) = default ;
309
+
310
+ #if !defined(_MSC_VER) || _MSC_VER >= 1900
311
+
312
+ Value (Value&&) = default;
313
+
314
+ #else
315
+
316
+ Value (Value &&other)
317
+ {
318
+ *this = std::move (other);
319
+ }
320
+
321
+ #endif
322
+
323
+ template <
324
+ typename T,
325
+ typename std::enable_if<std::is_signed<T>::value>::type* = nullptr
326
+ >
327
+ Value (T x)
328
+ : Value(static_cast <int64_t >(x))
329
+ {}
330
+
331
+ template <
332
+ typename T,
333
+ typename std::enable_if<std::is_unsigned<T>::value>::type* = nullptr
334
+ >
335
+ Value (T x)
336
+ : Value(static_cast <uint64_t >(x))
337
+ {}
338
+
339
+ /*
340
+ Assignment operator is implemented using constructors.
341
+ */
342
+
343
+ Value& operator =(const Value&) = default ;
344
+
345
+ #if !defined(_MSC_VER) || _MSC_VER >= 1900
346
+
347
+ Value& operator =(Value&&) = default ;
348
+
349
+ #else
350
+
351
+ Value& operator =(Value&&);
352
+
353
+ #endif
354
+
355
+ template <typename T>
356
+ Value& operator =(T x)
357
+ {
358
+ *this = Value (x);
359
+ return *this ;
360
+ }
361
+
313
362
private:
314
363
315
364
/*
@@ -461,6 +510,29 @@ class PUBLIC_API Value : public internal::Printable
461
510
static const Value nullvalue;
462
511
463
512
513
+ #if defined(_MSC_VER) && _MSC_VER < 1900
514
+
515
+ inline
516
+ Value& Value::operator =(Value &&other)
517
+ {
518
+ m_type = other.m_type ;
519
+ m_val = other.m_val ;
520
+
521
+ switch (m_type)
522
+ {
523
+ case STRING: m_str = std::move (other.m_str ); break ;
524
+ case DOCUMENT: m_doc = std::move (other.m_doc ); break ;
525
+ case RAW: m_raw = std::move (other.m_raw ); break ;
526
+ case ARRAY: m_arr = std::move (other.m_arr ); break ;
527
+ default : break ;
528
+ }
529
+
530
+ return *this ;
531
+ }
532
+
533
+ #endif
534
+
535
+
464
536
namespace internal {
465
537
466
538
/*
0 commit comments