Reputation: 451
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?
Upvotes: 1
Views: 69
Reputation: 26066
Could somebody tell me whether this would be okay?
Yes, it is perfectly fine, no UB.
In general, overloading is not something that triggers UB on its own.
Upvotes: 1