for (torrent_info::file_iterator i = t.begin_files();
i != t.end_files(); ++i, ++index)
{
int first = t.map_file(index, 0, 1).piece;
int last = t.map_file(index, i->size - 1, 1).piece;
std::cout << " " << std::setw(11) << i->size
<< " " << i.filename() << "[ " << first << ", "
<< last << " ]\n";
}
コンパイルすると、次のエラーが発生します。
error: ‘class __gnu_cxx::__normal_iterator<const libtorrent::internal_file_entry*, std::vector<libtorrent::internal_file_entry, std::allocator<libtorrent::internal_file_entry> > >’ has no member named ‘filename’
AFAICSi
は定数internal_file_entry
構造体であり、そのヘッダーコードはオープンソースのlibtorrentプロジェクトにあります。初めてC++を見ているだけですi.filename()
が、コンパイル時に上記の呼び出しが失敗する理由を一生理解できません。