All the various indirection in the data structures confuses me, though I
think I've settled in to a proposal for the internal architecture.
(1) I leave the SuggestionList and SuggestionEnumeration virtual.
(2) In suggest.cpp, I rename the SuggestionList class to SuggestList (so
as
not to collide with the new acommon::SuggestionList).
(3) I add a vector of Suggestions to SuggestionListImpl (renamed
SuggestListImpl), parallel to the vector of Strings in the field
"suggestions"; I can call it "scored_suggestions".
(4) When Speller->suggest is called, it calculates scored_suggestions,
then
copies that into suggestions and continues as now.
(5) I create a derived class of (new) SuggestionList in suggest.cppwhich
contains SuggestListImpl, called SuggestionListImpl.
(6) Its elements() call returns a SuggestionEnumeration pointing to the
the
new scored_suggestions field of its SuggestionListImpl.
-- I hope this can use MakeEnumeration from enumeration.hpp.
(7) A new method in Speller (maybe "scored_suggest") returns a new
SuggestionList initialized with code common to the existing suggest
method.
An option is to store only the vector of Suggestion and make the
enumerator
which returns string suggestions know about the Suggestion structure,
extracting the string it needs from that. I don't favor that because
it's
extra work and doesn't save much space.
I'm not sure I 100% understand. Please show me some what the interface
will look like so I can have a better understanding of what you propose.