fork download
  1. #include <iostream>
  2. #include <vector>
  3. using namespace std;
  4.  
  5. template<typename Range, typename Value>
  6. void set_to(Range& range, const Value& value)
  7. {
  8. for (auto x : range)
  9. {
  10. x = value;
  11. //cout << x;
  12. }
  13. }
  14.  
  15. int main()
  16. {
  17. std::vector<bool> bbb = {true , false, true};
  18. //std::vector<int> bbb = {true , false, true};
  19. cout << bbb[0] << bbb[1] << bbb[2] << std::endl;
  20. set_to(bbb, false);
  21.  
  22. cout << bbb[0] << bbb[1] << bbb[2] << std::endl;
  23. // your code goes here
  24. return 0;
  25. }
  26.  
Success #stdin #stdout 0s 15232KB
stdin
Standard input is empty
stdout
101
000