Skip to main content

You are not logged in. Your edit will be placed in a queue until it is peer reviewed.

We welcome edits that make the post easier to understand and more valuable for readers. Because community members review edits, please try to make the post substantially better than how you found it, for example, by fixing grammar or adding additional resources and hyperlinks.

Required fields*

3
  • Please present a complete example that readers that can try out. Commented Aug 1, 2018 at 10:37
  • 1
    You want Token::operator char() const; in in your token class. Beware this can give unexpected results. Prefer Token::as_char() const; instead. Commented Aug 1, 2018 at 10:38
  • For the record, that explicit conversion is (IMO) much better. Adding implicit conversions to primitive types is the route to madness. Your logic that you want to give Token the power to decide how the conversion should be performed is reasonable, so a conversion operator makes some sense... but at least make it explicit! Commented Aug 1, 2018 at 11:04