Boost logo

Boost :

From: Fernando Cacciola (fernando_cacciola_at_[hidden])
Date: 2002-11-15 18:21:47


----- Original Message -----
From: "Jaakko Jarvi" <jajarvi_at_[hidden]>
To: "Boost mailing list" <boost_at_[hidden]>
Sent: Friday, November 15, 2002 4:50 PM
Subject: Re: [boost] Named Template Parameters implementation

> > OK, I read the docs, followed the example and *tried* to use it in the
> > library.
> > Unfortunately, I received tons of mysterious compiler errors with BCC55;
> > apparently as a result of the usage of template template parameters in
> > ntp::as_named<>.
>
> as_named is needed if you allow an argument slot to accept both
> unnamed and named template parameters.
> You should be able to go around the need for template template
> parameters by 'expanding' as_name by hand:
>
> instead of
>
> typename boost::ntp::as_named<Model, Model_is>::type
>
> write:
>
> typename boost::mpl::if_c<detail::is_named_parameter<Model>::value,
> T, Model_is<T> >::type
>
> Are there other things that cause trouble with your compiler?
>
Yes, unfortunately...

I have expaned is_named all the way as follow:

    typedef boost::ntp::detail::is_named_parameter<Model> Model_IsNamed ;
    typedef boost::ntp::detail::is_named_parameter<Color> Color_IsNamed ;

    typedef Model_is<Model> NamedModel ;
    typedef Color_is<Color> NamedColor ;

    typedef typename boost::mpl::if_<Model_IsNamed,Model, NamedMode>::type
ModelP ;
    typedef typename boost::mpl::if_<Color_IsNamed,Color,NamedColor>::type
ColorP ;

    typedef boost::tuple<ModelP,ColorP,Seats,Transmission> argument_tuple;

But then I get:

typedef typename features::Model Model ;

---> Member is ambiguous: Model_is<limited>::Model and
'default_car_fetures::Model'

If I change

  typedef boost::tuple<ModelP,ColorP,Seats,Transmission> argument_tuple;

to this:

  typedef boost::tuple< Model_is<Model>, Color_is<Color>,Seats,Transmission>
argument_tuple;

So to fix the 'make it Named' part

I get the same error.

Perhaps BCC is getting confused when the tuple elements are *local*
instances of the Named parameters.
Because after all, if I remove the 'Make sure is Named' part and let the
test use only truly named parameters it works.
That is, if the local template parameter Model is already 'Model_is<XX>' it
works.

Any ideas?

BTW: I get the same errors if I skip the depedent-feature part.
That is, if I use this directly:

  typedef boost::ntp::named_parameter_extractor<argument_tuple> features;

(PS: I'm leaving now, so I won't get back to this until Monday...)

> /Jaakko
>

Fernando Cacciola


Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk