blob: 4b4045a51bae097e336bb169bc33eeeb6424ffdf [file] [log] [blame]
Howard Hinnantc52f43e2010-08-22 00:59:46 +00001//===----------------------------------------------------------------------===//
2//
3// The LLVM Compiler Infrastructure
4//
Howard Hinnantb64f8b02010-11-16 22:09:02 +00005// This file is dual licensed under the MIT and the University of Illinois Open
6// Source Licenses. See LICENSE.TXT for details.
Howard Hinnantc52f43e2010-08-22 00:59:46 +00007//
8//===----------------------------------------------------------------------===//
9
10// <memory>
11
12// template <class Alloc>
13// struct allocator_traits
14// {
15// typedef Alloc::const_void_pointer
16// | pointer_traits<pointer>::rebind<const void>
17// const_void_pointer;
18// ...
19// };
20
21#include <memory>
22#include <type_traits>
23
24template <class T>
25struct Ptr {};
26
27template <class T>
28struct A
29{
30 typedef T value_type;
31 typedef Ptr<T> pointer;
32};
33
34template <class T>
35struct B
36{
37 typedef T value_type;
38};
39
40template <class T>
41struct CPtr {};
42
43template <class T>
44struct C
45{
46 typedef T value_type;
47 typedef CPtr<const void> const_void_pointer;
48};
49
50int main()
51{
52 static_assert((std::is_same<std::allocator_traits<A<char> >::const_void_pointer, Ptr<const void> >::value), "");
53 static_assert((std::is_same<std::allocator_traits<B<char> >::const_void_pointer, const void*>::value), "");
54 static_assert((std::is_same<std::allocator_traits<C<char> >::const_void_pointer, CPtr<const void> >::value), "");
55}