@@ -501,8 +501,14 @@ class out {
501
501
//
502
502
// -----------------------------------------------------------------------
503
503
//
504
+ #ifdef _MSC_VER
505
+ #define CPP2_FORCE_INLINE [[msvc::forceinline]]
506
+ #else
507
+ #define CPP2_FORCE_INLINE __attribute__ ((always_inline))
508
+ #endif
509
+
504
510
#define CPP2_UFCS (FUNCNAME,PARAM1,...) \
505
- [](auto && obj, auto && ...params) { \
511
+ [](auto && obj, auto && ...params) CPP2_FORCE_INLINE { \
506
512
if constexpr (requires { std::forward<decltype (obj)>(obj).FUNCNAME (std::forward<decltype (params)>(params)...); }) { \
507
513
return std::forward<decltype (obj)>(obj).FUNCNAME (std::forward<decltype (params)>(params)...); \
508
514
} else { \
@@ -511,7 +517,7 @@ class out {
511
517
}(PARAM1, __VA_ARGS__)
512
518
513
519
#define CPP2_UFCS_0 (FUNCNAME,PARAM1 ) \
514
- [](auto && obj) { \
520
+ [](auto && obj) CPP2_FORCE_INLINE { \
515
521
if constexpr (requires { std::forward<decltype (obj)>(obj).FUNCNAME (); }) { \
516
522
return std::forward<decltype (obj)>(obj).FUNCNAME (); \
517
523
} else { \
@@ -522,7 +528,7 @@ class out {
522
528
#define CPP2_UFCS_REMPARENS (...) __VA_ARGS__
523
529
524
530
#define CPP2_UFCS_TEMPLATE (FUNCNAME,TEMPARGS,PARAM1,...) \
525
- [](auto && obj, auto && ...params) { \
531
+ [](auto && obj, auto && ...params) CPP2_FORCE_INLINE { \
526
532
if constexpr (requires { std::forward<decltype (obj)>(obj).template FUNCNAME CPP2_UFCS_REMPARENS TEMPARGS (std::forward<decltype (params)>(params)...); }) { \
527
533
return std::forward<decltype (obj)>(obj).template FUNCNAME CPP2_UFCS_REMPARENS TEMPARGS (std::forward<decltype (params)>(params)...); \
528
534
} else { \
@@ -531,7 +537,7 @@ class out {
531
537
}(PARAM1, __VA_ARGS__)
532
538
533
539
#define CPP2_UFCS_TEMPLATE_0 (FUNCNAME,TEMPARGS,PARAM1 ) \
534
- [](auto && obj) { \
540
+ [](auto && obj) CPP2_FORCE_INLINE { \
535
541
if constexpr (requires { std::forward<decltype (obj)>(obj).template FUNCNAME CPP2_UFCS_REMPARENS TEMPARGS (); }) { \
536
542
return std::forward<decltype (obj)>(obj).template FUNCNAME CPP2_UFCS_REMPARENS TEMPARGS (); \
537
543
} else { \
0 commit comments