seq.hpp
Go to the documentation of this file.
1
2#pragma once
3
4#include "core/ast.hpp"
7
8namespace by {
9
10 typedef class _nout tbridge<nseq> __seqSuperClass;
11
16 class _nout seq: public __seqSuperClass, public tucontainable<nInt, nInt, nInt>, tarrayable<nInt, nInt, nInt> {
17 // seq uses wrapType:
18 // wrapType contains beanType as 'const type*' instance variable. so user should be
19 // careful when calling ttype<arr>. because it will also return wrapType instance
20 // as a consequences, but it won't contain beanType.
21 //
22 // the most appropriate getter for wrapType of arr is to call getType() of instance
23 // to arr.
24 BY(ME(seq, __seqSuperClass), INIT_META(seq), CLONE(seq), VISIT())
25
26 public:
27 typedef ntype metaType; // for ttype<T>
30 template <typename T, nbool> friend struct tmarshaling;
31
32 public:
33 seq(const nInt& start, const nInt& end);
34 seq(const nInt& start, const nInt& end, const nInt& step);
35
36 private:
37 // @hidden this's only available to marshaling.
38 seq();
39
40 public:
42 nInt operator[](nidx n) override;
43
44 public:
45 const ntype& getType() const override;
46
47 using super::subs;
48 scope& subs() override;
49
50 ncnt len() const override;
51
52 nbool in(nidx n) const override;
53
54 // get:
56 using super::get;
57 nInt get(nidx n) override;
58
59 // etc:
60 void rel() override;
61
62 protected:
63 iteration* _onMakeIteration(ncnt step, nbool isReversed) const override;
64
65 private:
66 // these method has been prohibited.
67 // set:
70 nbool set(const iter& at, const nInt& new1) override;
71 nbool set(nidx n, const nInt& new1) override;
72 // add:
75 nbool add(const iter& at, const nInt& new1) override;
76 nbool add(nidx n, const nInt& new1) override;
77 void add(const iter& here, const iter& from, const iter& to) override;
78 // del:
80 nbool del(nidx n) override;
81 nbool del(const iter& it) override;
82 nbool del(const iter& from, const iter& to) override;
83 };
84} // 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 type system for byeol language.
Definition: ntype.hpp:19
Managed sequence container for integer ranges.
Definition: seq.hpp:16
Definition: tarrayable.hpp:10
Template unidirectional container interface.
Definition: tucontainable.hpp:19
Bidirectional iterator for key-value containers.
Definition: biter.hpp:9
Definition: biteration.hpp:5
Template marshaling interface for C++ bridge.
Definition: tmarshaling.hpp:18