예제 #1
0
static inline size_t
handle_bucket(TSTNode<CharT>* node,
              unsigned char** strings,
              size_t pos,
              size_t depth)
{
	static_assert(BucketNum < 3, "BucketNum < 3");
	if (node->is_tst[BucketNum]) {
		pos = burst_traverse<BucketT>(
			static_cast<TSTNode<CharT>*>(node->buckets[BucketNum]),
			strings,
			pos,
			depth + (BucketNum==1)*sizeof(CharT));
	} else if (node->buckets[BucketNum]) {
		BucketT* buck = static_cast<BucketT*>(node->buckets[BucketNum]);
		size_t bsize = buck->size();
		std::copy(buck->begin(), buck->end(), strings+pos);
		delete buck;
		if (not is_middle_bucket(BucketNum)) {
			mkqsort(strings+pos, bsize, depth);
		} else if (not is_end(node->pivot)) {
			mkqsort(strings+pos,
				bsize,
				depth+sizeof(CharT));
		}
		pos += bsize;
	}
	return pos;
}
static inline void
copy(const BucketT& bucket, OutputIterator dst)
{
    std::copy(bucket.begin(), bucket.end(), dst);
}