[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: Please add support for non-copiable but movable types to C++ parser
From: |
Akim Demaille |
Subject: |
Re: Please add support for non-copiable but movable types to C++ parser |
Date: |
Tue, 3 Mar 2015 16:38:57 +0100 |
> Le 1 mars 2015 à 10:36, Askar Safin <address@hidden> a écrit :
>
> Please, add support for non-copiable, but movable (I mean C++11 moving
> construstors and moving operator=) semantic values to C++ parser (to %define
> api.value.type variant, of course).
>
> For example, it is very useful to have the following semantic type for
> expressions like 2 + 3 - 4:
> class expr
> {
> public:
> enum class kind {num, plus, minus};
> kind k;
> int num;
> std::unique_ptr<expr> a;
> std::unique_ptr<expr> b;
> };
>
> But, unfortunately, unique_ptr member makes this types non-copiable, so
> currently this class cannot be used as semantic value.
> (CC me if you want to answer)
This would be very useful, indeed. Hans Haberg has already
provided hints on how this should be coded. I don't have
enough time right now to do it properly. You might want to
have a look at Hans' work.
http://lists.gnu.org/archive/html/bug-bison/2015-01/msg00066.html