Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(958)

Unified Diff: base/type_utils.h

Issue 624713003: Keep only base/extractor.[cc|h]. (Closed) Base URL: https://chromium.googlesource.com/external/omaha.git@master
Patch Set: Created 6 years, 2 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « base/tr_rand_unittest.cc ('k') | base/user_info.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: base/type_utils.h
diff --git a/base/type_utils.h b/base/type_utils.h
deleted file mode 100644
index edbd286e07b88088a466627b8eb636b6c9a25739..0000000000000000000000000000000000000000
--- a/base/type_utils.h
+++ /dev/null
@@ -1,68 +0,0 @@
-// Copyright 2005-2009 Google Inc.
-//
-// Licensed under the Apache License, Version 2.0 (the "License");
-// you may not use this file except in compliance with the License.
-// You may obtain a copy of the License at
-//
-// http://www.apache.org/licenses/LICENSE-2.0
-//
-// Unless required by applicable law or agreed to in writing, software
-// distributed under the License is distributed on an "AS IS" BASIS,
-// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-// See the License for the specific language governing permissions and
-// limitations under the License.
-// ========================================================================
-
-#ifndef OMAHA_COMMON_TYPE_UTILS_H_
-#define OMAHA_COMMON_TYPE_UTILS_H_
-
-namespace omaha {
-
-//
-// Detecting convertibility and inheritence at compile time
-// (Extracted from: Modern C++ Design)
-//
-
-// Evaluates true if U inherites from T publically, or if T and U are same type
-#define SUPERSUBCLASS(T, U) \
- (ConversionUtil<const U*, const T*>::exists && \
- !ConversionUtil<const T*, const void*>::same_type)
-
-// Evaluates true only if U inherites from T publically
-#define SUPERSUBCLASS_STRICT(T, U) \
- (SUPERSUBCLASS(T, U) && \
- !ConversionUtil<const T, const U>::same_type)
-
-// Perform type test
-template <class T, class U>
-class ConversionUtil {
- private:
- typedef char Small;
- class Big {
- char dummy[2];
- };
- static Small Test(U);
- static Big Test(...);
- static T MakeT();
-
- public:
- // Tell whether there is ConversionUtil from T to U
- enum { exists = sizeof(Test(MakeT())) == sizeof(Small) };
-
- // Tells whether there are ConversionUtils between T and U in both directions
- enum { exists_2way = exists && ConversionUtil<U, T>::exists };
-
- // Tells whether there are same type
- enum { same_type = false };
-};
-
-// Perform same type test through partial template specialization
-template<class T>
-class ConversionUtil<T, T> {
- public:
- enum { exists = 1, exists_2way = 1, same_type = 1 };
-};
-
-} // namespace omaha
-
-#endif // OMAHA_COMMON_TYPE_UTILS_H_
« no previous file with comments | « base/tr_rand_unittest.cc ('k') | base/user_info.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698