相关疑难解决方法(0)

为什么声明一个只包含C中数组的结构?

我遇到了一些包含以下内容的代码:

struct ABC {
    unsigned long array[MAX];
} abc;
Run Code Online (Sandbox Code Playgroud)

何时使用这样的声明是有意义的?

c arrays struct coding-style

129
推荐指数
5
解决办法
6988
查看次数

如何在复制控制功能中处理C++数组成员?

这是我长期以来一直想知道的事情.请看以下示例:

struct matrix
{
    float data[16];
};
Run Code Online (Sandbox Code Playgroud)

我知道默认构造函数和析构函数在这个特定示例中做了什么(没有),但是复制构造函数和复制赋值运算符呢?

struct matrix
{
    float data[16];

    // automatically generated copy constructor
    matrix(const matrix& that) : // What happens here?
    {
        // (or here?)
    }

    // automatically generated copy assignment operator
    matrix& operator=(const matrix& that)
    {
        // What happens here?

        return *this;
    }
};
Run Code Online (Sandbox Code Playgroud)

它涉及std::copystd::uninitialized_copymemcpymemmove或什么?

c++ arrays copy-constructor assignment-operator

31
推荐指数
1
解决办法
4198
查看次数