nseq.hpp
Go to the documentation of this file.
1
2#pragma once
3
4#include "core/ast/node.hpp"
8
9namespace by {
10
15 class _nout nseq: public tnucontainer<nInt, nInt, nInt>, public tarrayable<nInt, nInt, nInt> {
17 BY(CLASS(nseq, _super3))
18 friend class seq;
19
20 public:
21#include "../iter/nseqIteration.hpp"
22
23 public:
24 nseq(const nInt& start, const nInt& end);
25 nseq(const nInt& start, const nInt& end, const nInt& step);
26
27 public:
29 nInt operator[](nidx n) override;
30
31 public:
32 const nInt& getStart() const;
33 const nInt& getEnd() const;
34 const nInt& getStep() const;
35
36 ncnt len() const override;
37
38 void rel() override;
39
40 using super::get;
41 nInt get(nidx n) override;
42
43 using super::in;
44 nbool in(nidx n) const override;
45
46 protected:
47 iteration* _onMakeIteration(ncnt step, nbool isReversed) const override;
48
49 private:
50 // these method has been prohibited.
51 using super::add;
53 nbool add(const iter& at, const nInt& new1) override;
54 void add(const iter& at, const iter& from, const iter& to) override;
55 nbool add(nidx n, const nInt& new1) override;
56
57 using super::set;
59 nbool set(const iter& at, const nInt& new1) override;
60 nbool set(nidx n, const nInt& new1) override;
61
62 using super::del;
64 nbool del(const iter& it) override;
65 nbool del(const iter& from, const iter& end) override;
66 nbool del(nidx n) override;
67
68 void _updateStep();
69
70 private:
71 nInt _start;
72 nInt _end;
73 nInt _step;
74 };
75} // namespace by
Deferred execution utility like defer keyword in other languages.
Definition: end.hpp:14
Integer primitive type in byeol language.
Definition: nInt.hpp:12
Native sequence container for integer ranges.
Definition: nseq.hpp:15
Managed sequence container for integer ranges.
Definition: seq.hpp:16
Definition: tarrayable.hpp:10
Definition: tnucontainer.hpp:9
Bidirectional iterator for key-value containers.
Definition: biter.hpp:9
Definition: biteration.hpp:5