What you are experiencing is the basic of template introspection and it is called SFINAE.
Simply put: when a template parameter substitution fails, it doesn't throw but simply "move on" and grab the next candidate that doesn't result in a deduction failure. This can be useful to do some compile-time analysis.
Boost's enable_if is base on SFINAE.