Skip to content

Commit 0f0ff9d

Browse files
committed
Work-around for Visual Studio
1 parent 23b3195 commit 0f0ff9d

File tree

2 files changed

+25
-26
lines changed

2 files changed

+25
-26
lines changed

include/tao/json/byte_view.hpp

Lines changed: 12 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -336,13 +336,13 @@ namespace tao
336336
return x.compare( y ) == 0;
337337
}
338338

339-
template< class byteT >
339+
template< class byteT, int = 1 > // work-around for Visual C++
340340
constexpr bool operator==( basic_byte_view< byteT > x, internal::identity< basic_byte_view< byteT > > y ) noexcept
341341
{
342342
return x.compare( y ) == 0;
343343
}
344344

345-
template< class byteT >
345+
template< class byteT, int = 2 > // work-around for Visual C++
346346
constexpr bool operator==( internal::identity< basic_byte_view< byteT > > x, basic_byte_view< byteT > y ) noexcept
347347
{
348348
return x.compare( y ) == 0;
@@ -354,13 +354,13 @@ namespace tao
354354
return x.compare( y ) != 0;
355355
}
356356

357-
template< class byteT >
357+
template< class byteT, int = 1 > // work-around for Visual C++
358358
constexpr bool operator!=( basic_byte_view< byteT > x, internal::identity< basic_byte_view< byteT > > y ) noexcept
359359
{
360360
return x.compare( y ) != 0;
361361
}
362362

363-
template< class byteT >
363+
template< class byteT, int = 2 > // work-around for Visual C++
364364
constexpr bool operator!=( internal::identity< basic_byte_view< byteT > > x, basic_byte_view< byteT > y ) noexcept
365365
{
366366
return x.compare( y ) != 0;
@@ -372,13 +372,13 @@ namespace tao
372372
return x.compare( y ) < 0;
373373
}
374374

375-
template< class byteT >
375+
template< class byteT, int = 1 > // work-around for Visual C++
376376
constexpr bool operator<( basic_byte_view< byteT > x, internal::identity< basic_byte_view< byteT > > y ) noexcept
377377
{
378378
return x.compare( y ) < 0;
379379
}
380380

381-
template< class byteT >
381+
template< class byteT, int = 2 > // work-around for Visual C++
382382
constexpr bool operator<( internal::identity< basic_byte_view< byteT > > x, basic_byte_view< byteT > y ) noexcept
383383
{
384384
return x.compare( y ) < 0;
@@ -390,13 +390,13 @@ namespace tao
390390
return x.compare( y ) > 0;
391391
}
392392

393-
template< class byteT >
393+
template< class byteT, int = 1 > // work-around for Visual C++
394394
constexpr bool operator>( basic_byte_view< byteT > x, internal::identity< basic_byte_view< byteT > > y ) noexcept
395395
{
396396
return x.compare( y ) > 0;
397397
}
398398

399-
template< class byteT >
399+
template< class byteT, int = 2 > // work-around for Visual C++
400400
constexpr bool operator>( internal::identity< basic_byte_view< byteT > > x, basic_byte_view< byteT > y ) noexcept
401401
{
402402
return x.compare( y ) > 0;
@@ -408,13 +408,13 @@ namespace tao
408408
return x.compare( y ) <= 0;
409409
}
410410

411-
template< class byteT >
411+
template< class byteT, int = 1 > // work-around for Visual C++
412412
constexpr bool operator<=( basic_byte_view< byteT > x, internal::identity< basic_byte_view< byteT > > y ) noexcept
413413
{
414414
return x.compare( y ) <= 0;
415415
}
416416

417-
template< class byteT >
417+
template< class byteT, int = 2 > // work-around for Visual C++
418418
constexpr bool operator<=( internal::identity< basic_byte_view< byteT > > x, basic_byte_view< byteT > y ) noexcept
419419
{
420420
return x.compare( y ) <= 0;
@@ -426,13 +426,13 @@ namespace tao
426426
return x.compare( y ) >= 0;
427427
}
428428

429-
template< class byteT >
429+
template< class byteT, int = 1 > // work-around for Visual C++
430430
constexpr bool operator>=( basic_byte_view< byteT > x, internal::identity< basic_byte_view< byteT > > y ) noexcept
431431
{
432432
return x.compare( y ) >= 0;
433433
}
434434

435-
template< class byteT >
435+
template< class byteT, int = 2 > // work-around for Visual C++
436436
constexpr bool operator>=( internal::identity< basic_byte_view< byteT > > x, basic_byte_view< byteT > y ) noexcept
437437
{
438438
return x.compare( y ) >= 0;

include/tao/json/external/string_view.hpp

Lines changed: 13 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -413,13 +413,13 @@ namespace tao
413413
return x.compare( y ) == 0;
414414
}
415415

416-
template< class charT, class traits >
416+
template< class charT, class traits, int = 1 > // work-around for Visual C++
417417
constexpr bool operator==( basic_string_view< charT, traits > x, internal::identity< basic_string_view< charT, traits > > y ) noexcept
418418
{
419419
return x.compare( y ) == 0;
420420
}
421421

422-
template< class charT, class traits >
422+
template< class charT, class traits, int = 2 > // work-around for Visual C++
423423
constexpr bool operator==( internal::identity< basic_string_view< charT, traits > > x, basic_string_view< charT, traits > y ) noexcept
424424
{
425425
return x.compare( y ) == 0;
@@ -431,13 +431,13 @@ namespace tao
431431
return x.compare( y ) != 0;
432432
}
433433

434-
template< class charT, class traits >
434+
template< class charT, class traits, int = 1 > // work-around for Visual C++
435435
constexpr bool operator!=( basic_string_view< charT, traits > x, internal::identity< basic_string_view< charT, traits > > y ) noexcept
436436
{
437437
return x.compare( y ) != 0;
438438
}
439439

440-
template< class charT, class traits >
440+
template< class charT, class traits, int = 2 > // work-around for Visual C++
441441
constexpr bool operator!=( internal::identity< basic_string_view< charT, traits > > x, basic_string_view< charT, traits > y ) noexcept
442442
{
443443
return x.compare( y ) != 0;
@@ -449,13 +449,13 @@ namespace tao
449449
return x.compare( y ) < 0;
450450
}
451451

452-
template< class charT, class traits >
452+
template< class charT, class traits, int = 1 > // work-around for Visual C++
453453
constexpr bool operator<( basic_string_view< charT, traits > x, internal::identity< basic_string_view< charT, traits > > y ) noexcept
454454
{
455455
return x.compare( y ) < 0;
456456
}
457457

458-
template< class charT, class traits >
458+
template< class charT, class traits, int = 2 > // work-around for Visual C++
459459
constexpr bool operator<( internal::identity< basic_string_view< charT, traits > > x, basic_string_view< charT, traits > y ) noexcept
460460
{
461461
return x.compare( y ) < 0;
@@ -467,31 +467,30 @@ namespace tao
467467
return x.compare( y ) > 0;
468468
}
469469

470-
template< class charT, class traits >
470+
template< class charT, class traits, int = 1 > // work-around for Visual C++
471471
constexpr bool operator>( basic_string_view< charT, traits > x, internal::identity< basic_string_view< charT, traits > > y ) noexcept
472472
{
473473
return x.compare( y ) > 0;
474474
}
475475

476-
template< class charT, class traits >
476+
template< class charT, class traits, int = 2 > // work-around for Visual C++
477477
constexpr bool operator>( internal::identity< basic_string_view< charT, traits > > x, basic_string_view< charT, traits > y ) noexcept
478478
{
479479
return x.compare( y ) > 0;
480480
}
481481

482-
template< class charT, class traits >
483-
constexpr bool operator<=( basic_string_view< charT, traits > x, basic_string_view< charT, traits > y ) noexcept
482+
template< class charT, class traits constexpr bool operator<=( basic_string_view< charT, traits > x, basic_string_view< charT, traits > y ) noexcept
484483
{
485484
return x.compare( y ) <= 0;
486485
}
487486

488-
template< class charT, class traits >
487+
template< class charT, class traits, int = 1 > // work-around for Visual C++
489488
constexpr bool operator<=( basic_string_view< charT, traits > x, internal::identity< basic_string_view< charT, traits > > y ) noexcept
490489
{
491490
return x.compare( y ) <= 0;
492491
}
493492

494-
template< class charT, class traits >
493+
template< class charT, class traits, int = 2 > // work-around for Visual C++
495494
constexpr bool operator<=( internal::identity< basic_string_view< charT, traits > > x, basic_string_view< charT, traits > y ) noexcept
496495
{
497496
return x.compare( y ) <= 0;
@@ -503,13 +502,13 @@ namespace tao
503502
return x.compare( y ) >= 0;
504503
}
505504

506-
template< class charT, class traits >
505+
template< class charT, class traits, int = 1 > // work-around for Visual C++
507506
constexpr bool operator>=( basic_string_view< charT, traits > x, internal::identity< basic_string_view< charT, traits > > y ) noexcept
508507
{
509508
return x.compare( y ) >= 0;
510509
}
511510

512-
template< class charT, class traits >
511+
template< class charT, class traits, int = 2 > // work-around for Visual C++
513512
constexpr bool operator>=( internal::identity< basic_string_view< charT, traits > > x, basic_string_view< charT, traits > y ) noexcept
514513
{
515514
return x.compare( y ) >= 0;

0 commit comments

Comments
 (0)