blob: 89861352f2c92b8cdd16de84a90c73785ffd1f60 (
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
26
27
28
29
30
31
32
|
#ifndef TYPEASVALUE_SRC_RUNTIME_LIST_FOR_EACH_H_
#define TYPEASVALUE_SRC_RUNTIME_LIST_FOR_EACH_H_
#include <type_traits>
#include "list/list.h"
namespace tav {
namespace runtime {
template <
typename Current,
typename Function,
typename std::enable_if<std::is_void<Current>::value, std::size_t>::type = 0
>
void for_each(const Function&) { }
template <
typename Current,
typename Function,
typename std::enable_if<!std::is_void<Current>::value, std::size_t>::type = 0
>
void for_each(const Function& function) {
function(Head<Current>::value);
for_each<Tail<Current>, Function>(function);
}
}
}
#endif // TYPEASVALUE_SRC_RUNTIME_LIST_FOR_EACH_H_
|