Fixed template constructor and assign member function iterator usage.

[SVN r20227]
This commit is contained in:
John Maddock
2003-09-30 11:38:30 +00:00
parent f3c1b8d784
commit 83306608a7

View File

@ -111,14 +111,12 @@ public:
explicit reg_expression(const std::basic_string<charT, ST, SA>& p, flag_type f = regex_constants::normal, const Allocator& a = Allocator()) explicit reg_expression(const std::basic_string<charT, ST, SA>& p, flag_type f = regex_constants::normal, const Allocator& a = Allocator())
: data(a), pkmp(0), error_code_(REG_EMPTY), _expression(0) { set_expression(p, f | regex_constants::use_except); } : data(a), pkmp(0), error_code_(REG_EMPTY), _expression(0) { set_expression(p, f | regex_constants::use_except); }
template <class I> template <class InputIterator>
reg_expression(I first, I last, flag_type f = regex_constants::normal, const Allocator& al = Allocator()) reg_expression(InputIterator first, InputIterator last, flag_type f = regex_constants::normal, const Allocator& al = Allocator())
: data(al), pkmp(0), error_code_(REG_EMPTY), _expression(0) : data(al), pkmp(0), error_code_(REG_EMPTY), _expression(0)
{ {
size_type len = last-first; std::basic_string<charT> a(first, last);
scoped_array<charT> a(new charT[len]); set_expression(a.data(), a.data() + a.size(), f | regex_constants::use_except);
std::copy(first, last, a.get());
set_expression(a.get(), a.get() + len, f | regex_constants::use_except);
} }
template <class ST, class SA> template <class ST, class SA>
@ -137,15 +135,13 @@ public:
return *this; return *this;
} }
template <class fwd_iterator> template <class InputIterator>
reg_expression& BOOST_REGEX_CALL assign(fwd_iterator first, reg_expression& BOOST_REGEX_CALL assign(InputIterator first,
fwd_iterator last, InputIterator last,
flag_type f = regex_constants::normal) flag_type f = regex_constants::normal)
{ {
size_type len = last-first; std::basic_string<charT> a(first, last);
scoped_array<charT> a(new charT[len]); set_expression(a.data(), a.data() + a.size(), f | regex_constants::use_except);
std::copy(first, last, a.get());
set_expression(a.get(), a.get() + len, f | regex_constants::use_except);
return *this; return *this;
} }
#else #else