variadic constructors

Posted by FredOverflow on Stack Overflow See other posts from Stack Overflow or by FredOverflow
Published on 2010-06-01T21:49:37Z Indexed on 2010/06/01 21:53 UTC
Read the original article Hit count: 170

Are variadic constructors supposed to hide the implicitly generated ones, i.e. the default constructor and the copy constructor?

struct Foo
{
    template<typename... Args> Foo(Args&&... x)
    {
        std::cout << "inside the variadic constructor\n";
    }
};

int main()
{
    Foo a;
    Foo b(a);
}

Somehow I was expecting this to print nothing after reading this answer, but it prints inside the variadic constructor twice on g++ 4.5.0 :( Is this behavior correct?

© Stack Overflow or respective owner

Related posts about c++

Related posts about templates