If I have a template function, say one that calculates an average by summing up the elements in a container of type T holding things of T::value_type, how do I elegantly initialize the sum with a zero?
Suppose the underlying type is not a plain old data type. It could be a complex variable, or some other as yet uncoded mathematical entity which has some form of a zero.
Something more elegant than
T::value_type sum = 0;
Then hoping for the best cast.
maybe you would like better