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"

TArray of Abstract class type

When I declare a TArray and ISomeInterface has protected constructor & destructor and thus cannot be instantiated, it gives me an error that it can't access the destructor!

Am I suppose to go around that by doing TArray < TSharedRef< ISomeInterface > > ?

Any other options?

Why is this happening?

Thanks :)

Product Version: UE 4.8
Tags:
more ▼

asked Jun 17 '15 at 11:49 PM in C++ Programming

avatar image

danr
18 4 6 9

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

2 answers: sort voted first

If you do

 TArray<ISomeInterface> SomeInterfaces;

the TArray requires a copy and for an abstract class that is not possible. Instead you should reference your interfaces through pointers or similar!

 TArray<ISomeInterface*> SomeInterfaces;
more ▼

answered Jun 18 '15 at 02:31 AM

avatar image

Zaucy
686 15 13 128

avatar image danr Jun 18 '15 at 11:41 AM

Yep, I wrote it in the question but it stripped my it from opening tags (xss protection probably)... it was one of my examples :)

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

What if I need to clean the memory?

Like:

TArray array;

array.Add(new A());

array.Empty();

DOSE clean up the A istance?

more ▼

answered Mar 07 '16 at 08:46 AM

avatar image

SaverioFrancesco
1 2

(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