#ifndef GENERS_ASSIGNIFPOSSIBLE_HH_ #define GENERS_ASSIGNIFPOSSIBLE_HH_ // This header will work only with C++11 #include namespace gs { namespace Private { template< typename A, typename B, bool assignable = std::is_assignable::value > struct AssignmentHelper { inline static bool assign(A&, const B&) {return false;} }; template struct AssignmentHelper { inline static bool assign(A& a, const B& b) {a = b; return true;} }; } template inline bool assignIfPossible(A& a, const B& b) { return Private::AssignmentHelper::assign(a, b); } } #endif // GENERS_ASSIGNIFPOSSIBLE_HH_