I have some class like:
class A {
A& operator=(const A& a);
A& operator=(const int a);
A& operator=(const std::string a);
};
I made type trait for iterable is_iterable
; How to implement overload for operator=
for iterable types?
My approach:
template<typename TContainer, std::enable_if_t<is_iterable<TContainer>::value>>
A& operator=(const TContainer& val) {
// do stuff
}
but it doesn't work causing no viable overload
error when i try to feed std::list
or std::vector
.
So, how to fix it and is it possible to use that kind of overload?
Aucun commentaire:
Enregistrer un commentaire