On Sun, Dec 6, 2020 at 4:29 PM Emile Cormier <emile.cormier.jr@gmail.com> wrote:
I do, Barry. Something like this (not tested):

struct parse_event
{
    template <typename T>
    parse_event(T&& value) : token(std::forward<T>(value)) {}
   
#ifndef VARIANT_SAFELY_TAKES_CHAR_POINTER
    // Workaround
    parse_event(const char* s) : token(std::string(s)) {}
#endif
   
    std::variant<bool, int, std::string> token;
};

The idea is to disable the workaround code when the C++ library implementation has the P0608/P1957 fixes.

You could just write:

struct parse_event
{
    template <typename T>
    parse_event(T&& value) : token(std::forward<T>(value)) {}
   
    // Workaround
    parse_event(const char* s) : token(std::string(s)) {}
   
    std::variant<bool, int, std::string> token;
};

This works regardless of whether the fix is implemented.

Barry