简体   繁体   中英

Create std::tuple of types “contained” in another std::tuple

I have a std::tuple created from a variadic template function

std::tuple<Args&...> mytup(args...);

Each object in args has defined a type value_type .

Now, I want to create a std::tuple called mynewtup of the same length of mytup but of types the different types value_type . Moreover, each args has a method f() which return a value_type and mynewtup need to be created calling that function.

In other words, I would like to do something like (pseudocode)

std::tuple<typename args1::value_type,....> mynewtup(args1.f(),....);

Is it possible to do that? How?

只需使用std::make_tuple如下所示:

auto mynewtup = std::make_tuple(args.f()...);

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM