We can use std::min in below way:
// 1.
int a = 1, b = 2;
std::min(a, b);
// 2.
std::min({1,2,3,4});
But why can\'t use a std
"The more they overthink the plumbing, the easier it is to stop up the drain." – Commander Montgomery Scott
The purpose of std::min is to return the smaller of its parameters. Simple and succinct. As with your own designs, it is better for a function (or function template) to do one thing well than to do many things poorly. Thus, std::min has no knowledge of containers. It simply knows how to take two things and compare them. Knowledge of containers was instead granted to std::min_element. Between the two templates, most use cases were covered.
One case that was not covered was finding the minimum of more than two elements when those elements were not the elements of a (range within a) container. This case could be handled by daisy-chaining std::min, but it is somewhat awkward to do so. For C++11, it was decided that the benefits of handling more parameters outweighed the cost of complicating the template, as long as the complications were kept to a minimum. Thus a single, simple mechanism for supplying an arbitrary number of arguments was chosen, namely std::initializer_list. There is no need to allow arbitrary containers because std::min_element already covers that situation.