From 013519b3cb02475dbd6bf4bda05467fd887cd576 Mon Sep 17 00:00:00 2001 From: Maxime Coste Date: Wed, 2 Mar 2016 23:45:39 +0000 Subject: [PATCH] Remove iterator based regex constructor --- src/commands.cc | 3 +-- src/highlighters.cc | 2 +- src/regex.hh | 10 ---------- 3 files changed, 2 insertions(+), 13 deletions(-) diff --git a/src/commands.cc b/src/commands.cc index 43cfa850..8733bdd8 100644 --- a/src/commands.cc +++ b/src/commands.cc @@ -671,8 +671,7 @@ const CommandDesc add_hook_cmd = { }, [](const ParametersParser& parser, Context& context, const ShellContext&) { - Regex regex(parser[2].begin(), parser[2].end(), - Regex::optimize | Regex::nosubs | Regex::ECMAScript); + Regex regex(parser[2], Regex::optimize | Regex::nosubs | Regex::ECMAScript); const String& command = parser[3]; auto hook_func = [=](StringView param, Context& context) { diff --git a/src/highlighters.cc b/src/highlighters.cc index 9e5b60c6..0f55e525 100644 --- a/src/highlighters.cc +++ b/src/highlighters.cc @@ -263,7 +263,7 @@ public: String id = "hlregex'" + params[0] + "'"; - Regex ex{params[0].begin(), params[0].end(), Regex::optimize}; + Regex ex{params[0], Regex::optimize}; return {id, make_unique(std::move(ex), std::move(faces))}; diff --git a/src/regex.hh b/src/regex.hh index a26daab7..1ccc1fe7 100644 --- a/src/regex.hh +++ b/src/regex.hh @@ -30,11 +30,6 @@ struct Regex : std::regex : std::regex(re.begin(), re.end(), flags), m_str(re.str()) {} catch (std::runtime_error& err) { throw regex_error(err.what()); } - template - Regex(Iterator begin, Iterator end, flag_type flags = ECMAScript) try - : std::regex(begin, end, flags), m_str(begin, end) {} - catch (std::runtime_error& err) { throw regex_error(err.what()); } - bool empty() const { return m_str.empty(); } bool operator==(const Regex& other) const { return m_str == other.m_str; } bool operator!=(const Regex& other) const { return m_str != other.m_str; } @@ -54,11 +49,6 @@ struct Regex : boost::regex : boost::regex(re.begin(), re.end(), flags) {} catch (std::runtime_error& err) { throw regex_error(err.what()); } - template - Regex(Iterator begin, Iterator end, flag_type flags = ECMAScript) try - : boost::regex(begin, end, flags) {} - catch (std::runtime_error& err) { throw regex_error(err.what()); } - String str() const { auto s = boost::regex::str(); return {s.data(), (int)s.length()}; } }; namespace regex_ns = boost;