小编Jor*_*999的帖子

这是Visual Studio 2013更新4 C++优化器错误还是我的代码错了?

自从我更新为1.58和VS2013以来,我一直在软件中看到崩溃.只有在编译器优化开启时,我们才会看到崩溃.使用boost 1.55,没有崩溃.我设法隔离了我所看到的问题boost::any_range以及我们如何使用它.

请参阅下面的示例代码:

#include <boost/range/any_range.hpp>
#include <boost/range/adaptor/transformed.hpp>
#include <vector>
#include <memory>
#include <cstdio>

class DummyElement
{
public:
    float f_;
};

using ElementRange = boost::any_range < DummyElement*, boost::bidirectional_traversal_tag >;

using DummyElementUPtr = std::unique_ptr < DummyElement > ;

class BoostAnyTest
{
public:
    BoostAnyTest()
    { 
        for (int i = 0; i < 10; ++i)
        {
            auto element = DummyElementUPtr(new DummyElement());
            _tprintf(_T("BoostAnyTest::ctor() 0x%p\n"), element.get());

            c_.emplace_back(std::tuple<Int, DummyElementUPtr>(i, std::move(element)));
        }
    }

public:
    ElementRange GetAll();

private:
    using _ContainerType = std::vector < std::tuple<Int, std::unique_ptr<DummyElement>> > ; …
Run Code Online (Sandbox Code Playgroud)

c++ boost c++11 boost-range

8
推荐指数
1
解决办法
233
查看次数

标签 统计

boost ×1

boost-range ×1

c++ ×1

c++11 ×1