MCPcopy Create free account
hub / github.com/ParAlg/gbbs / sequence

Class sequence

pbbslib/seq.h:99–296  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

97
98template <typename T>
99struct sequence {
100 public:
101 using value_type = T;
102 // using iterator = T*;
103 using const_iterator = const T*;
104
105 sequence() : s(NULL), n(0) {}
106
107 // copy constructor
108 sequence(const sequence& a) : n(a.n) {
109 copy_here(a.s, a.n);
110 if (check_copy)
111 std::cout << "copy constructor: len: " << a.n << " sizeof: " << sizeof(T)
112 << std::endl;
113 }
114
115 // move constructor
116 sequence(sequence&& a) : s(a.s), n(a.n) {
117 a.s = NULL;
118 a.n = 0;
119 }
120
121 // copy assignment
122 sequence& operator=(const sequence& a) {
123 if (this != &a) {
124 clear();
125 copy_here(a.s, a.n);
126 }
127 if (check_copy)
128 std::cout << "copy assignment: len: " << a.n << " sizeof: " << sizeof(T)
129 << std::endl;
130 return *this;
131 }
132
133 // move assignment
134 sequence& operator=(sequence&& a) {
135 if (this != &a) {
136 clear();
137 s = a.s;
138 n = a.n;
139 a.s = NULL;
140 a.n = 0;
141 }
142 return *this;
143 }
144
145 sequence(const size_t _n)
146 : s(pbbs::new_array<T>(_n)),
147 n(_n){
148 // if (n > 1000000000) std::cout << "make empty: " << s << std::endl;
149 };
150
151 static sequence<T> no_init(const size_t n) {
152 sequence<T> r;
153 r.s = pbbs::new_array_no_init<T>(n);
154 // if (n > 1000000000) std::cout << "make no init: " << r.s << std::endl;
155 r.n = n;
156 return r;

Callers 1

build_sequenceMethod · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected