diff options
author | tfarina <tfarina@chromium.org> | 2015-05-07 19:15:20 -0700 |
---|---|---|
committer | Commit bot <commit-bot@chromium.org> | 2015-05-08 02:15:45 +0000 |
commit | 2e252345d488b3120cdff29d3afc087b36707d8d (patch) | |
tree | 52b925e2ad31fb6d74e3bc7d8b3a753407872a78 /base/macros.h | |
parent | 65db145cc63bfef8b2bf9a539cec21a2151639b2 (diff) | |
download | chromium_src-2e252345d488b3120cdff29d3afc087b36707d8d.zip chromium_src-2e252345d488b3120cdff29d3afc087b36707d8d.tar.gz chromium_src-2e252345d488b3120cdff29d3afc087b36707d8d.tar.bz2 |
base: Remove gcc and msvs workaround limitations for arraysize template magic.
Mike (mtklein) built this simplified version when doing https://codereview.chromium.org/1114283003/.
TEST=trybots seems happy
R=danakj@chromium.org
Review URL: https://codereview.chromium.org/1115993004
Cr-Commit-Position: refs/heads/master@{#328904}
Diffstat (limited to 'base/macros.h')
-rw-r--r-- | base/macros.h | 14 |
1 files changed, 2 insertions, 12 deletions
diff --git a/base/macros.h b/base/macros.h index 3ea576c..d904328 100644 --- a/base/macros.h +++ b/base/macros.h @@ -52,18 +52,8 @@ // This template function declaration is used in defining arraysize. // Note that the function doesn't need an implementation, as we only // use its type. -template <typename T, size_t N> -char (&ArraySizeHelper(T (&array)[N]))[N]; - -// That gcc wants both of these prototypes seems mysterious. VC, for -// its part, can't decide which to use (another mystery). Matching of -// template overloads: the final frontier. -#ifndef _MSC_VER -template <typename T, size_t N> -char (&ArraySizeHelper(const T (&array)[N]))[N]; -#endif - -#define arraysize(array) (sizeof(::ArraySizeHelper(array))) +template <typename T, size_t N> char (&ArraySizeHelper(T (&array)[N]))[N]; +#define arraysize(array) (sizeof(ArraySizeHelper(array))) // Use implicit_cast as a safe version of static_cast or const_cast |