Skip to content

feature?: ignored characters `'_ / allowing prefixs 0x and 0b etc... #124

Open
@Andersama

Description

@Andersama

This isn't a performance related feature, but I've found it odd that the charconv spec goes out of its way to avoid parsing what would otherwise be necessary to handle c++'s own floating point literals. What would you think about having some additional utility from_chars like functions to handle those formats?

Ages ago I modified microsoft's charconv to do this for myself, but it broke at some point because headers changed and some utility functions went missing. The core idea is roughly this:

if (fmt is prefixed) {
  //bump pointer forward past the prefix for the format
}

//continue parsing like charconv would except skip over specified characters
uint64_t mantissa = 0;
for (;begin != end; ++begin) {
if ((*begin == some_template_pack) || ...)
  continue;
const unsigned char digit = char_table[*begin];
if (digit >= base)
  break;
//so on...
}

Not used your library, but it seems like hex formatted floats have the enum for the format but aren't supported? Could also be the opportunity to add that in.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions