Skip to content

Windows ::isdigit compilation error #2135

@cacharle

Description

@cacharle

I get the following error when trying to use the header:

C:\...\httplib.h:2039:26: error: no matching function for call to 'all_of'
 2039 |   return !str.empty() && std::all_of(str.begin(), str.end(), ::isdigit);
      |                          ^~~~~~~~~~~
C:\...\MSVC\...\include\algorithm:1256:30: note: candidate template ignored: couldn't infer template argument '_Pr'
 1256 | _NODISCARD _CONSTEXPR20 bool all_of(_InIt _First, _InIt _Last, _Pr _Pred) { // test if all elements satisfy _Pred
      |                              ^
C:\...\MSVC\...\include\algorithm:1271:17: note: candidate function template not viable: requires 4 arguments, but 3 were provided
 1271 | _NODISCARD bool all_of(_ExPo&&, _FwdIt _First, _FwdIt _Last, _Pr _Pred) noexcept; // terminates
      |                 ^      ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
1 error generated.

I see that you already use a lambda workaround here

  return std::all_of(str.cbegin(), str.cend(),
                       [](unsigned char c) { return std::isdigit(c); });

Would it be possible to use the same thing for this ?

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions