Many early C ++ compilers created instances of all member functions, regardless of whether you called them or not.
Consider, for example, std::list , which has a member function called sort . With the current, properly functioning compiler, you can create a list instance of a type that does not support comparison. If you try to use list::sort , it will fail because you do not support comparison. Until you call sort on this list, all this is fine, because list<T>::sort will not be created unless you name it.
Together with those older, poorly functioning compilers, trying to create a list<T> meant that list<T>::sort was created even if you had never used it. The existence of list::sort meant that you had to implement < for T , just to create list<T> , even if you had never used sort in a list of this type at all.
source share