[ConceptGCC] |
ConceptGCC :Re: question about CopyConstructible |
From: Douglas Gregor (doug.gregor_at_[hidden])
Date: 2007-02-21 01:16:40
On Feb 20, 2007, at 4:53 PM, Martin Sebor wrote:
> I'm playing for the first time with conceptgcc and have
> a question about the CopyConstructible concept that might
> just be a reflection of a misunderstanding on my part. Is
> the concept intended to match the core language notion of
> copy constructibility? I.e., does a type whose copy ctor
> takes its argument by non-const reference satisfy the
> concept?
No, the CopyConstructible concept is based on the CopyConstructible
requirements table in [utility.requirements], which requires that a
CopyConstructible type be constructible from both a const T and a non-
const T.
> I ask because I get an error from the alpha-4
> compiler (see below).
Yes, that's correct behavior for the way the concept is defined.
> I also note that gcc defines the
> concept slightly differently than N2042 (the paper has
> T::T(T) while gcc has T::T(const T&) although swapping
> one for the other didn't make a difference)
These are actually interchangeable. Since there's no reason to ever
make a copy when calling through a concept signature, a type
parameter 'T' turns into 'const T&'.
Cheers,
Doug