Boost logo

Boost :

From: Tobias Schwinger (tschwinger_at_[hidden])
Date: 2006-01-19 05:59:10


Andy Little wrote:
> "Tobias Schwinger" wrote
>
>>Dear Boost developers,
>
>
>
> In the my limited experience of using Boost.Typeof as a user, I have found
> that I only needed to register at most a few types (mostly mpl), and was unhappy
> in the situation where the only choice is that all types in every header
> dependency known or unknown got registered.

Good point.

For "expression template libraries" such as Spirit, Bind, Lamda or Phoenix it's
not necessary to register everything. What needs to be registered are only the
templates and types that end up in the expression type:

Say we an expression like

     some_p(param) >> "foo"

'some_p' might be a function template defined like this

     template<typename T>
     typename some_p_result<T>::type some_p(T const & param)
     { [...] }

We should only register the components that may end up in the actual expression:

     sequence< some_parser< maybe_a_user_type >, strlit<char> >

and not bother with the 'some_p_result' metafunction in this example.

For libraries such as MPL and especially Fusion it will be more difficult to
decide what needs to be registered although my guess is that (in the particular
case of MPL) it will be enough to register the sequences and constant wrappers,
because MPL programs are written as types and not as expressions.

Maybe Dan can add some details on the Fusion case.

> I appreciate that in many cases
> the specialisations are relatively simple but if there is a large number of
> specialisations it will eventually have a noticeable effect on compilation
> times. In the case of libraries of components such as mpl therefore, if
> possible I would prefer the 1st option over the 2nd and 3rd and would be happy
> to use the convention of a directory named typeof_support (or just typeof?)

> which user would add to component include path to use versions of the component
> that included typeof registration.

Another good idea!

If changing the include path should work to globally enable Typeof support we'd
need a 'boost' directory under 'typeof' (or 'typeof_support'), though.

>
> Of course the above approach is the most complicated, much more fussy than
> simply registering everything at once, but I would think that needing to
> register only a few components rather than everything that might possibly need
> to be registered in a particular library is the most likely requirement?

Well, it depends on the case. For Spirit I'd usually want Typeof support for all
the components I use, but the case might not be representative.

>
> Thanks anyway for working to sort this out.

Thank you for your reply!

--
Tobias

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