Boost logo

Boost :

From: Peder Holt (peder.holt_at_[hidden])
Date: 2006-03-01 13:21:13

On 2/26/06, Tobias Schwinger <tschwinger_at_[hidden]> wrote:
> Peder Holt wrote:
> > In confix_parser_gen:
> > Adding another level of indirection solves the problem:
> > [...]
> >
> > Now rule_parser_1_1 passes without problems.
> Great!
> > Attached is a patch with this fix.
> >
> I applied the workaround to all functions in the CVS version of confix.hpp.
> Unfortunately the same trick won't help to get rid of the ICE in rule_parser_2_2 when applied to the subscript operator of spirit::parser (would've been too easy)...

I have looked at this, and this is a problem between VC7.1 and the way
the typeof emulation works, as you showed in the simplified test-case.
The problem lies in the use of the operator[] with function pointers.

The only workaround for this problem that I have found, apart from
rewriting the user code, is to separate the sizeof operation and the
(like in the #if ! defined BOOM clause)
Problem is, this has to be done inside a struct, and can not be made
to emulate the BOOST_TYPEOF syntax.
The proposed solution is then to add a new macro called something like:
BOOST_TYPEOF_NESTED_TYPEDEF(name,expr) which looks roughly like this:
struct name {
   //Twophase typeof using expr
   typedef resulting_type_calculated type;

To access the type, you have to do a typedef typename name::type

Introducing this construct has two positive effects:
1. rule_parser_2_2 (and similar tests) pass.
2. In emulation mode, there is no longer any limit to the complexity
of the types passed to BOOST_TYPEOF_NESTED_TYPEDEF.
BOOST_TYPEOF_LIMIT_SIZE is no longer a limiting factor.

The downside is the added complexity of the library. It also doesn't
reflect any proposed C++ features.

Is there any interest in adding this feature to the typeof library?


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