mercredi 24 avril 2019

Enable_if as tempalte parameter

Please tell me why this this answer works.

  1. What happen to the enable_if such we can omit it after that?
  2. Should not that code be something like this:

Edited version:

template <typename Policy,
          typename = typename std::enable_if<std::is_base_of<BasePolicy, Policy>::value>::type >
struct Foo;

template <typename Policy>
struct Foo<Policy> {  // <Policy> added!
    Foo();
};

template <typename Policy>
Foo<Policy>::Foo() {
}

Aucun commentaire:

Enregistrer un commentaire