how to remove maximum number of characters in c++ cin,ignore

C++
std::cin.ignore(std::numeric_limits<std::streamsize>::max(), '\n');
Source

Also in C++: