fork download
  1. #include <vector>
  2. #include <algorithm>
  3. #include <iostream>
  4.  
  5. enum Item_t { A, B, C };
  6.  
  7. template <class T>
  8. bool vectorContains(std::vector<T> &vector,const T& value){
  9. return std::find(vector.begin(), vector.end(), value)!=vector.end();
  10. }
  11.  
  12. int main() {
  13. std::vector<Item_t>* spareItems = new std::vector<Item_t>();
  14. Item_t newItem;
  15. std::cout << std::boolalpha;
  16. std::cout << vectorContains(*spareItems, newItem) << std::endl;;
  17. }
  18.  
Success #stdin #stdout 0.01s 2856KB
stdin
Standard input is empty
stdout
false