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"

How to remove item from struct array

I've being trying to remove a boolean from my struct array while iterating but, I couldn't get it done. Some tip for a newbie?

The .h file struct FMyStruct

....
UPROPERTY(...)

bool MyBoo


class MyClass : public

UPROPERTY(...)

TArray <FMyStruct> MyStruct

Then the .cpp

if (conditions met) { 
MyStruct.Remove(MyBoo);
}

VS2013 show me error like type name is not allowed

Product Version: UE 4.8
Tags:
more ▼

asked Sep 16 '15 at 01:55 PM in C++ Programming

avatar image

edsonsantoro
30 10 13 11

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

1 answer: sort voted first

It looks like MyBoo is a bool type, while MyStruct is a TArray of FMyStruct-s, so you can't remove a bool from it. Maybe it's just a typing mistake, but you need to remove the struct instead of the bool. Also, you might want to avoid removing elements from a container while you're iterating through it. You can avoid that for eg. by storing which elements you want to remove in a separate array, and then removing them

If you can't resolve the issue, post more of your source, I can't really tell what MyBoo is in your MyClass.cpp

more ▼

answered Sep 19 '15 at 12:33 PM

avatar image

balazon
116 6 7 11

(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