Пример #1
0
inline bool operator==(const std::tr1::unordered_set<size_t> &a, const std::tr1::unordered_set<size_t> &b) {
  if (a.size() != b.size()) return false;

  std::tr1::unordered_set<size_t>::const_iterator cit = a.begin();
  while (a.end() != cit) {
    if (b.end() == b.find(*cit))
      return false;
    cit++;
  }
 
  return true;
}
Пример #2
-1
inline void operator<< (object::with_zone& o, const std::tr1::unordered_set<T>& v)
{
	o.type = type::ARRAY;
	if(v.empty()) {
		o.via.array.ptr = NULL;
		o.via.array.size = 0;
	} else {
		object* p = (object*)o.zone->malloc(sizeof(object)*v.size());
		object* const pend = p + v.size();
		o.via.array.ptr = p;
		o.via.array.size = v.size();
		typename std::tr1::unordered_set<T>::const_iterator it(v.begin());
		do {
			*p = object(*it, o.zone);
			++p;
			++it;
		} while(p < pend);
	}
}