Reputation: 28520
What part of the cppreference.com's page on structured binding declarations should make apparent that they cannot be used with "things" not known at compile time?
That page does not contain any explicit reference to compile or run time.
I recently bumped into this question about whether structured binding declarations work with std::vector
, which doesn't since its size is not known at compile time. Since I'm trying to understand how Boost.Hana works, I need to make clear in my mind what the detailed distinction between run time and compile time is, hence I took the chance to ask the question above.
Upvotes: 2
Views: 99
Reputation: 180305
The relevant part is std::tuple_size
, which yields a compile-time size. You can't implement that for std::vector
. It has a run-time variable std::vector::size
.
Upvotes: 6