blob: 74cd3475f6645796426a23bf27a9b5d20b2f045d [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::void_pointer
16// | pointer_traits<pointer>::rebind<void>
17// 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<void> void_pointer;
48};
49
50int main()
51{
52 static_assert((std::is_same<std::allocator_traits<A<char> >::void_pointer, Ptr<void> >::value), "");
53 static_assert((std::is_same<std::allocator_traits<B<char> >::void_pointer, void*>::value), "");
54 static_assert((std::is_same<std::allocator_traits<C<char> >::void_pointer, CPtr<void> >::value), "");
55}