size_type.pass.cpp revision f5256e16dfc425c1d466f6308d4026d529ce9e0b
1//===----------------------------------------------------------------------===// 2// 3// The LLVM Compiler Infrastructure 4// 5// This file is distributed under the University of Illinois Open Source 6// License. See LICENSE.TXT for details. 7// 8//===----------------------------------------------------------------------===// 9 10// <memory> 11 12// template <class Alloc> 13// struct allocator_traits 14// { 15// typedef Alloc::size_type | size_t size_type; 16// ... 17// }; 18 19#include <memory> 20#include <type_traits> 21 22template <class T> 23struct A 24{ 25 typedef T value_type; 26 typedef unsigned short size_type; 27}; 28 29template <class T> 30struct B 31{ 32 typedef T value_type; 33}; 34 35int main() 36{ 37 static_assert((std::is_same<std::allocator_traits<A<char> >::size_type, unsigned short>::value), ""); 38 static_assert((std::is_same<std::allocator_traits<B<char> >::size_type, std::size_t>::value), ""); 39} 40