File tree Expand file tree Collapse file tree 2 files changed +24
-3
lines changed Expand file tree Collapse file tree 2 files changed +24
-3
lines changed Original file line number Diff line number Diff line change @@ -57,6 +57,25 @@ struct foo
5757};
5858```
5959
60+ If the member is defined outside of the class, use `TICK_MEMBER_REQUIRES_OC` (OC: outside_class) outside the class. For example,
61+ ```cpp
62+ template<class T>
63+ struct foo
64+ {
65+ T x;
66+
67+ TICK_MEMBER_REQUIRES(is_incrementable<T>())
68+ void up();
69+ };
70+
71+ template<class T>
72+ TICK_MEMBER_REQUIRES_OC(is_incrementable<T>())
73+ void foo<T>::up()
74+ {
75+ x++;
76+ }
77+ ```
78+
6079TICK_PARAM_REQUIRES
6180--------------------
6281
Original file line number Diff line number Diff line change @@ -53,14 +53,16 @@ trait(Ts&&...) noexcept
5353
5454#define TICK_CLASS_REQUIRES (...) typename std::enable_if<(__VA_ARGS__)>::type
5555
56- #define TICK_REQUIRES (...) bool TickPrivateBool ## __LINE__=true , typename std::enable_if<(TickPrivateBool##__LINE__ && __VA_ARGS__), int >::type = 0
56+ #define TICK_REQUIRES (...) bool TickPrivateBool ## __LINE__=true , typename std::enable_if<(TickPrivateBool##__LINE__ && __VA_ARGS__), int >::type = 0
57+ #define TICK_REQUIRES_OC (...) bool TickPrivateBool ## __LINE__, typename std::enable_if<(TickPrivateBool##__LINE__ && __VA_ARGS__), int >::type
5758
58- #define TICK_MEMBER_REQUIRES (...) template <TICK_REQUIRES(__VA_ARGS__)>
59+ #define TICK_MEMBER_REQUIRES (...) template <TICK_REQUIRES( __VA_ARGS__)>
60+ #define TICK_MEMBER_REQUIRES_OC (...) template <TICK_REQUIRES_OC(__VA_ARGS__)>
5961
6062#define TICK_PARAM_REQUIRES (...) \
6163typename std::enable_if< \
6264 (tick::detail::param_extract<decltype (__VA_ARGS__)>::value), \
6365 typename tick::detail::private_enum<__LINE__>::type \
6466>::type = tick::detail::private_enum<__LINE__>::type::na
6567
66- #endif
68+ #endif
You can’t perform that action at this time.
0 commit comments