简体   繁体   English

std :: vector展示台无法在std :: vector上正常工作<boost::variant>

[英]std::vector visualizer doesn't work properly on std::vector<boost::variant>

The visual studio std::vector visualizer in the VS2008 autoexp.dat file doesn't seem to work if I have a std::vector<boost::variant<...>> . 如果我有std::vector<boost::variant<...>> ,则VS2008 autoexp.dat文件中的visual studio std :: vector可视化工具似乎不起作用。 It does work on other types of vectors I have tried (eg std::vector<int> , std::vector<boost::shared_ptr<..>> ) 它确实适用于我尝试过的其他类型的向量(例如std::vector<int>std::vector<boost::shared_ptr<..>>

Here is the visualizer code: 这是可视化工具代码:

std::vector<*>{
children
(
    #array
    (
        expr :      ($e._Myfirst)[$i],
        size :      $e._Mylast-$e._Myfirst
    )
)
preview
(
    #(
        "[", $e._Mylast - $e._Myfirst , "](",
        #array
        (
            expr :  ($e._Myfirst)[$i],
            size :  $e._Mylast-$e._Myfirst
        ),
        ")"
    )

)
}

Instead of showing the number of items and the item values, the preview shows 预览不显示项目数量和项目值,而是显示

{_Myfirst= _Mylast= _Myend= }

And the children, which should be the vector items, are the actual vector members. 而应该作为向量项的子代是实际的向量成员。 It's as if the std::vector visualizer didn't exist. 好像std :: vector可视化工具不存在。

I took a screenshot of the watch window. 我拍摄了监视窗口的屏幕截图。 You can see how it displays the std::vector<boost::variant<int, std::string>> wrong, and then displays the next two vectors correctly: Hyperlink to screenshot 您会看到它如何错误地显示std::vector<boost::variant<int, std::string>> ,然后正确显示接下来的两个向量: 超链接至屏幕截图

Does anyone know what is causing this and how to stop it happening? 有谁知道这是什么原因以及如何阻止它发生?

Thanks! 谢谢!

It seems to be a bug related to the size of the name of your type... boost::variant generates types with very long names. 这似乎是与您的类型名称大小有关的错误... boost :: variant生成具有很长名称的类型。

I've made some tests, and it seems that the limit is a struct with name size of 497 characters. 我进行了一些测试,似乎限制是名称大小为497个字符的结构。 The following code reproduces the error... take the last character of the struct name, and it works fine! 以下代码重现该错误...采用结构名称的最后一个字符,它可以正常工作!

struct abcdefghijklmnopqrstuvwxyz012345abcdefghijklmnopqrstuvwxyz012345abcdefghijklmnopqrstuvwxyz012345abcdefghijklmnopqrstuvwxyz012345abcdefghijklmnopqrstuvwxyz012345abcdefghijklmnopqrstuvwxyz012345abcdefghijklmnopqrstuvwxyz012345abcdefghijklmnopqrstuvwxyz012345abcdefghijklmnopqrstuvwxyz012345abcdefghijklmnopqrstuvwxyz012345abcdefghijklmnopqrstuvwxyz012345abcdefghijklmnopqrstuvwxyz012345abcdefghijklmnopqrstuvwxyz012345abcdefghijklmnopqrstuvwxyz012345abcdefghijklmnopqrstuvwxyz012345abcdefghijklmnopq
{
};

int main()
{
    std::vector< abcdefghijklmnopqrstuvwxyz012345abcdefghijklmnopqrstuvwxyz012345abcdefghijklmnopqrstuvwxyz012345abcdefghijklmnopqrstuvwxyz012345abcdefghijklmnopqrstuvwxyz012345abcdefghijklmnopqrstuvwxyz012345abcdefghijklmnopqrstuvwxyz012345abcdefghijklmnopqrstuvwxyz012345abcdefghijklmnopqrstuvwxyz012345abcdefghijklmnopqrstuvwxyz012345abcdefghijklmnopqrstuvwxyz012345abcdefghijklmnopqrstuvwxyz012345abcdefghijklmnopqrstuvwxyz012345abcdefghijklmnopqrstuvwxyz012345abcdefghijklmnopqrstuvwxyz012345abcdefghijklmnopq > test2;

    test2.resize(10);

    return 0;
}

Feel free to report the bug on http://connect.microsoft.com/ 随时在http://connect.microsoft.com/上报告该错误。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM