1//===----------------------------------------------------------------------===//
2//
3// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
4// See https://llvm.org/LICENSE.txt for license information.
5// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
6//
7//===----------------------------------------------------------------------===//
8
9// UNSUPPORTED: c++03
10
11// <forward_list>
12
13// forward_list(initializer_list<value_type> il);
14
15#include <forward_list>
16#include <cassert>
17
18#include "test_macros.h"
19#include "min_allocator.h"
20
21int main(int, char**)
22{
23 {
24 typedef int T;
25 typedef std::forward_list<T> C;
26 C c = {0, 1, 2, 3, 4, 5, 6, 7, 8, 9};
27 int n = 0;
28 for (C::const_iterator i = c.begin(), e = c.end(); i != e; ++i, ++n)
29 assert(*i == n);
30 assert(n == 10);
31 }
32 {
33 typedef int T;
34 typedef std::forward_list<T, min_allocator<T>> C;
35 C c = {0, 1, 2, 3, 4, 5, 6, 7, 8, 9};
36 int n = 0;
37 for (C::const_iterator i = c.begin(), e = c.end(); i != e; ++i, ++n)
38 assert(*i == n);
39 assert(n == 10);
40 }
41
42 return 0;
43}
44

source code of libcxx/test/std/containers/sequences/forwardlist/forwardlist.cons/init.pass.cpp