lundi 30 novembre 2015

Inheriting templated constructor from class template?

What would be the syntax to inherit constructors (some of them are template) from a class template in C++11 ?

template <class T>
struct Base
{
    using type = T;
    explicit constexpr Base(const type& x): value{x} {};
    template <class U> explicit constexpr Base(U&& x): value{std::forward<U>(x)} {};
    type value;
}

struct Derived: Base<bool>
{
    using Base::Base<bool>; // Does not seem to work ?!?
}

Aucun commentaire:

Enregistrer un commentaire