update
This commit is contained in:
parent
3f256ef270
commit
92a433ed69
@ -10,7 +10,7 @@ namespace zt {
|
||||
template<typename T>
|
||||
class Range{
|
||||
private:
|
||||
T _start,_end,_step;
|
||||
const T _start,_end,_step;
|
||||
public:
|
||||
constexpr Range()=delete;
|
||||
constexpr Range(const T start,const T end,const T step)noexcept:_start(start),_end(end),_step(step){}
|
||||
@ -18,7 +18,9 @@ namespace zt {
|
||||
constexpr Range(const T end)noexcept:Range(1,end,1){}
|
||||
|
||||
struct Iterator{
|
||||
T current,step;
|
||||
T current;
|
||||
const T step;
|
||||
|
||||
constexpr Iterator()=delete;
|
||||
constexpr Iterator(const T start,const T step)noexcept:current(start),step(step){}
|
||||
constexpr bool operator!=(const Iterator &other)const noexcept{
|
||||
@ -33,10 +35,10 @@ namespace zt {
|
||||
}
|
||||
};
|
||||
|
||||
constexpr Iterator begin(){
|
||||
constexpr Iterator begin()const{
|
||||
return Iterator(_start,_step);
|
||||
}
|
||||
constexpr Iterator end(){
|
||||
constexpr Iterator end()const{
|
||||
return Iterator(_end,_step);
|
||||
}
|
||||
};
|
||||
|
Loading…
Reference in New Issue
Block a user