std::vector<std::string> v; std::sort(v.begin(), v.end(), [] (const std::string& first, const std::string& second){ return first.size() < second.size(); });