123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134 |
- #ifndef BASE_TEMPLATE_UTIL_H_
- #define BASE_TEMPLATE_UTIL_H_
- #include "internal/sparseconfig.h"
- _START_GOOGLE_NAMESPACE_
- typedef char small_;
- struct big_ {
- char dummy[2];
- };
- template <class T>
- struct identity_ {
- typedef T type;
- };
- template<class T, T v>
- struct integral_constant {
- static const T value = v;
- typedef T value_type;
- typedef integral_constant<T, v> type;
- };
- template <class T, T v> const T integral_constant<T, v>::value;
- typedef integral_constant<bool, true> true_type;
- typedef integral_constant<bool, false> false_type;
- typedef true_type true_;
- typedef false_type false_;
- template<bool cond, typename A, typename B>
- struct if_{
- typedef A type;
- };
- template<typename A, typename B>
- struct if_<false, A, B> {
- typedef B type;
- };
- template<typename A, typename B>
- struct type_equals_ : public false_ {
- };
- template<typename A>
- struct type_equals_<A, A> : public true_ {
- };
- template<typename A, typename B>
- struct and_ : public integral_constant<bool, (A::value && B::value)> {
- };
- template<typename A, typename B>
- struct or_ : public integral_constant<bool, (A::value || B::value)> {
- };
- _END_GOOGLE_NAMESPACE_
- #endif
|