J'écris du code qui utilise la bibliothèque du système de fichiers boost. Voici un extrait de mon code:Boost Filesystem Compile Error
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));
Types:
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
je reçois une erreur de compilation:
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
Ce code fait partie d'un programme qui fournit un script batch utilise lame.exe pour convertir les fichiers en mp3. La bibliothèque musicale il est conçu pour a le format:
root/artiste/chanson
OU
root/artiste/album/chanson
this-> m_input_path est le chemin à la racine .
Je ne sais pas si j'aborde correctement le problème. Si je le suis, comment puis-je corriger l'erreur que je reçois?
EDIT:
Mon code est maintenant:
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;
}
L'erreur que je reçois est maintenant:
Assertion failed: itr.m_pos && "basic_path::iterator decrement pat begin()", file ... boost\filesystem\path.hpp, line 1444
Quelle version de boost utilisez-vous? –
Boost 1.41.0 - 15char –