A RetroSearch Logo

Home - News ( United States | United Kingdom | Italy | Germany ) - Football scores

Search Query:

Showing content from http://www.cplusplus.com/reference/initializer_list/initializer_list/end-free/ below:

function template

<initializer_list>

std::end (initializer_list)
template<class E> const T* end (initializer_list<T> il) noexcept;
template<class E> constexpr const T* end (initializer_list<T> il) noexcept;

Return iterator to end

Returns a pointer to the past-the-end element in il, just like initializer_list's member function end.

This is a template specialization of the global function end for initializer_list objects.



Parameters none

Return Value A pointer to the position that follows the last element in the initializer_list object il.

Example
1
2
3
4
5
6
7
8
9
10
11
12
13
14
// begin/end (initializer_list)
#include <iostream>          // std::cout
#include <initializer_list>  // std::initializer_list

template<class T> void print_list (std::initializer_list<T> il) {
  for (const T* it=begin(il); it!=end(il); ++it) std::cout << ' ' << *it;
  std::cout << '\n';
}

int main()
{
  print_list ({10,20,30});
  return 0;
}

Output:


Complexity Constant.

Data races The il object is accessed. Its contained elements are constant: Concurrently accessing them is always safe.

Exception safetyNo-throw guarantee: this function never throws exceptions.

See also
initializer_list::end
Return iterator to end (public member function)
begin (initializer_list)
Return iterator to beginning (function template)

RetroSearch is an open source project built by @garambo | Open a GitHub Issue

Search and Browse the WWW like it's 1997 | Search results from DuckDuckGo

HTML: 3.2 | Encoding: UTF-8 | Version: 0.7.4