Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > comp.lang.c++ > #87971
| From | Bonita Montero <Bonita.Montero@gmail.com> |
|---|---|
| Newsgroups | comp.lang.c++ |
| Subject | Re: How can I get the type in a C++17 fold function? |
| Date | 2022-12-16 05:41 +0100 |
| Organization | A noiseless patient Spider |
| Message-ID | <tngss9$3af0c$1@dont-email.me> (permalink) |
| References | <tmsbtq$fp6$1@gioia.aioe.org> <tnfjnt$34jgb$1@dont-email.me> <tngs1d$3adp3$1@dont-email.me> |
Now it's so simple that anyone should understand this:
#include <iostream>
#include <concepts>
#include <type_traits>
using namespace std;
int main()
{
auto variadic = []<typename ... Args>( Args &&... args )
{
if constexpr( sizeof ...(Args) >= 1 )
{
auto tupl = make_tuple( ref( args ) ... );
auto &firstElem = get<0>( tupl );
if constexpr( is_same_v<remove_cvref_t<decltype(firstElem)>, string> )
cout << firstElem << endl;
}
};
variadic( string( "hello world"), 123 );
}
Back to comp.lang.c++ | Previous | Next — Previous in thread | Next in thread | Find similar | Unroll thread
How can I get the type in a C++17 fold function? Muttley@dastardlyhq.com - 2022-12-08 09:48 +0000
Re: How can I get the type in a C++17 fold function? Juha Nieminen <nospam@thanks.invalid> - 2022-12-08 12:18 +0000
Re: How can I get the type in a C++17 fold function? Muttley@dastardlyhq.com - 2022-12-08 15:41 +0000
Re: How can I get the type in a C++17 fold function? Juha Nieminen <nospam@thanks.invalid> - 2022-12-09 12:57 +0000
Re: How can I get the type in a C++17 fold function? Öö Tiib <ootiib@hot.ee> - 2022-12-08 04:45 -0800
Re: How can I get the type in a C++17 fold function? Muttley@dastardlyhq.com - 2022-12-08 15:45 +0000
Re: How can I get the type in a C++17 fold function? Öö Tiib <ootiib@hot.ee> - 2022-12-08 13:59 -0800
Re: How can I get the type in a C++17 fold function? Vir Campestris <vir.campestris@invalid.invalid> - 2022-12-14 10:42 +0000
Re: How can I get the type in a C++17 fold function? Bonita Montero <Bonita.Montero@gmail.com> - 2022-12-14 18:02 +0100
Re: How can I get the type in a C++17 fold function? Muttley@dastardlyhq.com - 2022-12-14 17:17 +0000
Re: How can I get the type in a C++17 fold function? Bonita Montero <Bonita.Montero@gmail.com> - 2022-12-14 18:23 +0100
Re: How can I get the type in a C++17 fold function? Bonita Montero <Bonita.Montero@gmail.com> - 2022-12-15 17:59 +0100
Re: How can I get the type in a C++17 fold function? Muttley@dastardlyhq.com - 2022-12-15 17:20 +0000
Re: How can I get the type in a C++17 fold function? Bonita Montero <Bonita.Montero@gmail.com> - 2022-12-15 18:37 +0100
Re: How can I get the type in a C++17 fold function? Bonita Montero <Bonita.Montero@gmail.com> - 2022-12-16 05:26 +0100
Re: How can I get the type in a C++17 fold function? Bonita Montero <Bonita.Montero@gmail.com> - 2022-12-16 05:41 +0100
Re: How can I get the type in a C++17 fold function? scott@slp53.sl.home (Scott Lurndal) - 2022-12-16 15:17 +0000
Re: How can I get the type in a C++17 fold function? Bonita Montero <Bonita.Montero@gmail.com> - 2022-12-16 18:22 +0100
Re: How can I get the type in a C++17 fold function? scott@slp53.sl.home (Scott Lurndal) - 2022-12-16 17:42 +0000
Re: How can I get the type in a C++17 fold function? Bonita Montero <Bonita.Montero@gmail.com> - 2022-12-16 19:20 +0100
Re: How can I get the type in a C++17 fold function? Tim Rentsch <tr.17687@z991.linuxsc.com> - 2022-12-28 16:41 -0800
Re: How can I get the type in a C++17 fold function? Bonita Montero <Bonita.Montero@gmail.com> - 2022-12-29 03:40 +0100
Re: How can I get the type in a C++17 fold function? Tim Rentsch <tr.17687@z991.linuxsc.com> - 2022-12-28 22:27 -0800
Re: How can I get the type in a C++17 fold function? Paavo Helde <eesnimi@osa.pri.ee> - 2022-12-29 09:36 +0200
Re: How can I get the type in a C++17 fold function? Mason <mason.nobody@gmail.com> - 2022-12-29 17:15 +0000
Re: How can I get the type in a C++17 fold function? "Alf P. Steinbach" <alf.p.steinbach@gmail.com> - 2022-12-29 19:11 +0100
Re: How can I get the type in a C++17 fold function? Tim Rentsch <tr.17687@z991.linuxsc.com> - 2022-12-29 19:58 -0800
Re: How can I get the type in a C++17 fold function? Bonita Montero <Bonita.Montero@gmail.com> - 2022-12-30 08:09 +0100
Re: How can I get the type in a C++17 fold function? Michael S <already5chosen@yahoo.com> - 2022-12-30 03:27 -0800
Re: How can I get the type in a C++17 fold function? "Alf P. Steinbach" <alf.p.steinbach@gmail.com> - 2022-12-30 14:01 +0100
Re: How can I get the type in a C++17 fold function? Muttley@dastardlyhq.com - 2022-12-30 15:17 +0000
Re: How can I get the type in a C++17 fold function? "Alf P. Steinbach" <alf.p.steinbach@gmail.com> - 2022-12-30 20:04 +0100
Re: How can I get the type in a C++17 fold function? "Chris M. Thomasson" <chris.m.thomasson.1@gmail.com> - 2022-12-30 13:54 -0800
Re: How can I get the type in a C++17 fold function? Muttley@dastardlyhq.com - 2022-12-31 15:33 +0000
Re: How can I get the type in a C++17 fold function? Jorgen Grahn <grahn+nntp@snipabacken.se> - 2022-12-30 17:31 +0000
Re: How can I get the type in a C++17 fold function? Tim Rentsch <tr.17687@z991.linuxsc.com> - 2023-01-02 13:30 -0800
Re: How can I get the type in a C++17 fold function? Bonita Montero <Bonita.Montero@gmail.com> - 2022-12-30 18:36 +0100
csiph-web