16#include <initializer_list>
78 : std::vector<F>(
seq) {}
85 inline operator std::set<F>()
const {
87 for(
typename std::vector<F>::
88 const_iterator i =
this->begin(); i != this->end(); ++i)
96 template<
class G,
class H>
101 template<
class G,
class H>
106 template<
class G,
class H,
class I,
class J>
110 inline std::vector<bool> operator||(
const Sequence<F>& set)
const;
112 inline std::vector<bool> operator&&(
const Sequence<F>& set)
const;
129 virtual std::ostream&
info(std::ostream&
os)
const;
137 DEBUGL(SeqInput_D,
"val = " << val);
146 if (
str.size() > 0) {
157 this->push_back(q.front());
172 template<
class G,
class H>
175 for(
typename std::vector<F>::
176 const_iterator i =
this->begin(); i != this->end(); ++i) {
177 G val = ((*i)->*
fun)();
184 template<
class G,
class H>
187 for(
typename std::vector<F>::
188 const_iterator i = this->begin(); i != this->end();++i) {
189 G* val = &((*i)->*fun)();
196 template<
class G,
class H,
class I,
class J>
199 for(
typename std::vector<F>::
200 const_iterator is = this->begin(); is != this->end();++is) {
201 G val = ((*is)->*fun)(i);
208 std::vector<bool> BaseSequence<F>::operator||(
const Sequence<F>& seq)
const
211 std::vector<bool> result(this->size(),
false);
213 std::vector<bool>::iterator i = result.begin();
214 typename std::vector<F>::
215 const_iterator it = this->begin(), is = seq.begin();
216 for(; it != this->end(); ++it, ++is, ++i)
222 std::vector<bool> BaseSequence<F>::operator&&(
const Sequence<F>& seq)
const
225 std::vector<bool> result(this->size(),
false);
227 std::vector<bool>::iterator i = result.begin();
228 typename std::vector<F>::
229 const_iterator it = this->begin(), is = seq.begin();
230 for(; it != this->end(); ++it, ++is, ++i)
236 Sequence<F> BaseSequence<F>::operator-(
const Sequence<F>& seq)
const {
237 std::set<F> set = seq;
238 std::vector<F> result;
239 result.reserve(this->size());
240 for(
typename std::vector<F>::
241 const_iterator i = this->begin(); i != this->end(); ++i)
242 if (set.find(*i) == set.end()) result.push_back(*i);
247 Sequence<F> BaseSequence<F>::operator-(
const F& val)
const {
248 std::vector<F> result;
249 result.reserve(this->size());
250 for(
typename std::vector<F>::
251 const_iterator i = this->begin(); i != this->end(); ++i)
252 if (!(*i == val)) result.push_back(*i);
257 Sequence<F> BaseSequence<F>::operator+(
const Sequence<F>& seq)
const {
258 std::vector<F> result(this->size() + seq.size());
259 typename std::vector<F>::iterator i = result.begin();
260 typename std::vector<F>::
261 const_iterator it = this->begin(), is = seq.begin();
262 for(; it != this->end(); ++it, ++i) *i = *it;
263 for(; is != seq.end(); ++is, ++i) *i = *is;
269 std::vector<bool> result(this->size());
274 std::vector<bool>::iterator i = result.begin();
275 for(
typename std::vector<F>::
276 const_iterator it = this->begin(); it != this->end(); ++it, ++i)
309 std::vector<F> result(count(seq.begin(), seq.end(),
true));
310 if (result.size() > 0) {
311 std::vector<bool>::const_iterator is = seq.begin();
312 typename std::vector<F>::const_iterator it = this->begin();
313 typename std::vector<F>::iterator i = result.begin();
314 for(; it != this->end(); ++it, ++is)
325 for(
typename std::vector<F>::
326 const_iterator i = this->begin(); i != this->end(); ++i)
328 if (*i == val)
return true;
337 for(
typename std::vector<F>::
338 const_iterator i = this->begin(); i != this->end();) {
339 pointerOutput(os, *i);
340 if (++i != this->end()) os <<
", ";
380 va_start(param, first);
381 for(uint i = 1; i < n; ++i)
382 data[i] = va_arg(param, F);
396 uint n = list.size();
407 Sequence<F> makeEquidistantSequence(uint n,
const F& first,
const F& diff)
410 typename Sequence<F>::iterator i = data.begin();
411 F current = *i++ = first;
412 for(; i != data.end(); ++i)
413 *i++ = (current+=diff);
437 template<
class F,
class G>
446 typename Combtype<F,G>::type prod;
447 for(; i1 != seq1.end(); ) {
455 template<
class F,
class G>
456 Sequence<typename Combtype<F,G>::type>
457 operator*(
const Sequence<F> seq1,
const G factor)
459 Sequence<typename Combtype<F,G>::type> seq;
460 typename Sequence<F>::const_iterator i1 = seq1.begin();
461 for(; i1 != seq1.end(); )
462 seq.push_back( *i1++ * factor);
468 template<
class F,
class G>
469 Sequence<typename Combtype<F,G>::type>
470 operator/(
const Sequence<F> seq1,
const Sequence<G> seq2)
474 Sequence<typename Combtype<F,G>::type> seq;
475 typename Sequence<F>::const_iterator i1 = seq1.begin();
476 typename Sequence<F>::const_iterator i2 = seq2.begin();
477 for(; i1 != seq1.end(); )
478 seq.push_back( *i1++ / *i2++);
482 template<
class F,
class G>
483 Sequence<typename Combtype<F,G>::type>
484 operator/(
const Sequence<F> seq1,
const G divisor)
486 Sequence<typename Combtype<F,G>::type> seq;
487 typename Sequence<F>::const_iterator i1 = seq1.begin();
488 for(; i1 != seq1.end(); )
489 seq.push_back( *i1++ / divisor);
std::vector< bool > operator==(const F val) const
Returns true for the elements with are equal to val.
Sequence< F > operator()(const BaseSequence< bool > &seq) const
Returns subsequence which indices are true in seq.
Sequence< G * > operator()(G &(H::*fun)() const) const
BaseSequence(const std::string &str)
BaseSequence(const G &seq)
Constructor, which uses the constructor of the base class std::vector.
BaseSequence(const int N)
Constructor taking an integer.
bool exist(F val) const
Returns true, if a value is in the seq.
Sequence< G > operator()(G(H::*fun)(I) const, J i) const
virtual std::ostream & info(std::ostream &os) const
Returns information in an output stream.
Sequence< G > operator()(G(H::*fun)() const) const
BaseSequence(std::queue< F > q)
Constructor taking a queue (takes a copy)
Sequence< bool > operator&(const Sequence< bool > &seq) const
Deletes each bit, which is not set in \seq.
Sequence()
Standard Constructor.
Sequence(const F &seq)
Constructor, which uses the constructor of the base class BaseSequence.
Sequence< bool > operator|(const Sequence< bool > &seq) const
Set each bit, which is set in \seq.
Sequence< bool > operator~() const
Returns copy of this sequence with negate bits.
#define conceptsAssert(cond, exc)
#define DEBUGL(doit, msg)
std::string typeOf(const T &t)
Sequence< int > makeRangeSequence(uint n)
Returns the sequence 0,1,...,n-1.
Sequence< int > makeSignAlternatingSequence(uint n)
Returns the sequence +1,-1, +1,...
Set< F > makeSet(uint n, const F &first,...)
Sequence< F > makeSequence(uint n, const F &first,...)