|
Boost : |
From: Nicola Musatti (Nicola.Musatti_at_[hidden])
Date: 2006-12-15 04:28:49
Thorsten Ottosen <thorsten.ottosen <at> dezide.com> writes:
[...]
> What bothers me is the self-explanatory properties are lost; I can't
> figure out what tuple element that means what by just looking at the
> code. Is it
>
> tie(eval,dev1,dev2) = find_root(...)
>
> or
>
> tie(dev1,dev2,eval) = find_root(...)
>
> ?
>
> Instead a struct would be somewhat unambiguous:
>
> template< class Float >
> struct root_result
> {
> Float eval, dev1, dev2;
> };
>
> root_result<float> r = find_root( ... );
One could always do something like
template< class Float >
struct root_result : public tuple<Float &, Float &, Float &>
{
root_result() : tuple<Float &, Float &, Float &>(eval, dev1, dev2) {}
Float eval, dev1, dev2;
};
And get the best of both worlds. I sort of wish the compiler would create it by
magic, though.
Cheers,
Nicola Musatti
Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk