Boost logo

Boost :

From: Thorsten Ottosen (thorsten.ottosen_at_[hidden])
Date: 2008-02-06 05:47:10

Hi Eric,

My semantic actions might look like

  +(name[push_back(ref(causeNames),as<std::string>(_) )]);

My first question here is whether ref() is really necessary?

In your example from the documentation, I can better understand it:

   [ ref(result)[s1] = as<int>(s2) ];

because you apply the [] operator to the result.

But otherwise, is there any time you not want a reference stored?
In my case above, couldn't the destructor of push_back() take a T&
argumentment and construct a lazy reference from that?

I also have another question: is it really necessary to write the
as<std::string>(_) part of the semantic action?

Can this type not be deduced from the template argument to push_back()?
In my case it would simply be Container::value_type.

If so, we would end up with the really slick looking


best regards


Boost list run by bdawes at, gregod at, cpdaniel at, john at