メッセージは「termは2つの引数を取る関数に評価されません」でした
Visual Studioでは、エラーリストにはエラーメッセージの最初の行のみが表示されます。これは、エラーの概要を一目で確認できるようにすることを目的としています。一部のエラーメッセージは、特にテンプレートが関係している場合は非常に長くなります。完全なエラーメッセージは、ビルドの[出力]ウィンドウに表示されます。
テンプレートのインスタンス化中にエラーが発生すると、コンパイラーは、エラーが検出されたときにインスタンス化していたテンプレートのスタックを出力します。たとえば、スニペットをVisual C ++ 2012でコンパイルすると、次のエラーが出力されます(Visual C ++ 2008でも同様のメッセージが出力されますが、標準ライブラリの実装が異なるため、必ず異なります)。
C:\Program Files (x86)\Microsoft Visual Studio 11.0\VC\INCLUDE\xtree(1792) : error C2064: term does not evaluate to a function taking 2 arguments
C:\Program Files (x86)\Microsoft Visual Studio 11.0\VC\INCLUDE\xtree(1153) : see reference to function template instantiation 'std::pair<_Ty1,_Ty2> std::_Tree<_Traits>::_Insert_nohint<std::pair<const _Kty,_Ty>&,std::_Tree_node<_Value_type,_Voidptr>*>(bool,_Valty,_Nodety)' being compiled
with
[
_Ty1=std::_Tree_iterator<std::_Tree_val<std::_Tree_simple_types<std::pair<const std::string,int>>>>,
_Ty2=bool,
_Traits=std::_Tmap_traits<std::string,int,comp<true>,std::allocator<std::pair<const std::string,int>>,false>,
_Kty=std::string,
_Ty=int,
_Value_type=std::pair<const std::string,int>,
_Voidptr=void *,
_Valty=std::pair<const std::string,int> &,
_Nodety=std::_Tree_node<std::pair<const std::string,int>,void *> *
]
C:\Program Files (x86)\Microsoft Visual Studio 11.0\VC\INCLUDE\xtree(1153) : see reference to function template instantiation 'std::pair<_Ty1,_Ty2> std::_Tree<_Traits>::_Insert_nohint<std::pair<const _Kty,_Ty>&,std::_Tree_node<_Value_type,_Voidptr>*>(bool,_Valty,_Nodety)' being compiled
with
[
_Ty1=std::_Tree_iterator<std::_Tree_val<std::_Tree_simple_types<std::pair<const std::string,int>>>>,
_Ty2=bool,
_Traits=std::_Tmap_traits<std::string,int,comp<true>,std::allocator<std::pair<const std::string,int>>,false>,
_Kty=std::string,
_Ty=int,
_Value_type=std::pair<const std::string,int>,
_Voidptr=void *,
_Valty=std::pair<const std::string,int> &,
_Nodety=std::_Tree_node<std::pair<const std::string,int>,void *> *
]
stubby.cpp(12) : see reference to function template instantiation 'std::pair<_Ty1,_Ty2> std::_Tree<_Traits>::insert<std::pair<const char *,int>>(_Valty &&)' being compiled
with
[
_Ty1=std::_Tree_iterator<std::_Tree_val<std::_Tree_simple_types<std::pair<const std::string,int>>>>,
_Ty2=bool,
_Traits=std::_Tmap_traits<std::string,int,comp<true>,std::allocator<std::pair<const std::string,int>>,false>,
_Valty=std::pair<const char *,int>
]
stubby.cpp(12) : see reference to function template instantiation 'std::pair<_Ty1,_Ty2> std::_Tree<_Traits>::insert<std::pair<const char *,int>>(_Valty &&)' being compiled
with
[
_Ty1=std::_Tree_iterator<std::_Tree_val<std::_Tree_simple_types<std::pair<const std::string,int>>>>,
_Ty2=bool,
_Traits=std::_Tmap_traits<std::string,int,comp<true>,std::allocator<std::pair<const std::string,int>>,false>,
_Valty=std::pair<const char *,int>
]
C:\Program Files (x86)\Microsoft Visual Studio 11.0\VC\INCLUDE\xtree(1796) : error C2064: term does not evaluate to a function taking 2 arguments
C:\Program Files (x86)\Microsoft Visual Studio 11.0\VC\INCLUDE\xtree(1817) : error C2064: term does not evaluate to a function taking 2 arguments
さて、これらの用語の定義によって、これはまだ特に読みやすく、ユーザーフレンドリーではありません。ただし、エラーが発生した場所は表示されます。3つのトップレベルエラーは、の1792、1796、および1817行で発生し<xtree>
、これらの行はすべて、比較子を使用して2つの引数を比較しようとします。