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:
Eric Niebler
2004-02-26 18:27:02 +00:00
parent fa299bb703
commit 058431aed0
10 changed files with 40 additions and 36 deletions

View File

@@ -9,6 +9,8 @@
* $Date$
*/
#include <boost/config.hpp>
namespace boost {
//! Namespace containing constrained_value template and types
@@ -46,9 +48,9 @@ namespace CV {
return *this;
}
//! Return the max allowed value (traits method)
static value_type max() {return value_policies::max();};
static value_type max BOOST_PREVENT_MACRO_SUBSTITUTION () {return (value_policies::max)();};
//! Return the min allowed value (traits method)
static value_type min() {return value_policies::min();};
static value_type min BOOST_PREVENT_MACRO_SUBSTITUTION () {return (value_policies::min)();};
//! Coerce into the representation type
operator value_type() const {return value_;};
protected:
@@ -58,11 +60,11 @@ namespace CV {
{
//adding 1 below gets rid of a compiler warning which occurs when the
//min_value is 0 and the type is unsigned....
if (value+1 < min()+1) {
if (value+1 < (min)()+1) {
value_policies::on_error(value_, value, min_violation);
return;
}
if (value > max()) {
if (value > (max)()) {
value_policies::on_error(value_, value, max_violation);
return;
}
@@ -78,8 +80,8 @@ namespace CV {
{
public:
typedef rep_type value_type;
static rep_type min() { return min_value; };
static rep_type max() { return max_value;};
static rep_type min BOOST_PREVENT_MACRO_SUBSTITUTION () { return min_value; };
static rep_type max BOOST_PREVENT_MACRO_SUBSTITUTION () { return max_value;};
static void on_error(rep_type, rep_type, violation_enum)
{
throw exception_type();

View File

@@ -96,7 +96,7 @@ namespace date_time {
typedef typename date_type::year_type year_type;
typedef typename date_type::month_type month_type;
unsigned pos = 0;
typename date_type::ymd_type ymd(year_type::min(),1,1);
typename date_type::ymd_type ymd((year_type::min)(),1,1);
boost::tokenizer<boost::char_delimiters_separator<char> > tok(s);
for(boost::tokenizer<>::iterator beg=tok.begin(); beg!=tok.end(), pos < spec_str.size(); ++beg, ++pos) {
unsigned short i =0;
@@ -130,7 +130,7 @@ namespace date_time {
int offsets[] = {4,2,2};
int pos = 0;
typedef typename date_type::year_type year_type;
typename date_type::ymd_type ymd(year_type::min(),1,1);
typename date_type::ymd_type ymd((year_type::min)(),1,1);
boost::offset_separator osf(offsets, offsets+3);
boost::tokenizer<boost::offset_separator> tok(s, osf);
for(boost::tokenizer<boost::offset_separator>::iterator ti=tok.begin(); ti!=tok.end();++ti) {

View File

@@ -10,6 +10,7 @@
*/
#include "boost/config.hpp"
#include "boost/limits.hpp" //work around compilers without limits
#include "boost/date_time/special_defs.hpp"
#include "boost/date_time/locale_config.hpp"
@@ -46,23 +47,23 @@ public:
}
static const int_adapter pos_infinity()
{
return ::std::numeric_limits<int_type>::max();
return (::std::numeric_limits<int_type>::max)();
}
static const int_adapter neg_infinity()
{
return ::std::numeric_limits<int_type>::min();
return (::std::numeric_limits<int_type>::min)();
}
static const int_adapter not_a_number()
{
return ::std::numeric_limits<int_type>::max()-1;
return (::std::numeric_limits<int_type>::max)()-1;
}
static int_adapter max()
static int_adapter max BOOST_PREVENT_MACRO_SUBSTITUTION ()
{
return ::std::numeric_limits<int_type>::max()-2;
return (::std::numeric_limits<int_type>::max)()-2;
}
static int_adapter min()
static int_adapter min BOOST_PREVENT_MACRO_SUBSTITUTION ()
{
return ::std::numeric_limits<int_type>::min()+1;
return (::std::numeric_limits<int_type>::min)()+1;
}
static int_adapter from_special(special_values sv)
{
@@ -70,8 +71,8 @@ public:
case not_a_date_time: return not_a_number();
case neg_infin: return neg_infinity();
case pos_infin: return pos_infinity();
case max_date_time: return max();
case min_date_time: return min();
case max_date_time: return (max)();
case min_date_time: return (min)();
default: return not_a_number();
}
}
@@ -104,7 +105,7 @@ public:
//-3 leaves room for representations of infinity and not a date
static int_type maxcount()
{
return ::std::numeric_limits<int_type>::max()-3;
return (::std::numeric_limits<int_type>::max)()-3;
}
bool is_infinity() const
{