[phobos] phobos commit, revision 2181

Andrei Alexandrescu andrei at erdani.com
Thu Nov 18 14:27:41 PST 2010


That should not be accepted, so you made the right call.

Andrei

On 11/18/10 2:23 PM, Shin Fujishiro wrote:
> By the way, is it acceptable to swap structs that have const member(s)?
> std.algorithm.swap() used to allow the following code:
> ----------
> struct S
> {
>      const string name;
> }
> auto a = S("a");
> auto b = S("b");
>
> swap(a, b);
> assert(a.name == "b";
> assert(b.name == "a");
> ----------
>
> This behavior breaks const correctness, whereas it's sometimes useful
> since S doesn't allow built-in assignment.  Should swap() disallow it?
>
>
> Shin
> _______________________________________________
> phobos mailing list
> phobos at puremagic.com
> http://lists.puremagic.com/mailman/listinfo/phobos


More information about the phobos mailing list