Feel lost with wx/dynarray.h

19 views
Skip to first unread message

Hibou57

unread,
Jul 26, 2026, 9:11:41 AM (12 days ago) Jul 26
to wx-users
Hello out there,

With my apologizes for my lack of knowledge of C++ and wxWidgets, which may be the cause.

In interface/dynarray.h there is a template class wxArray<T>. As it is in the interface directory, it appears in the documentation: https://docs.wxwidgets.org/3.2/classwx_array_3_01_t_01_4.html

In the include directory, there is a corresponding dynarray.h but it contains the template classes wxArray_SortFunction, wxSortedArray_SortFunction and some others, with no wxArray.

I though the interface directory was to contain a strip-down version of what is in include. Where am I wrong?

There is something else I don’t understand and that was my original worry. I had a look at those include files, after I saw this in the document: https://docs.wxwidgets.org/3.2/classwx_array_3_01_t_01_4.html#a7fcfbd2fa53fe042ea385f4e254729da

It says `wxArray<T>::wxSortedArray (int(*)(T first, T second) compareFunction)`

It was not looking like what I knew of the syntax for pointer to functions. So I checked it, and what I read at https://en.cppreference.com/cpp/language/pointer#Pointers_to_functions , confirmed the few I know about it. I still wanted to check in case it is not complete, and wrote a tiny test program in C then C++ and this kind syntax was rejected, it expects the name to be after the opening parentheses and star, that is, something like this:  `wxSortedArray (int(*compareFunction)(T first, T second))` and the same with C++.

Will try to investigate more, but already investigated enough to feel lost.

With the hope to not annoy people …

Vadim Zeitlin

unread,
Jul 26, 2026, 9:27:41 AM (12 days ago) Jul 26
to wx-u...@googlegroups.com
On Sun, 26 Jul 2026 06:11:41 -0700 (PDT) 'Hibou57' via wx-users wrote:

H> In interface/dynarray.h there is a template class wxArray<T>.

Why are you looking at it? These classes are deprecated and shouldn't be
used in the new code, they're only retained for compatibility.

H> I though the interface directory was to contain a strip-down version of
H> what is in include. Where am I wrong?

The headers in the interface directory don't always correspond to the real
headers exactly. There are sometimes good reasons for this but I don't
think they apply to this particular header which seems to be just wrong.
Again, the best would probably be to just not deal with it.

H> It says `wxArray<T>::wxSortedArray (int(*)(T first, T
H> second) compareFunction)`
H>
H> It was not looking like what I knew of the syntax for pointer to functions.

Yes, this is wrong, but it's far from being the only thing wrong there,
wxSortedArray (and inexistent wxObjArray) ctors shouldn't be defined inside
wxArray declaration...

Regards,
VZ

--
TT-Solutions: wxWidgets consultancy and technical support
https://www.tt-solutions.com/

Hibou57

unread,
Jul 26, 2026, 9:40:30 AM (12 days ago) Jul 26
to wx-users
Le dimanche 26 juillet 2026 à 15:27:41 UTC+2, Vadim Zeitlin a écrit :
These classes are deprecated and shouldn't be
used in the new code, they're only retained for compatibility. 

Indeed, after your reply, I searched for it in the page and it says: “The legacy dynamic array class, existing for compatibility only and NOT to be used in the new code. ”

Why are you looking at it?
 
Just because of the syntax I found there.

Also, just noticed this:

> wxWidgets has three different kinds of array. All of them derive from wxBaseArray class which works with untyped data and cannot be used directly. The standard macros WX_DEFINE_ARRAY(), WX_DEFINE_SORTED_ARRAY() and WX_DEFINE_OBJARRAY() are used to define a new class deriving from it. The classes declared will be called in this documentation wxArray, wxSortedArray and wxObjArray but you should keep in mind that **no classes with such names actually exist**
 
Will search for deprecations to avoid to look at it.

Thanks for your reponse

Reply all
Reply to author
Forward
0 new messages