Przestrzenie nazw
Warianty

std::set::begin, std::set::cbegin

Z cppreference.com
<tbody> </tbody> <tbody class="t-dcl-rev "> </tbody><tbody> </tbody> <tbody class="t-dcl-rev "> </tbody><tbody> </tbody>
iterator begin();
(do C++11)
iterator begin() noexcept;
(od C++11)
const_iterator begin() const;
(do C++11)
const_iterator begin() const noexcept;
(od C++11)
const_iterator cbegin() const noexcept;
(od C++11)

Zwraca iterator na pierwsy element kontenera.

Jeśli kontener jest pusty, zwrócony iterator ma wartość równą end().

Parametry

(brak)

Zwracana wartość

Iterator na pierwszy element

Złożoność

Stała

Przykład

#include <set>
#include <iostream>
 
int main() {
  std::set<int> set = { 6, 1, 3, 4, 2, 5 };
  for (auto it = set.begin(); it != set.end(); ++it)
    std::cout << *it << "\n";
}

Możliwy wynik:

1
2
3
4
5
6

Zobacz także

zwraca iterator za koniec kontenera
(publiczna metoda) [edit]
Morty Proxy This is a proxified and sanitized view of the page, visit original site.