Is there a way in C ++ to ensure that function calls are made at compile time so that this call is resolved:
obj.reset().setParam1(10).setParam2(20);
but this does not compile:
obj.reset().setParam1(10);
I want to avoid setting all the parameters in one function, since there are too many of them; therefore, I prefer to use something similar to idiom named parameters.
EDIT: An alternative syntax could be:
obj.reset(setParam1(10), setParam2(20));
or
obj.reset(setParam1(10).setParam2(20));
source
share