I prefer auto i = decltype(e){0};
for this. It's a bit simpler than using type_traits
, and I feel it more explicitly specifies the intent that you want a variable initialized to a 0 of e
's type.
I've been using Herb's "AAA Style" a lot lately, so it could just be bias on my part.