小编Lim*_*hin的帖子

在可变参数模板中交换两个参数

我正在尝试交换参数包的两个项目.

理想情况下,我想做这样的事情:

template<int i1, int i2, class... Args>
void swapped_copy(some_class a, some_class b, Args... args) {
    a(args...) = b(/* 'args...' where parameters with indices i1 and i2 are swapped */);
}
Run Code Online (Sandbox Code Playgroud)

任何的想法?

非常感谢.

c++ variadic-templates c++11

12
推荐指数
1
解决办法
271
查看次数

标签 统计

c++ ×1

c++11 ×1

variadic-templates ×1