私は、この質問に関するこの完全な説明に従って、copy-swap イディオムを学び、採用しようとしていました: Copy-Swap Idiom .
しかし、見たことのないコードを見つけました: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
}
};
using std::swap;
関数実装の本体内での意味は何ですか?- ADL とはどういう意味ですか?