- As the title states, is there a specific reason why there is no (implicit) conversion from
std::tuple<Ts...>&
tostd::tuple<Ts&...>
? In contrast, thetuple
implementation of EASTL provides this conversion.
#include <EASTL/tuple.h>
#include <tuple>
#include <type_traits>
int main()
{
using TupleRef = std::tuple<int, float>&;
using RefTuple = std::tuple<int&, float&>;
using EATupleRef = eastl::tuple<int, float>&;
using EARefTuple = eastl::tuple<int&, float&>;
// static_assert(std::is_convertible_v<TupleRef, RefTuple>); // fails to compile
static_assert(std::is_convertible_v<EATupleRef, EARefTuple>);
return 0;
}
- What do I have to change/add, if I reimplemented the STL
tuple
implementation?
Here is a link to godbolt show-casing the problem: https://godbolt.org/z/zqfrETKEz
PS: I used the c++17
flag in godbolt since EASTL does not compile with the c++20
flag, but I am also interested in a c++20
solution.