std::forward_list<T,Allocator>:: front
|
reference front
(
)
;
|
(1) |
(seit C++11)
(constexpr seit C++26) |
|
const_reference front
(
)
const
;
|
(2) |
(seit C++11)
(constexpr seit C++26) |
Gibt eine Referenz auf das erste Element im Container zurück.
|
Wenn empty() true ist, ist das Verhalten undefiniert. |
(bis C++26) |
|
Wenn empty() true ist:
|
(seit C++26) |
InhaltRückgabewertVerweis auf das erste Element. KomplexitätKonstante. HinweiseFür einen Container c ist der Ausdruck c. front ( ) äquivalent zu * c. begin ( ) . BeispielDer folgende Code verwendet Diesen Code ausführen #include <cassert>
#include <forward_list>
int main()
{
std::forward_list<char> letters{'a', 'b', 'c', 'd'};
assert(letters.front() == 'a');
}
Siehe auch
|