template<typename SomeContainer, typename T, size_t n>
SomeContainer ContainerMake(const T(&array)[n])
{
return SomeContainer(array, array + n);
}
const int vals1[] = { 0, 1, 2, 3, 4};
vector<int> vct1 = ContainerMake<vector<int> >(vals1);
template<template<typename U, typename Allocator> class Container, typename T, size_t n>
Container<T, allocator<T> > ContainerMake(const T(&array)[n])
{
return Container<T, allocator<T> >(array, array + n);
}
const int vals1[] = {0, 1, 2, 3, 4};
vector<int> vct1 = ContainerMake<vector>(vals1);
template<typename T, size_t n>
class MakerContainer
{
const T* Array;
public:
MakerContainer(const T* array) : Array(array) {}
template<typename U>
operator U() const
{ return U(Array, Array + n); }
};
template<typename T, size_t n>
MakerContainer<T,n> ContainerMake(const T(&array)[n])
{
return MakerContainer<T,n>(array);
}
const int vals1[] = {0, 1, 2, 3, 4};
vector<int> vct1 = ContainerMake(vals1);