template_util.h revision 3345a6884c488ff3a535c2c9acdd33d74b37e311
1// Copyright (c) 2010 The Chromium Authors. All rights reserved. 2// Use of this source code is governed by a BSD-style license that can be 3// found in the LICENSE file. 4 5#ifndef BASE_TEMPLATE_UTIL_H_ 6#define BASE_TEMPLATE_UTIL_H_ 7#pragma once 8 9namespace base { 10 11// template definitions from tr1 12 13template<class T, T v> 14struct integral_constant { 15 static const T value = v; 16 typedef T value_type; 17 typedef integral_constant<T, v> type; 18}; 19 20template <class T, T v> const T integral_constant<T, v>::value; 21 22typedef integral_constant<bool, true> true_type; 23typedef integral_constant<bool, false> false_type; 24 25template <class T> struct is_pointer : false_type {}; 26template <class T> struct is_pointer<T*> : true_type {}; 27 28} // namespace base 29 30#endif // BASE_TEMPLATE_UTIL_H_ 31