Hacker Newsnew | past | comments | ask | show | jobs | submitlogin

If you only use std::tuple, then yes xD


There is a nasty trick which uses structured binding to convert an arbitrary aggregate to a tuple.

That still doesn't help if you want the fields names.


You have any link?



Thanks. This may be useful for me someday.


No, because C++ templates are basically a Lisp, and only things that are list-like can be processed by templates. (Like tuples, for example.)


That's a bit confusing. Lisp has all kinds of datatypes.

But you are right that C++ templates are a bad functional programming language with duck typing.


But there are automated ways to to convert aggregates to tuples.




Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: