Remove iterator based regex constructor

This commit is contained in:
Maxime Coste 2016-03-02 23:45:39 +00:00
parent f877c388fe
commit 013519b3cb
3 changed files with 2 additions and 13 deletions

View File

@ -671,8 +671,7 @@ const CommandDesc add_hook_cmd = {
}, },
[](const ParametersParser& parser, Context& context, const ShellContext&) [](const ParametersParser& parser, Context& context, const ShellContext&)
{ {
Regex regex(parser[2].begin(), parser[2].end(), Regex regex(parser[2], Regex::optimize | Regex::nosubs | Regex::ECMAScript);
Regex::optimize | Regex::nosubs | Regex::ECMAScript);
const String& command = parser[3]; const String& command = parser[3];
auto hook_func = [=](StringView param, Context& context) { auto hook_func = [=](StringView param, Context& context) {

View File

@ -263,7 +263,7 @@ public:
String id = "hlregex'" + params[0] + "'"; 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<RegexHighlighter>(std::move(ex), return {id, make_unique<RegexHighlighter>(std::move(ex),
std::move(faces))}; std::move(faces))};

View File

@ -30,11 +30,6 @@ struct Regex : std::regex
: std::regex(re.begin(), re.end(), flags), m_str(re.str()) {} : std::regex(re.begin(), re.end(), flags), m_str(re.str()) {}
catch (std::runtime_error& err) { throw regex_error(err.what()); } catch (std::runtime_error& err) { throw regex_error(err.what()); }
template<typename Iterator>
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 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; }
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) {} : boost::regex(re.begin(), re.end(), flags) {}
catch (std::runtime_error& err) { throw regex_error(err.what()); } catch (std::runtime_error& err) { throw regex_error(err.what()); }
template<typename Iterator>
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()}; } String str() const { auto s = boost::regex::str(); return {s.data(), (int)s.length()}; }
}; };
namespace regex_ns = boost; namespace regex_ns = boost;