誰かがこの問題を抱えていましたか?recursive_directory_iteratorでパーティションを検索するときに、最後に到達するとクラッシュします。
これは、ブースト1.39のVisual Studio 2008で取得しますが、自宅でもブースト1.46のMinGWを使用して取得します。私は何か間違ったことをしているとは思わない:
#include "stdafx.h"
#include <iostream>
#include <boost/filesystem.hpp>
using namespace std;
int _tmain(int argc, _TCHAR* argv[])
{
boost::filesystem::path musicPaths("d:\\");
for(boost::filesystem::recursive_directory_iterator it(musicPaths); it != boost::filesystem::recursive_directory_iterator(); ++it)
{
string strToFind = ".mp3";
boost::filesystem::path dummypath = it->path().filename();
string str = dummypath.string();
if(str.find(strToFind) != -1)
{
cout << str << endl;
}
}
return 0;
}
編集:
最後にはクラッシュしませんが、システムボリューム情報に達したときにクラッシュすることがわかります