Upstream version 10.39.225.0
[platform/framework/web/crosswalk.git] / src / third_party / libc++ / trunk / test / containers / unord / unord.multimap / types.pass.cpp
1 //===----------------------------------------------------------------------===//
2 //
3 //                     The LLVM Compiler Infrastructure
4 //
5 // This file is dual licensed under the MIT and the University of Illinois Open
6 // Source Licenses. See LICENSE.TXT for details.
7 //
8 //===----------------------------------------------------------------------===//
9
10 // <unordered_map>
11
12 // template <class Key, class T, class Hash = hash<Key>, class Pred = equal_to<Key>,
13 //           class Alloc = allocator<pair<const Key, T>>>
14 // class unordered_multimap
15 // {
16 // public:
17 //     // types
18 //     typedef Key                                                        key_type;
19 //     typedef T                                                          mapped_type;
20 //     typedef Hash                                                       hasher;
21 //     typedef Pred                                                       key_equal;
22 //     typedef Alloc                                                      allocator_type;
23 //     typedef pair<const key_type, mapped_type>                          value_type;
24 //     typedef value_type&                                                reference;
25 //     typedef const value_type&                                          const_reference;
26 //     typedef typename allocator_traits<allocator_type>::pointer         pointer;
27 //     typedef typename allocator_traits<allocator_type>::const_pointer   const_pointer;
28 //     typedef typename allocator_traits<allocator_type>::size_type       size_type;
29 //     typedef typename allocator_traits<allocator_type>::difference_type difference_type;
30
31 #include <unordered_map>
32 #include <type_traits>
33
34 #include "min_allocator.h"
35
36 int main()
37 {
38     {
39         typedef std::unordered_multimap<char, short> C;
40         static_assert((std::is_same<C::key_type, char>::value), "");
41         static_assert((std::is_same<C::mapped_type, short>::value), "");
42         static_assert((std::is_same<C::hasher, std::hash<C::key_type> >::value), "");
43         static_assert((std::is_same<C::key_equal, std::equal_to<C::key_type> >::value), "");
44         static_assert((std::is_same<C::allocator_type, std::allocator<C::value_type> >::value), "");
45         static_assert((std::is_same<C::value_type, std::pair<const C::key_type, C::mapped_type> >::value), "");
46         static_assert((std::is_same<C::reference, C::value_type&>::value), "");
47         static_assert((std::is_same<C::const_reference, const C::value_type&>::value), "");
48         static_assert((std::is_same<C::pointer, C::value_type*>::value), "");
49         static_assert((std::is_same<C::const_pointer, const C::value_type*>::value), "");
50         static_assert((std::is_same<C::size_type, std::size_t>::value), "");
51         static_assert((std::is_same<C::difference_type, std::ptrdiff_t>::value), "");
52     }
53 #if __cplusplus >= 201103L
54     {
55         typedef std::unordered_multimap<char, short, std::hash<char>, std::equal_to<char>,
56                             min_allocator<std::pair<const char, short>>> C;
57         static_assert((std::is_same<C::key_type, char>::value), "");
58         static_assert((std::is_same<C::mapped_type, short>::value), "");
59         static_assert((std::is_same<C::hasher, std::hash<C::key_type> >::value), "");
60         static_assert((std::is_same<C::key_equal, std::equal_to<C::key_type> >::value), "");
61         static_assert((std::is_same<C::allocator_type, min_allocator<C::value_type> >::value), "");
62         static_assert((std::is_same<C::value_type, std::pair<const C::key_type, C::mapped_type> >::value), "");
63         static_assert((std::is_same<C::reference, C::value_type&>::value), "");
64         static_assert((std::is_same<C::const_reference, const C::value_type&>::value), "");
65         static_assert((std::is_same<C::pointer, min_pointer<C::value_type>>::value), "");
66         static_assert((std::is_same<C::const_pointer, min_pointer<const C::value_type>>::value), "");
67     //  min_allocator doesn't have a size_type, so one gets synthesized
68         static_assert((std::is_same<C::size_type, std::make_unsigned<C::difference_type>::type>::value), "");
69         static_assert((std::is_same<C::difference_type, std::ptrdiff_t>::value), "");
70     }
71 #endif
72 }