ここで本当に必要なのは、テンプレートを特殊化することです。あなたの例では、次のように記述します。
template<>
class Foo<int, string>
{
string MyMethod(whatever...);
};
enable_if も使用できます。
template<typename A, typename B>
class Foo
{
typename boost::enable_if<
boost::mpl::and_<
boost::mpl::is_same<A, int>,
boost::mpl::is_same<B, string>
>,
string>::type MyMethod(whatever...){}
};
オーバーロードがない場合は、static_assert も使用できます。
template<typename A, typename B>
class Foo
{
string MyMethod(whatever...)
{
static_assert(your condition here, "must validate condition");
// method implementation follows
}
};
これにより、条件が設定されていない状態で MyMethod を呼び出そうとすると、コンパイル エラーが発生します。