ここで何をすべきか本当にわかりません。私が調べたすべての回答には、理解できない構文があります。
エラー:
Error 1 error C2064: term does not evaluate to a function taking 1 arguments
ハッシュ テーブル コンストラクターで関数ポインターを使用しています。とヘッダーを使用して、私が抱えていた問題を解決することが提案されました。エラーは解決しましたが、上記のエラーが発生しました。
私のハッシュテーブル宣言とctorは次のとおりです:
#pragma once
#include "SLList.h"
template<typename Type> class HTable
{
public:
HTable(unsigned int numOfBuckets, std::function<unsigned int(const Type&)> hFunction);
~HTable();
HTable<Type>& operator=(const HTable<Type>& that);
HTable(const HTable<Type>& that);
void insert(const Type& v);
bool findAndRemove(const Type& v);
void clear();
int find(const Type& v) const;
private:
SLList<Type>* ht;
std::function<unsigned int(const Type&)> hFunct;
unsigned int numOfBuck;
};
template<typename Type>
HTable<Type>:: HTable(unsigned int numOfBuckets, std::function<unsigned int(const Type&)> hFunction)
{
ht = new SLList<Type>[numOfBuckets];
this->numOfBuck = numOfBuckets;
this->hFunct = hFunction;
}
Game.h (テーブルを含む):
#pragma once
#include "stdafx.h"
#include "HTable.h"
#include "BST.h"
#include "DTSTimer.h"
using namespace std;
class Game
{
public:
Game(void);
virtual ~Game(void);
void refresh();
void input();
unsigned int xorHash(const string &s);
private:
string userInput;
DTSTimer timer;
BST<string> answers;
HTable<string> dictionary;
};
Game.cpp (xorHash 関数を渡そうとしています)
#include "Game.h"
Game::Game(void) : dictionary(2048, std::bind(&Game::xorHash, this))
{
}
Game::~Game(void)
{
}
void Game::refresh()
{
}
void Game::input()
{
}
unsigned int Game::xorHash(const string &s)
{
return 0;
}
前もって感謝します。