How to declare a variadic template function as a friend?

前端 未结 1 645
走了就别回头了
走了就别回头了 2021-01-04 22:18

How to declare a variadic template function as a friend?

For example as follows:

template
class A
{
    friend ??? MakeA ??? ; // What         


        
相关标签:
1条回答
  • 2021-01-04 23:06

    It's quite straightforward. It's simply a template declaration with the added friend specifier:

    template<class T>
    class A
    {
        template<class T1, class... Args>
        friend A<T1> MakeA(Args&&... args);
    
        A(T) { }
    };
    
    0 讨论(0)
提交回复
热议问题