Howard Hinnant | bc8d3f9 | 2010-05-11 19:42:16 +0000 | [diff] [blame] | 1 | //===----------------------------------------------------------------------===// |
| 2 | // |
Howard Hinnant | f5256e1 | 2010-05-11 21:36:01 +0000 | [diff] [blame] | 3 | // The LLVM Compiler Infrastructure |
Howard Hinnant | bc8d3f9 | 2010-05-11 19:42:16 +0000 | [diff] [blame] | 4 | // |
| 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 | // void insert(initializer_list<value_type> il); |
| 15 | |
| 16 | #include <map> |
| 17 | #include <cassert> |
| 18 | |
| 19 | int main() |
| 20 | { |
Howard Hinnant | 73d21a4 | 2010-09-04 23:28:19 +0000 | [diff] [blame^] | 21 | #ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES |
Howard Hinnant | bc8d3f9 | 2010-05-11 19:42:16 +0000 | [diff] [blame] | 22 | typedef std::pair<const int, double> V; |
| 23 | std::map<int, double> m = |
| 24 | { |
| 25 | {1, 1}, |
| 26 | {1, 1.5}, |
| 27 | {1, 2}, |
| 28 | {3, 1}, |
| 29 | {3, 1.5}, |
| 30 | {3, 2} |
| 31 | }; |
| 32 | m.insert({ |
| 33 | {2, 1}, |
| 34 | {2, 1.5}, |
| 35 | {2, 2}, |
| 36 | }); |
| 37 | assert(m.size() == 3); |
| 38 | assert(distance(m.begin(), m.end()) == 3); |
| 39 | assert(*m.begin() == V(1, 1)); |
| 40 | assert(*next(m.begin()) == V(2, 1)); |
| 41 | assert(*next(m.begin(), 2) == V(3, 1)); |
Howard Hinnant | 73d21a4 | 2010-09-04 23:28:19 +0000 | [diff] [blame^] | 42 | #endif // _LIBCPP_HAS_NO_RVALUE_REFERENCES |
Howard Hinnant | bc8d3f9 | 2010-05-11 19:42:16 +0000 | [diff] [blame] | 43 | } |