본문 바로가기
College Study/C++ (ENG)

[C++] Purpose of STL Container (ENG)

by 2den 2022. 1. 2.
728x90

 

the Purpose

STL container has a standard interface that can be applied to every container.

- It is a little weird. Extremely object-oriented.

std::vector<int> scores;
scores.push_back(10);  // seems like a stack

std::list<int> ages;
ages.push_back(100);   // seems like a stack
 

 

std algorithms work in many containers.

 

It is based on template programming.

 

It allows the memory to be menaged automatically.

- Frequent memory reallocation can result in memory fragmentation. This can be a huge problem, especially when running programs on platforms that do not support virtual memory.

- Debugging and fixing is also not easy.

 

 

 

Self-Made Alternatives of the Companies

EA

- EASTL

- STL compatible containers for fixing memory issues

 

Epic Games (UE4)

- TArray, TMap, TMultiMap, TSet

- containers that have better interface than STL

 

728x90

댓글