VC 7 で error C2664 std::vector

VC 6 では通っていたが,VC 7 でエラーとなってそのままだったコード.
std::vector <void*> voidPtrs(1024,NULL) ;


c:\Program Files\Microsoft Visual Studio .NET\Vc7\include\vector(124) : error C2664:
‘std::vector >::_Construct_n’ : 2 番目の引数を ‘int’ から ‘void *const & ‘ に変換できません。
理由: ‘int’ から ‘void *const ‘ へは変換できません。
整数型からポインタ型への変換には reinterpret_cast、C スタイル キャストまたは関数スタイル キャストが必要です。
c:\Program Files\Microsoft Visual Studio .NET\Vc7\include\vector(109) :
コンパイルされたクラスのテンプレートのインスタンス化 ‘void std::vector<_Ty,_Ax>::_Construct(_Iter,int,std::_Int_iterator_tag)’ の参照を確認してください
with
[
_Ty=void *,
_Ax=std::allocator,
_Iter=int
]
c:\~\~.cpp(206) : コンパイルされたクラスのテンプレートのインスタンス化
‘std::vector<_Ty,_Ax>::vector(_Iter,int)’ の参照を確認してください
with
[
_Ty=void *,
_Ax=std::allocator,
_Iter=int
]


(void*) とすることで通るみたい.
std::vector <void*> voidPtrs(1024,(void*)NULL) ;

カテゴリー: VC, メモ パーマリンク

コメントを残す

メールアドレスが公開されることはありません。 が付いている欄は必須項目です