I don\'t know if it\'s possible but I want to do stuff like
int someval = 1; if({1,2,3,4}_v.contains(someval ))
but when I try to define l
How about this:
#include template bool contains(std::initializer_list const & il, T const & x) { for (auto const & z : il) { if (z == x) return true; } return false; }
Usage:
bool b = contains({1, 2, 3}, 5); // false