This is the mail archive of the
mailing list for the libstdc++ project.
Re: [Patch] Small refactor on <regex> _State<>
- From: Jonathan Wakely <jwakely at redhat dot com>
- To: Tim Shen <timshen at google dot com>
- Cc: libstdc++ <libstdc++ at gcc dot gnu dot org>, gcc-patches <gcc-patches at gcc dot gnu dot org>
- Date: Wed, 29 Jul 2015 10:15:44 +0100
- Subject: Re: [Patch] Small refactor on <regex> _State<>
- Authentication-results: sourceware.org; auth=none
- References: <CAG4ZjNnYLoCYnjNpkJYHa2Q-ux0KnKmVXBDUOa33xk29MzeTKA at mail dot gmail dot com> <20150725153121 dot GW21787 at redhat dot com> <CAG4ZjNnvm=QAwihOUvMLtOezYprtasaJOY3i-MhJV0Tf4z5mpg at mail dot gmail dot com> <20150728151925 dot GO10878 at redhat dot com> <20150729083214 dot GB13355 at redhat dot com> <CAG4ZjNm0YkxLZjajuV7HaQgEGhapFybEem1wi07UMLy3Xg9+BA at mail dot gmail dot com>
On 29/07/15 01:43 -0700, Tim Shen wrote:
On Wed, Jul 29, 2015 at 1:32 AM, Jonathan Wakely <firstname.lastname@example.org> wrote:
Apologies, you have a user-declared move constructor, so assignment is
already deleted. It wouldn't hurt to make that explicit though:
I'm just bad at memorizing when they are implicitly
declared/defined/deleted and fully unware of the deleted copy
It's better to make it explicit, since I don't want to be clever on
pretending knowing all ctor/assigment rules :)
Yes, I think it's better to make it explicit.
_State& operator=(const _State&) = delete;
So it's just the alignment issue that I'm concerned about now.
Will alignof(std::function<bool(C)>) be all the same across
instantiations, including user-defined C, now and in the future?
All member variables of std::function<> are in the _Function_base base
class, which is not a template, so it has the same size and alignment
for all instantiations.
I created template parameter _Matcher_size (which should be
__matcher_size) because I don't want to make this assumption on
sizeof(). If they (both alignment and size) are expected to be the
same, we can remove that template parameter (and all indentation
Yes, that makes sense. See the code in <ext/aligned_buffer.h> for how
to set the alignment of the buffer appropriately. You can use the size
and alignment of std::function<bool(char)> even though it will
sometimes be a different std::function specialization.