这是我正在尝试的.MinGW g ++ 4.7.0.
#include <iostream>
#include <string>
class Fruit
{
public:
enum Value { APPLE, ORANGE, BANANA, NONE };
static const Value VALUES[4] = { APPLE, ORANGE, BANANA, NONE };
Fruit (Value v = NONE) : v_(v) { };
std::string to_string () const {
switch (v_) {
case APPLE: return "apple";
case ORANGE: return "orange";
case BANANA: return "banana";
default: return "none";
}
}
private:
Value v_;
};
int main (int argc, char * argv[])
{
for (Fruit f …
Run Code Online (Sandbox Code Playgroud) 试图修改此页面中的代码.
这是问题代码:
#include <iostream>
#include <array>
template<class T>
class const_reverse_wrapper
{
public:
const_reverse_wrapper (const T& cont)
: container_(cont)
{
}
decltype( container_.rbegin() ) begin() const
{
return container_.rbegin();
}
decltype( container_.rend() ) end()
{
return container_.rend();
}
private:
const T & container_;
};
template<class T>
class reverse_wrapper
{
public:
reverse_wrapper (T & cont)
: container_(cont)
{
}
decltype( container_.rbegin() ) begin()
{
return container_.rbegin();
}
decltype( container_.rend() ) end()
{
return container_.rend();
}
private:
T & container_;
}; …
Run Code Online (Sandbox Code Playgroud) 我需要遍历文件服务器上的所有文件,并且我希望能够停止该过程并在以后在文件树中的任何位置恢复它。这可以用 os.walk 来完成,还是需要从头开始实现?
编辑:理想情况下,我希望解决方案是持久的,以便脚本可以停止并在以后恢复。