Boost logo

Boost :

From: Michael Fawcett (michael.fawcett_at_[hidden])
Date: 2008-05-02 18:02:59

On Fri, May 2, 2008 at 5:40 PM, Simonson, Lucanus J
<lucanus.j.simonson_at_[hidden]> wrote:
> I suppose it behooves me to apologize as well. I didn't really intend
> to put words in other people's mouths. I was trying to point out a
> contradiction in your shared position.
> When the argument is that I should provide runtime parameters to the
> user, but use compile time parameters internally you are exactly
> advocating code that looks like:
> if(condition)
> point.get<0>() = value;
> else
> point.get<1>() = value;

Why do you think I am advocating that? The user is free to use
whatever his point class provides, be that .x()/.y() members, free
functions, or array-like access.

if (condition)
   point.x() = value;
   point[1] = value; // this point class supports member functions and
array-like access!

float magnitude = sqrt(dot_product(point, point));

The dot_product internals are where the compile-time access takes
place. dot_product would therefore work on arrays, tuples, and fusion
tuples out of the box and any custom type simply needs to add get<>
support (which would hopefully be trivial, perhaps using Fusion).

--Michael Fawcett

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