type_traits.h (243830) | type_traits.h (249423) |
---|---|
1//===- llvm/Support/type_traits.h - Simplfied type traits -------*- C++ -*-===// 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//===----------------------------------------------------------------------===// --- 131 unchanged lines hidden (view full) --- 140/// \brief Metafunction that determines whether the given type is a pointer 141/// type. 142template <typename T> struct is_pointer : false_type {}; 143template <typename T> struct is_pointer<T*> : true_type {}; 144template <typename T> struct is_pointer<T* const> : true_type {}; 145template <typename T> struct is_pointer<T* volatile> : true_type {}; 146template <typename T> struct is_pointer<T* const volatile> : true_type {}; 147 | 1//===- llvm/Support/type_traits.h - Simplfied type traits -------*- C++ -*-===// 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//===----------------------------------------------------------------------===// --- 131 unchanged lines hidden (view full) --- 140/// \brief Metafunction that determines whether the given type is a pointer 141/// type. 142template <typename T> struct is_pointer : false_type {}; 143template <typename T> struct is_pointer<T*> : true_type {}; 144template <typename T> struct is_pointer<T* const> : true_type {}; 145template <typename T> struct is_pointer<T* volatile> : true_type {}; 146template <typename T> struct is_pointer<T* const volatile> : true_type {}; 147 |
148/// \brief Metafunction that determines wheather the given type is a reference. 149template <typename T> struct is_reference : false_type {}; 150template <typename T> struct is_reference<T&> : true_type {}; 151 |
|
148/// \brief Metafunction that determines whether the given type is either an 149/// integral type or an enumeration type. 150/// 151/// Note that this accepts potentially more integral types than we whitelist 152/// above for is_integral because it is based on merely being convertible 153/// implicitly to an integral type. 154template <typename T> class is_integral_or_enum { 155 // Provide an overload which can be called with anything implicitly --- 44 unchanged lines hidden (view full) --- 200// C++0x [meta.trans.ptr]. 201template <typename T> struct remove_pointer { typedef T type; }; 202template <typename T> struct remove_pointer<T*> { typedef T type; }; 203template <typename T> struct remove_pointer<T*const> { typedef T type; }; 204template <typename T> struct remove_pointer<T*volatile> { typedef T type; }; 205template <typename T> struct remove_pointer<T*const volatile> { 206 typedef T type; }; 207 | 152/// \brief Metafunction that determines whether the given type is either an 153/// integral type or an enumeration type. 154/// 155/// Note that this accepts potentially more integral types than we whitelist 156/// above for is_integral because it is based on merely being convertible 157/// implicitly to an integral type. 158template <typename T> class is_integral_or_enum { 159 // Provide an overload which can be called with anything implicitly --- 44 unchanged lines hidden (view full) --- 204// C++0x [meta.trans.ptr]. 205template <typename T> struct remove_pointer { typedef T type; }; 206template <typename T> struct remove_pointer<T*> { typedef T type; }; 207template <typename T> struct remove_pointer<T*const> { typedef T type; }; 208template <typename T> struct remove_pointer<T*volatile> { typedef T type; }; 209template <typename T> struct remove_pointer<T*const volatile> { 210 typedef T type; }; 211 |
212// If T is a pointer, just return it. If it is not, return T&. 213template<typename T, typename Enable = void> 214struct add_lvalue_reference_if_not_pointer { typedef T &type; }; 215 216template<typename T> 217struct add_lvalue_reference_if_not_pointer<T, 218 typename enable_if<is_pointer<T> >::type> { 219 typedef T type; 220}; 221 222// If T is a pointer to X, return a pointer to const X. If it is not, return 223// const T. 224template<typename T, typename Enable = void> 225struct add_const_past_pointer { typedef const T type; }; 226 227template<typename T> 228struct add_const_past_pointer<T, typename enable_if<is_pointer<T> >::type> { 229 typedef const typename remove_pointer<T>::type *type; 230}; 231 |
|
208template <bool, typename T, typename F> 209struct conditional { typedef T type; }; 210 211template <typename T, typename F> 212struct conditional<false, T, F> { typedef F type; }; 213 214} 215 216#ifdef LLVM_DEFINED_HAS_FEATURE 217#undef __has_feature 218#endif 219 220#endif | 232template <bool, typename T, typename F> 233struct conditional { typedef T type; }; 234 235template <typename T, typename F> 236struct conditional<false, T, F> { typedef F type; }; 237 238} 239 240#ifdef LLVM_DEFINED_HAS_FEATURE 241#undef __has_feature 242#endif 243 244#endif |