jeudi 13 décembre 2018

using class local type definition in constructor declaration

I am trying to use a class local type definition in a constructor declaration. both the classes are templates, here is the code.

template < typename T>
class complexType
{
    public:
    using value_type = T;
    complexType( T t ) {}
};


template <typename containedType >
class container
{
    public:
    container ( containedType::value_type v ) { return; }
    //container ( int v ) { return; }
};

int main(int ac, char **av)
{
    container <complexType<int>> c(100);
    return 0;
}

if i use the second constructor definition which is being passed an int, the code builds fine. i cannot reason why the code won't build.

Aucun commentaire:

Enregistrer un commentaire