相关疑难解决方法(0)

C++ 11中是否有一个范围类用于基于范围的循环?

我发现自己刚刚写了这篇文章:

template <long int T_begin, long int T_end>
class range_class {
 public:
   class iterator {
      friend class range_class;
    public:
      long int operator *() const { return i_; }
      const iterator &operator ++() { ++i_; return *this; }
      iterator operator ++(int) { iterator copy(*this); ++i_; return copy; }

      bool operator ==(const iterator &other) const { return i_ == other.i_; }
      bool operator !=(const iterator &other) const { return i_ != other.i_; }

    protected:
      iterator(long int start) : i_ (start) { } …
Run Code Online (Sandbox Code Playgroud)

c++ std c++11

99
推荐指数
3
解决办法
4万
查看次数

标签 统计

c++ ×1

c++11 ×1

std ×1