mercredi 10 mars 2021

Function with two template overloads

I have a template function:

template <typename T>
inline void myFunction(T variable);

Now I want an overload/specialization for the case T is actually an std vector. So I also have

template <typename T>
inline void myFunction(std::vector<T> variable)

It doens't give me any compile time or runtime warnings or errors but I'm worried that it might give undefined behavior. Could somebody tell me whether this would be okay?

Aucun commentaire:

Enregistrer un commentaire