相关疑难解决方法(0)

std :: launder的目的是什么?

P0137引入了函数模板, std::launder并在有关联合,生命周期和指针的部分中对标准进行了许多更改.

这篇论文解决了什么问题?我必须注意哪些语言的变化?我们在做什么launder

c++ memory c++-faq c++17 stdlaunder

223
推荐指数
3
解决办法
2万
查看次数

什么`在类方法实现的主体内使用std :: swap`意味着什么?

在一些c ++实践中,我试图学习并采用复制交换习语,对这个问题进行彻底的解释:复制交换习语.

但我发现了一些我从未见过的代码:using std::swap; // allow ADL在这个例子中

class dumb_array
{
public:
    // ...

    void swap(dumb_array& pOther) // nothrow
    {
        using std::swap; // allow ADL    /* <===== THE LINE I DONT UNDERSTAND */

        swap(mSize, pOther.mSize); // with the internal members swapped,
        swap(mArray, pOther.mArray); // *this and pOther are effectively swapped
    }
};
Run Code Online (Sandbox Code Playgroud)
  1. using std::swap;在函数实现的主体内部意味着什么?
  2. ADL是什么意思?

c++ stl using std argument-dependent-lookup

26
推荐指数
2
解决办法
5310
查看次数

标签 统计

c++ ×2

argument-dependent-lookup ×1

c++-faq ×1

c++17 ×1

memory ×1

std ×1

stdlaunder ×1

stl ×1

using ×1