0

As the title says. I don't know what the <> does in the std::less<>

For example, I have seen it in templates like this:

template <typename T, typename C = std::less<>>

and like this as well:

template <typename T, typename C = std::less<T>>

What is the difference?

Sz. David
  • 17
  • 5
  • 2
    It means in the first case the default template argument will be used for `std::less` while in the second case you're explicitly passing `T` as the template argument. – Jason Jun 22 '22 at 06:28
  • When used with `std::set` and `std::map`, `less<>` (aka `less`) enables some extra perks. Look up "transparent comparators". – HolyBlackCat Jun 22 '22 at 06:31

0 Answers0