Advertisement
ulfben

any of, none of

Mar 18th, 2021
1,201
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 0.30 KB | None | 0 0
  1. template <typename T, typename ...Args>
  2. bool any_of(T const v, Args&&... args) requires (sizeof...(args) > 0)
  3. {
  4.    return ((args == v) || ...);
  5. }
  6.  
  7. template <typename T, typename ...Args>
  8. bool none_of(T const v, Args&&... args) requires (sizeof...(args) > 0)
  9. {
  10.    return ((args != v) && ...);
  11. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement