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

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