forked from boostorg/regex
remove minmax hack from win32.hpp and fix all places that could be affected by the minmax macros
[SVN r22394]
This commit is contained in:
@ -35,6 +35,7 @@ using std::getline;
|
|||||||
#include <boost/regex.hpp>
|
#include <boost/regex.hpp>
|
||||||
#include <boost/timer.hpp>
|
#include <boost/timer.hpp>
|
||||||
#include <boost/smart_ptr.hpp>
|
#include <boost/smart_ptr.hpp>
|
||||||
|
#include <boost/minmax.hpp>
|
||||||
|
|
||||||
#if (defined(_MSC_VER) && (_MSC_VER <= 1300)) || defined(__sgi)
|
#if (defined(_MSC_VER) && (_MSC_VER <= 1300)) || defined(__sgi)
|
||||||
// maybe no Koenig lookup, use using declaration instead:
|
// maybe no Koenig lookup, use using declaration instead:
|
||||||
@ -145,7 +146,7 @@ int main(int argc, char**argv)
|
|||||||
double tim;
|
double tim;
|
||||||
bool result;
|
bool result;
|
||||||
int iters = 100;
|
int iters = 100;
|
||||||
double wait_time = std::min(t.elapsed_min() * 1000, 1.0);
|
double wait_time = boost::std_min(t.elapsed_min() * 1000, 1.0);
|
||||||
|
|
||||||
while(true)
|
while(true)
|
||||||
{
|
{
|
||||||
|
@ -213,7 +213,7 @@ public:
|
|||||||
{
|
{
|
||||||
difference_type dist = boost::re_detail::distance(a,b);
|
difference_type dist = boost::re_detail::distance(a,b);
|
||||||
states *= states;
|
states *= states;
|
||||||
difference_type lim = std::numeric_limits<difference_type>::max() - 1000 - states;
|
difference_type lim = (std::numeric_limits<difference_type>::max)() - 1000 - states;
|
||||||
if(dist > (difference_type)(lim / states))
|
if(dist > (difference_type)(lim / states))
|
||||||
max_state_count = lim;
|
max_state_count = lim;
|
||||||
else
|
else
|
||||||
|
@ -78,7 +78,7 @@ void perl_matcher<BidiIterator, Allocator, traits, Allocator2>::estimate_max_sta
|
|||||||
difference_type dist = boost::re_detail::distance(base, last);
|
difference_type dist = boost::re_detail::distance(base, last);
|
||||||
traits_size_type states = static_cast<traits_size_type>(re.size());
|
traits_size_type states = static_cast<traits_size_type>(re.size());
|
||||||
states *= states;
|
states *= states;
|
||||||
difference_type lim = std::numeric_limits<difference_type>::max() - 1000 - states;
|
difference_type lim = (std::numeric_limits<difference_type>::max)() - 1000 - states;
|
||||||
if(dist > (difference_type)(lim / states))
|
if(dist > (difference_type)(lim / states))
|
||||||
max_state_count = lim;
|
max_state_count = lim;
|
||||||
else
|
else
|
||||||
|
@ -21,6 +21,7 @@
|
|||||||
#define BOOST_REGEX_V4_PERL_MATCHER_NON_RECURSIVE_HPP
|
#define BOOST_REGEX_V4_PERL_MATCHER_NON_RECURSIVE_HPP
|
||||||
|
|
||||||
#include <new>
|
#include <new>
|
||||||
|
#include <boost/minmax.hpp>
|
||||||
|
|
||||||
#ifdef BOOST_HAS_ABI_HEADERS
|
#ifdef BOOST_HAS_ABI_HEADERS
|
||||||
# include BOOST_ABI_PREFIX
|
# include BOOST_ABI_PREFIX
|
||||||
@ -546,7 +547,7 @@ bool perl_matcher<BidiIterator, Allocator, traits, Allocator2>::match_dot_repeat
|
|||||||
return match_dot_repeat_slow();
|
return match_dot_repeat_slow();
|
||||||
|
|
||||||
const re_repeat* rep = static_cast<const re_repeat*>(pstate);
|
const re_repeat* rep = static_cast<const re_repeat*>(pstate);
|
||||||
unsigned count = std::min(static_cast<unsigned>(re_detail::distance(position, last)), static_cast<unsigned>(rep->greedy ? rep->max : rep->min));
|
unsigned count = std_min(static_cast<unsigned>(re_detail::distance(position, last)), static_cast<unsigned>(rep->greedy ? rep->max : rep->min));
|
||||||
if(rep->min > count)
|
if(rep->min > count)
|
||||||
return false; // not enough text left to match
|
return false; // not enough text left to match
|
||||||
std::advance(position, count);
|
std::advance(position, count);
|
||||||
@ -593,7 +594,7 @@ bool perl_matcher<BidiIterator, Allocator, traits, Allocator2>::match_char_repea
|
|||||||
if(::boost::is_random_access_iterator<BidiIterator>::value)
|
if(::boost::is_random_access_iterator<BidiIterator>::value)
|
||||||
{
|
{
|
||||||
BidiIterator end = position;
|
BidiIterator end = position;
|
||||||
std::advance(end, std::min((unsigned)re_detail::distance(position, last), desired));
|
std::advance(end, std_min((unsigned)re_detail::distance(position, last), desired));
|
||||||
BidiIterator origin(position);
|
BidiIterator origin(position);
|
||||||
while((position != end) && (traits_inst.translate(*position, icase) == what))
|
while((position != end) && (traits_inst.translate(*position, icase) == what))
|
||||||
{
|
{
|
||||||
@ -660,7 +661,7 @@ bool perl_matcher<BidiIterator, Allocator, traits, Allocator2>::match_set_repeat
|
|||||||
if(::boost::is_random_access_iterator<BidiIterator>::value)
|
if(::boost::is_random_access_iterator<BidiIterator>::value)
|
||||||
{
|
{
|
||||||
BidiIterator end = position;
|
BidiIterator end = position;
|
||||||
std::advance(end, std::min((unsigned)re_detail::distance(position, last), desired));
|
std::advance(end, std_min((unsigned)re_detail::distance(position, last), desired));
|
||||||
BidiIterator origin(position);
|
BidiIterator origin(position);
|
||||||
while((position != end) && map[(traits_uchar_type)traits_inst.translate(*position, icase)])
|
while((position != end) && map[(traits_uchar_type)traits_inst.translate(*position, icase)])
|
||||||
{
|
{
|
||||||
@ -727,7 +728,7 @@ bool perl_matcher<BidiIterator, Allocator, traits, Allocator2>::match_long_set_r
|
|||||||
if(::boost::is_random_access_iterator<BidiIterator>::value)
|
if(::boost::is_random_access_iterator<BidiIterator>::value)
|
||||||
{
|
{
|
||||||
BidiIterator end = position;
|
BidiIterator end = position;
|
||||||
std::advance(end, std::min((unsigned)re_detail::distance(position, last), desired));
|
std::advance(end, std_min((unsigned)re_detail::distance(position, last), desired));
|
||||||
BidiIterator origin(position);
|
BidiIterator origin(position);
|
||||||
while((position != end) && (position != re_is_set_member(position, last, set, re)))
|
while((position != end) && (position != re_is_set_member(position, last, set, re)))
|
||||||
{
|
{
|
||||||
|
@ -20,6 +20,8 @@
|
|||||||
#ifndef BOOST_REGEX_V4_PERL_MATCHER_RECURSIVE_HPP
|
#ifndef BOOST_REGEX_V4_PERL_MATCHER_RECURSIVE_HPP
|
||||||
#define BOOST_REGEX_V4_PERL_MATCHER_RECURSIVE_HPP
|
#define BOOST_REGEX_V4_PERL_MATCHER_RECURSIVE_HPP
|
||||||
|
|
||||||
|
#include <boost/minmax.hpp>
|
||||||
|
|
||||||
#ifdef BOOST_HAS_ABI_HEADERS
|
#ifdef BOOST_HAS_ABI_HEADERS
|
||||||
# include BOOST_ABI_PREFIX
|
# include BOOST_ABI_PREFIX
|
||||||
#endif
|
#endif
|
||||||
@ -400,7 +402,7 @@ bool perl_matcher<BidiIterator, Allocator, traits, Allocator2>::match_dot_repeat
|
|||||||
// start by working out how much we can skip:
|
// start by working out how much we can skip:
|
||||||
//
|
//
|
||||||
const re_repeat* rep = static_cast<const re_repeat*>(pstate);
|
const re_repeat* rep = static_cast<const re_repeat*>(pstate);
|
||||||
unsigned count = std::min(static_cast<unsigned>(re_detail::distance(position, last)), (rep->greedy ? rep->max : rep->min));
|
unsigned count = std_min(static_cast<unsigned>(re_detail::distance(position, last)), (rep->greedy ? rep->max : rep->min));
|
||||||
if(rep->min > count)
|
if(rep->min > count)
|
||||||
return false; // not enough text left to match
|
return false; // not enough text left to match
|
||||||
std::advance(position, count);
|
std::advance(position, count);
|
||||||
@ -458,7 +460,7 @@ bool perl_matcher<BidiIterator, Allocator, traits, Allocator2>::match_char_repea
|
|||||||
if(::boost::is_random_access_iterator<BidiIterator>::value)
|
if(::boost::is_random_access_iterator<BidiIterator>::value)
|
||||||
{
|
{
|
||||||
BidiIterator end = position;
|
BidiIterator end = position;
|
||||||
std::advance(end, std::min((unsigned)re_detail::distance(position, last), desired));
|
std::advance(end, std_min((unsigned)re_detail::distance(position, last), desired));
|
||||||
BidiIterator origin(position);
|
BidiIterator origin(position);
|
||||||
while((position != end) && (traits_inst.translate(*position, icase) == what))
|
while((position != end) && (traits_inst.translate(*position, icase) == what))
|
||||||
{
|
{
|
||||||
@ -538,7 +540,7 @@ bool perl_matcher<BidiIterator, Allocator, traits, Allocator2>::match_set_repeat
|
|||||||
if(::boost::is_random_access_iterator<BidiIterator>::value)
|
if(::boost::is_random_access_iterator<BidiIterator>::value)
|
||||||
{
|
{
|
||||||
BidiIterator end = position;
|
BidiIterator end = position;
|
||||||
std::advance(end, std::min((unsigned)re_detail::distance(position, last), desired));
|
std::advance(end, std_min((unsigned)re_detail::distance(position, last), desired));
|
||||||
BidiIterator origin(position);
|
BidiIterator origin(position);
|
||||||
while((position != end) && map[(traits_uchar_type)traits_inst.translate(*position, icase)])
|
while((position != end) && map[(traits_uchar_type)traits_inst.translate(*position, icase)])
|
||||||
{
|
{
|
||||||
@ -618,7 +620,7 @@ bool perl_matcher<BidiIterator, Allocator, traits, Allocator2>::match_long_set_r
|
|||||||
if(::boost::is_random_access_iterator<BidiIterator>::value)
|
if(::boost::is_random_access_iterator<BidiIterator>::value)
|
||||||
{
|
{
|
||||||
BidiIterator end = position;
|
BidiIterator end = position;
|
||||||
std::advance(end, std::min((unsigned)re_detail::distance(position, last), desired));
|
std::advance(end, std_min((unsigned)re_detail::distance(position, last), desired));
|
||||||
BidiIterator origin(position);
|
BidiIterator origin(position);
|
||||||
while((position != end) && (position != re_is_set_member(position, last, set, re)))
|
while((position != end) && (position != re_is_set_member(position, last, set, re)))
|
||||||
{
|
{
|
||||||
|
@ -63,7 +63,7 @@ struct results
|
|||||||
safe_greta_time(-1),
|
safe_greta_time(-1),
|
||||||
posix_time(-1),
|
posix_time(-1),
|
||||||
pcre_time(-1),
|
pcre_time(-1),
|
||||||
factor(std::numeric_limits<double>::max()),
|
factor((std::numeric_limits<double>::max)()),
|
||||||
expression(ex),
|
expression(ex),
|
||||||
description(desc)
|
description(desc)
|
||||||
{}
|
{}
|
||||||
|
@ -9,6 +9,7 @@
|
|||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
#include <boost/minmax.hpp>
|
||||||
#include "regex_comparison.hpp"
|
#include "regex_comparison.hpp"
|
||||||
#include <boost/timer.hpp>
|
#include <boost/timer.hpp>
|
||||||
#include <boost/regex.hpp>
|
#include <boost/regex.hpp>
|
||||||
@ -45,7 +46,7 @@ double time_match(const std::string& re, const std::string& text, bool icase)
|
|||||||
boost::regex_match(text, what, e);
|
boost::regex_match(text, what, e);
|
||||||
}
|
}
|
||||||
run = tim.elapsed();
|
run = tim.elapsed();
|
||||||
result = std::min(run, result);
|
result = std_min(run, result);
|
||||||
}
|
}
|
||||||
return result / iter;
|
return result / iter;
|
||||||
}
|
}
|
||||||
@ -86,7 +87,7 @@ double time_find_all(const std::string& re, const std::string& text, bool icase)
|
|||||||
boost::regex_grep(&dummy_grep_proc, text, e);
|
boost::regex_grep(&dummy_grep_proc, text, e);
|
||||||
}
|
}
|
||||||
run = tim.elapsed();
|
run = tim.elapsed();
|
||||||
result = std::min(run, result);
|
result = std_min(run, result);
|
||||||
}
|
}
|
||||||
return result / iter;
|
return result / iter;
|
||||||
}
|
}
|
||||||
|
@ -9,6 +9,7 @@
|
|||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
#include <boost/minmax.hpp>
|
||||||
#include "regex_comparison.hpp"
|
#include "regex_comparison.hpp"
|
||||||
#if defined(BOOST_HAS_GRETA)
|
#if defined(BOOST_HAS_GRETA)
|
||||||
#include <cassert>
|
#include <cassert>
|
||||||
@ -48,7 +49,7 @@ double time_match(const std::string& re, const std::string& text, bool icase)
|
|||||||
e.match(text, what);
|
e.match(text, what);
|
||||||
}
|
}
|
||||||
run = tim.elapsed();
|
run = tim.elapsed();
|
||||||
result = std::min(run, result);
|
result = std_min(run, result);
|
||||||
}
|
}
|
||||||
return result / iter;
|
return result / iter;
|
||||||
}
|
}
|
||||||
@ -94,7 +95,7 @@ double time_find_all(const std::string& re, const std::string& text, bool icase)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
run = tim.elapsed();
|
run = tim.elapsed();
|
||||||
result = std::min(run, result);
|
result = std_min(run, result);
|
||||||
}
|
}
|
||||||
return result / iter;
|
return result / iter;
|
||||||
}
|
}
|
||||||
|
@ -12,6 +12,7 @@
|
|||||||
#include "regex_comparison.hpp"
|
#include "regex_comparison.hpp"
|
||||||
#include <boost/timer.hpp>
|
#include <boost/timer.hpp>
|
||||||
#include <boost/regex.hpp>
|
#include <boost/regex.hpp>
|
||||||
|
#include <boost/minmax.hpp>
|
||||||
|
|
||||||
namespace bl{
|
namespace bl{
|
||||||
|
|
||||||
@ -45,7 +46,7 @@ double time_match(const std::string& re, const std::string& text, bool icase)
|
|||||||
boost::regex_match(text, what, e);
|
boost::regex_match(text, what, e);
|
||||||
}
|
}
|
||||||
run = tim.elapsed();
|
run = tim.elapsed();
|
||||||
result = std::min(run, result);
|
result = std_min(run, result);
|
||||||
}
|
}
|
||||||
return result / iter;
|
return result / iter;
|
||||||
}
|
}
|
||||||
@ -86,7 +87,7 @@ double time_find_all(const std::string& re, const std::string& text, bool icase)
|
|||||||
boost::regex_grep(&dummy_grep_proc, text, e);
|
boost::regex_grep(&dummy_grep_proc, text, e);
|
||||||
}
|
}
|
||||||
run = tim.elapsed();
|
run = tim.elapsed();
|
||||||
result = std::min(run, result);
|
result = std_min(run, result);
|
||||||
}
|
}
|
||||||
return result / iter;
|
return result / iter;
|
||||||
}
|
}
|
||||||
|
@ -11,6 +11,7 @@
|
|||||||
|
|
||||||
#include <cassert>
|
#include <cassert>
|
||||||
#include <cfloat>
|
#include <cfloat>
|
||||||
|
#include <boost/minmax.hpp>
|
||||||
#include "regex_comparison.hpp"
|
#include "regex_comparison.hpp"
|
||||||
#ifdef BOOST_HAS_PCRE
|
#ifdef BOOST_HAS_PCRE
|
||||||
#include "pcre.h"
|
#include "pcre.h"
|
||||||
@ -69,7 +70,7 @@ double time_match(const std::string& re, const std::string& text, bool icase)
|
|||||||
erroffset = pcre_exec(ppcre, pe, text.c_str(), text.size(), 0, 0, what, sizeof(what)/sizeof(int));
|
erroffset = pcre_exec(ppcre, pe, text.c_str(), text.size(), 0, 0, what, sizeof(what)/sizeof(int));
|
||||||
}
|
}
|
||||||
run = tim.elapsed();
|
run = tim.elapsed();
|
||||||
result = std::min(run, result);
|
result = std_min(run, result);
|
||||||
}
|
}
|
||||||
free(ppcre);
|
free(ppcre);
|
||||||
free(pe);
|
free(pe);
|
||||||
@ -152,7 +153,7 @@ double time_find_all(const std::string& re, const std::string& text, bool icase)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
run = tim.elapsed();
|
run = tim.elapsed();
|
||||||
result = std::min(run, result);
|
result = std_min(run, result);
|
||||||
}
|
}
|
||||||
return result / iter;
|
return result / iter;
|
||||||
}
|
}
|
||||||
|
@ -11,6 +11,7 @@
|
|||||||
|
|
||||||
#include <cassert>
|
#include <cassert>
|
||||||
#include <cfloat>
|
#include <cfloat>
|
||||||
|
#include <boost/minmax.hpp>
|
||||||
#include "regex_comparison.hpp"
|
#include "regex_comparison.hpp"
|
||||||
#ifdef BOOST_HAS_POSIX
|
#ifdef BOOST_HAS_POSIX
|
||||||
#include <boost/timer.hpp>
|
#include <boost/timer.hpp>
|
||||||
@ -50,7 +51,7 @@ double time_match(const std::string& re, const std::string& text, bool icase)
|
|||||||
regexec(&e, text.c_str(), e.re_nsub, what, 0);
|
regexec(&e, text.c_str(), e.re_nsub, what, 0);
|
||||||
}
|
}
|
||||||
run = tim.elapsed();
|
run = tim.elapsed();
|
||||||
result = std::min(run, result);
|
result = std_min(run, result);
|
||||||
}
|
}
|
||||||
regfree(&e);
|
regfree(&e);
|
||||||
return result / iter;
|
return result / iter;
|
||||||
@ -116,7 +117,7 @@ double time_find_all(const std::string& re, const std::string& text, bool icase)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
run = tim.elapsed();
|
run = tim.elapsed();
|
||||||
result = std::min(run, result);
|
result = std_min(run, result);
|
||||||
}
|
}
|
||||||
return result / iter;
|
return result / iter;
|
||||||
}
|
}
|
||||||
|
@ -14,6 +14,7 @@
|
|||||||
|
|
||||||
#include <cassert>
|
#include <cassert>
|
||||||
#include <boost/timer.hpp>
|
#include <boost/timer.hpp>
|
||||||
|
#include <boost/minmax.hpp>
|
||||||
#include "regexpr2.h"
|
#include "regexpr2.h"
|
||||||
|
|
||||||
namespace gs{
|
namespace gs{
|
||||||
@ -49,7 +50,7 @@ double time_match(const std::string& re, const std::string& text, bool icase)
|
|||||||
e.match(text, what);
|
e.match(text, what);
|
||||||
}
|
}
|
||||||
run = tim.elapsed();
|
run = tim.elapsed();
|
||||||
result = std::min(run, result);
|
result = std_min(run, result);
|
||||||
}
|
}
|
||||||
return result / iter;
|
return result / iter;
|
||||||
}
|
}
|
||||||
@ -96,7 +97,7 @@ double time_find_all(const std::string& re, const std::string& text, bool icase)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
run = tim.elapsed();
|
run = tim.elapsed();
|
||||||
result = std::min(run, result);
|
result = std_min(run, result);
|
||||||
}
|
}
|
||||||
return result / iter;
|
return result / iter;
|
||||||
}
|
}
|
||||||
|
Reference in New Issue
Block a user