We are committed to provide service 24 X 7

Deals, Shopping, Training, Tools

Category: end()

Different ways to iterate over a set in C++

In this article we will discuss different ways to iterate over a set in C++. Let’s create a set of strings i.e. Advertisements // Set of strings std::set<std::string> setOfStr = { “jjj”, “khj”, “bca”, “aaa”, “ddd” }; Now let’s iterate over it and print the contents on screen using different methods i.e. Iterating over a …

Different ways to iterate over a set in C++Read More

Different ways to Erase / Delete an element from a Set in C++

In this article we will discuss different ways to remove an element from Set. std::set provides 3 overloaded version of erase() member function. We will discuss them one by one. Advertisements Suppose we have a set of strings i.e. //Set Of Strings std::set<std::string> setOfStrs = {“Hi”, “Hello”, “is”, “the”, “at”, “Hi”, “is”, “from”, “that”}; Let’s …

Different ways to Erase / Delete an element from a Set in C++Read More

Erase elements from a Set while Iterating in C++ & Generic erase_if()

In this article we will discuss how to erase elements from a set while iterating over it. Erasing elements from std::set while Iterating std::set provides a member function erase() that accepts an iterator as an argument and deletes it from the set i.e. iterator erase (const_iterator position); But it makes the passed iterator invalid. From …

Erase elements from a Set while Iterating in C++ & Generic erase_if()Read More

Cart

Your Cart is Empty

Back To Shop