Offical way to initialize wxPointlist?

If you are using the main C++ distribution of wxWidgets, Feel free to ask any question related to wxWidgets development here. This means questions regarding to C++ and wxWidgets, not compile problems.
Post Reply
czczzzz
Earned a small fee
Earned a small fee
Posts: 20
Joined: Thu May 13, 2021 10:34 am

Offical way to initialize wxPointlist?

Post by czczzzz »

Is there a Offical way to initialize a wxPointlist?

I am doing this right now:

Code: Select all

wxPoint polygon[] = { {130,140},{180,170},{180,140},{220,110},{140,100} };

wxPointList pl;

for (auto& i : polygon)
     pl.Append(&i);

dc.DrawPolygon(&pl);
and I has tried a lot of other ways(comparing to vector),but with no luck......

and I can not find document about it......

Could someone tell me is there a offical way to initialize it?


sorry for my english
PB
Part Of The Furniture
Part Of The Furniture
Posts: 4193
Joined: Sun Jan 03, 2010 5:45 pm

Re: Offical way to initialize wxPointlist?

Post by PB »

Well, perhaps wxList does not support C++11 initializers?

If you build wxWidgets with wxUSE_STL set to 1, it could work but I did not try...
czczzzz
Earned a small fee
Earned a small fee
Posts: 20
Joined: Thu May 13, 2021 10:34 am

Re: Offical way to initialize wxPointlist?

Post by czczzzz »

sad......

at least I can use auto in the for loop......not too verbose :(
Post Reply