summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMaxime Coste <mawww@kakoune.org>2017-11-12 12:30:21 +0800
committerMaxime Coste <mawww@kakoune.org>2017-11-12 12:30:21 +0800
commit5cfccad39cd4b215736f8560a55404f78bae4b7d (patch)
tree7d72063158bc781089a0a62775154822e831c626
parentc9b43d36343202262dcb9ed5f6270e3cf06745aa (diff)
Regex: Use MemoryDomain::Regex for captures and MatchResults contents
-rw-r--r--src/regex.hh10
-rw-r--r--src/regex_impl.hh4
2 files changed, 7 insertions, 7 deletions
diff --git a/src/regex.hh b/src/regex.hh
index 8e6c2dac..58f71270 100644
--- a/src/regex.hh
+++ b/src/regex.hh
@@ -47,7 +47,7 @@ struct MatchResults
struct iterator : std::iterator<std::bidirectional_iterator_tag, SubMatch, size_t, SubMatch*, SubMatch>
{
- using It = typename Vector<Iterator>::const_iterator;
+ using It = typename Vector<Iterator, MemoryDomain::Regex>::const_iterator;
iterator() = default;
iterator(It it) : m_it{std::move(it)} {}
@@ -64,7 +64,7 @@ struct MatchResults
};
MatchResults() = default;
- MatchResults(Vector<Iterator> values) : m_values{std::move(values)} {}
+ MatchResults(Vector<Iterator, MemoryDomain::Regex> values) : m_values{std::move(values)} {}
iterator begin() const { return iterator{m_values.begin()}; }
iterator cbegin() const { return iterator{m_values.cbegin()}; }
@@ -96,7 +96,7 @@ struct MatchResults
}
private:
- Vector<Iterator> m_values;
+ Vector<Iterator, MemoryDomain::Regex> m_values;
};
inline RegexExecFlags match_flags(bool bol, bool eol, bool bow, bool eow)
@@ -116,7 +116,7 @@ bool regex_match(It begin, It end, const Regex& re)
template<typename It>
bool regex_match(It begin, It end, MatchResults<It>& res, const Regex& re)
{
- Vector<It> captures;
+ Vector<It, MemoryDomain::Regex> captures;
const bool matched = regex_match(begin, end, captures, *re.impl());
res = matched ? MatchResults<It>{std::move(captures)} : MatchResults<It>{};
return matched;
@@ -133,7 +133,7 @@ template<typename It, MatchDirection direction = MatchDirection::Forward>
bool regex_search(It begin, It end, MatchResults<It>& res, const Regex& re,
RegexExecFlags flags = RegexExecFlags::None)
{
- Vector<It> captures;
+ Vector<It, MemoryDomain::Regex> captures;
const bool matched = regex_search<It, direction>(begin, end, captures, *re.impl(), flags);
res = matched ? MatchResults<It>{std::move(captures)} : MatchResults<It>{};
return matched;
diff --git a/src/regex_impl.hh b/src/regex_impl.hh
index 358fc9bb..74294f4c 100644
--- a/src/regex_impl.hh
+++ b/src/regex_impl.hh
@@ -517,7 +517,7 @@ bool regex_match(It begin, It end, const CompiledRegex& re, RegexExecFlags flags
}
template<typename It, MatchDirection direction = MatchDirection::Forward>
-bool regex_match(It begin, It end, Vector<It>& captures, const CompiledRegex& re,
+bool regex_match(It begin, It end, Vector<It, MemoryDomain::Regex>& captures, const CompiledRegex& re,
RegexExecFlags flags = RegexExecFlags::None)
{
ThreadedRegexVM<It, direction> vm{re};
@@ -538,7 +538,7 @@ bool regex_search(It begin, It end, const CompiledRegex& re,
}
template<typename It, MatchDirection direction = MatchDirection::Forward>
-bool regex_search(It begin, It end, Vector<It>& captures, const CompiledRegex& re,
+bool regex_search(It begin, It end, Vector<It, MemoryDomain::Regex>& captures, const CompiledRegex& re,
RegexExecFlags flags = RegexExecFlags::None)
{
ThreadedRegexVM<It, direction> vm{re};