C++ multiset cbegin()C++ multiset cbegin() function is used to return a constant iterator pointing to the first element of the multiset container. SyntaxA const_iterator is an iterator that points to constant content. ParameterNone Return valueThe cbegin() funtion returns a const_iterator pointing to the first element of the multiset. ComplexityConstant Iterator validityNo changes. Data RacesThe container is accessed. Concurrently accessing the elements of a multiset container is safe. Exception SafetyThis member function never throws exception. Example 1Let's see the simple example for cbegin() function: Output: C C++ Java SQL In the above example, cbegin() function is used to return a constant iterator pointing to the first element in the mymultiset multiset. 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 multiset using while loop: Output: Dolly John Nikita Nikita Robin In the above example, cbegin() function is used to return an iterator pointing to the first element in the mymultiset multiset. Example 4Let's see another simple example: Output: Increasing order: ______________________ 290 350 400 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 mymultiset multiset.
Next TopicC++ multiset
|