summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorMaxime Coste <frrrwww@gmail.com>2016-03-02 23:45:39 +0000
committerMaxime Coste <frrrwww@gmail.com>2016-04-16 21:41:04 +0100
commit013519b3cb02475dbd6bf4bda05467fd887cd576 (patch)
tree5b0d0b0f0e33f7593ae0552d36d9fa28d73597bb /src
parentf877c388fea0e794f663d62e3508c5d11832601e (diff)
Remove iterator based regex constructor
Diffstat (limited to 'src')
-rw-r--r--src/commands.cc3
-rw-r--r--src/highlighters.cc2
-rw-r--r--src/regex.hh10
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<RegexHighlighter>(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<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 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<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()}; }
};
namespace regex_ns = boost;