forked from HowardHinnant/date
Enable the c++14 CONSTDATA code path for VS2017 and fix const const warning.
This commit is contained in:
6
date.h
6
date.h
@ -60,15 +60,15 @@ namespace date
|
||||
// MSVC's constexpr support is still a WIP, even in VS2015.
|
||||
// Fall back to a lesser mode to support it.
|
||||
// TODO: Remove this or retest later once MSVC's constexpr improves.
|
||||
#if defined(_MSC_VER) && ! defined(__clang__)
|
||||
// MS cl compiler.
|
||||
#if defined(_MSC_VER) && _MSC_VER <= 1900 && ! defined(__clang__)
|
||||
// MS cl compiler pre VS2017
|
||||
# define CONSTDATA const
|
||||
# define CONSTCD11
|
||||
# define CONSTCD14
|
||||
# define NOEXCEPT _NOEXCEPT
|
||||
#elif __cplusplus >= 201402
|
||||
// C++14
|
||||
# define CONSTDATA constexpr
|
||||
# define CONSTDATA constexpr const
|
||||
# define CONSTCD11 constexpr
|
||||
# define CONSTCD14 constexpr
|
||||
# define NOEXCEPT noexcept
|
||||
|
6
tz.cpp
6
tz.cpp
@ -724,7 +724,7 @@ static
|
||||
unsigned
|
||||
parse_dow(std::istream& in)
|
||||
{
|
||||
const char*const dow_names[] =
|
||||
CONSTDATA char*const dow_names[] =
|
||||
{"Sun", "Mon", "Tue", "Wed", "Thu", "Fri", "Sat"};
|
||||
auto s = parse3(in);
|
||||
auto dow = std::find(std::begin(dow_names), std::end(dow_names), s) - dow_names;
|
||||
@ -737,7 +737,7 @@ static
|
||||
unsigned
|
||||
parse_month(std::istream& in)
|
||||
{
|
||||
const char*const month_names[] =
|
||||
CONSTDATA char*const month_names[] =
|
||||
{"Jan", "Feb", "Mar", "Apr", "May", "Jun",
|
||||
"Jul", "Aug", "Sep", "Oct", "Nov", "Dec"};
|
||||
auto s = parse3(in);
|
||||
@ -2800,7 +2800,7 @@ init_tzdb()
|
||||
db.version = get_version(path);
|
||||
#endif // !AUTO_DOWNLOAD
|
||||
|
||||
CONSTDATA const char* files[] =
|
||||
CONSTDATA char*const files[] =
|
||||
{
|
||||
"africa", "antarctica", "asia", "australasia", "backward", "etcetera", "europe",
|
||||
"pacificnew", "northamerica", "southamerica", "systemv", "leapseconds"
|
||||
|
Reference in New Issue
Block a user