Considering
struct Foo
{
Foo(Foo&) {}
};
std::is_copy_constructible<Foo>::value false
Foo has a valid constructor instance: from draft n4659:
15.8.1 Copy/move constructors [class.copy.ctor]
1
A non-template constructor for class X is a copy constructor if its first parameter is of type X& , const X& ,
volatile X& or const volatile X& , and either there are no other parameters or else all other parameters
have default arguments (11.3.6). [Example: X::X(const X&) and X::X(X&,int=1) are copy constructors.
but is_copy_constructiblechecks is_constructible_v<T, const T&>( const ) according to the standard.
Why isn't a class with a non-const copy constructor considered a way to copy?
source
share