@@ -791,18 +791,18 @@ class out {
791
791
// we instead make it a template parameter of the UFCS lambda.
792
792
// But using a template parameter, Clang also ICEs on an application.
793
793
// So we use these `NOTHROW` macros to fall back to the ideal for when not using GCC.
794
- #define CPP2_UFCS_IS_NOTHROW (TEMPKW,...) \
795
- requires { requires requires { std::declval<Obj>().TEMPKW __VA_ARGS__ (std::declval<Params>()...); }; \
796
- requires noexcept (std::declval<Obj>().TEMPKW __VA_ARGS__ (std::declval<Params>()...)); } \
797
- || requires { requires !requires { std::declval<Obj>().TEMPKW __VA_ARGS__ (std::declval<Params>()...); }; \
798
- requires noexcept (__VA_ARGS__ (std::declval<Obj>(), std::declval<Params>()...)); }
799
- #define CPP2_UFCS_IS_NOTHROW_PARAM (TEMPKW,...) /* empty*/
800
- #define CPP2_UFCS_IS_NOTHROW_ARG (TEMPKW,...) CPP2_UFCS_IS_NOTHROW(TEMPKW,__VA_ARGS__)
794
+ #define CPP2_UFCS_IS_NOTHROW (QUALID, TEMPKW,...) \
795
+ requires { requires requires { std::declval<Obj>().QUALID TEMPKW __VA_ARGS__ (std::declval<Params>()...); }; \
796
+ requires noexcept (std::declval<Obj>().QUALID TEMPKW __VA_ARGS__ (std::declval<Params>()...)); } \
797
+ || requires { requires !requires { std::declval<Obj>().QUALID TEMPKW __VA_ARGS__ (std::declval<Params>()...); }; \
798
+ requires noexcept (QUALID __VA_ARGS__ (std::declval<Obj>(), std::declval<Params>()...)); }
799
+ #define CPP2_UFCS_IS_NOTHROW_PARAM (QUALID, TEMPKW,...) /* empty*/
800
+ #define CPP2_UFCS_IS_NOTHROW_ARG (QUALID, TEMPKW,...) CPP2_UFCS_IS_NOTHROW(QUALID, TEMPKW,__VA_ARGS__)
801
801
#if defined(__GNUC__) && !defined(__clang__)
802
802
#undef CPP2_UFCS_IS_NOTHROW_PARAM
803
803
#undef CPP2_UFCS_IS_NOTHROW_ARG
804
- #define CPP2_UFCS_IS_NOTHROW_PARAM (TEMPKW,...) , bool IsNothrow = CPP2_UFCS_IS_NOTHROW(TEMPKW,__VA_ARGS__)
805
- #define CPP2_UFCS_IS_NOTHROW_ARG (TEMPKW,...) IsNothrow
804
+ #define CPP2_UFCS_IS_NOTHROW_PARAM (QUALID, TEMPKW,...) , bool IsNothrow = CPP2_UFCS_IS_NOTHROW(QUALID, TEMPKW,__VA_ARGS__)
805
+ #define CPP2_UFCS_IS_NOTHROW_ARG (QUALID, TEMPKW,...) IsNothrow
806
806
#if __GNUC__ < 11
807
807
#undef CPP2_UFCS_IS_NOTHROW_PARAM
808
808
#undef CPP2_UFCS_IS_NOTHROW_ARG
@@ -811,23 +811,25 @@ class out {
811
811
#endif
812
812
#endif
813
813
814
- #define CPP2_UFCS_ (LAMBDADEFCAPT,TEMPKW,...) \
815
- [LAMBDADEFCAPT]<typename Obj, typename ... Params CPP2_UFCS_IS_NOTHROW_PARAM (TEMPKW,__VA_ARGS__)> \
814
+ #define CPP2_UFCS_ (LAMBDADEFCAPT,QUALID, TEMPKW,...) \
815
+ [LAMBDADEFCAPT]<typename Obj, typename ... Params CPP2_UFCS_IS_NOTHROW_PARAM (QUALID, TEMPKW,__VA_ARGS__)> \
816
816
CPP2_LAMBDA_NO_DISCARD (Obj&& obj, Params&& ...params) CPP2_FORCE_INLINE_LAMBDA_CLANG \
817
- noexcept (CPP2_UFCS_IS_NOTHROW_ARG(TEMPKW,__VA_ARGS__)) CPP2_FORCE_INLINE_LAMBDA -> decltype(auto ) \
818
- requires requires { CPP2_FORWARD (obj).TEMPKW __VA_ARGS__ (CPP2_FORWARD (params)...); } \
819
- || requires { __VA_ARGS__ (CPP2_FORWARD (obj), CPP2_FORWARD (params)...); } { \
820
- if constexpr (requires { CPP2_FORWARD (obj).TEMPKW __VA_ARGS__ (CPP2_FORWARD (params)...); }) { \
821
- return CPP2_FORWARD (obj).TEMPKW __VA_ARGS__ (CPP2_FORWARD (params)...); \
817
+ noexcept (CPP2_UFCS_IS_NOTHROW_ARG(QUALID, TEMPKW,__VA_ARGS__)) CPP2_FORCE_INLINE_LAMBDA -> decltype(auto ) \
818
+ requires requires { CPP2_FORWARD (obj).QUALID TEMPKW __VA_ARGS__ (CPP2_FORWARD (params)...); } \
819
+ || requires { QUALID __VA_ARGS__ (CPP2_FORWARD (obj), CPP2_FORWARD (params)...); } { \
820
+ if constexpr (requires { CPP2_FORWARD (obj).QUALID TEMPKW __VA_ARGS__ (CPP2_FORWARD (params)...); }) { \
821
+ return CPP2_FORWARD (obj).QUALID TEMPKW __VA_ARGS__ (CPP2_FORWARD (params)...); \
822
822
} else { \
823
- return __VA_ARGS__ (CPP2_FORWARD (obj), CPP2_FORWARD (params)...); \
823
+ return QUALID __VA_ARGS__ (CPP2_FORWARD (obj), CPP2_FORWARD (params)...); \
824
824
} \
825
825
}
826
826
827
- #define CPP2_UFCS (...) CPP2_UFCS_(&,,__VA_ARGS__)
828
- #define CPP2_UFCS_TEMPLATE (...) CPP2_UFCS_(&,template ,__VA_ARGS__)
829
- #define CPP2_UFCS_NONLOCAL (...) CPP2_UFCS_(,,__VA_ARGS__)
830
- #define CPP2_UFCS_TEMPLATE_NONLOCAL (...) CPP2_UFCS_(,template ,__VA_ARGS__)
827
+ #define CPP2_UFCS (...) CPP2_UFCS_(&,,,__VA_ARGS__)
828
+ #define CPP2_UFCS_TEMPLATE (...) CPP2_UFCS_(&,,template ,__VA_ARGS__)
829
+ #define CPP2_UFCS_QUALIFIED_TEMPLATE (QUALID,...) CPP2_UFCS_(&,QUALID,template ,__VA_ARGS__)
830
+ #define CPP2_UFCS_NONLOCAL (...) CPP2_UFCS_(,,,__VA_ARGS__)
831
+ #define CPP2_UFCS_TEMPLATE_NONLOCAL (...) CPP2_UFCS_(,,template ,__VA_ARGS__)
832
+ #define CPP2_UFCS_QUALIFIED_TEMPLATE_NONLOCAL (QUALID,...) CPP2_UFCS_(,QUALID,template ,__VA_ARGS__)
831
833
832
834
833
835
// -----------------------------------------------------------------------
0 commit comments