Question: How would you write a template function that takes a variable number of homogeneous non-POD function arguments in C++11?

For example suppose we wanted to write a min function for any type that defines the less than "operator<" as follows:

```
// pseduo-code...

template<class T...>
T min(T x1, T x2, ..., T xn)
{
    T lowest = x1;

    for (T x : {x2,...,xn})
       if (x < lowest)
           lowest = x;

    return lowest;
}

```

The above is illegal C++11, how would you write it legally?

Answer: 
Homogeneous? **Just use `std::initializer_list`**.

```
template <typename T>
T min_impl(std::initializer_list<T> values)
{
    return *std::min_element(values.begin(), values.end());
}

...

return min_impl({8, 5, 4, 1, 6});

```

(As [@Jesse](https://stackoverflow.com/questions/9762531/c11-variadic-homogeneous-non-pod-template-function-arguments/9762849#comment12423060_9762849) noted, this is the equivalent to [std::min](http://en.cppreference.com/w/cpp/algorithm/min) in the standard library.)

If you don't like the extra braces, make a variadic template that forwards to the initializer list implementation: 

```
template <typename... T>
auto min(T&&... args) -> decltype(min_impl({std::forward<T>(args)...}))
{
    return min_impl({std::forward<T>(args)...});
}

...

return min(8, 5, 1, 4, 6);

```
Another possibility:

```
template <typename T, typename... T2>
T min(T x1, T2... rest);

template <typename T>
T min(T x)
{
  return x;
}

template <typename T, typename... T2>
T min(T x1, T2... rest)
{
  return std::min (x1, min (rest...));
}

```

While this doesn't seem to enforce homogenity, calling with e.g. `int` and `long` gives compilation errors. Unfortunately, I'm not that good at standardese to say if it is supposed to be so.