lundi 24 mai 2021

How STL Containers Instantiate For User Objects

Starting to learn C++, I fell on this -

If I created a class template/function template I need to know in advance possible "types" that may use it. So I need to declare something like :

class template ClassName<type1,type2>;

The line above causes a specialization to be instantiated for specific function and linker attaches calls to that instance. But then question is how STL containers/algorithms etc achieve that for "any" user object?

Seems like this has to do with interface of application.

Excuse me if this is a duplicate question but I did not find any answer on google or StackOverflow. If it is already there, a pointer would help.

Aucun commentaire:

Enregistrer un commentaire