blob: 1877ee81155376dfe054f108c88683b292274aee (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
|
#pragma once
#include <string>
template <typename T>
bool is_empty(const T& val)
{
return val == 0;
}
template <>
bool is_empty(const std::string& val);
template <typename T>
T get_first_non_empty(T&& last)
{
return last;
}
template <typename T, typename... Args>
T get_first_non_empty(T&& first, Args&&... args)
{
if (!is_empty(first))
return first;
return get_first_non_empty(std::forward<Args>(args)...);
}
|