On 31/10/2019 04:46, Zach Laine wrote:
Where that breaks down is when you have not a function template that uses certain aspects of a type, but a class template that represents a set of types. That case is different:
foo_template<T> foo; // <-- feel free to use the entire API
If the API is different for various values of T, such as it would be for a text template that instantiates as string-like or rope-like (because those have significantly different interfaces), that implies to me that I should have two names in play -- one for the string version and one for the rope version. Otherwise, the result is super confusing for someone reading or writing code using the unified name.
While I don't disagree with that, there is some precedent for it in the STL, namely future<void> having a different interface from other future<T>. Although most of that is due to C++'s reluctance to treat void as an actual type. (Though it does have some good features, such as explicit return void, that are lacking in some other languages.)