std::initializer_list begin() method
- since C++14
- until C++14
// Const version
constexpr T* begin() const noexcept;
// Const version
constexpr T* begin() const noexcept;
Returns a pointer
to the first element in the initializer list.If the initializer list is empty, the returned pointer will be equal to end()
.
Parameters
(none)
Return value
Pointer to the first character.
Complexity
Constant - O(1).
Example
Main.cpp
#include <initializer_list>
int main()
{
static constexpr auto il = {42, 24};
static_assert(*il.begin() == 0x2A);
}
This article originates from this CppReference page. It was likely altered for improvements or editors' preference. Click "Edit this page" to see all changes made to this document.
Hover to see the original license.
Hover to see the original license.