@@ -289,6 +289,9 @@ private:
289
289
static const intmax_t __gcd_n1_d2 = __static_gcd<_R1::num, _R2::den>::value;
290
290
static const intmax_t __gcd_d1_n2 = __static_gcd<_R1::den, _R2::num>::value;
291
291
292
+ static_assert (__is_ratio<_R1>::value, " [ratio.general]/2 requires R1 to be a specialisation of the ratio template" );
293
+ static_assert (__is_ratio<_R2>::value, " [ratio.general]/2 requires R2 to be a specialisation of the ratio template" );
294
+
292
295
public:
293
296
typedef typename ratio< __ll_mul<_R1::num / __gcd_n1_d2, _R2::num / __gcd_d1_n2>::value,
294
297
__ll_mul<_R2::den / __gcd_n1_d2, _R1::den / __gcd_d1_n2>::value >::type type;
@@ -312,6 +315,9 @@ private:
312
315
static const intmax_t __gcd_n1_n2 = __static_gcd<_R1::num, _R2::num>::value;
313
316
static const intmax_t __gcd_d1_d2 = __static_gcd<_R1::den, _R2::den>::value;
314
317
318
+ static_assert (__is_ratio<_R1>::value, " [ratio.general]/2 requires R1 to be a specialisation of the ratio template" );
319
+ static_assert (__is_ratio<_R2>::value, " [ratio.general]/2 requires R2 to be a specialisation of the ratio template" );
320
+
315
321
public:
316
322
typedef typename ratio< __ll_mul<_R1::num / __gcd_n1_n2, _R2::den / __gcd_d1_d2>::value,
317
323
__ll_mul<_R2::num / __gcd_n1_n2, _R1::den / __gcd_d1_d2>::value >::type type;
@@ -335,6 +341,9 @@ private:
335
341
static const intmax_t __gcd_n1_n2 = __static_gcd<_R1::num, _R2::num>::value;
336
342
static const intmax_t __gcd_d1_d2 = __static_gcd<_R1::den, _R2::den>::value;
337
343
344
+ static_assert (__is_ratio<_R1>::value, " [ratio.general]/2 requires R1 to be a specialisation of the ratio template" );
345
+ static_assert (__is_ratio<_R2>::value, " [ratio.general]/2 requires R2 to be a specialisation of the ratio template" );
346
+
338
347
public:
339
348
typedef typename ratio_multiply<
340
349
ratio<__gcd_n1_n2, _R1::den / __gcd_d1_d2>,
@@ -361,6 +370,9 @@ private:
361
370
static const intmax_t __gcd_n1_n2 = __static_gcd<_R1::num, _R2::num>::value;
362
371
static const intmax_t __gcd_d1_d2 = __static_gcd<_R1::den, _R2::den>::value;
363
372
373
+ static_assert (__is_ratio<_R1>::value, " [ratio.general]/2 requires R1 to be a specialisation of the ratio template" );
374
+ static_assert (__is_ratio<_R2>::value, " [ratio.general]/2 requires R2 to be a specialisation of the ratio template" );
375
+
364
376
public:
365
377
typedef typename ratio_multiply<
366
378
ratio<__gcd_n1_n2, _R1::den / __gcd_d1_d2>,
@@ -384,10 +396,16 @@ struct _LIBCPP_TEMPLATE_VIS ratio_subtract : public __ratio_subtract<_R1, _R2>::
384
396
// ratio_equal
385
397
386
398
template <class _R1 , class _R2 >
387
- struct _LIBCPP_TEMPLATE_VIS ratio_equal : _BoolConstant<(_R1::num == _R2::num && _R1::den == _R2::den)> {};
399
+ struct _LIBCPP_TEMPLATE_VIS ratio_equal : _BoolConstant<(_R1::num == _R2::num && _R1::den == _R2::den)> {
400
+ static_assert (__is_ratio<_R1>::value, " [ratio.general]/2 requires R1 to be a specialisation of the ratio template" );
401
+ static_assert (__is_ratio<_R2>::value, " [ratio.general]/2 requires R2 to be a specialisation of the ratio template" );
402
+ };
388
403
389
404
template <class _R1 , class _R2 >
390
- struct _LIBCPP_TEMPLATE_VIS ratio_not_equal : _BoolConstant<!ratio_equal<_R1, _R2>::value> {};
405
+ struct _LIBCPP_TEMPLATE_VIS ratio_not_equal : _BoolConstant<!ratio_equal<_R1, _R2>::value> {
406
+ static_assert (__is_ratio<_R1>::value, " [ratio.general]/2 requires R1 to be a specialisation of the ratio template" );
407
+ static_assert (__is_ratio<_R2>::value, " [ratio.general]/2 requires R2 to be a specialisation of the ratio template" );
408
+ };
391
409
392
410
// ratio_less
393
411
@@ -441,16 +459,28 @@ struct __ratio_less<_R1, _R2, -1LL, -1LL> {
441
459
};
442
460
443
461
template <class _R1 , class _R2 >
444
- struct _LIBCPP_TEMPLATE_VIS ratio_less : _BoolConstant<__ratio_less<_R1, _R2>::value> {};
462
+ struct _LIBCPP_TEMPLATE_VIS ratio_less : _BoolConstant<__ratio_less<_R1, _R2>::value> {
463
+ static_assert (__is_ratio<_R1>::value, " [ratio.general]/2 requires R1 to be a specialisation of the ratio template" );
464
+ static_assert (__is_ratio<_R2>::value, " [ratio.general]/2 requires R2 to be a specialisation of the ratio template" );
465
+ };
445
466
446
467
template <class _R1 , class _R2 >
447
- struct _LIBCPP_TEMPLATE_VIS ratio_less_equal : _BoolConstant<!ratio_less<_R2, _R1>::value> {};
468
+ struct _LIBCPP_TEMPLATE_VIS ratio_less_equal : _BoolConstant<!ratio_less<_R2, _R1>::value> {
469
+ static_assert (__is_ratio<_R1>::value, " [ratio.general]/2 requires R1 to be a specialisation of the ratio template" );
470
+ static_assert (__is_ratio<_R2>::value, " [ratio.general]/2 requires R2 to be a specialisation of the ratio template" );
471
+ };
448
472
449
473
template <class _R1 , class _R2 >
450
- struct _LIBCPP_TEMPLATE_VIS ratio_greater : _BoolConstant<ratio_less<_R2, _R1>::value> {};
474
+ struct _LIBCPP_TEMPLATE_VIS ratio_greater : _BoolConstant<ratio_less<_R2, _R1>::value> {
475
+ static_assert (__is_ratio<_R1>::value, " [ratio.general]/2 requires R1 to be a specialisation of the ratio template" );
476
+ static_assert (__is_ratio<_R2>::value, " [ratio.general]/2 requires R2 to be a specialisation of the ratio template" );
477
+ };
451
478
452
479
template <class _R1 , class _R2 >
453
- struct _LIBCPP_TEMPLATE_VIS ratio_greater_equal : _BoolConstant<!ratio_less<_R1, _R2>::value> {};
480
+ struct _LIBCPP_TEMPLATE_VIS ratio_greater_equal : _BoolConstant<!ratio_less<_R1, _R2>::value> {
481
+ static_assert (__is_ratio<_R1>::value, " [ratio.general]/2 requires R1 to be a specialisation of the ratio template" );
482
+ static_assert (__is_ratio<_R2>::value, " [ratio.general]/2 requires R2 to be a specialisation of the ratio template" );
483
+ };
454
484
455
485
template <class _R1 , class _R2 >
456
486
struct __ratio_gcd {
0 commit comments