aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorPavel Belikov <pavel.fuchs.belikov@gmail.com>2018-05-04 20:19:33 +0300
committerPavel Belikov <pavel.fuchs.belikov@gmail.com>2018-05-04 20:19:33 +0300
commit17cfe1afd74dbfa5e4ba1401eeca9c80f6011b95 (patch)
tree81fa421d5792a99c9f821b610e9e5b64a2da01c9
parentAdd test for windows minmax (diff)
downloadargs.hxx-17cfe1afd74dbfa5e4ba1401eeca9c80f6011b95.tar.xz
Fix Nargs::min, Nargs::max initializers for min/max macros from <windows.h>
-rw-r--r--CMakeLists.txt8
-rw-r--r--args.hxx4
-rw-r--r--test/windows_h.cxx8
3 files changed, 12 insertions, 8 deletions
diff --git a/CMakeLists.txt b/CMakeLists.txt
index 76caba4..8f17cab 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -44,11 +44,9 @@ add_executable(gitlike examples/gitlike.cxx)
target_link_libraries(gitlike args)
set_property(TARGET gitlike PROPERTY CXX_STANDARD 11)
-if (WIN32)
- add_executable(argstest-windows-h test/windows_h.cxx)
- target_link_libraries(argstest-windows-h args)
- set_property(TARGET argstest-windows-h PROPERTY CXX_STANDARD 11)
-endif ()
+add_executable(argstest-windows-h test/windows_h.cxx)
+target_link_libraries(argstest-windows-h args)
+set_property(TARGET argstest-windows-h PROPERTY CXX_STANDARD 11)
add_executable(completion examples/completion.cxx)
target_link_libraries(completion args)
diff --git a/args.hxx b/args.hxx
index 655718f..c4fbc10 100644
--- a/args.hxx
+++ b/args.hxx
@@ -748,7 +748,7 @@ namespace args
const size_t min;
const size_t max;
- Nargs(size_t min_, size_t max_) : min(min_), max(max_)
+ Nargs(size_t min_, size_t max_) : min{min_}, max{max_}
{
#ifndef ARGS_NOEXCEPT
if (max < min)
@@ -758,7 +758,7 @@ namespace args
#endif
}
- Nargs(size_t num_) : min(num_), max(num_)
+ Nargs(size_t num_) : min{num_}, max{num_}
{
}
diff --git a/test/windows_h.cxx b/test/windows_h.cxx
index a9befe1..007a1e7 100644
--- a/test/windows_h.cxx
+++ b/test/windows_h.cxx
@@ -1,8 +1,14 @@
+#ifdef _WIN32
#include "windows.h"
+#else
+#define min(a,b) ((a)<(b)?(a):(b))
+#define max(a,b) ((a)>(b)?(a):(b))
+#endif
+
#include <iostream>
#include <args.hxx>
-int main()
+int main(int argc, char** argv)
{
args::ArgumentParser parser("This is a test program.", "This goes after the options.");
args::HelpFlag help(parser, "help", "Display this help menu", {'h', "help"});