lundi 27 juin 2016

C++: Why "using" does not work in some cases?

This is OK:

template<typename T>
    using MyVector = std::vector<T>;

MyVector<int> xyz;

But not this:

template <typename F>
using MyCalc = float calc1(F f) { return -1.0f * f(3.3f) + 666.0f; }

though

template <typename F>
float calc1(F f) { return -1.0f * f(3.3f) + 666.0f; }

is OK. Is there a way to define an alias for calc1?

Aucun commentaire:

Enregistrer un commentaire