blob: df79f2f1aa2cf6b288e64050008266a1e09bebb1 [file] [log] [blame]
Howard Hinnantbc8d3f92010-05-11 19:42:16 +00001//===----------------------------------------------------------------------===//
2//
Howard Hinnantf5256e12010-05-11 21:36:01 +00003// The LLVM Compiler Infrastructure
Howard Hinnantbc8d3f92010-05-11 19:42:16 +00004//
5// This file is distributed under the University of Illinois Open Source
6// License. See LICENSE.TXT for details.
7//
8//===----------------------------------------------------------------------===//
9
10// <map>
11
12// class map
13
14// map& operator=(initializer_list<value_type> il);
15
16#include <map>
17#include <cassert>
18
19int main()
20{
Howard Hinnant73d21a42010-09-04 23:28:19 +000021#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES
Howard Hinnantbc8d3f92010-05-11 19:42:16 +000022 typedef std::pair<const int, double> V;
23 std::map<int, double> m =
24 {
25 {20, 1},
26 };
Howard Hinnant6046ace2010-08-22 00:15:28 +000027 m =
Howard Hinnantbc8d3f92010-05-11 19:42:16 +000028 {
29 {1, 1},
30 {1, 1.5},
31 {1, 2},
32 {2, 1},
33 {2, 1.5},
34 {2, 2},
35 {3, 1},
36 {3, 1.5},
37 {3, 2}
38 };
39 assert(m.size() == 3);
40 assert(distance(m.begin(), m.end()) == 3);
41 assert(*m.begin() == V(1, 1));
42 assert(*next(m.begin()) == V(2, 1));
43 assert(*next(m.begin(), 2) == V(3, 1));
Howard Hinnant73d21a42010-09-04 23:28:19 +000044#endif // _LIBCPP_HAS_NO_RVALUE_REFERENCES
Howard Hinnantbc8d3f92010-05-11 19:42:16 +000045}