Category "stl"

STL parallel execution vs. OpenMP performance

I'm starting a new project and would like to parallelize some computations. I've used OpenMP in the past, but am aware that now many STL algorithms can be paral

Find the number of steps a string can be reduced to 0

My assignment: You are given a non-negative integer variable $Z$. There are two actions available that can change its value: if $Z$ is odd, subtract 1

Can ETL be used with Atmel Studio?

The Embedded Template Library provides the data structures of the STL without using dynamic allocation, to be used in embedded development. I'm experimenting wi

Which STL data structures with an incomplete type stored can be used as a class member?

As far as I know, since C++17 some STL data structures may "exist" with an incomplete type as the template parameter which describes the type stored. For exampl

How can I make a list that can be accesed by other classes?

I'm trying to make a project using the standard std::list. There is a list of names that have to be accessed by multiple classes. The list has to be inside a cl

Does GCC support C++20 std::format?

If it doesn't, do you know what compiler or version will? See cppreference/format.

MSVC C++ find out what function requires linker symbol

I have a special situation. In my project the kernel32.lib is replaced by a substition library (Windows realtime extension RTX). So I do not link to kernel32.li

Is there still a need to provide default constructors to use STL containers?

I remember that back in C++98, if you wanted to make an STL container of MyClass, you needed to provide default constructor to MyClass. Was this specific to som

Algorithm to convert std::stack to std::string in C++ STL

In below C++ program I'm deleting a previous character considering '#' as a backspace character. I have used stack to build the string. Is there any C++ STL alg

How do I print a queue?

I am trying to print a queue below. I have tried the idea of creating a temp queue and writing into it then writing it back. But it's not working. Or what am I

how do you insert the value in a sorted vector?

ALL, This question is a continuation of this one. I think that STL misses this functionality, but it just my IMHO. Now, to the question. Consider following c

C++ STL vector for existing data

Can I create an std::vector using my pre-existing data instead of it allocating new memory and copying the data? To be clearer, if I have a memory area (either

Use of a functor on for_each

Why does the for_each call on functor doesn't update sum::total at the end? struct sum { sum():total(0){}; int total; void operator()(int element)

C++ Double Address Operator? (&&)

I'm reading STL source code and I have no idea what && address operator is supposed to do. Here is a code example from stl_vector.h: vector& operat