Checking if a username is valid
We can avoid the excessive indentation by returning early.
Instead of checking for validity:
if (username.length() &gt;= MIN_NAME_LENGTH)
{
    ... additional nested checks...
}

we reverse the check and return as soon as possible:
if (username.length &lt; MIN_NAME_LENGTH)
    return false; // done!

So overall we'd get something like:
if (username.length() &lt; MIN_NAME_LENGTH || username.length() &gt; MAX_NAME_LENGTH)
    return false;

if (username.empty() || !std::isalpha(static_cast&lt;unsigned char&gt;(username.front()))) // paranoia: avoid crashing with empty username
    return false;

if (std::find_if(username.begin(), username.end(), isNotValid) != username.end())
    return false;

return true;


Note that isalpha is in the std:: namespace in C++. Technically we should also cast to unsigned char when calling the function. (We could wrap that in a function of our own).