From 7571020243889db72bb0182dbacc84e506afa279 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?louiz=E2=80=99?= Date: Wed, 6 Nov 2019 17:47:35 +0100 Subject: Make is_empty work with any integral type --- src/utils/get_first_non_empty.cpp | 5 +---- src/utils/get_first_non_empty.hpp | 7 ++++++- 2 files changed, 7 insertions(+), 5 deletions(-) diff --git a/src/utils/get_first_non_empty.cpp b/src/utils/get_first_non_empty.cpp index 5b3bedb..17585b1 100644 --- a/src/utils/get_first_non_empty.cpp +++ b/src/utils/get_first_non_empty.cpp @@ -1,11 +1,8 @@ #include +template <> bool is_empty(const std::string& val) { return val.empty(); } -bool is_empty(const int& val) -{ - return val == 0; -} diff --git a/src/utils/get_first_non_empty.hpp b/src/utils/get_first_non_empty.hpp index a38f5fb..1877ee8 100644 --- a/src/utils/get_first_non_empty.hpp +++ b/src/utils/get_first_non_empty.hpp @@ -2,8 +2,13 @@ #include +template +bool is_empty(const T& val) +{ + return val == 0; +} +template <> bool is_empty(const std::string& val); -bool is_empty(const int& val); template T get_first_non_empty(T&& last) -- cgit v1.2.3