The list::cbegin is a built-in function in C STL which returns a constant random access iterator which points to the beginning of the list. Hence the iterator obtained can be used to iterate container but cannot be used to modify the content of the object to which it is pointing even if the object itself is not constant.
Returns an iterator to the first element of the vector. If the vector is empty, the returned iterator will be equal to end. Map::cend is a built-in function in C STL which returns a constant iterator pointing to the theoretical element that follows last element in the multimap. Since map container contains the element in an ordered way, cend will point to that follows the last element according to the container’s sorting criterion.
C++ Vector Cbegin
Cbegin Cend Dev C 4
Description
The C++ function std::vector::cbegin() returns a constant random access iterator which points to the beginning of the vector.
Iterator obtained by this member function can be used to iterate container but cannot be used to modify the content of object to which it is pointing even if object itself is not constant.
Declaration
Following is the declaration for std::vector::cbegin() function form std::vector header.
C++11Parameters
None
Return value
Returns a constant random access iterator which points to the beginning of the vector.
ExceptionsDev C++ For Windows 10
This member function never throws exception.
Dev C++ Download Windows 10Time complexity
Constant i.e. O(1)
Example
The following example shows the usage of std::vector::cbegin() function.
Let us compile and run the above program, this will produce the following result −
Cbegin Cend
vector.htm
Comments are closed.
|
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |