Skip to content
Snippets Groups Projects
Commit 30af32f6 authored by Carsten Gräser's avatar Carsten Gräser
Browse files

Remove overload for staticSize

This fails to compile if you cannot instanciate the default
constructor T.

The problem showed up with a std::tuple<T> where T is
not default constructible. This is a really nasty issue:
std::tuple<T> implements a default constructor but
instanciating this fails in this case.

As a consequence std::is_constructible<std::tuple<T>> is
true, but trying to instanciate it gives a compile error.
Similar behaviour can be observed with operator<.
At least for the default constructor of std::tuple
this seems to be fixed in C++17 by removing it from the
overload set if you can't instanciate one for T.
parent e1870123
No related branches found
No related tags found
No related merge requests found
Pipeline #
......@@ -188,14 +188,6 @@ constexpr auto staticSize(const T*, const PriorityTag<0>&)
return {};
}
// Try if class has constexpr default constructor and size method
template<class T>
constexpr auto staticSize(const T*, const PriorityTag<1>&)
-> decltype(std::integral_constant<std::size_t,T().size()>())
{
return {};
}
// Try if tuple_size is implemented for class
template<class T>
constexpr auto staticSize(const T*, const PriorityTag<2>&)
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment