From e13d3fdf4d4754c85e7e05e98592afb71d22be3b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?louiz=E2=80=99?= Date: Mon, 22 Aug 2016 21:29:22 +0200 Subject: Move get_first_non_empty to louloulibs/utils --- src/utils/get_first_non_empty.cpp | 11 ----------- src/utils/get_first_non_empty.hpp | 20 -------------------- 2 files changed, 31 deletions(-) delete mode 100644 src/utils/get_first_non_empty.cpp delete mode 100644 src/utils/get_first_non_empty.hpp (limited to 'src/utils') diff --git a/src/utils/get_first_non_empty.cpp b/src/utils/get_first_non_empty.cpp deleted file mode 100644 index 5b3bedb..0000000 --- a/src/utils/get_first_non_empty.cpp +++ /dev/null @@ -1,11 +0,0 @@ -#include - -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 deleted file mode 100644 index a38f5fb..0000000 --- a/src/utils/get_first_non_empty.hpp +++ /dev/null @@ -1,20 +0,0 @@ -#pragma once - -#include - -bool is_empty(const std::string& val); -bool is_empty(const int& val); - -template -T get_first_non_empty(T&& last) -{ - return last; -} - -template -T get_first_non_empty(T&& first, Args&&... args) -{ - if (!is_empty(first)) - return first; - return get_first_non_empty(std::forward(args)...); -} -- cgit v1.2.3