P
PengYu.UT
Hi,
I have the code below this email. I want to replace the last 4 lines
with a Metaprogramming loop to get something like the following (I
don't know the syntax). Is it possible?
for type in {left_tag, right_tag, down_tag, up_tag) {
fun(type());
}
Thanks,
Peng
struct left_tag{};
struct right_tag{};
struct down_tag{};
struct up_tag{};
template <typename Dir>
void fun(Dir) { }
//Can I replace the following code with a metaprogramming "for" loop
fun(left_tag());
fun(right_tag());
fun(down_tag());
fun(up_tag());
I have the code below this email. I want to replace the last 4 lines
with a Metaprogramming loop to get something like the following (I
don't know the syntax). Is it possible?
for type in {left_tag, right_tag, down_tag, up_tag) {
fun(type());
}
Thanks,
Peng
struct left_tag{};
struct right_tag{};
struct down_tag{};
struct up_tag{};
template <typename Dir>
void fun(Dir) { }
//Can I replace the following code with a metaprogramming "for" loop
fun(left_tag());
fun(right_tag());
fun(down_tag());
fun(up_tag());