Namespace
Varianti

std::forward_list::begin, std::forward_list::cbegin

Da cppreference.com.
 
 
 
std::forward_list
Membri funzioni
Original:
Member functions
The text has been machine-translated via Google Translate.
You can help to correct and verify the translation. Click here for instructions.
forward_list::forward_list
forward_list::~forward_list
forward_list::operator=
forward_list::assign
forward_list::get_allocator
Elemento accesso
Original:
Element access
The text has been machine-translated via Google Translate.
You can help to correct and verify the translation. Click here for instructions.
forward_list::front
Iteratori
Original:
Iterators
The text has been machine-translated via Google Translate.
You can help to correct and verify the translation. Click here for instructions.
forward_list::before_begin
forward_list::cbefore_begin
forward_list::begin
forward_list::cbegin
forward_list::end
forward_list::cend
Capacità
Original:
Capacity
The text has been machine-translated via Google Translate.
You can help to correct and verify the translation. Click here for instructions.
forward_list::empty
forward_list::max_size
Modificatori
Original:
Modifiers
The text has been machine-translated via Google Translate.
You can help to correct and verify the translation. Click here for instructions.
forward_list::clear
forward_list::insert_after
forward_list::emplace_after
forward_list::erase_after
forward_list::push_front
forward_list::emplace_front
forward_list::pop_front
forward_list::resize
forward_list::swap
Operazioni
Original:
Operations
The text has been machine-translated via Google Translate.
You can help to correct and verify the translation. Click here for instructions.
forward_list::merge
forward_list::splice_after
forward_list::remove
forward_list::remove_if
forward_list::reverse
forward_list::unique
forward_list::sort
 
iterator begin() noexcept;
const_iterator begin() const noexcept;
const_iterator cbegin() const noexcept;

Restituisce un iteratore al primo elemento del container.

Se il container è vuoto, l'iteratore restituito sarà uguale a end().

range-begin-end.svg

Indice

[modifica] Parametri

(nessuno)

[modifica] Valore restituito

Iteratore al primo elemento

[modifica] Complessità

Costante


[modifica] Example

#include <iostream>
#include <forward_list>
#include <string>
 
int main()
{
	std::forward_list<int> ints {1, 2, 4, 8, 16};
	std::forward_list<std::string> fruits {"orange", "apple", "raspberry"};
	std::forward_list<char> empty;
 
	// Sums all integers in the forward_list ints (if any), printing only the result.
	int sum = 0;
	for (auto it = ints.cbegin(); it != ints.cend(); it++)
		sum += *it;
	std::cout << "Sum of ints: " << sum << "\n";
 
	// Prints the first fruit in the forward_list fruits, without checking if there is one.
	std::cout << "First fruit: " << *fruits.begin() << "\n";
 
	if (empty.begin() == empty.end())
		std::cout << "forward_list 'empty' is indeed empty.\n";
}

Output:

Sum of ints: 31
First fruit: orange
forward_list 'empty' is indeed empty.

[modifica] Vedi anche

restituisce un iteratore fino alla fine
Original:
returns an iterator to the end
The text has been machine-translated via Google Translate.
You can help to correct and verify the translation. Click here for instructions.

(metodo pubblico) [edit]