Boost logo

Glas :

Re: [glas] MTL3 design ? [was MTL project site is up]

From: David Abrahams (dave_at_[hidden])
Date: 2005-02-03 08:54:31


"Patrick Kowalzick" <patrick.kowalzick_at_[hidden]> writes:

> From: "David Abrahams" <dave_at_[hidden]>
>> Guntram Berti <berti_at_[hidden]> writes:
>
> [snip]
>
>>> I think it will not be uncommon to wish to forbid even assignment
>>> between vectors of equal size, for example if one represents
>>> cell-based and the other one vertex-based quantities (speaking
>>> FEM). So one could introduce mechanisms to forbid assigment at
>>> compile time (i.e. making those vectors different types).
>>
>> Or const?
>
> IMO for a "user" there is an easy way needed to create a bunch of vectors
> with different _semantic_ meanings. One example is Guntrams FEM example.
> Another one might be the representations of geometrical entities, e.g the
> semantic difference between points and vectors. This truly depends on the
> mathematical context.
>
> Having different types makes it much easier declaring functions for some
> action. As an example take two vectors[3], where one represents a point and
> the other a line in a 2D homogeneous space. The affine transformations for
> both types must not be equal, so the functions should be overloaded:
> point affine_transformation( const matrix & a, const point & x );
> line affine_transformation( const matrix & a, const line & x );
>
> Both points and lines _are_ vectors, but behave completly different. E.g.
> addition of both is forbidden.

Now you're talking about
http://article.gmane.org/gmane.comp.lib.boost.devel/117232 (click the
message subject to see the whole thread).

-- 
Dave Abrahams
Boost Consulting
www.boost-consulting.com