From 8bdf2a9c58ac9b15b3f6d2f44699865590e88370 Mon Sep 17 00:00:00 2001 From: Marcel Raad Date: Tue, 3 Jun 2014 14:32:44 +0200 Subject: [PATCH] Make tuple constructor explicit Otherwise everything implicitly convertible to the data type of the first element is implicitly convertible to a boost::tuple, which has led to long-unnoticed bugs in production code. This change is also consistent with the TR1 and C++11 tuple. --- include/boost/tuple/detail/tuple_basic.hpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/include/boost/tuple/detail/tuple_basic.hpp b/include/boost/tuple/detail/tuple_basic.hpp index 5f26c7f..9a3b34e 100644 --- a/include/boost/tuple/detail/tuple_basic.hpp +++ b/include/boost/tuple/detail/tuple_basic.hpp @@ -484,7 +484,7 @@ public: // access_traits::parameter_type takes non-reference types as const T& tuple() {} - tuple(typename access_traits::parameter_type t0) + explicit tuple(typename access_traits::parameter_type t0) : inherited(t0, detail::cnull(), detail::cnull(), detail::cnull(), detail::cnull(), detail::cnull(), detail::cnull(), detail::cnull(), detail::cnull(), detail::cnull()) {}