クラスのテンプレート パラメーターの型に基づいて代入演算子を提供するテンプレート整数ラッパー クラスを作成しています。
template<typename IntType>
class secure_int {
public:
// enable only if boost::is_signed<IntType>
secure_int &operator=(intmax_t value) {
// check for truncation during assignment
}
// enable only if boost::is_unsigned<IntType>
secure_int &operator=(uintmax_t value) {
// check for truncation during assignment
}
};
operator= はメンバー テンプレートではないため、boost::enable_if_c を使用した SFINAE は機能しません。そのような機能を提供するための作業オプションは何ですか?