0

私はテンプレートメタプログラミングにかなり慣れていないので、このアプローチで私の思考エラーを見つけることができません:

template <typename T>
    typename T::ReturnType Query(const std::string& Str);

template <>
ResultTypeRowCount Query(const std::string& Str) { return this->queryRowCount(Str); }

ResultTypeRowCount は、ReturnType という名前の public typedef を実装します。

読んでくれてありがとう

4

2 に答える 2

2

そのはず:

template <>
ResultTypeRowCount::ReturnType Query<ResultTypeRowCount>(const std::string& Str) { return this->queryRowCount(Str); }
于 2011-07-27T22:03:17.010 に答える
1

テンプレートの特殊化は、次のパターンに従う必要があります。

template<typename T>
  void foo() {
  }

template<>
  void foo<int>() {
  }
于 2011-07-27T22:03:33.317 に答える