diff --git a/native_mate/object_template_builder.h b/native_mate/object_template_builder.h index a433590..de953d3 100644 --- a/native_mate/object_template_builder.h +++ b/native_mate/object_template_builder.h @@ -10,7 +10,6 @@ #include "base/strings/string_piece.h" #include "native_mate/converter.h" #include "native_mate/function_template.h" -#include "native_mate/template_util.h" #include "v8/include/v8.h" namespace mate { @@ -42,8 +41,8 @@ struct CallbackTraits > { // come from the the JavaScript "this" object the function was called on, not // from the first normal parameter. template -struct CallbackTraits::value>::type> { +struct CallbackTraits::value>::type> { static v8::Local CreateTemplate( v8::Isolate* isolate, T callback) { int flags = HolderIsFirstArgument; diff --git a/native_mate/template_util.h b/native_mate/template_util.h deleted file mode 100644 index d4ce819..0000000 --- a/native_mate/template_util.h +++ /dev/null @@ -1,157 +0,0 @@ -// Copyright (c) 2011 The Chromium Authors. All rights reserved. -// Use of this source code is governed by a BSD-style license that can be -// found in the LICENSE file. - -#ifndef NATIVE_MATE_TEMPLATE_UTIL_H_ -#define NATIVE_MATE_TEMPLATE_UTIL_H_ - -#include // For size_t. - -#include "build/build_config.h" - -namespace mate { - -// template definitions from tr1 - -template -struct integral_constant { - static const T value = v; - typedef T value_type; - typedef integral_constant type; -}; - -template const T integral_constant::value; - -typedef integral_constant true_type; -typedef integral_constant false_type; - -template struct is_pointer : false_type {}; -template struct is_pointer : true_type {}; - -// Member function pointer detection up to four params. Add more as needed -// below. This is built-in to C++ 11, and we can remove this when we switch. -template -struct is_member_function_pointer : false_type {}; - -template -struct is_member_function_pointer : true_type {}; -template -struct is_member_function_pointer : true_type {}; - -template -struct is_member_function_pointer : true_type {}; -template -struct is_member_function_pointer : true_type {}; - -template -struct is_member_function_pointer : true_type {}; -template -struct is_member_function_pointer : true_type {}; - -template -struct is_member_function_pointer : true_type {}; -template -struct is_member_function_pointer : true_type {}; - -template -struct is_member_function_pointer : true_type {}; -template -struct is_member_function_pointer : true_type {}; - -template -struct is_member_function_pointer : true_type {}; -template -struct is_member_function_pointer : true_type {}; - - -template struct is_same : public false_type {}; -template struct is_same : true_type {}; - -template struct is_array : public false_type {}; -template struct is_array : public true_type {}; -template struct is_array : public true_type {}; - -template struct is_non_const_reference : false_type {}; -template struct is_non_const_reference : true_type {}; -template struct is_non_const_reference : false_type {}; - -template struct is_const : false_type {}; -template struct is_const : true_type {}; - -template struct is_void : false_type {}; -template <> struct is_void : true_type {}; - -namespace internal { - -// Types YesType and NoType are guaranteed such that sizeof(YesType) < -// sizeof(NoType). -typedef char YesType; - -struct NoType { - YesType dummy[2]; -}; - -// This class is an implementation detail for is_convertible, and you -// don't need to know how it works to use is_convertible. For those -// who care: we declare two different functions, one whose argument is -// of type To and one with a variadic argument list. We give them -// return types of different size, so we can use sizeof to trick the -// compiler into telling us which function it would have chosen if we -// had called it with an argument of type From. See Alexandrescu's -// _Modern C++ Design_ for more details on this sort of trick. - -struct ConvertHelper { - template - static YesType Test(To); - - template - static NoType Test(...); - - template - static From& Create(); -}; - -// Used to determine if a type is a struct/union/class. Inspired by Boost's -// is_class type_trait implementation. -struct IsClassHelper { - template - static YesType Test(void(C::*)(void)); - - template - static NoType Test(...); -}; - -} // namespace internal - -// Inherits from true_type if From is convertible to To, false_type otherwise. -// -// Note that if the type is convertible, this will be a true_type REGARDLESS -// of whether or not the conversion would emit a warning. -template -struct is_convertible - : integral_constant( - internal::ConvertHelper::Create())) == - sizeof(internal::YesType)> { -}; - -template -struct is_class - : integral_constant(0)) == - sizeof(internal::YesType)> { -}; - -template -struct enable_if {}; - -template -struct enable_if { typedef T type; }; - -} // namespace mate - -#endif // NATIVE_MATE_TEMPLATE_UTIL_H_ diff --git a/native_mate/wrappable.h b/native_mate/wrappable.h index 48f70dd..29c2844 100644 --- a/native_mate/wrappable.h +++ b/native_mate/wrappable.h @@ -9,7 +9,6 @@ #include "native_mate/compat.h" #include "native_mate/converter.h" #include "native_mate/constructor.h" -#include "native_mate/template_util.h" namespace mate { diff --git a/native_mate_files.gypi b/native_mate_files.gypi index cc44678..867ec79 100644 --- a/native_mate_files.gypi +++ b/native_mate_files.gypi @@ -17,7 +17,6 @@ 'native_mate/persistent_dictionary.cc', 'native_mate/persistent_dictionary.h', 'native_mate/scoped_persistent.h', - 'native_mate/template_util.h', 'native_mate/try_catch.cc', 'native_mate/try_catch.h', 'native_mate/wrappable.cc',