I have functions foo
, bar
, baz
defined as follows:
template <typename ...T>
int foo(T... t)
{
return (bar(t), ...);
}
template <typename T>
int bar(T t)
{
// do something and return an int
}
bool baz(int i)
{
// do something and return a bool
}
I want my function foo
to stop folding when baz(bar(t)) == true
and return the value of bar(t)
when that happens. How can I modify the above code to be able to do that?