Example #1
0
void combineL(std::vector<List<int>>::const_iterator it, 
			  std::vector<List<int>>::const_iterator end, 
			  std::vector<int> & acc)
{
	int sum = 0;
	std::vector<List<int>> tails;
	while (it != end)
	{
		if (it->isEmpty())
			return;
		sum += it->front();
		tails.push_back(it->pop_front());
		++it;
	}
	acc.push_back(sum);
	combineL(tails.begin(), tails.end(), acc);
}