hanickadot / compile-time-regular-expressions

Compile Time Regular Expression in C++
https://twitter.com/hankadusikova
Apache License 2.0
3.29k stars 178 forks source link

Compilation failure in VS2017 #212

Open Siapran opened 3 years ago

Siapran commented 3 years ago

MSVC 14.16.27023 cannot find the unqualified find_captures. changing it to ::ctre::find_captures seems to fix this. build log excerpt

code excerpt:

constexpr auto JOURNAL_PAGE_PATTERN = ctll::fixed_string{"^journal_(\\d+)$"};

using std::filesystem::path;

std::optional<unsigned long> matchJournalPage(path const& path)
{
    if (auto matches =
            ctre::match<JOURNAL_PAGE_PATTERN>(path.filename().string()))
        return std::stoul(matches.get<1>().to_string());
    else
        return std::nullopt;
}
Siapran commented 3 years ago

changing the definition:

template <typename ResultIterator, typename Pattern>
using return_type = decltype(regex_results(std::declval<ResultIterator>(),
                                           find_captures(Pattern{})));

to

template <typename ResultIterator, typename Pattern>
using return_type = decltype(regex_results(std::declval<ResultIterator>(),
                                           ::ctre::find_captures(Pattern{})));

fixes this issue