Skip to content

std::search called in search() when compiling with C++14 #50

@eyalroz

Description

@eyalroz

I'm trying to compile one of the examples of my cuda-api-wrappers library, which uses string-view-lite, using C++14 instead of C++11 like I was compiling it so far. I get:

... snip ...
/home/eyalroz/src/mine/cuda-api-wrappers/examples/other/jitify/string_view.hpp:572:23: error: call to non-‘constexpr’ function ‘_FIter1 std::search(_FIter1, _FIter1, _FIter2, _FIter2) [with _FIter1 = const char*; _FIter2 = const char*]’
  572 |     return std::search( haystack.begin(), haystack.end(), needle.begin(), needle.end() );
      |            ~~~~~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
... snip...

and, indead, std::search is not constexpr before C++20.

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