Boost logo

Boost :

From: Tobias Schwinger (tschwinger_at_[hidden])
Date: 2005-03-09 09:49:10


Pavel Chikulaev wrote:
> "Tobias Schwinger" <tschwinger_at_[hidden]> wrote in message
> news:d0ka2v$hm4$1_at_sea.gmane.org...
>
>>>Maybe I misundersand something?
>>
>>...the inline part needs special care to work within your expressions
>>(can't use user-defined conversion before type deduction - but you'ld need
>>exactly this to add this feature non-intrusively).
>>This way the initialization part becomes "recycling code".
>
>
> I still can't get you point. Please explain more thoroughly.
>

I needed all these features (which may seem strange to you) to make the
use of my library convenient enough for "real life".
However, these are just examples of functionality that is needed in one
way or the other, sooner or later by one or the other (well - that's the
challenge of generic programming isn't it ?) - look at it as a checklist
to bulletproof your design (I am not trying to put a dozen of feature
requests on your todo-list - it's enough if what I'm talking about is
easily implementable).

You're maybe right that this particular point is beyond the scope of
your proposal. But it depends on how much you want the design to be a
"black box" and on how properly it adresses the problems we are talking
about here [ -> http://tinyurl.com/3wob5 ], I believe.

This said, I try to explain in more detail:

As long as our_vector is a non-template class with always three floats,
for example - there are no problems at all.

In this case we won't need such stuff at all because we'ld have a
constructor with 3 paramters for initialization - this we can use inline
and everything is just fine ;-).

Now let our_vector be a template with parametrized dimensionality.
In this case it's unlikely there is such a constructor.

One way would be an overloaded factory function with different scalar
types (a la "make_pair") with one overload for each possible
dimensionality.
This way has some advantages but isn't truely generic (unless you pull
your genericity to preprocessing time ;-). N-ary element inlines are.

The expression of (vec_inl|1,2,3) gives me an n-ary _expression_object_
which can work directly with lazy operators.
I won't explain how it works, again [ just did this in another post in
this thread http://tinyurl.com/6xhe6 ].

Regards,

Tobias


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