I need to construct an std::tuple
object so that std::tuple_size<T>::value
= 0.
Is there a way to do this?
Asked
Active
Viewed 6,598 times
5

Darius Duesentrieb
- 837
- 10
- 20
-
I don't see the problem here... – Matthieu Brucher Apr 09 '19 at 10:06
-
1what did you try and how did it fail? – 463035818_is_not_an_ai Apr 09 '19 at 10:10
-
i tried std::tuple() and had no clue what to try else. I didn't know that empty template brackets are a thing. How is this even implemented? – Darius Duesentrieb Apr 09 '19 at 10:11
-
2@DariusDuesentrieb, Just like the forward declaration in [a reference](https://en.cppreference.com/w/cpp/utility/tuple). By the way, `std::tuple()` works as of C++17. – chris Apr 09 '19 at 10:31
1 Answers
18
std::tuple<> empty;
using empty_t = std::tuple<>;
auto empty2 = std::make_tuple();
static_assert(std::tuple_size<std::tuple<>>::value == 0);

cmdLP
- 1,658
- 9
- 19