I've been investigating the use of some judicious static assertions to improve error messages. Here's an example:
#include <type_traits> template<typename T> struct is_less_than_comparable { template<typename Test> static char test(decltype(*static_cast<Test*>(nullptr) < *static_cast<Test*>(nullptr))); template<typename Test> static int test(...); static const bool value = std::is_same<char, decltype(test<T>(true))>::value; }; template<typename K, typename V> class map { public: static_assert(is_less_than_comparable<K>::value, "Key type must be less-than comparable!"); }; struct x {}; int main() { map<x, int> intmap; } IDEONE will happily reject this code with the nice, clean error message I was hoping to get (once you replace nullptr with 0, anyway). But MSVC will not fire the static assertion and compiles this code just fine- even if I add some member functions and start calling on them.
decltypefor SFINAE. I've given up on attempting to use it at all :-[