template <typename Traits, typename = void>

struct CopyUtil

Notes about CopyUtil/MoveUtil.

CopyUtil is a partially specialized trait template which acts as a helper

when we want to test both the copy and the move forms of an operation in

a (mostly) generic test. It defines a single static operation which

returns a const PtrType

&

form of a pointer triggering the copy form of

an operation being tested when the test environment's pointer type

supports copying (eg, T* or RefPtr

<T

>).

When copying is not supported (unique_ptr

<T

>), it will use std::move to

return an rvalue reference to the pointer instead. This is *only* to

keep the compiler happy. In general, tests should exercise themselves

using the MoveUtil helper, then test again using CopyUtil, but only if

CopyUtil::CanCopy is true. Failure to check this before calling the test

again will simply result in the move version of the test being executed

twice (which is in-efficient, but not fatal).

If/when if-constexpr becomes a real thing (C++17 is the hypothetical

target), we can eliminate the need to

use these partial specialization tricks and just rely on the compiler

eliminating the copy form of the test if the constexpr properties of the

pointer type indicate that it does not support copying.