IO<T>
テンプレートクラスと別のテンプレートクラスがあるとしましょうMembershipFunction<T>
。私の物にはMembershipFunction<T>*
sのベクトルが必要であり、 fromからまでも必要です。私にとって、このような複雑なコードで物事を思い出すことは不可能です。特にイテレータを使用する場合。だから私はにいくつかのsを追加しようとしました。しかし、コンパイラはネストされたテンプレートを見ることができないようです。エラーは以下のとおりです。IO
std::map
std::string
MembershipFunction<T>*
typedef
IO
克服するにはどうすればよいですか?
#include <vector>
#include <map>
#include <string>
#include <utility>
#include "membership_function.h" // for the love of god!
// MembershipFunction is defined there!
#include "FFIS_global.h"
template <typename T>
class DLL_SHARED_EXPORT IO
{
private:
typedef std::pair<std::string, MembershipFunction<T>* > MapEntry; // (1)
typedef std::map<std::string, MembershipFunction<T>* > Map; // (2)
typedef std::vector<const MembershipFunction<T>* > Vector; // (3)
// And so on...
これらはエラーです:
(1) error: 'MembershipFunction' was not declared in this scope
(1) error: template argument 2 is invalid
(1) error: expected unqualified-id before '>' token
(2 and 3): same errors
編集:
これはのコードですMembershipFunction
template <typename T>
class DLL_SHARED_EXPORT MembershipFunction
{
public:
virtual T value(const T& input) const{return T();}
virtual void setImplicationMethod(const typename MFIS<T>::Implication& method);
};