Hello, first of all thanks for your great work! :-)
For the listbox there are two models. Typically, if you have complicated data and you want to avoid data duplication and senseless back and forward conversions, you'd pick the shared_model.
The problem is that this model still forces you to do unnecessary conversions.
If you pick a shared_model and want to handle the container yourself, the model should pass iterators to the custom callbacks.
Let's take an example random access container (deque) with various columns of floating point numbers. The first column being the index of the elements (increment from 1 to last index):
Number | Value | Cost ====================== 1 | 30.373 | 2.39 2 | 40.702 | 9.99 ...
If you provide your custom sort function for this:
set_sort_compare (size_type col, std::function< bool(const std::string &, nana::any *, const std::string &, nana::any *, bool reverse)> strick_ordering)
you end up with converting floats to strings and string to floats all the time.
If instead you'd simply pass the iterators, you could access your items (objects) directly the way you want. You could also deduce the index without cost, as it is a random access container (std::distance).
Likewise, when passing a callback for the cell translation you currently pass the item to the callback. There is no way to tell the index by that. You'd have to store an extra index for the first column, in this example. If instead you'd pass an iterator, you'd have both the item and the index efficiently.
How about using iterators instead?