Search code examples
tuplesd

Can I create Tuple without initialization?


I need to create Tuple. I do:

auto historyTuple = Tuple!(string, "gps", string, "sensor");

I want to initialize with data it's later.

I am getting error:

Error: type Tuple!(string, "gps", string, "sensor") has no value


Solution

  • The value you specified on the right is actually the type of the tuple. You should instead write

    Tuple!(string, "gps", string, "sensor") historyTuple;
    

    However, if you intend to use this tuple very often, you may instead wish to create an alias for it:

    alias History = Tuple!(string, "gps", string, "sensor");
    History historyTuple;