forked from boostorg/regex
merged changes in regex5 branch
[SVN r26692]
This commit is contained in:
@ -28,34 +28,54 @@ namespace boost{
|
||||
# include BOOST_ABI_PREFIX
|
||||
#endif
|
||||
|
||||
template <class OutputIterator, class Iterator, class traits, class Allocator, class charT>
|
||||
template <class OutputIterator, class BidirectionalIterator, class traits, class charT>
|
||||
OutputIterator regex_replace(OutputIterator out,
|
||||
Iterator first,
|
||||
Iterator last,
|
||||
const reg_expression<charT, traits, Allocator>& e,
|
||||
BidirectionalIterator first,
|
||||
BidirectionalIterator last,
|
||||
const basic_regex<charT, traits>& e,
|
||||
const charT* fmt,
|
||||
match_flag_type flags = match_default)
|
||||
{
|
||||
Iterator l = first;
|
||||
re_detail::merge_out_predicate<OutputIterator, Iterator, charT, Allocator, traits> oi(out, l, fmt, flags, e.get_traits());
|
||||
regex_grep(oi, first, last, e, flags);
|
||||
return (flags & format_no_copy) ? out : std::copy(l, last, out);
|
||||
regex_iterator<BidirectionalIterator, charT, traits> i(first, last, e, flags);
|
||||
regex_iterator<BidirectionalIterator, charT, traits> j;
|
||||
if(i == j)
|
||||
{
|
||||
if(!(flags & regex_constants::format_no_copy))
|
||||
out = std::copy(first, last, out);
|
||||
}
|
||||
else
|
||||
{
|
||||
BidirectionalIterator last_m = first;
|
||||
while(i != j)
|
||||
{
|
||||
if(!(flags & regex_constants::format_no_copy))
|
||||
out = std::copy(i->prefix().first, i->prefix().second, out);
|
||||
out = i->format(out, fmt, flags, e);
|
||||
last_m = (*i)[0].second;
|
||||
if(flags & regex_constants::format_first_only)
|
||||
break;
|
||||
++i;
|
||||
}
|
||||
if(!(flags & regex_constants::format_no_copy))
|
||||
out = std::copy(last_m, last, out);
|
||||
}
|
||||
return out;
|
||||
}
|
||||
|
||||
template <class OutputIterator, class Iterator, class traits, class Allocator, class charT>
|
||||
template <class OutputIterator, class Iterator, class traits, class charT>
|
||||
inline OutputIterator regex_replace(OutputIterator out,
|
||||
Iterator first,
|
||||
Iterator last,
|
||||
const reg_expression<charT, traits, Allocator>& e,
|
||||
const basic_regex<charT, traits>& e,
|
||||
const std::basic_string<charT>& fmt,
|
||||
match_flag_type flags = match_default)
|
||||
{
|
||||
return regex_replace(out, first, last, e, fmt.c_str(), flags);
|
||||
}
|
||||
|
||||
template <class traits, class Allocator, class charT>
|
||||
template <class traits, class charT>
|
||||
std::basic_string<charT> regex_replace(const std::basic_string<charT>& s,
|
||||
const reg_expression<charT, traits, Allocator>& e,
|
||||
const basic_regex<charT, traits>& e,
|
||||
const charT* fmt,
|
||||
match_flag_type flags = match_default)
|
||||
{
|
||||
@ -65,9 +85,9 @@ std::basic_string<charT> regex_replace(const std::basic_string<charT>& s,
|
||||
return result;
|
||||
}
|
||||
|
||||
template <class traits, class Allocator, class charT>
|
||||
template <class traits, class charT>
|
||||
std::basic_string<charT> regex_replace(const std::basic_string<charT>& s,
|
||||
const reg_expression<charT, traits, Allocator>& e,
|
||||
const basic_regex<charT, traits>& e,
|
||||
const std::basic_string<charT>& fmt,
|
||||
match_flag_type flags = match_default)
|
||||
{
|
||||
|
Reference in New Issue
Block a user