Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

C++ standard container and STL container in c++

Recently I am working on a c++ project that I am not allowed to use standard template library or any other templates.

I am kinds of confused after I did some research. What are the containers belongs to standard library while others belongs to standard template library ? Or we don't say container for standard library, do we?

Is vector a container or not? Is vector a class for standard library or it belongs to STL?

I am hoping to implement a list of some structure in standard library, can I use list or vector?

like image 372
leon Avatar asked Jul 29 '15 05:07

leon


People also ask

What is an STL container?

An STL container is a collection of objects of the same type (the elements). Container owns the elements. Creation and destruction is controlled by the container.

Is there an STL for C?

C can't have an "exact equivalent" of STL because C doesn't have templates or classes.

What does STL mean in C?

C++ STL (standard template library) is a software library for the C++ language that provides a collection of templates representing containers, iterators, algorithms, and function objects.

What are the types of STL containers?

Types of STL Container in C++ In C++, there are generally 3 kinds of STL containers: Sequential Containers. Associative Containers. Unordered Associative Containers.


1 Answers

Nothing in the C++ Standard Library "belongs" to the STL. STL is a different library that only influenced many parts in the C++ Standard Library. From the tag wiki:

[STL] is a C++ library of generic containers, iterators, algorithms, and function objects. When C++ was standardised, large parts of the STL were adopted into the Standard Library, […]

However, many people refer to the C++ Standard Library as the Standard Template Library, which is not entirely correct. I'm guessing that if you're not allowed to use the STL, they actually mean that you're not allowed to use the C++ Standard Library. But you'd have to ask them to know what they really mean.

For more information, see What's the difference between "STL" and "C++ Standard Library"?

like image 141
emlai Avatar answered Nov 09 '22 07:11

emlai