SHARE
TWEET

Untitled

a guest Aug 12th, 2017 44 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. #pragma once
  2.  
  3. namespace Logic {
  4.     template<typename Cond, typename T>
  5.     bool any(Cond cond, T v)
  6.     {
  7.         return cond(v);
  8.     }
  9.  
  10.     template<typename Cond, typename T, typename... Args>
  11.     bool any(Cond cond, T v, Args... args)
  12.     {
  13.         return cond(v) || any(cond, args...);
  14.     }
  15.  
  16.     template<typename Cond, typename T>
  17.     bool all(Cond cond, T v)
  18.     {
  19.         return cond(v);
  20.     }
  21.  
  22.     template<typename Cond, typename T, typename... Args>
  23.     bool all(Cond cond, T v, Args... args)
  24.     {
  25.         return cond(v) && all(cond, args...);
  26.     }
  27.  
  28.     template<typename Cond, typename... Args>
  29.     bool none(Cond cond, Args... args)
  30.     {
  31.         return !all(cond, args...);
  32.     }
  33. }
RAW Paste Data
Top