Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Forcing std::tuple to contain std::pair<fixed_type, T>

Tags:

c++

stdtuple

Is it possible to use std::tuple "partly specialized" so that it contains std::pair<fixed_t, T> with varying T?

UPD: the tuple should contain the pairs. So it is equivalent to using an array of fixed_t together with a regular std::tuple.

like image 529
Alex Avatar asked Mar 08 '26 12:03

Alex


1 Answers

Use variadic tempate alias and parameter pack expansion:

template<typename... Types>
using fixed_tuple = std::tuple< std::pair<fixed_t, Types>... >;

Live example.

like image 183
Revolver_Ocelot Avatar answered Mar 10 '26 00:03

Revolver_Ocelot



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!