Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- template <typename T>
- requires (T& a, const T& b, uint32_t i) {
- a.Update(i);
- {b.GetResult()} -> int32_t;
- }
- void foo(T& x)
- {
- // ...
- }
- template <typename T>
- class foo_traits {
- template <typename U>
- auto check(...) -> std::false_type;
- template <typename U>
- auto check(U x) -> decltype((void)x.Update(uint32_t{}), std::true_type{});
- public:
- bool has_update = decltype(check(std::declval<T>()))::value;
- };
- template <typename T>
- void foo(T& x)
- {
- static_assert(foo_traits<T>::has_update, "blah blah blah");
- }
- template <typename T>
- std::enable_if_t<foo_traits<T>::has_update> foo(T& x)
- {
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement