I use #include <type_traits>
I don’t know such work with templates, but I would like to understand Anywhere there is good material on the introduction of such "management" of templates?
I would like to understand how to specialize templates for a pointer to a class, for a pointer to simple types, etc.
In this code, the error is: error C2593: неоднозначный "operator &"
He cannot choose between the operators that he marked ### in the comment.
#include <type_traits> struct A { // для массивов // Для массивов указано правильно или можно сделать лучше? template <typename T, size_t N, size_t M> void operator&(T (& obj)[N][M]){} // ### template <typename T, size_t N> void operator&(T (& obj)[N]){} // для классов template<typename T> typename std::enable_if<!std::is_enum<T>::value,void>::type operator&(T & obj){obj.serialize(*this,0);} // для указателя на класс template<typename T> typename std::enable_if<std::is_class<T>::value,void>::type operator&(T * obj){ if(obj != 0){obj->serialize(*this,0);}} // ### для указателя на простые типы template<typename T> typename std::enable_if<!std::is_class<T>::value && !std::is_array<T>::value && !std::is_enum<T>::value,void>::type operator&(T * obj){ if(obj != 0){}} }; int main() { A a; int * p_int; a& p_int; unsigned long long maps[200000]; a&maps; std::system("pause"); return 0; }