[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: About %destructor is c++ mode
From: |
Min Wang |
Subject: |
Re: About %destructor is c++ mode |
Date: |
Thu, 18 Aug 2016 23:50:45 -0400 |
HI
@Hans. thanks a lot.
just fyi,
on another thread at:
http://lists.gnu.org/archive/html/bug-bison/2016-08/msg00006.html
it seems I could use std::unique_ptr as the semantic value , but need one
hack
- return *new (yyas_<T> ()) T (t);
+ return *new (yyas_<T> ()) T (std::move((T&)t));
min
On Thu, Aug 18, 2016 at 4:39 PM, Hans Åberg <address@hidden> wrote:
>
> > On 18 Aug 2016, at 21:07, Min Wang <address@hidden> wrote:
>
> > Could you explain more on "reference count” ?
>
> One adds an integer variable for each object, keeping track how many other
> objects referencing it, cf. [1]. Might be used in a runtime environment
> where one cannot risk hitting GC time, but is tricky to implement by hand,
> and one limitation is that circular reference are not removed.
>
> The programming language Swift has that builtin [2-3].
>
> > do you mean std::shared_ptr?
>
> Yes, this class of C++11 and later provides it, so you might try it, cf.
> [4].
>
>
> 1. https://en.wikipedia.org/wiki/Reference_counting
> 2. https://en.wikipedia.org/wiki/Swift_(programming_language)
> 3. https://developer.apple.com/library/ios/documentation/
> Swift/Conceptual/Swift_Programming_Language/AutomaticReferenceCounting.
> html
> 4. https://en.wikipedia.org/wiki/Smart_pointer#shared_ptr_and_weak_ptr
>
>
>
>
--
http://www.comrite.com
- Re: About %destructor is c++ mode, (continued)
- Re: About %destructor is c++ mode, Hans Åberg, 2016/08/18
- Re: About %destructor is c++ mode, Min Wang, 2016/08/18
- Re: About %destructor is c++ mode, Hans Åberg, 2016/08/18
- Re: About %destructor is c++ mode, Min Wang, 2016/08/18
- Re: About %destructor is c++ mode, Hans Åberg, 2016/08/18
- Re: About %destructor is c++ mode, Min Wang, 2016/08/18
- Re: About %destructor is c++ mode, Hans Åberg, 2016/08/18
- Re: About %destructor is c++ mode, Min Wang, 2016/08/18
- Re: About %destructor is c++ mode, Min Wang, 2016/08/18
- Re: About %destructor is c++ mode, Hans Åberg, 2016/08/18
- Re: About %destructor is c++ mode,
Min Wang <=
- Re: About %destructor is c++ mode, Hans Åberg, 2016/08/19
- Re: About %destructor is c++ mode, Min Wang, 2016/08/19
- Re: About %destructor is c++ mode, Hans Åberg, 2016/08/19
- Re: About %destructor is c++ mode, Min Wang, 2016/08/19
- Re: About %destructor is c++ mode, Hans Åberg, 2016/08/19
- Re: About %destructor is c++ mode, Hans Åberg, 2016/08/19
- Re: About %destructor is c++ mode, Min Wang, 2016/08/19
- Re: About %destructor is c++ mode, Hans Åberg, 2016/08/19
- Re: About %destructor is c++ mode, Min Wang, 2016/08/19
- Re: About %destructor is c++ mode, Min Wang, 2016/08/18