Hello, OnlineGDB Q&A section lets you put your programming query to fellow community users. Asking a solution for whole assignment is strictly not allowed. You may ask for help where you are stuck. Try to add as much information as possible so that fellow users can know about your problem statement easily.

Why is the vector class written as a template class?

–4 votes
asked Apr 10, 2020 by TylerBlachowiak (330 points)
retagged Apr 10, 2020 by TylerBlachowiak

1 Answer

+1 vote
answered Jan 5, 2021 by Purushottam Kumar (240 points)

vector is a template class, which can be used with a type, in the format: vector<int> , vector<double> , vector<string> . The same template class can be used to handle many types, instead of repeatably writing codes for each of the type.

Welcome to OnlineGDB Q&A, where you can ask questions related to programming and OnlineGDB IDE and and receive answers from other members of the community.
...