Dear Ben, the way you taught about maps was extremely poor… I seriously didn’t understand how it works…
1 Like
DanM
February 8, 2017, 6:42pm
2
Does my explanation here help?
Hi Elijah,
I really struggled with this section but @DanM came along as usual and helped me understand it. I’ll try to break it down for you as best I can.
Above the For Loop we’ve created the definition of bool IsIsogram(), made an if statement that will make sure single-letter entries are returned as Isograms, and set up a Map named “LetterSeen” that will assign boolean values to each character it is given.
Now for the For Loop.
for (auto Letter : Word)
This line is creating a For Loop …
or here
As George said, that’s a parameter. It allows you to pass things into the function. For example
int square(int i)
{
return i*i;
}
int main()
{
int a = square(4); //a == 16
}
4 gets passed into the function, get’s multiplied by itself and the result returned to the caller.
No, this is creating a std::map (through the #define TMap std::map) which is an associative container, it maps unique keys to values and is sorted. So when you declare it using the angle brackets <> you are supplyi…
3 Likes
Bumping this post because this was a very valuable summary by @DanM
going into map blind I had a lot of questions about how the functions were working and it took this as well as reading TMap on unreal to get an understanding of it.
1 Like