Developer forums (C::B DEVELOPMENT STRICTLY!) > Compiler Framework Redesign

Compiler Messages: Sorting by Message (I'm stuck trying to do this...)


Hi guys. I'm sort of stuck trying to add a "Sort by Message" item in the compiler messages. I've needed to do it when linting a big number of javascript files (the lint is my "compiler" :P ). And there were tons of trivial errors that I wanted to tackle. And I said: Why not sort the compiler messages by the error message?

So, I began writing the code, when suddenly...

--- Code: ---WX_DECLARE_OBJARRAY(CompileError, ErrorsArray);

--- End code ---

How on Earth do you sort a wxWhateverObjArray? I googled and searched the wxWidgets documentation, and there's no such thing as WX_DECLARE_SORTED_OBJARRAY.

Any ideas?
(Also, do we still have to rely on the WX_DECLARE macros? We're in 2011 and the STL are supported everywhere)

Have you read this:

Looking in the docs wxSortedArray is not a good candidate for this case, because addition in the array is slower (O(log(N)) and you need to sort the array at the end.
In my opinion wxArray should never be used, because it has pretty strange const rules, see the operator[] which may lead to pretty strange and hard to fix bugs.
If you need an array you can use a vector or a deque or even one of the map/set classes in STL. You can sort them easily using std::sort.


[0] Message Index

Go to full version