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 | // |
Howard Hinnant | b64f8b0 | 2010-11-16 22:09:02 +0000 | [diff] [blame] | 5 | // This file is dual licensed under the MIT and the University of Illinois Open |
| 6 | // Source Licenses. See LICENSE.TXT for details. |
Howard Hinnant | bc8d3f9 | 2010-05-11 19:42:16 +0000 | [diff] [blame] | 7 | // |
| 8 | //===----------------------------------------------------------------------===// |
| 9 | |
| 10 | // <map> |
| 11 | |
| 12 | // class multimap |
| 13 | |
| 14 | // multimap(initializer_list<value_type> il, const key_compare& comp = key_compare()); |
| 15 | |
| 16 | #include <map> |
| 17 | #include <cassert> |
| 18 | #include "../../../test_compare.h" |
| 19 | |
| 20 | int main() |
| 21 | { |
Howard Hinnant | e3e3291 | 2011-08-12 21:56:02 +0000 | [diff] [blame^] | 22 | #ifndef _LIBCPP_HAS_NO_GENERALIZED_INITIALIZERS |
Howard Hinnant | bc8d3f9 | 2010-05-11 19:42:16 +0000 | [diff] [blame] | 23 | typedef test_compare<std::less<int> > Cmp; |
| 24 | typedef std::multimap<int, double, Cmp> C; |
| 25 | typedef C::value_type V; |
| 26 | C m( |
| 27 | { |
| 28 | {1, 1}, |
| 29 | {1, 1.5}, |
| 30 | {1, 2}, |
| 31 | {2, 1}, |
| 32 | {2, 1.5}, |
| 33 | {2, 2}, |
| 34 | {3, 1}, |
| 35 | {3, 1.5}, |
| 36 | {3, 2} |
| 37 | }, |
| 38 | Cmp(4) |
| 39 | ); |
| 40 | assert(m.size() == 9); |
| 41 | assert(distance(m.begin(), m.end()) == 9); |
| 42 | C::const_iterator i = m.cbegin(); |
| 43 | assert(*i == V(1, 1)); |
| 44 | assert(*++i == V(1, 1.5)); |
| 45 | assert(*++i == V(1, 2)); |
| 46 | assert(*++i == V(2, 1)); |
| 47 | assert(*++i == V(2, 1.5)); |
| 48 | assert(*++i == V(2, 2)); |
| 49 | assert(*++i == V(3, 1)); |
| 50 | assert(*++i == V(3, 1.5)); |
| 51 | assert(*++i == V(3, 2)); |
| 52 | assert(m.key_comp() == Cmp(4)); |
Howard Hinnant | e3e3291 | 2011-08-12 21:56:02 +0000 | [diff] [blame^] | 53 | #endif // _LIBCPP_HAS_NO_GENERALIZED_INITIALIZERS |
Howard Hinnant | bc8d3f9 | 2010-05-11 19:42:16 +0000 | [diff] [blame] | 54 | } |