<filesystem> VS2013 与 VS2012 中的不同行为



在这个测试程序中,我在VS2012 Update 4和VS2013 Update 1之间得到了不同的行为:

#include "stdafx.h"
#include <iostream>
#include <string>
#include <filesystem>
using namespace std;
using namespace std::tr2::sys;
void main()
{
string s("C:\");
for (auto i = directory_iterator(path(s).parent_path()); i != directory_iterator(); ++i) 
cout << (path(s).parent_path()/i->path()).string() << endl;
}

VS2012生产:

C:AUTOEXEC.BAT
...

VS2013生产:

C:C:AUTOEXEC.BAT
...

哪些行为符合C++标准?

编辑

由于filesystem还没有在C++标准中,而只是一个库建议,我重新表述了我的问题:VS2013行为是一个bug吗?

我认为这是VC++2012中的一个错误。以下是C++11/14 STL Features,Fixes,And Breaking Changes In VS 2013的摘录。

<文件系统>'s directory_迭代器返回的路径short(DevDiv#411531)。(请注意,recursive_directory_editor有效正确。)我们将directory_迭代器固定在N1975之后文件系统V2草稿。(文件系统V3在我们的雷达上,但它不会2013年RTM实施)

您可以在此处找到N1975。

相关内容

最新更新