C++ set cbegin()C++ set cbegin() function is used to return a constant iterator pointing to the first element of the set container. SyntaxA const_iterator is an iterator that points to constant content. ParameterNone Return valueIt returns a const_iterator pointing to the first element of the set. ComplexityConstant Iterator validityNo changes. Data RacesThe container is accessed. Concurrently accessing the elements of a set is safe. Exception SafetyThis member function never throws exception. Example 1Let's see the simple example for cbegin() function: Output: C++ Java SQL In the above example, cbegin() function is used to return a constant iterator pointing to the first element in the myset set. Example 2Let's see a simple example: Output: The first element of s1 is 1 The first element of s1 is now 2 Example 3Let's see a simple example to iterate over the set using while loop: Output: Dolly John Nikita Robin In the above example, cbegin() function is used to return an iterator pointing to the first element in the myset set. Example 4Let's see another simple example: Output: Increasing order: ______________________ 290 350 400 410 465 Smallest Number is: 290 Biggest Number is: 465 In the above example, cbegin() function is used to return an iterator pointing to the first element in the myset set. Next TopicSet end() Function |
We provides tutorials and interview questions of all technology like java tutorial, android, java frameworks
G-13, 2nd Floor, Sec-3, Noida, UP, 201301, India