Skip to content
Snippets Groups Projects
Commit 3f26d719 authored by Imdad Sardharwalla's avatar Imdad Sardharwalla Committed by GitHub Enterprise
Browse files

REFORM-1096 Fixes for macOS (#50)

XCode10 lacks support for several C++17 standard library
features. Hence, for macOS, std::size() has been replaced with calls
to sizeof(), and std::map::try_emplace() has been replaced with calls
to std::map::emplace().
parent 7e5f246c
No related branches found
No related tags found
1 merge request!14Merge latest changes to Base from ReForm
...@@ -174,8 +174,13 @@ void Parser::add_option(Option& _option) ...@@ -174,8 +174,13 @@ void Parser::add_option(Option& _option)
OPTION_THROW_if(help_option(_option.name()), OPTION_THROW_if(help_option(_option.name()),
_option.name() << " cannot override -h or --help."); _option.name() << " cannot override -h or --help.");
#ifdef __APPLE__
OPTION_THROW_if(!options_.emplace(_option.name(), _option).second,
_option.name() << " has already been added to the argument parser.");
#else // __APPLE__
OPTION_THROW_if(!options_.try_emplace(_option.name(), _option).second, OPTION_THROW_if(!options_.try_emplace(_option.name(), _option).second,
_option.name() << " has already been added to the argument parser."); _option.name() << " has already been added to the argument parser.");
#endif // __APPLE__
} }
void Parser::parse() void Parser::parse()
...@@ -349,7 +354,13 @@ Checksum::Level ChecksumLevel::parse_level(const std::string& _arg) ...@@ -349,7 +354,13 @@ Checksum::Level ChecksumLevel::parse_level(const std::string& _arg)
// Make _arg uppercase // Make _arg uppercase
auto arg = to_upper(_arg); auto arg = to_upper(_arg);
size_t num_levels = std::size(Checksum::LEVEL_TEXT); #ifdef __APPLE__
const size_t num_levels =
sizeof(Checksum::LEVEL_TEXT) / sizeof(Checksum::LEVEL_TEXT[0]);
#else // __APPLE__
const size_t num_levels = std::size(Checksum::LEVEL_TEXT);
#endif // __APPLE__
for (size_t i = 0; i < num_levels; i++) for (size_t i = 0; i < num_levels; i++)
{ {
if (arg == Checksum::LEVEL_TEXT[i]) if (arg == Checksum::LEVEL_TEXT[i])
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment