2 * \file GuiCompleter.cpp
3 * This file is part of LyX, the document processor.
4 * Licence details can be found in the file COPYING.
6 * \author Stefan Schimanski
8 * Full author contact details are available in file CREDITS.
13 #include <boost/assert.hpp>
15 #include <support/convert.h>
16 #include <support/debug.h>
17 #include <support/docstring.h>
18 #include <support/weighted_btree.h>
30 struct WordList::Impl {
34 typedef stx::weighted_btree<docstring, size_t> Words;
46 for (size_t i = 1000000; i > 0; --i) {
47 d->words_.insert("a" + convert<docstring>(i), size_t(1), stx::Void());
59 docstring const & WordList::word(size_t idx) const
61 Impl::Words::const_iterator it
62 = d->words_.find_summed_weight(idx);
63 BOOST_ASSERT(it != d->words_.end());
68 size_t WordList::size() const
70 return d->words_.size();
74 void WordList::insert(docstring const & w)
76 d->words_.insert(w, size_t(1), stx::Void());