Skip to main content

std::initializer_list end() method

// Const version
constexpr T* end() const noexcept;

Returns a pointer

to the last element in the initializer list.

If the initializer list is empty, the returned pointer will be equal to begin().

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.end() == 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.

std::initializer_list end() method

// Const version
constexpr T* end() const noexcept;

Returns a pointer

to the last element in the initializer list.

If the initializer list is empty, the returned pointer will be equal to begin().

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.end() == 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.