我在上课的项目中有以下代码.我在打印声明上遇到了几个小时的麻烦,我无法在互联网上找到我需要的东西.
这是我的模板类定义:
template <class T>
class oset {
template <class U>
class node {
.....
};
.....
public:
template <class U>
class iter {
node<U> *pos; // node _before_ the one with this->operator*
// constructor is private:
iter(node<U>* n) : pos(n) { }
friend class oset<U>;
....
};
private:
iter<T> start; // initialized in the constructors below
iter<T> finish; // initialized in the constructors below
public:
iter<T> begin() {
return start;
}
iter<T> end() {
return finish;
}
....
}; …
Run Code Online (Sandbox Code Playgroud) 我需要遍历每个cpu,这样我就可以从中获取一个per_cpu
值,但似乎没有for_each_cpu(i)
宏.linux内核版本是2.6.26.5
我想做的事情如下:
for_each_cpu(i)
per_cpu(vm_event_states, i)
Run Code Online (Sandbox Code Playgroud)