How can C++ avoid using highly unrestricted templates with common names
This article mainly explains "how C++ avoids using a highly unrestricted template for common names". Interested friends may wish to have a look. The method introduced in this paper is simple, fast and practical. Next, let the editor take you to learn how C++ can avoid using a highly unrestricted template for common names.
T.47: avoid using highly unrestricted templates with common names
Reason (reason)
An unconstrained template argument is a perfect match for anything so such a template can be preferred over more specific types that require minor conversions. This is particularly annoying/dangerous when ADL is used. Common names make this problem more likely.
Unrestricted template parameters perfectly match anything, so such templates can cover specific types that require slight conversion. This situation can be troublesome / dangerous when using ADL. A common name will make this problem more likely to occur.
Example (sample)
Namespace Bad {
Struct S {int m;}
Template
Bool operator== (T1, T2) {cout