Modern C++ INPUT VALIDATION - Using function in seperate file. Check input within and outside class

preview_player
Показать описание
Support:
- Udemy courses coming soon!

Links:

-C++ Tutorials:
-SFML:
-SFML Sidescroller:
-SFML Open World RPG:
-SFML Simple Games and Apps:
-SFML Games in ONE VIDEO:
-Livestreams:

#gamedeveloper #2dGames #programming
Рекомендации по теме
Комментарии
Автор

I believe you are incorrect in how the cin.ignore method works, according to cplusplus reference: "Extracts characters from the input sequence and discards them, until either n characters have been extracted, or one compares equal to delim."
The newline character can be used as another way to define a limit on what should be ignored.

theyreMineralsMarie
Автор

Super straight forward. Really enjoyed it

FrankStranathan-qjet
Автор

Pretty cool stuff. I am new to templates, so it is nice to see a basic use case for it!

simonchesney
Автор

Hello! Suraj, this has saved my bacon again good sirs! Have another like! and I subbed now :)

UltirianHeavyIndustry
Автор

In the function getInput, shouldn't we be using std::string_view or a const std::string& instead of a const std::string.
Pass by reference is less expensive than pass by value.
Also, isn't the const in const std::string a bit redundant? Since you're passing by value, it doesn't matter if the function argument string can be modified or not, since the original string is unaffected.
I am still learning so excuse me if I'm talking silly.

enochchan
Автор

Do you have recommended book sir to learn this knowledge ?

ResZRyou
Автор

Thank you for your interesting video. What do you think about std::optional from c++17 standart?

Ii_Naomasa_san
Автор

Where is the Another beautifull video, on this beautifull channel, on this beautifull day?

AhmetYusufYatkin
Автор

something to look at also is doing

Some compilers need to set to show characters left in cin.rdbuf() but
the problem with doing this will lose synchronization between printf and cout if working with mixed functions.
Also need to declare start of program or before use of cin or risk reseting rdbuf() losing potential wanted data.
Normally all C++ streams have this set to true. if is true then in_avail() is always 0 but MVS seems to work with it at true also.

thanks for the video

jtaimneas
Автор

yo epic channel, i think you could reach many more ppl with a good thumbnail so work on that

DarxDev