タイトルが十分に説明的でなかった場合は申し訳ありませんが、これの何が問題なのかわかりません。
template <class S, class P>
P* findPolicy(boost::ptr_vector<P> &policies,S *state)
{
typename boost::ptr_vector<P>::iterator it;
for ( it = policies.begin(); it != policies.end(); ++it)
{
if ( *it->getState() == state)
{
return &(*it);
}
}
}
次のメンバー関数内から上記の関数を呼び出すと、次のようになります。
template <class S> template <class P>
void Policy<S>::updateOptimal(boost::ptr_vector<P> &policies)
{
S *curr_state = state;
boost::ptr_vector<Action> actions = curr_state->getAllActions();
P *best_pol;
boost::ptr_vector<Action>::iterator iter;
for (iter = actions.begin(); iter != actions.end(); ++iter)
{
if (iter->getNextState())
{
S *s = dynamic_cast<S *>(iter->getNextState());
P *temp_pol = var::findPolicy<S,P>(policies,s);
if (temp_pol->getValue() > best_pol->getValue())
{
opt_Action = &(*iter);
}
}
}
}
私はいつも得る:
policy.hpp:237: error: no matching function for call to 'findPolicy(boost::ptr_vector<Greedy<guState>, boost::heap_clone_allocator, std::allocator<void*> >&, State*&)