lundi 3 août 2015

how to create a complex type using tuples and variadic templates

In first place, I'm not a very skilled programmer in C++11 and templates, I read a lot of posts but I can't figure out how to write my idea (if is even possible), saying that, this is my idea.

My idea is create a complex compiler-time type, I'm trying to follow this rules

  • Defined like a struct, I mean field by field (no syntax restrinctions), for example something like this.
  • Each field type will be one of this types: int, short, long, byte, bool and std::string.
  • And here is the tricky part, I want a tuple where each position will be a reference to each field, in this way I can access to the stored data field by field or get a tuple to it. I have no problem to use std::tuples or boost::tuples.

Every suggestion, example, advise and any other comment are welcome, I'm trying to learn how to do this.

Thanks in advance

Best Regards

Aucun commentaire:

Enregistrer un commentaire