
18 Jul
2006
18 Jul
'06
12:42 p.m.
Philippe Vaucher wrote:
but what you can do to get the info is :
if(std::distance(tok.begin(), tok.end()) < 3) { std::cout << "not enough arguments\n"; exit(1); }
arg1=*pos++; arg2=*pos++; arg3=*pos++;
Alternatively, you could write a next() function: template<typename It> inline typename std::iterator_traits<It>::value_type next(It &first, It &last) { if(first == last) { throw something; } return *first++; } And then just do: arg1 = next(pos, end); arg2 = next(pos, end); arg3 = next(pos, end); Sebastian Redl