x

Search in
Sort by:

Question Status:

Search help

  • Simple searches use one or more words. Separate the words with spaces (cat dog) to search cat,dog or both. Separate the words with plus signs (cat +dog) to search for items that may contain cat but must contain dog.
  • You can further refine your search on the search results page, where you can search by keywords, author, topic. These can be combined with each other. Examples
    • cat dog --matches anything with cat,dog or both
    • cat +dog --searches for cat +dog where dog is a mandatory term
    • cat -dog -- searches for cat excluding any result containing dog
    • [cats] —will restrict your search to results with topic named "cats"
    • [cats] [dogs] —will restrict your search to results with both topics, "cats", and "dogs"

Add initializer_list to TPair and TMap request

There is initializer_list for TArray. It's great. I can do next:

 TArray<int32> = {1, 2, 3, 4, 5};

I think it would be nice works TMaps also:

 TMap<int32, FName> map = { {1, "Hi!"}, {2, "Yo!"}, {3, "Lolz"} };

It possible if TPair will be extended with constructor with key and value, and TMap with initializer_list.

Thanks!

Product Version: UE 4.14
Tags:
more ▼

asked Nov 29 '16 at 01:21 PM in C++ Programming

avatar image

broly
559 44 63 91

avatar image Tyler.Thompson May 11 '17 at 04:41 PM

I'd love to see this too.

avatar image UEMonkey May 11 '17 at 04:46 PM

This would be very useful.

avatar image benhumphreys Mar 01 '18 at 06:24 PM

I would love this too

avatar image Wrekk Mar 05 '18 at 01:35 PM

Would be a great addition. I hate having to do Map.Add for each element.

(comments are locked)
10|2000 characters needed characters left
Viewable by all users

1 answer: sort voted first

It is possible like this:

 TMap<int32, float> map = { TPairInitializer<const int32&, const float&>(2, 5.f) };
more ▼

answered Nov 15 '18 at 01:46 PM

avatar image

Forrgit
6 1 4 6

(comments are locked)
10|2000 characters needed characters left
Viewable by all users
Your answer
toggle preview:

Up to 5 attachments (including images) can be used with a maximum of 5.2 MB each and 5.2 MB total.

Follow this question

Once you sign in you will be able to subscribe for any updates here

Answers to this question