This is the mail archive of the libstdc++@gcc.gnu.org mailing list for the libstdc++ project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: [Patch] Small refactor on <regex> _State<>


On 29/07/15 01:43 -0700, Tim Shen wrote:
On Wed, Jul 29, 2015 at 1:32 AM, Jonathan Wakely <jwakely@redhat.com> 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
assignment :)

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
changes!);

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.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]