はありません。これは、コードです:C++エラー:「テンプレートパラメータに依存して 『setw』には引数
template <class TYPE, class KTYPE>
void AvlTree<TYPE, KTYPE> :: _print (NODE<TYPE> *root, int level)
{
int i;
if (root)
{
_print (root->right, level + 1);
cout << "bal " << setw(3) << root->bal
<< ": Level " << setw(3) << level;
for (i = 0; i <= level; i++)
cout << "....";
cout << setw(3) << root->data.key;
if (root->bal == LH)
cout << " (LH)\n";
else if (root->bal == RH)
cout << " (RH)\n";
else
cout << " (EH)\n";
_print (root->left, level + 1);
}
}
これは、使用してドライバイムです:
AvlTree<node, int> tree;
if (tree.AVL_Empty())
cout << "tree is empty\n";
node newItem;
newItem.word = "ryan";
newItem.key = 1;
tree.AVL_Insert(newItem);
tree.AVL_Print();
return 0;
を誤りイム取得することです:
error: there are no arguments to 'setw' that depend on a template parameter, so a declaration of 'setw' must be available [-fpermissive]
error: 'setw' was not declared in this scope
私はエラーが消え運と他の同様の質問ごとに「this->」を使用してみましたが、そのreplaています。このエラーが発生しました:
error: 'class AvlTree<node, int>' has no member named 'setw'
あなたには「」が含まれていますか?これは、['std :: setw'](http://en.cppreference.com/w/cpp/io/manip/setw)が定義されているからです。 –
Cornstalks
私の含まれていない:iostream、cstdlibとusing namespace std; – nanjero05