This is the mail archive of the
libstdc++@gcc.gnu.org
mailing list for the libstdc++ project.
[patch 2/N] std::regex refactoring - sub _Executor for lookahead
- From: Jonathan Wakely <jwakely at redhat dot com>
- To: Tim Shen <timshen91 at gmail dot com>
- Cc: libstdc++ at gcc dot gnu dot org, gcc-patches at gcc dot gnu dot org
- Date: Mon, 28 Apr 2014 13:45:35 +0100
- Subject: [patch 2/N] std::regex refactoring - sub _Executor for lookahead
- Authentication-results: sourceware.org; auth=none
- References: <20140428124003 dot GW928 at redhat dot com>
Is there any reason this object is created on the heap?
diff --git a/libstdc++-v3/include/bits/regex_executor.tcc b/libstdc++-v3/include/bits/regex_executor.tcc
index 7f89933..92ca590 100644
--- a/libstdc++-v3/include/bits/regex_executor.tcc
+++ b/libstdc++-v3/include/bits/regex_executor.tcc
@@ -145,13 +145,9 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION
_M_lookahead(_State<_TraitsT> __state)
{
_ResultsVec __what(_M_cur_results.size());
- auto __sub = std::unique_ptr<_Executor>(new _Executor(_M_current,
- _M_end,
- __what,
- _M_re,
- _M_flags));
- __sub->_M_start_state = __state._M_alt;
- if (__sub->_M_search_from_first())
+ _Executor __sub(_M_current, _M_end, __what, _M_re, _M_flags);
+ __sub._M_start_state = __state._M_alt;
+ if (__sub._M_search_from_first())
{
for (size_t __i = 0; __i < __what.size(); __i++)
if (__what[__i].matched)