我正在编写一些利用boost文件系统库的代码。下面是我的代码的摘录:Boost Filesystem编译错误
artist = (this->find_diff(paths_iterator->parent_path(), this->m_input_path) == 1) ? (*(paths_iterator->parent_path().end() - 1)) : (*(paths_iterator->parent_path().end() - 2));
album = (this->find_diff(paths_iterator->parent_path(), this->m_input_path) == 1) ? "" : (*(paths_iterator->parent_path().end() - 1));
类型:
artist and album are of type std::string this->find_diff returns an int this->m_input_path is a std::string paths_iterator is of type std::vector(open bracket)boost::filesystem::path>::iterator
我得到一个编译错误:
error C2039: 'advance' : is not a member of 'boost::filesystem::basic_path<String,Traits>::iterator' d:\development\libraries\boost\boost\iterator\iterator_facade.hpp on line 546
此代码是输出一个批处理脚本程序的一部分使用lame.exe将文件转换为mp3。 这是专为音乐库的格式为:
根/歌手/歌曲
OR
根/艺术家/专辑/歌曲
这个 - > m_input_path是通向根。
我不知道我是否正确地接近问题。如果我是,我该如何解决我所得到的错误?
编辑:
我的代码是现在:
boost::filesystem::path::iterator end_path_itr = paths_iterator->parent_path().end();
if(this->find_diff(paths_iterator->parent_path(), this->m_input_path) == 1) /* For cases where: /root/artist/song */
{
album = "";
end_path_itr--;
artist = *end_path_itr;
}
else /* For cases where: /root/artist/album/song */
{
end_path_itr--;
album = *end_path_itr;
end_path_itr--; <-- Crash Here
artist = *end_path_itr;
}
的错误,我现在得到的是:
Assertion failed: itr.m_pos && "basic_path::iterator decrement pat begin()", file ... boost\filesystem\path.hpp, line 1444
您正在使用哪种版本的boost? – 2009-12-21 03:39:01
Boost 1.41.0 - 15char – 2009-12-21 03:40:25