is it possible to construct variadic arguments for function by overloading operator comma of the argument? i want to see an example how to do so.., maybe something like this
Maybe something like this:
class MyArgList {
public:
typedef std::list ManyList;
template
MyArgList& operator, (const T& val) {
elems.push_back(val);
return *this;
}
ManyList::iterator begin() {return elems.begin();}
...
private:
ManyList elems;
};
Usage would be:
void foo(MyArgList& list);
foo((myArgList(),1,2,3,4,5));