S
strnbrg
I'd like to write code that fails to compile if a certain
function *does* exist in a 3rd party library. (This is the
opposite of the well-known problem of wanting compilation to fail if
a certain function does *not* exist.)
Say a library class has been designed to prevent use
of the copy constructor,
class C
{
[stuff...]
private:
C( C const & );
};
I then write client code that assumes a C is never constructed from
another C. But, for extra safety, I'd like to put something in my code
that would cause the compiler to reject my code, should that 3rd party
library ever be changed so as to expose and define the C copy
constructor.
Maybe there's some SFINAE (substitution failure is not an error)
template trick for this...? In any case, I haven't been able to put
one together.
Ted Sternberg
Berkeley, CA, USA
function *does* exist in a 3rd party library. (This is the
opposite of the well-known problem of wanting compilation to fail if
a certain function does *not* exist.)
Say a library class has been designed to prevent use
of the copy constructor,
class C
{
[stuff...]
private:
C( C const & );
};
I then write client code that assumes a C is never constructed from
another C. But, for extra safety, I'd like to put something in my code
that would cause the compiler to reject my code, should that 3rd party
library ever be changed so as to expose and define the C copy
constructor.
Maybe there's some SFINAE (substitution failure is not an error)
template trick for this...? In any case, I haven't been able to put
one together.
Ted Sternberg
Berkeley, CA, USA