diff --git a/include/boost/date_time/constrained_value.hpp b/include/boost/date_time/constrained_value.hpp index 6bd1470..20423a4 100644 --- a/include/boost/date_time/constrained_value.hpp +++ b/include/boost/date_time/constrained_value.hpp @@ -9,6 +9,8 @@ * $Date$ */ +#include + 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(); diff --git a/include/boost/date_time/date_parsing.hpp b/include/boost/date_time/date_parsing.hpp index 94fd995..2eaee2a 100644 --- a/include/boost/date_time/date_parsing.hpp +++ b/include/boost/date_time/date_parsing.hpp @@ -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 > 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 tok(s, osf); for(boost::tokenizer::iterator ti=tok.begin(); ti!=tok.end();++ti) { diff --git a/include/boost/date_time/int_adapter.hpp b/include/boost/date_time/int_adapter.hpp index 8be9d8d..02ee247 100644 --- a/include/boost/date_time/int_adapter.hpp +++ b/include/boost/date_time/int_adapter.hpp @@ -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::max(); + return (::std::numeric_limits::max)(); } static const int_adapter neg_infinity() { - return ::std::numeric_limits::min(); + return (::std::numeric_limits::min)(); } static const int_adapter not_a_number() { - return ::std::numeric_limits::max()-1; + return (::std::numeric_limits::max)()-1; } - static int_adapter max() + static int_adapter max BOOST_PREVENT_MACRO_SUBSTITUTION () { - return ::std::numeric_limits::max()-2; + return (::std::numeric_limits::max)()-2; } - static int_adapter min() + static int_adapter min BOOST_PREVENT_MACRO_SUBSTITUTION () { - return ::std::numeric_limits::min()+1; + return (::std::numeric_limits::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::max()-3; + return (::std::numeric_limits::max)()-3; } bool is_infinity() const { diff --git a/test/gregorian/testdate.cpp b/test/gregorian/testdate.cpp index 8811383..076dbef 100644 --- a/test/gregorian/testdate.cpp +++ b/test/gregorian/testdate.cpp @@ -57,9 +57,9 @@ main() //The max function will not compile with Borland 5.5 //Complains about must specialize basic_data ??? -// std::cout << "Max date is " << date::max() << std::endl; -// //std::cout << "Max date is " << basic_date< date_limits >::max() << std::endl; -// //std::cout << "Max date is " << date_limits::max() << std::endl; +// std::cout << "Max date is " << (date::max)() << std::endl; +// //std::cout << "Max date is " << (basic_date< date_limits >::max)() << std::endl; +// //std::cout << "Max date is " << (date_limits::max)() << std::endl; const date answers[] = {date(1900,Jan,1),date(1900,Jan,4),date(1900,Jan,7), date(1900,Jan,10),date(1900,Jan,13)}; diff --git a/test/gregorian/testgreg_day.cpp b/test/gregorian/testgreg_day.cpp index 44d8d94..7d8fdf1 100644 --- a/test/gregorian/testgreg_day.cpp +++ b/test/gregorian/testgreg_day.cpp @@ -38,8 +38,8 @@ test_day() check("Bad day creation2", true); //good } - check("traits min day", greg_day::min() == 1); - check("traits max day", greg_day::max() == 31); + check("traits min day", (greg_day::min)() == 1); + check("traits max day", (greg_day::max)() == 31); greg_weekday sunday(0); greg_weekday monday(1); diff --git a/test/gregorian/testgreg_month.cpp b/test/gregorian/testgreg_month.cpp index e8ca3f2..d2482c9 100644 --- a/test/gregorian/testgreg_month.cpp +++ b/test/gregorian/testgreg_month.cpp @@ -53,8 +53,8 @@ test_month() sm1.as_short_string() == std::string("Jan")); check("short construction -- 12", sm12.as_short_string() == std::string("Dec")); - check("month traits min", greg_month::min() == 1); - check("month traits max", greg_month::max() == 12); + check("month traits min", (greg_month::min)() == 1); + check("month traits max", (greg_month::max)() == 12); } diff --git a/test/gregorian/testgreg_year.cpp b/test/gregorian/testgreg_year.cpp index 9c4d07c..699b3bc 100644 --- a/test/gregorian/testgreg_year.cpp +++ b/test/gregorian/testgreg_year.cpp @@ -39,8 +39,8 @@ main() check("Bad year creation2", true); //good } - check("traits min year", greg_year::min() == 1400); - check("traits max year", greg_year::max() == 10000); + check("traits min year", (greg_year::min)() == 1400); + check("traits max year", (greg_year::max)() == 10000); printTestStats(); return 0; diff --git a/test/testconstrained_value.cpp b/test/testconstrained_value.cpp index 9d5c470..d3337bb 100644 --- a/test/testconstrained_value.cpp +++ b/test/testconstrained_value.cpp @@ -5,6 +5,7 @@ * Author: Jeff Garland */ +#include "boost/config.hpp" #include "boost/date_time/constrained_value.hpp" #include "boost/date_time/testfrmwk.hpp" #include @@ -16,8 +17,8 @@ class day_value_policies { public: typedef unsigned int value_type; - static unsigned int min() { return 0; }; - static unsigned int max() { return 31;}; + static unsigned int min BOOST_PREVENT_MACRO_SUBSTITUTION () { return 0; }; + static unsigned int max BOOST_PREVENT_MACRO_SUBSTITUTION () { return 31;}; static void on_error(unsigned int&, unsigned int, boost::CV::violation_enum) { throw bad_day(); diff --git a/test/testint64_range.cpp b/test/testint64_range.cpp index 5282f01..8cbf537 100644 --- a/test/testint64_range.cpp +++ b/test/testint64_range.cpp @@ -20,10 +20,10 @@ main() #else std::cout << "int64_t max: " - << std::numeric_limits::max() + << (std::numeric_limits::max)() << std::endl; std::cout << "uint64_t max: " - << std::numeric_limits::max() + << (std::numeric_limits::max)() << std::endl; @@ -34,7 +34,7 @@ main() << microsec_per_day << std::endl; - boost::uint64_t total_days = std::numeric_limits::max() / microsec_per_day; + boost::uint64_t total_days = (std::numeric_limits::max)() / microsec_per_day; std::cout << "Representable days: " << total_days diff --git a/test/testint_adapter.cpp b/test/testint_adapter.cpp index c5865ca..429eaa7 100644 --- a/test/testint_adapter.cpp +++ b/test/testint_adapter.cpp @@ -19,8 +19,8 @@ void print() #if (defined(BOOST_DATE_TIME_NO_LOCALE)) || (defined(BOOST_MSVC) && (_MSC_VER <= 1200)) // 1200 == VC++ 6.0 #else - std::cout << "min: " << int_type::min().as_number() << std::endl; - std::cout << "max: " << int_type::max().as_number() << std::endl; + std::cout << "min: " << (int_type::min)().as_number() << std::endl; + std::cout << "max: " << (int_type::max)().as_number() << std::endl; std::cout << "neg_infin: " << int_type::neg_infinity().as_number() << std::endl; std::cout << "pos_infin: " << @@ -134,9 +134,9 @@ void test_int() check("from special ", int_type::from_special(boost::date_time::not_a_date_time) == int_type::not_a_number()); check("from special ", - int_type::from_special(boost::date_time::min_date_time) == int_type::min()); + int_type::from_special(boost::date_time::min_date_time) == (int_type::min)()); check("from special ", - int_type::from_special(boost::date_time::max_date_time) == int_type::max()); + int_type::from_special(boost::date_time::max_date_time) == (int_type::max)()); } int