From 4c69ebf3fefbd62757d34d51a54c05041a5ed300 Mon Sep 17 00:00:00 2001 From: Pranav Srinivas Kumar Date: Sun, 12 Apr 2020 09:38:21 -0500 Subject: [PATCH] Placing definitions in unnamed namespace to prevent multiple definition linker error #75 --- include/argparse.hpp | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/include/argparse.hpp b/include/argparse.hpp index ae67ab0a..d1b0d684 100644 --- a/include/argparse.hpp +++ b/include/argparse.hpp @@ -73,6 +73,8 @@ struct is_container< template static constexpr bool is_container_v = is_container::value; +namespace { + template constexpr bool standard_signed_integer = false; template <> constexpr bool standard_signed_integer = true; template <> constexpr bool standard_signed_integer = true; @@ -88,6 +90,8 @@ template <> constexpr bool standard_unsigned_integer = true; template <> constexpr bool standard_unsigned_integer = true; +} + template constexpr bool standard_integer = standard_signed_integer || standard_unsigned_integer; @@ -186,11 +190,15 @@ template struct parse_number { } }; +namespace { + template constexpr auto generic_strtod = nullptr; template <> constexpr auto generic_strtod = strtof; template <> constexpr auto generic_strtod = strtod; template <> constexpr auto generic_strtod = strtold; +} + template inline auto do_strtod(std::string const &s) -> T { if (isspace(static_cast(s[0])) || s[0] == '+') throw std::invalid_argument{"pattern not found"};