fork(1) download
  1. #include <algorithm>
  2. #include <array>
  3. #include <string>
  4. #include <iostream>
  5. #include <initializer_list>
  6.  
  7. template<class Type, class Next>
  8. bool is_one_of(const Type& needle, const Next& next)
  9. {return needle==next;}
  10. template<class Type, class Next, class ... Rest>
  11. bool is_one_of(const Type& needle, const Next& next, Rest... haystack)
  12. {return needle==next || is_one_of(needle, haystack...);}
  13.  
  14. int main() {
  15. std::string X, Y;
  16. if (is_one_of(X, Y, "HI"))
  17. std::cout << "it is!";
  18. else
  19. std::cout << "it isn't!";
  20. return 0;
  21. }
Success #stdin #stdout 0s 2884KB
stdin
Standard input is empty
stdout
it is!