C++

Difference between begin() and cbegin() of Set in C++

This tutorial will discuss the differences between begin() and cbegin() of set in C++. Table Of Contents begin() function of Set cbegin() function of Set In C++, both begin() and cbegin() are member functions of class set. They both returns an iterator pointing to the first element of the container. However, there’s a subtle difference

Difference between begin() and cbegin() of Set in C++ Read More »

How to Use Lambda function during Set Iteration in C++?

This tutorial will discuss multiple ways to use lambda function during set iteration in C++. Table Of Contents Using std::for_each() and Lambda Function Using Range Based For Loop and Lambda Function Using std::for_each() and Lambda Function Suppose we have a set of integers. If we want to iterate over all the elements in this set

How to Use Lambda function during Set Iteration in C++? Read More »

How to Use Range Based For Loops with Set in C++11 and later?

This tutorial will discuss how to use range based for loops with set in C++11 and later. In C++11, the range-based for loop was introduced. It allows us to iterate over a sequence of elements without explicitly using an iterator or random-access operators. In the range-based for loop, we only need to specify a variable

How to Use Range Based For Loops with Set in C++11 and later? Read More »

What Kind of iterators does a Set provide in C++?

This tutorial will discuss the different kind of iterators a Set provides in C++. Table Of Contents Bidirectional Iterator Const Iterator : const_iterator Reverse iterator Const Reverse iterator In C++, the Set class provides bidirectional iterators. This means we can increment and decrement the iterators, but we cannot perform arithmetic operations on them like we

What Kind of iterators does a Set provide in C++? Read More »

Scroll to Top