|
Boost : |
From: Andrea Torsello (torsello_at_[hidden])
Date: 2004-04-15 15:06:12
"Bronek Kozicki" <brok_at_[hidden]> ha scritto nel messaggio
news:3sflue4cj1fw.xzo45r0v4i7n.dlg_at_40tude.net...
> On Thu, 15 Apr 2004 20:34:19 +0200, Andrea Torsello wrote:
> > I tested the code with gcc 3.3.1 and successfully compiled it with
comeau
> > online.
>
> Here you have some results from different compilers.
Great thanks!
> MSVC71
> non-const lvalue copy contructor
> explicit copy constructor
> non-const rvalue move constructor
> non-const rvalue move constructor
> non-const rvalue move constructor
> non-const rvalue move constructor
> non-const lvalue copy contructor
> explicit copy constructor
> non-const rvalue move constructor
> non-const rvalue move constructor
> discriminate: non-const lvalue
> discriminate: const value
> non-const rvalue move constructor
> discriminate: non-const rvalue
> non-const rvalue move constructor
> discriminate: const value
const rvalues get treated like non-const rvalues.
I never noticed it because I never return const temporaries,
but the same happens on gcc 3.3.1.
Does the same happen with mojo? I ask because the const vs temporary
deduction is taken almost verbatim from it
> Comeau in relaxed mode (no -a , no -A options set, backend is MSVC71)
> non-const lvalue copy contructor
> explicit copy constructor
> non-const lvalue copy contructor
> explicit copy constructor
> non-const lvalue copy contructor
> const copy constructor
> const copy constructor
> discriminate: non-const lvalue
> discriminate: const value
> discriminate: non-const lvalue
> discriminate: const value
Comeau cannot discriminate temporaries in relaxed
mode but can in strict mode
> Comeau in strict mode (-A options set)
> non-const lvalue copy contructor
> explicit copy constructor
> non-const rvalue move constructor
> explicit copy constructor
> non-const rvalue move constructor
> explicit copy constructor
Looks like all copy constructor of the form X x2(x1); use the explicit
constructor.
I wonder what happens with the more common X x2=x1;
> non-const rvalue move constructor
> non-const rvalue move constructor
> non-const lvalue copy contructor
> const copy constructor
> non-const rvalue move constructor
> non-const rvalue move constructor
> non-const rvalue move constructor
> const copy constructor
> discriminate: non-const lvalue
> discriminate: const value
> non-const rvalue move constructor
> discriminate: non-const rvalue
> non-const rvalue move constructor
> discriminate: const value
everything else works OK.
I have attached a new version with an easyer output to parse.
It also changes the constructors from the form X x2(x1); to
X x2=x1;
Can you please re-run the tests?
Thank you.
Andrea Torsello
P.S. Here's the output for gcc 3.3.1
The const temporaries are not treated as consts in this case as well.
Constructors
-- Copy non-const lvalue
non-const lvalue copy contructor
-- Copy const lvalue
const copy constructor
-- Copy non-const rvalue
non-const rvalue move constructor
non-const rvalue move constructor
-- Copy const rvalue
non-const rvalue move constructor
const copy constructor
Pass by const ref
-- Pass non-const lvalue
-- Pass const lvalue
-- Pass non-const rvalue
non-const rvalue move constructor
-- Pass const rvalue
non-const rvalue move constructor
Pass by value
-- Pass non-const lvalue
non-const lvalue copy contructor
-- Pass const lvalue
const copy constructor
-- Pass non-const rvalue
non-const rvalue move constructor
non-const rvalue move constructor
-- Pass const rvalue
non-const rvalue move constructor
const copy constructor
Discriminate
-- Pass non-const lvalue
discriminate: non-const lvalue
-- Pass const lvalue
discriminate: const value
-- Pass non-const rvalue
-- Pass const rvalue
non-const rvalue move constructor
discriminate: const value
begin 666 move_test.cc
M(VEN8VQU9&4\:6]S=')E86T^#0H-"@T*=7-I;F<@<W1D.CIC;W5T.PT*=7-I
M;F<@<W1D.CIE;F1L.PT*#0IN86UE<W!A8V4@;6]V90T*>PT*"71E;7!L871E
M(#QC;&%S<R!4/B!S=')U8W0_at_96YA8FQE9 T*"7L-"@D)8VQA<W,@8V]N<W1A
M;G0@+R\@='EP92!S=6=A<B!F;W(@8V]N<W1A;G1S#0H)"7L-"@D)8V]N<W0@
M5"H_at_9&%T85\[#0H)"7!U8FQI8SH-"@D)97AP;&EC:70_at_8V]N<W1A;G0H8V]N
M<W0_at_5"8@;V)J*2 Z(&1A=&%?*"9O8FHI('M]#0H)"6-O;G-T(%0F(&=E="@I
M(&-O;G-T('L@<F5T=7)N("ID871A7SL@?0T*"0E].PT*#0H)"6-L87-S('1E
M;7!O<F%R>2 Z('!R:79A=&4_at_8V]N<W1A;G0@+R\@='EP92!S=6=A<B!F;W(@
M=&5M<&]R87)I97,-"@D)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pi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk