diff options
author | 2015-07-14 18:58:59 +0100 | |
---|---|---|
committer | 2015-07-14 19:26:57 +0100 | |
commit | 345f93e8533e5b5af1e567d1c9d2e21f96c69258 (patch) | |
tree | b34ce41f598e1d7c0f8019ecfad10bd41e998d6d /compiler/utils/array_ref.h | |
parent | 34fcff08a9ecc981f5967b9cc8111a5fac555282 (diff) |
Avoid unexpected conversions to ArrayRef.
Make single-parameter constructors explicit, except
for the default copy constructor.
Change-Id: If7c8db643b22a4c36e244830154fc699b39c9016
Diffstat (limited to 'compiler/utils/array_ref.h')
-rw-r--r-- | compiler/utils/array_ref.h | 14 |
1 files changed, 7 insertions, 7 deletions
diff --git a/compiler/utils/array_ref.h b/compiler/utils/array_ref.h index ff5a77c97a..303e0d5ad4 100644 --- a/compiler/utils/array_ref.h +++ b/compiler/utils/array_ref.h @@ -62,14 +62,14 @@ class ArrayRef { } template <size_t size> - constexpr ArrayRef(T (&array)[size]) + explicit constexpr ArrayRef(T (&array)[size]) : array_(array), size_(size) { } template <typename U, size_t size> - constexpr ArrayRef(U (&array)[size], - typename std::enable_if<std::is_same<T, const U>::value, tag>::type - t ATTRIBUTE_UNUSED = tag()) + explicit constexpr ArrayRef(U (&array)[size], + typename std::enable_if<std::is_same<T, const U>::value, tag>::type + t ATTRIBUTE_UNUSED = tag()) : array_(array), size_(size) { } @@ -83,9 +83,9 @@ class ArrayRef { } template <typename U, typename Alloc> - ArrayRef(const std::vector<U, Alloc>& v, - typename std::enable_if<std::is_same<T, const U>::value, tag>::type - t ATTRIBUTE_UNUSED = tag()) + explicit ArrayRef(const std::vector<U, Alloc>& v, + typename std::enable_if<std::is_same<T, const U>::value, tag>::type + t ATTRIBUTE_UNUSED = tag()) : array_(v.data()), size_(v.size()) { } |