Skip to content

Add wxVector(std::initializer_list<U> list) ctor (3.2)#25290

Closed
vslavik wants to merge 1 commit intowxWidgets:3.2from
vslavik:vector-std-initializer
Closed

Add wxVector(std::initializer_list<U> list) ctor (3.2)#25290
vslavik wants to merge 1 commit intowxWidgets:3.2from
vslavik:vector-std-initializer

Conversation

@vslavik
Copy link
Copy Markdown
Member

@vslavik vslavik commented Apr 3, 2025

(This is 3.2-only as this code is gone on master. I think it doesn't have ABI implications and so is safe to add to 3.2, and that it is worth having, because Linux distros ship w/o wxUSE_STD_CONTAINERS, but I realize your mileage may vary, so feel free to reject it.)

This is analogous to code present for wxArray and makes using wxVector easier. As a motivating example, adding data to wxDataViewListCtrl is a bit of a PITA w/o it:

wxVector<wxVariant> data;
data.push_back("foo");
data.push_back("bar");
data.push_back("zar");
list->AppendItem(data);

vs.

list->AppendItem({"foo", "bar", "zar"});

Improve compatibility with std::vector<> by adding std::initializer_list
contructor.
@vadz
Copy link
Copy Markdown
Contributor

vadz commented Apr 4, 2025

Looks good to me, thanks! Will push soon.

vadz pushed a commit that referenced this pull request Apr 4, 2025
Improve compatibility with std::vector<> by adding std::initializer_list
constructor.

Closes #25290.
@vadz vadz closed this Apr 4, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants