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// <memory> 11 12// template <class Alloc> 13// struct allocator_traits 14// { 15// static pointer allocate(allocator_type& a, size_type n); 16// ... 17// }; 18 19#include <memory> 20#include <cassert> 21 22template <class T> 23struct A 24{ 25 typedef T value_type; 26 27 value_type* allocate(std::size_t n) 28 { 29 assert(n == 10); 30 return (value_type*)0xDEADBEEF; 31 } 32}; 33 34int main() 35{ 36 A<int> a; 37 assert(std::allocator_traits<A<int> >::allocate(a, 10) == (int*)0xDEADBEEF); 38} 39