Make is_empty work with any integral type
This commit is contained in:
@@ -1,11 +1,8 @@
|
|||||||
#include <utils/get_first_non_empty.hpp>
|
#include <utils/get_first_non_empty.hpp>
|
||||||
|
|
||||||
|
template <>
|
||||||
bool is_empty(const std::string& val)
|
bool is_empty(const std::string& val)
|
||||||
{
|
{
|
||||||
return val.empty();
|
return val.empty();
|
||||||
}
|
}
|
||||||
|
|
||||||
bool is_empty(const int& val)
|
|
||||||
{
|
|
||||||
return val == 0;
|
|
||||||
}
|
|
||||||
|
|||||||
@@ -2,8 +2,13 @@
|
|||||||
|
|
||||||
#include <string>
|
#include <string>
|
||||||
|
|
||||||
|
template <typename T>
|
||||||
|
bool is_empty(const T& val)
|
||||||
|
{
|
||||||
|
return val == 0;
|
||||||
|
}
|
||||||
|
template <>
|
||||||
bool is_empty(const std::string& val);
|
bool is_empty(const std::string& val);
|
||||||
bool is_empty(const int& val);
|
|
||||||
|
|
||||||
template <typename T>
|
template <typename T>
|
||||||
T get_first_non_empty(T&& last)
|
T get_first_non_empty(T&& last)
|
||||||
|
|||||||
Reference in New Issue
Block a user