ホーム » VC » VC 7 で error C2664 std::vector

2013年5月
 1234
567891011
12131415161718
19202122232425
262728293031  

カテゴリー

アーカイブ

ブログ統計情報

  • 77,354 アクセス



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) ;

Is this 投稿 useful? Useful Useless 0 of 0 people say this 投稿 is useful.

コメントする

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

%d人のブロガーが「いいね」をつけました。