14#include <initializer_list>
72 BaseSet(
const G& set) : std::set<F>(set) {}
77 template<
class G,
class H>
82 template<
class G,
class H>
87 template<
class G,
class H,
class I,
class J>
110 inline bool isempty()
const {
return this->begin() == this->end(); }
112 virtual std::ostream&
info(std::ostream&
os)
const;
114 typedef typename std::set<F>::const_iterator const_iterator_;
115 typedef typename std::insert_iterator<std::set<F> > insert_iterator_;
120 insert_iterator_ i)
const;
125 insert_iterator_ i)
const;
130 insert_iterator_ i)
const;
134 std::istream& operator>>(std::istream&
is,
BaseSet<F>& set) {
138 DEBUGL(SetInput_D,
"val = " << val);
144 std::string(
" can not be created. The input symbol ` ") +
145 std::string(std::istreambuf_iterator<char>(
is), {}).
substr(0,1) +
146 std::string(
" ` does not meet the conversion criteria"
147 " of the operator>>, failbit was setted to true."));
154 if (
str.size() > 0) {
163 const F* e = (
const F*)a;
164 for(
uint i = a.
size(); i--;) this->insert(*e++);
169 template<
class G,
class H>
172 for(const_iterator_ i = this->begin(); i != this->end(); ++i) {
173 G val = ((*i)->*
fun)();
180 template<
class G,
class H>
183 for(const_iterator_ i = this->begin(); i != this->end();++i) {
184 G* val = &((*i)->*fun)();
191 template<
class G,
class H,
class I,
class J>
194 for(const_iterator_ is = this->begin(); is != this->end();++is) {
195 G val = ((*is)->*fun)(i);
202 Set<F> BaseSet<F>::operator||(
const Set<F>& set)
const {
204 union_(set.begin(), set.end(), inserter(result, result.begin()));
209 Set<F> BaseSet<F>::operator||(Set<F>& set)
const {
211 union_(set.begin(), set.end(), inserter(result, result.begin()));
216 Set<F> BaseSet<F>::operator&&(
const Set<F>& set)
const {
218 intersection_(set.begin(), set.end(), inserter(result, result.begin()));
223 Set<F> BaseSet<F>::operator&&(Set<F>& set)
const {
225 intersection_(set.begin(), set.end(), inserter(result, result.begin()));
231 (const_iterator_ first, const_iterator_ last, insert_iterator_ i)
const {
232 set_intersection(this->begin(), this->end(), first, last, i);
237 (const_iterator_ first, const_iterator_ last, insert_iterator_ i)
const {
238 set_union(this->begin(), this->end(), first, last, i);
243 (const_iterator_ first, const_iterator_ last, insert_iterator_ i)
const {
244 set_difference(this->begin(), this->end(), first, last, i);
250 difference_(set.begin(), set.end(), inserter(result, result.begin()));
255 Set<F> BaseSet<F>::operator-(Set<F>& set)
const {
257 difference_(set.begin(), set.end(), inserter(result, result.begin()));
263 std::set<uint> result;
265 for(const_iterator_ is = this->begin(); is != this->end(); ++is, ++i)
266 if (*is == val) result.insert(i);
274 typename std::set<uint>::const_iterator it = set.begin();
275 const_iterator_ is = this->begin();
276 while(it != set.end() && is != this->end()) {
289 set_union(this->begin(), this->end(),
290 set.begin(), set.end(),
291 inserter(*
this, this->begin()));
297 return this->find(val) != this->end();
303 for(const_iterator_ i = this->begin(); i != this->end();) {
304 pointerOutput(os, *i);
305 if (++i != this->end()) os <<
", ";
325 va_start(param, first);
326 for(uint i = 1; i < n; ++i)
327 data.insert(va_arg(param, F));
uint size() const
Returns the requested size of the array.
virtual void union_(const_iterator_ first, const_iterator_ last, insert_iterator_ i) const
Set< G * > operator()(G &(H::*fun)() const) const
BaseSet(const std::string &str)
virtual void difference_(const_iterator_ first, const_iterator_ last, insert_iterator_ i) const
Set< G > operator()(G(H::*fun)() const) const
virtual std::ostream & info(std::ostream &os) const
Returns information in an output stream.
virtual void intersection_(const_iterator_ first, const_iterator_ last, insert_iterator_ i) const
bool exist(F val) const
Returns true, if a value is in the set.
BaseSet(const G &set)
Constructor, which uses the constructor of the base class std::set.
BaseSet(const concepts::Array< F > &a)
bool isempty() const
Returns true, if set is empty.
Set< F > operator()(const Set< uint > &set) const
Returns subset with indices set.
Set< uint > operator==(const F val) const
Returns the indices of elements with are equal to val.
Set< G > operator()(G(H::*fun)(I) const, J i) const
BaseSet()
Standard Constructor.
#define conceptsAssert(cond, exc)
#define DEBUGL(doit, msg)
std::string typeOf(const T &t)
Set< F > makeSet(uint n, const F &first,...)