]> git.ipfire.org Git - thirdparty/gcc.git/blame - libstdc++-v3/testsuite/libstdc++-prettyprinters/cxx11.cc
printers.py (StdForwardListPrinter): Add.
[thirdparty/gcc.git] / libstdc++-v3 / testsuite / libstdc++-prettyprinters / cxx11.cc
CommitLineData
8dfb08ab
JW
1// { dg-do run }
2// { dg-options "-std=gnu++11 -g" }
3
4// Copyright (C) 2011 Free Software Foundation, Inc.
5//
6// This file is part of the GNU ISO C++ Library. This library is free
7// software; you can redistribute it and/or modify it under the
8// terms of the GNU General Public License as published by the
9// Free Software Foundation; either version 3, or (at your option)
10// any later version.
11
12// This library is distributed in the hope that it will be useful,
13// but WITHOUT ANY WARRANTY; without even the implied warranty of
14// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15// GNU General Public License for more details.
16
17// You should have received a copy of the GNU General Public License along
18// with this library; see the file COPYING3. If not see
19// <http://www.gnu.org/licenses/>.
20
21#include <forward_list>
22#include <unordered_map>
23#include <unordered_set>
24#include <string>
25#include <iostream>
26
27template<class T>
28void
29placeholder(const T &s)
30{
31 std::cout << s;
32}
33
34template<class T, class S>
35void
36placeholder(const std::pair<T,S> &s)
37{
38 std::cout << s.first;
39}
40
41template<class T>
42void
43use(const T &container)
44{
45 for (typename T::const_iterator i = container.begin();
46 i != container.end();
47 ++i)
48 placeholder(*i);
49}
50
51int
52main()
53{
54 std::forward_list<int> efl;
55// { dg-final { note-test efl "empty std::forward_list" } }
56
57 std::forward_list<int> fl;
58 fl.push_front(2);
59 fl.push_front(1);
60// { dg-final { note-test fl {std::forward_list = {[0] = 1, [1] = 2}} } }
61
62 std::unordered_map<int, std::string> eum;
63// { dg-final { note-test eum "std::unordered_map with 0 elements" } }
64 std::unordered_multimap<int, std::string> eumm;
65// { dg-final { note-test eumm "std::unordered_multimap with 0 elements" } }
66 std::unordered_set<int> eus;
67// { dg-final { note-test eus "std::unordered_set with 0 elements" } }
68 std::unordered_multiset<int> eums;
69// { dg-final { note-test eums "std::unordered_multiset with 0 elements" } }
70
71 placeholder(""); // Mark SPOT
72 use(efl);
73 use(fl);
74 use(eum);
75 use(eumm);
76 use(eus);
77 use(eums);
78
79 return 0;
80}
81
82// { dg-final { gdb-test SPOT } }