I have the following class :
template <typename T>
class Foo
{
    public:
        Foo() {//...}
        
        template <typename First, typename... Args>
        Foo(First first, Args... args) {//...}
};
Then in my main.cpp
int main(int argc, char *argv[])
{
    Foo<Abc> foo {0, "some", 20, true, "parameter that Abc::Abc() need", {0, 2, 3}};
    return 0;
}
The probleme is that when I compile, I get the following error :
error: no matching function for call to 'Foo<Abc>::Foo(<brace-enclosed initializer list>)'
What is wrong ?
Edit
I add {0, 2, 3} to the parameters.
The probleme come from here. I didn't specify the type of the parameter and that why it was causing probleme.
Aucun commentaire:
Enregistrer un commentaire