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 literal as:
std::vector<int> operator"" _v ( std::initializer_list<int> t )
{
return std::vector<int> (t);
}
to accept initializer list of ints I get
error: 'std::vector<int> operator"" _v(std::initializer_list<int> t)' has invalid argument list
Is there a way to do this? What I really want is to finally be rid of stuff like
if(value == 1 || value ==2 || value == 3 ...
Having to write stuff like this is really annoying, because you'd expect syntax to be
if value in (value1, value2 ...)
or something similar.