Plans of updating this in the future?

So C++17 is on the horizon and will add many useful features . A couple that I think would be beneficial to this section are

  • Structured bindings
  • if/switch (init, condition)
  • std::string_view
  • And possibly std::variant | std::optional | std::any

An example of structured bindings and if initialiser.

std::set<char, bool> LetterSeen; // setup our map
for (auto Letter : Word) 	// for all letters of the word
{
	Letter = tolower(Letter); // handle mixed case
	if (const auto [Iter, Inserted] = LetterSeen.insert(Letter); !Inserted)
	{
		return false; // we do NOT have an isogram
	} 	
	return true;
}

So the const auto [Iter, Inserted] = LetterSeen.insert(Letter) would create two variables Iter and Inserted which are the unpacked return value (std::pair<iterator, bool>) of the insert. Then using the bool for the if statement. (Of course you could just do if (!LettersSeen.insert(Letter).second) but this is the first example that came to mind for structured bindings and if(init, condition)). I feel like these two along with constexpr if would probably make their uses in UE4.

And then std::string_view would essentially replace const std::string& as parameter types (which you don’t actually do in this section but still seems worth a mention)

P.S. To anyone who was using the deprecated std::random_shuffle for getting random words from an array, that has now been removed in C++17 and you’ll have to use std::shuffle along with an engine.

1 Like

C++17 is great standard in terms of new features, but as far as UE4 officialy supports C++11, I think that’s what we’re going to focus on.
Nevertheless, I encourage everyone to go and improve one’s knowledge and skills on general C++ as it might be appropriate in the future.

I’m talking about future plans as in months from now considering C++17 isn’t even finalised yet and UE4 support even further. However this is posted in section 2 so no using UE4 at this stage. Keeping courses up to date is what I’m curious on.

1 Like

Privacy & Terms