Why does removing ‘const’ from the constructor parameter stop the class from being instantiated?

If const is there, and What<int> happens to have a constructor taking The, that would allow Heck(const What<int> &) to be used (because a const reference can bind to a temporary produced by such constructor). Checking for that constructor of What<int> requires instantiating the What<int> template.

If there is no const, no implementation of What<int> could possibly make Heck(What<int> &); be called, so there’s no point in instantiating it.


But it seems that no matter what constructor What<int> has, the Heck(The) overload would take precedence, so strictly speaking, this instantiation seems to be unnecessary in this specific case.

Leave a Comment

Hata!: SQLSTATE[HY000] [1045] Access denied for user 'divattrend_liink'@'localhost' (using password: YES)