From 345f93e8533e5b5af1e567d1c9d2e21f96c69258 Mon Sep 17 00:00:00 2001 From: Vladimir Marko Date: Tue, 14 Jul 2015 18:58:59 +0100 Subject: Avoid unexpected conversions to ArrayRef. Make single-parameter constructors explicit, except for the default copy constructor. Change-Id: If7c8db643b22a4c36e244830154fc699b39c9016 --- compiler/utils/array_ref.h | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) (limited to 'compiler/utils/array_ref.h') 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 - constexpr ArrayRef(T (&array)[size]) + explicit constexpr ArrayRef(T (&array)[size]) : array_(array), size_(size) { } template - constexpr ArrayRef(U (&array)[size], - typename std::enable_if::value, tag>::type - t ATTRIBUTE_UNUSED = tag()) + explicit constexpr ArrayRef(U (&array)[size], + typename std::enable_if::value, tag>::type + t ATTRIBUTE_UNUSED = tag()) : array_(array), size_(size) { } @@ -83,9 +83,9 @@ class ArrayRef { } template - ArrayRef(const std::vector& v, - typename std::enable_if::value, tag>::type - t ATTRIBUTE_UNUSED = tag()) + explicit ArrayRef(const std::vector& v, + typename std::enable_if::value, tag>::type + t ATTRIBUTE_UNUSED = tag()) : array_(v.data()), size_(v.size()) { } -- cgit v1.2.3-59-g8ed1b