相关疑难解决方法(0)

为什么'unbounded_array'比'vector'更有效?

它在这里

无界数组类似于std :: vector,因为它的大小可以超过任何固定边界.然而,unbounded_array旨在实现最佳性能.因此,unbounded_array不像std :: vector那样对序列进行建模.

这是什么意思?

c++ containers boost

20
推荐指数
2
解决办法
1459
查看次数

分段错误 - 已使用新建和删除.在运行时(无界数组)中创建了大量数组

我正在尝试实现一个无界数组:什么是无界数组?

本页更多细节:http: //www.cs.cmu.edu/~fp/courses/15122-s11/lectures/12-ubarrays.pdf

这是代码:

#include <iostream>
#include <cstdlib>

using namespace std;

class UBArray
{
public:

    int *arr, *arrN, j, *pos; //Initial array is arr. The position of arr is stored in pos. arrN is the new array created when size = limit.
    int size, limit; //size is the current size of the array and limit is the total size available untill a new array is created.

    UBArray()
    {
        size = 0;
        limit = 10;
        arr = new …
Run Code Online (Sandbox Code Playgroud)

c++ arrays segmentation-fault data-structures

0
推荐指数
1
解决办法
193
查看次数