4 ms·
int foo(invocable<int,int> auto fn){ return fn(10,20); } But I think you wanted to show a different example.
by gpderetta 3y ago
int foo(invocable<int,int> auto fn){ return fn(10,20); }
But I think you wanted to show a different example.
- injidup 3y agoI'm on mobile so maybe I mixed the concept and the trait but there should be an invocable_r version that constrains the return type in addition to invocable which just constrains the arguments. And yes the inline version rather than requires is much nicer.
- gpderetta 3y agoOh, I see. Yes, out of the box there is a trait, but not a concept.