Re: [Patch] Small refactor on _State<>

2015-07-30 Thread Jonathan Wakely
On 29/07/15 21:55 -0700, Tim Shen wrote: - typedef _Matcher _MatcherT; + typedef _Matcher<_Char_type> _MatcherT; + static_assert(sizeof(_MatcherT) == sizeof(_Matcher), + "The aussmption std::function has " + "the same size as std::function is vio

Re: [Patch] Small refactor on _State<>

2015-07-29 Thread Tim Shen
On Wed, Jul 29, 2015 at 9:21 PM, Tim Shen wrote: > On Wed, Jul 29, 2015 at 2:15 AM, Jonathan Wakely wrote: >> Yes, that makes sense. See the code in for how >> to set the alignment of the buffer appropriately. You can use the size >> and alignment of std::function even though it will >> sometime

Re: [Patch] Small refactor on _State<>

2015-07-29 Thread Tim Shen
On Wed, Jul 29, 2015 at 2:15 AM, Jonathan Wakely wrote: > Yes, that makes sense. See the code in for how > to set the alignment of the buffer appropriately. You can use the size > and alignment of std::function even though it will > sometimes be a different std::function specialization. Done. A

Re: [Patch] Small refactor on _State<>

2015-07-29 Thread Jonathan Wakely
On 29/07/15 01:43 -0700, Tim Shen wrote: On Wed, Jul 29, 2015 at 1:32 AM, Jonathan Wakely 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/

Re: [Patch] Small refactor on _State<>

2015-07-29 Thread Tim Shen
On Wed, Jul 29, 2015 at 1:32 AM, Jonathan Wakely 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 d

Re: [Patch] Small refactor on _State<>

2015-07-29 Thread Jonathan Wakely
On 28/07/15 16:19 +0100, Jonathan Wakely wrote: What I'm concerned about is assignment. You haven't defined an assignment operator. If there's an unwanted assignment we could get undefined behaviour. Please delete the assignment operator if it's not needed. Apologies, you have a user-declared m

Re: [Patch] Small refactor on _State<>

2015-07-28 Thread Jonathan Wakely
On 26/07/15 13:38 -0700, Tim Shen wrote: On Sat, Jul 25, 2015 at 8:31 AM, Jonathan Wakely wrote: On 25/07/15 00:11 -0700, Tim Shen wrote: It's not a very necessary refactoring, but simply can't resist. :) I'm not sure of the ::memcpy calls. It looks not very idiomatic, but std::copy on char*

Re: [Patch] Small refactor on _State<>

2015-07-25 Thread Tim Shen
On Sat, Jul 25, 2015 at 12:11 AM, Tim Shen wrote: > It's not a very necessary refactoring, but simply can't resist. :) > > I'm not sure of the ::memcpy calls. It looks not very idiomatic, but > std::copy on char* looks even more weird? :/ > > Bootstrapped and tested. > > Thanks! > > > -- > Regards