vector - Why does this piece of c++ not find the struct member 'filename'? -
(torrent_info::file_iterator = t.begin_files(); != 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"; }
compiling gives me following error:
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’
afaics i
constant internal_file_entry
struct header code lives here in open source libtorrent project. i'm looking @ c++ first time can't life of me work out why above call i.filename()
fails @ compile time?
i
iterator points @ internal_file_entry
- must dereferenced. access filename
so:
i->filename
this equivalent to:
(*i).filename
Comments
Post a Comment