void Normalizer::sort (std::vector<CodePoint>::iterator begin, std::vector<CodePoint>::iterator end) const { auto b=begin; for (;begin!=end;++begin) { auto cpi=begin->GetInfo(locale); if (!((cpi==nullptr) || (cpi->CanonicalCombiningClass==0))) continue; if (b!=begin) sort_impl(b,begin); b=begin+1; } if (b!=end) sort_impl(b,end); }
static siblings_idx sort_impl(Tree& t, siblings_idx s, DataSwap&& data_swap) noexcept { siblings_idx should = s; for (auto n : t.nodes(s) | t.with_children()) { ++should; siblings_idx c_sg = t.children_group(n); if (c_sg != should) { t.swap(c_sg, should); swap_data(t, c_sg, should, data_swap); should = sort_impl(t, should, data_swap); } else { should = sort_impl(t, c_sg, data_swap); } } return should; }