Working with std::variant reduction

Michael Powell <[email protected]> Wed, 31 Oct 2018 19:21:08 -0400
Newsgroups gmane.comp.parsers.spirit.general
Message-ID <CAMEoF_GxF-q6Rh64i_YAERdP6R_eLsm9z4waRiM7qmzG8RnYgw@mail.gmail.com>
Hello,

If I've got a rule that goes something like this:

type %= lit("double")
    | lit("float")
    | lit("int32")
    | lit("int64")
    | lit("uint32")
    | lit("uint64")
    | lit("sint32")
    | lit("sint64")
    | lit("fixed32")
    | lit("fixed64")
    | lit("sfixed32")
    | lit("sfixed64")
    | lit("bool")
    | lit("string")
    | lit("bytes")
    | msg_type
    | enum_type
    ;

Where the literals are the literals, and msg_type and enum_type are
both rules that produce element_type_t(), is it sufficient to
configure the type rule to produce std::variant<std::string,
element_type_t>? Or in my case, adapted via struct.

My apprehension, of course, is that I would have to exhaustively list
the variant types: i.e. std::variant<std::string, std::string, ...,
element_type_t, element_type_t>.

Thanks!

Cheers,

Michael Powell