Modernes C++ programmieren

Okt 23, 2024

lst-0678-godb.cpp

//#(compile) c++; compiler:g132; options:-O3 -std=c++23; libs:-
// https://godbolt.org/z/8oYaWYnbx 
#include <tuple>
#include <iostream>
template<typename ... Args>
auto conv2tuple(Args ... args) {
    return std::make_tuple(args...);
}
int main() {
    auto mytuple = conv2tuple("ende", 2, 3.14, 'A', false);
    std::cout << std::get<2>(mytuple) << '\n'; // Ausgabe: 3.14
}