compile-time-regular-expressions icon indicating copy to clipboard operation
compile-time-regular-expressions copied to clipboard

Compilation failure in VS2017

Open Siapran opened this issue 3 years ago • 1 comments

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 avatar Aug 16 '21 16:08 Siapran

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

Siapran avatar Aug 16 '21 16:08 Siapran