Are you familiar with the concept of SFINAE? Using this concept, you can include or exclude function templates from the candidate set based on any property of the template arguments. As Alex Martelli said, however, you have to cause this happen in the signature, not the body of the method.
This means you need to be able to make compile-time decisions concerning some property of type T, and use the result of that decision to force the template signature to become illegal, which will exclude that template from the compiler's candidate set without raising a compilation error.
Boost has two libraries that can facilitate this: Boost.TypeTraits, which allows you to ask things like "is T an array?" or "is T a pointer?" or "is T a subclass of U?" at compile time. The result of that query can be used by Boost.EnableIf to exclude a function (or not, as desired).
You may be able to achieve what you are after using a combination of those libraries. If you are using a specific compiler, you may also be able to achieve similar results using compiler-specific extensions (if that's okay with you). For example, using MSVC, you might be able to make use of the __if_exists keyword. Depending on how closely your simple example mirrors what you really want to do, one method may be cleaner than the other.