fork download
  1. #include <iostream>
  2. #include <vector>
  3.  
  4. template <std::size_t first, std::size_t last, typename T>
  5. bool in_range(T& in)
  6. {
  7. for(auto i = in.begin(); i!=in.end(); ++i)
  8. if(*i<first || *i>last)
  9. return false;
  10. return true;
  11. }
  12.  
  13.  
  14. int main()
  15. {
  16. std::vector<int> test;
  17. test.push_back(1);
  18. test.push_back(5);
  19. test.push_back(6);
  20.  
  21. std::cout<<in_range<4,7>(test);
  22. return 0;
  23. }
  24.  
Success #stdin #stdout 0s 3060KB
stdin
Standard input is empty
stdout
Standard output is empty