Most voted "stl" questions
The Standard Template Library, or STL, is a C++ library of generic containers, iterators, algorithms, and function objects. It largely influences the standard C++ library. The tag can be used in conjunction with the C++ tag and the more specific aspect of what the question deals with.
Learn more…13 questions
Sort by count of
-
20
votes2
answers1354
viewsIn which situations should I dynamically allocate a vector to C++?
I’m fiddling with a code from a framework for my work. In one of the functions, it dynamically allocates a std::vector, makes a copy of each node the object has and returns it to the user:…
-
12
votes2
answers5293
viewsWhat is an Iterator?
Studying the STL in C++, I almost always come across the term iterator, example: std::vector<int>::iterator it; What is the function of a iterator?…
-
10
votes1
answer2100
viewsDifference between Std::list, Std::vector and Std:array
All are containers used for data guards in a sequential manner, but what are the main differences between them?
-
7
votes1
answer131
viewsHow to dynamically insert into an Std::array?
I’m migrating from C to C++ language, and I want to stop using traditional C language means, like the C vector. It is possible using the std::array insert elements dynamically as in std::vector?…
-
5
votes2
answers259
viewsRemoval of repeated values
I have two Vectors, each with coordinates (x,y). I need to reverse the second vector, getting with (y, x) and merging with the first, but I can’t get repeat in the first field, so I thought I’d use…
-
3
votes1
answer2985
viewsStd::Sort with comparison function
Studying a little about the STL I came across the function std::sort which may receive a comparison function. template< class RandomIt, class Compare > void sort( RandomIt first, RandomIt…
-
2
votes1
answer75
views -
1
votes2
answers57
views -
1
votes1
answer424
viewsHow to create a mapped file with an Std::map
I’m trying to use a Std::map that allocates objects within a file mapped using boost, with a vector worked but with a map not #include <boost/interprocess/managed_mapped_file.hpp> #include…
-
1
votes0
answers75
viewsRuntime Error URI1270
I made a code in C++ to solve the problem URI 1270 Fiber Optics. I did several simulations and the code solves the problem but in the URI environment, the answer is "Runtime Error". Can someone help…
-
0
votes1
answer141
viewsProblem with Iterator Map C++
the program for a URI exercise hangs (as in infinite loop) when the input (double) is different from an integer or decimal number that is not something with a middle (e.g.: 55.5). I have tried to…
-
0
votes1
answer42
viewsHow much can the access cost of an unodered_map hinder the performance of a game?
The cost of access to unordered_map can cause FPS to drop in a game if it is accessed thousands of times per second? class var { public: template < typename t = double > static inline auto…
-
0
votes1
answer45
viewsHow to insert data into a member vector of a struct?
I’m trying to build a structure composed of members that are no more than strings. The 4th member is a string array, since it needs to store more than one piece of information. Once done I declare I…