mirror of
https://github.com/HowardHinnant/date.git
synced 2024-12-27 16:41:04 +08:00
Correction after code review
This commit is contained in:
parent
50802176f3
commit
0e64070a33
9
tz.cpp
9
tz.cpp
@ -768,11 +768,7 @@ operator>>(std::istream& is, MonthDayTime& x)
|
|||||||
throw std::runtime_error(std::string("bad operator: ") + c + c2
|
throw std::runtime_error(std::string("bad operator: ") + c + c2
|
||||||
+ std::to_string(d));
|
+ std::to_string(d));
|
||||||
x.type_ = c == '<' ? MonthDayTime::lteq : MonthDayTime::gteq;
|
x.type_ = c == '<' ? MonthDayTime::lteq : MonthDayTime::gteq;
|
||||||
#if !defined(_MSC_VER) || (_MSC_VER >= 1900)
|
x.u = MonthDayTime::pair{ date::month(m) / d, date::weekday(dow) };
|
||||||
x.u = {date::month(m)/d, date::weekday(dow)};
|
|
||||||
#else
|
|
||||||
x.u = MonthDayTime::U(date::month(m)/d, date::weekday(dow));
|
|
||||||
#endif
|
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
throw std::runtime_error(std::string("bad operator: ") + c);
|
throw std::runtime_error(std::string("bad operator: ") + c);
|
||||||
@ -1370,8 +1366,7 @@ find_previous_rule(const Rule* r, date::year y)
|
|||||||
// [first, last) all have the same name
|
// [first, last) all have the same name
|
||||||
static
|
static
|
||||||
std::pair<const Rule*, date::year>
|
std::pair<const Rule*, date::year>
|
||||||
find_next_rule(const Rule* first_rule, const Rule* last_rule, const Rule* r,
|
find_next_rule(const Rule* first_rule, const Rule* last_rule, const Rule* r, date::year y)
|
||||||
date::year y)
|
|
||||||
{
|
{
|
||||||
using namespace date;
|
using namespace date;
|
||||||
if (y == r->ending_year())
|
if (y == r->ending_year())
|
||||||
|
19
tz_private.h
19
tz_private.h
@ -35,7 +35,11 @@ private:
|
|||||||
{
|
{
|
||||||
#if defined(_MSC_VER) && (_MSC_VER < 1900)
|
#if defined(_MSC_VER) && (_MSC_VER < 1900)
|
||||||
pair() : month_day_(date::jan / 1), weekday_(0U) {}
|
pair() : month_day_(date::jan / 1), weekday_(0U) {}
|
||||||
|
|
||||||
|
pair(const date::month_day& month_day, const date::weekday& weekday)
|
||||||
|
: month_day_(month_day), weekday_(weekday) {}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
date::month_day month_day_;
|
date::month_day month_day_;
|
||||||
date::weekday weekday_;
|
date::weekday weekday_;
|
||||||
};
|
};
|
||||||
@ -44,17 +48,17 @@ private:
|
|||||||
|
|
||||||
Type type_{month_day};
|
Type type_{month_day};
|
||||||
|
|
||||||
#if defined(_MSC_VER) && (_MSC_VER < 1900)
|
#if !defined(_MSC_VER) || (_MSC_VER > 1900)
|
||||||
struct U
|
|
||||||
#else
|
|
||||||
union U
|
union U
|
||||||
|
#else
|
||||||
|
struct U
|
||||||
#endif
|
#endif
|
||||||
{
|
{
|
||||||
date::month_day month_day_;
|
date::month_day month_day_;
|
||||||
date::month_weekday_last month_weekday_last_;
|
date::month_weekday_last month_weekday_last_;
|
||||||
pair month_day_weekday_;
|
pair month_day_weekday_;
|
||||||
|
|
||||||
#if !defined(_MSC_VER) && (_MSC_VER >= 1900)
|
#if !defined(_MSC_VER) || (_MSC_VER >= 1900)
|
||||||
U() : month_day_{date::jan/1} {}
|
U() : month_day_{date::jan/1} {}
|
||||||
#else
|
#else
|
||||||
U() :
|
U() :
|
||||||
@ -62,12 +66,7 @@ private:
|
|||||||
month_weekday_last_(date::month(0U), date::weekday_last(date::weekday(0U)))
|
month_weekday_last_(date::month(0U), date::weekday_last(date::weekday(0U)))
|
||||||
{}
|
{}
|
||||||
|
|
||||||
U(const date::month_day& month_day,
|
#endif // !defined(_MSC_VER) || (_MSC_VER >= 1900)
|
||||||
const date::weekday& weekday) :
|
|
||||||
month_day_(month_day),
|
|
||||||
month_weekday_last_(date::month(0U), date::weekday_last(weekday))
|
|
||||||
{}
|
|
||||||
#endif // !defined(_MSC_VER) && (_MSC_VER >= 1900)
|
|
||||||
|
|
||||||
U& operator=(const date::month_day& x);
|
U& operator=(const date::month_day& x);
|
||||||
U& operator=(const date::month_weekday_last& x);
|
U& operator=(const date::month_weekday_last& x);
|
||||||
|
Loading…
x
Reference in New Issue
Block a user