#1 Build on clang.

This commit is contained in:
Per Malmberg 2019-03-15 11:45:23 +01:00
parent 802d8e724e
commit e725abf87f
3 changed files with 13 additions and 12 deletions

View File

@ -11,7 +11,8 @@ namespace libcron
class CronData class CronData
{ {
public: public:
static const std::array<Months, 7> months_with_31; static const int NUMBER_OF_LONG_MONTHS = 7;
static const libcron::Months months_with_31[NUMBER_OF_LONG_MONTHS];
static CronData create(const std::string& cron_expression); static CronData create(const std::string& cron_expression);

View File

@ -5,13 +5,13 @@ using namespace date;
namespace libcron namespace libcron
{ {
const constexpr std::array<Months, 7> CronData::months_with_31{ Months::January, const constexpr Months CronData::months_with_31[NUMBER_OF_LONG_MONTHS] = { Months::January,
Months::March, Months::March,
Months::May, Months::May,
Months::July, Months::July,
Months::August, Months::August,
Months::October, Months::October,
Months::December }; Months::December };
CronData CronData::create(const std::string& cron_expression) CronData CronData::create(const std::string& cron_expression)
{ {
@ -98,7 +98,7 @@ namespace libcron
{ {
res = false; res = false;
for (size_t i = 0; !res && i < months_with_31.size(); ++i) for (size_t i = 0; !res && i < NUMBER_OF_LONG_MONTHS; ++i)
{ {
res = months.find(months_with_31[i]) != months.end(); res = months.find(months_with_31[i]) != months.end();
} }

View File

@ -87,9 +87,9 @@ namespace libcron
// Limit to 29 days, possibly causing delaying schedule until next leap year. // Limit to 29 days, possibly causing delaying schedule until next leap year.
max = std::min(max, 29); max = std::min(max, 29);
} }
else if (std::find(CronData::months_with_31.begin(), else if (std::find(std::begin(CronData::months_with_31),
CronData::months_with_31.end(), std::end(CronData::months_with_31),
month) == CronData::months_with_31.end()) month) == std::end(CronData::months_with_31))
{ {
// Not among the months with 31 days // Not among the months with 31 days
max = std::min(max, 30); max = std::min(max, 30);