From 6b30a65ffddd44a3810903e5341b7baa5bc28902 Mon Sep 17 00:00:00 2001 From: Mike Zozu Date: Tue, 15 Dec 2020 16:59:45 +0300 Subject: [PATCH] special case for repr: bool value --- include/argparse/argparse.hpp | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/include/argparse/argparse.hpp b/include/argparse/argparse.hpp index 29abf78..376f34f 100644 --- a/include/argparse/argparse.hpp +++ b/include/argparse/argparse.hpp @@ -92,7 +92,9 @@ static constexpr bool is_representable_v = constexpr size_t repr_max_container_size = 5; template std::string repr(T const &val) { - if constexpr (std::is_convertible_v) { + if constexpr (std::is_same_v) { + return val ? "true" : "false"; + } else if constexpr (std::is_convertible_v) { return '"' + std::string{std::string_view{val}} + '"'; } else if constexpr (is_container_v) { std::stringstream out;