I have two functions

```
template <class T> void foo(std::vector<T>* p)

```

and

```
template <class T> void foo(std::valarray<T>* p)

```

The code in the function bodies is identical. Is there a clever way of writing the template so I can avoid the duplication? Something like

```
template <class T, class Container> void foo(Container<T>* p)

```

I'm using C++14.

I *only* want to allow `Container` to be either `std::vector` or `std::valarray`.