That is a function declaration of type std::set<std::string, cmp>
accepting one std::string
parameter by reference to const. The std::set container is also a type. So your function is of that type. The first parameter in <std::string, cmp>
template determines the type of elements stored in a set which is a std::string
. Set is a sorted container of unique elements. The second parameter in the set template is a key comparison function that determines how the elements are sorted. In your case the custom sorting is provided by your cmp
class which probably overloads the ()
operator and is actually a functor. The return type of the function is:
std::set<std::string, cmp, std::allocator<std::string>>
which is equivalent to:
std::set<std::string, cmp>
If you didn't have the custom comparator cmp
the return type would probably be:
std::set<std::string, std::less<std::string>, std::allocator<std::string>>
which is actually:
std::set<std::string>
for short.