Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR CPP

sort a vector of strings according to their length c++

std::vector<std::string> v;
std::sort(v.begin(), v.end(), []
    (const std::string& first, const std::string& second){
        return first.size() < second.size();
    });
Source by stackoverflow.com #
 
PREVIOUS NEXT
Tagged: #sort #vector #strings #length
ADD COMMENT
Topic
Name
5+5 =