Open
Description
@Naios Here are some suggestions about fu2::function_base
.
- There are too many boolean template parameters. It's hard to imagine what specific combination of policies are given if we just write
template<typename Arg>
using my_consumer = fu2::function_base<true, false, fu2::capacity_fixed<100U>,
true, false, void(Arg)&&>;
In my opinion, better alternatives might be:
- Use separate
enum
types for each policy parameter, or - Change policy parameters from non-type parameters to type parameters, and define new empty type for each policy.
The second approach might require more template metaprogramming, but it's open-ended (users can add more options at their will) while the enum approach is closed-ended. This might be either pros or cons, though.
I recommend the enum approach, and I think there is virtually no downside of it compared to the boolean approach, except that the implementation might be a bit more verbose.
- This one is about README. I'm not sure what
HasStrongExceptGuarantee
is meant to mean. I mean, I know what strong exception guarantee means in general, but I think it might be better to explicitly say (1) where are the placesfu2::function_base
is guarding against exceptions whenHasStrongExceptGuarantee
is set to betrue
, and (2) exactly what invariants are preserved. I assumed these are about copy assignment, is that correct?
Thanks!