这是我长期以来一直想知道的问题。看下面的例子:
struct matrix
{
float data[16];
};
我知道在这个特定的例子中默认构造函数和析构函数的作用(什么也不做),但是复制构造函数和赋值运算符又是怎样的呢?
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;
}
};
这是否涉及std::copy
或std::uninitialized_copy
或memcpy
或memmove
等内容?