Is template template parametrs supported for function supported in new C++ standards?

78 views Asked by At

I found the following statement in the book C++ Template: The complete Guide:

Template template parameters for function templates are not allowed.

But he following piece of code compiles and run for me.

template< typename T, template <typename elem,typename = std::allocator<elem> > class Cont>
void disp(const Cont<T>& t)
{
    for(auto it = t.cbegin(); it != t.cend(); ++it)
    {
        cout<<"Value : "<<*it<<endl;
    }
}

int main()
{
    int arr[] = {1,2,3,4,5};
    std::vector<int> vec(arr, (arr+ sizeof(arr)/sizeof(arr[0])));
    disp(vec);
}

Does this mean that the new C++ standard supports template template parameters for function? The answer for the following post says otherwise: How to get template template argument deduction working with functions?

0

There are 0 answers