Re: [RFA 02/22] Use RAII to save and restore scalars

Tom Tromey
2016-10-02T17:11:26Z

>>>>> "Pedro" == Pedro Alves <palves@redhat.com> writes:

>> However, once you need a copy constructor, it doesn't seem possible
>> without a move constructor. The issue is that a copy constructor take a
>> const reference, so you can't modify the fields of the original.

Pedro> You can -- make the fields mutable.

Ok, yeah, I had thought of this, but it seemed pretty ugly to me.

Instead I removed all the 2 argument forms in favor of a second explicit
assignment. This solves the problem as well.

I can go back and do the mutable thing if you really prefer it though.

Pedro> The gist is that I think that the features supported by compilers that
Pedro> people are using in practice to build gdb with is what matters
Pedro> in the end, not really C++03 vs C++11.

The issue I see is that it's just too easy otherwise for C++11isms to
slip in, especially considering that everybody doing development is
likely to be using a compiler with all the C++11 features. Maybe
buildbot can do C++03 builds to check.

Tom