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.
This commit is contained in:
Marcel Raad
2014-06-03 14:32:44 +02:00
parent c17f1ec5b2
commit 8bdf2a9c58

View File

@ -484,7 +484,7 @@ public:
// access_traits<T>::parameter_type takes non-reference types as const T&
tuple() {}
tuple(typename access_traits<T0>::parameter_type t0)
explicit tuple(typename access_traits<T0>::parameter_type t0)
: inherited(t0, detail::cnull(), detail::cnull(), detail::cnull(),
detail::cnull(), detail::cnull(), detail::cnull(),
detail::cnull(), detail::cnull(), detail::cnull()) {}