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"

Office Holiday

Epic Games' offices will be on holiday from June 22nd to July 7th. During this period support will be limited. Our offices will reopen on Monday, July 8th. 

Regarding de-referencing pointers.

So, I've been doing C++ for like 3 months now, and I wanted to dig deeper into pointers to finally understand them completely.

I'm familiar with what they are, and how they work, I just have this one question:

The last 2 lines, the FStrings, one is de-referencing the pointer. But I don't understand why the 2nd one works and what it's actually doing.

alt text

I really want to get this right. Could anyone please explain it to me?

Thanks!

Product Version: UE 4.21
Tags:
captura.png (16.8 kB)
more ▼

asked Dec 06 '18 at 02:39 AM in C++ Programming

avatar image

Evigmae
1.7k 8 4 8

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

1 answer: sort voted first

Even if you are dereferencing your string is still making a copy in your scope, in the case you have you should have something like FString& StringA if you really want to capture the memory data, but in your case is anyway impossible since the info is transforming the vector to a string, this has to be allocated somewhere, the real example for this should be in two ways

FString* StringA = &SomeRealData; FString& StringA = SomeRealData;

just to anwser your question the last 2 lines are doing exactly the same.

more ▼

answered Dec 06 '18 at 02:55 AM

avatar image

ZkarmaKun
381 9 12 18

avatar image Evigmae Dec 06 '18 at 03:48 AM

I see. It makes sense.

I know pointers are used to point to actual data instead of making copies of it.

But when would you use a Reference& , like, when is it necessary to declare something as a Reference to begin with?

Edit: You would use References as Function Parameters! I knew that, lol.

Thanks!

(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