bug-bison
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: C++11/14


From: Hans Aberg
Subject: Re: C++11/14
Date: Tue, 20 Jan 2015 16:05:44 +0100

> On 20 Jan 2015, at 09:57, Akim Demaille <address@hidden> wrote:
> 
> 
>> Le 19 janv. 2015 à 23:14, Hans Aberg <address@hidden> a écrit :
>> 
>> 
>>> On 19 Jan 2015, at 18:35, Akim Demaille <address@hidden> wrote:
>>> 
>>>> Le 19 janv. 2015 à 14:28, Hans Aberg <address@hidden> a écrit :
>>>> 
>>>> So it may suffice to have move constructors in the class variant.
>>> 
>>> Right.  With #if around them :)
>> 
>> I succeeded in replacing all copying with move operations in the calc++ 
>> example!
> 
> That's good news, thanks for the experimentation!

Some more inputs:

The variants class might work with both r- and l-values by something like
    template <typename T>
    variant (T&& t)
      : yytypeid_ (&typeid (T))
    {
      YYASSERT (sizeof (T) <= S);
      new (yyas_<T> ()) T (std::forward(t));
    }
but it requires a bit work when T becomes a reference type.

And since you already store a type_info pointer, it should be possible to do 
dynamic lookups by adding say a std::unordered_map<> with dynamic_cast pointers.





reply via email to

[Prev in Thread] Current Thread [Next in Thread]