44#ifndef GLOB_FN_EACH2_H
55#define GLOB_FN_EACH2_H
66
7+ #include < cstddef>
78#include < functional>
89#include < map>
910#include < vector>
@@ -12,45 +13,37 @@ namespace ModuleBase
1213{
1314namespace GlobalFunc
1415{
15-
16- template <typename Ti, typename ... T_tail>
17- void FUNC_EACH_2 (
18- Ti & tA,
19- const Ti & tB,
20- std::function< void ( Ti&, const Ti&, T_tail... ) > func,
21- const T_tail&... t_tail )
16+
17+ template <typename Ti, typename ... T_tail>
18+ void FUNC_EACH_2 (Ti& tA, const Ti& tB, std::function<void (Ti&, const Ti&, T_tail...)> func, const T_tail&... t_tail)
2219{
23- func ( tA, tB, t_tail... );
20+ func (tA, tB, t_tail...);
2421}
2522
26-
27- template <typename Tv, typename Ti, typename ... T_tail>
28- void FUNC_EACH_2 (
29- std::vector<Tv> & tA,
30- const std::vector<Tv> & tB,
31- std::function< void ( Ti&, const Ti&, T_tail... ) > func,
32- const T_tail&... t_tail )
23+ template <typename Tv, typename Ti, typename ... T_tail>
24+ void FUNC_EACH_2 (std::vector<Tv>& tA,
25+ const std::vector<Tv>& tB,
26+ std::function<void (Ti&, const Ti&, T_tail...)> func,
27+ const T_tail&... t_tail)
3328{
34- for ( size_t i= 0 ; i!= tA.size (); ++i )
35- {
36- FUNC_EACH_2 ( tA[i], tB[i], func, t_tail... );
37- }
29+ for (std:: size_t i = 0 ; i != tA.size (); ++i)
30+ {
31+ FUNC_EACH_2 (tA[i], tB[i], func, t_tail...);
32+ }
3833}
3934
40-
41- template <typename T1 , typename T2 , typename Ti, typename ... T_tail>
42- void FUNC_EACH_2 (
43- std::map<T1 ,T2 > & tA,
44- const std::map<T1 ,T2 > & tB,
45- std::function< void ( Ti&, const Ti&, T_tail... ) > func,
46- const T_tail&... t_tail )
35+ template <typename T1 , typename T2 , typename Ti, typename ... T_tail>
36+ void FUNC_EACH_2 (std::map<T1 , T2 >& tA,
37+ const std::map<T1 , T2 >& tB,
38+ std::function<void (Ti&, const Ti&, T_tail...)> func,
39+ const T_tail&... t_tail)
4740{
48- for ( auto & ta : tA )
49- {
50- FUNC_EACH_2 ( ta.second , tB.at (ta.first ), func, t_tail... );
51- }
41+ for ( auto & ta: tA)
42+ {
43+ FUNC_EACH_2 (ta.second , tB.at (ta.first ), func, t_tail...);
44+ }
5245}
5346
54- }
55- }
47+ } // namespace GlobalFunc
48+ } // namespace ModuleBase
5649#endif // GLOB_FN_EACH2_H
0 commit comments