0

本 C++ Template: The complete Guide で次のステートメントを見つけました。

関数テンプレートのテンプレート テンプレート パラメーターは使用できません。

しかし、彼は次のコードをコンパイルして実行します。

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);
}

これは、新しい C++ 標準が関数のテンプレート テンプレート パラメーターをサポートするということですか? 次の投稿の答えは別のことを言っています: How to get template template argument deduction working with functions?

4

0 に答える 0