Boost logo

Ublas :

Subject: Re: [ublas] [feature request] new free functions for matrix/vector sizes
From: Marco Guazzone (marco.guazzone_at_[hidden])
Date: 2009-09-30 04:18:39


On Wed, Sep 30, 2009 at 12:15 AM, Gunter Winkler <guwi17_at_[hidden]> wrote:
> Hello Marco,
>
> I am still reviewing your code. It is very clear and well documented.

Thank you! I'm glad to hear this.

> Below I give some comments - more will follow soon.
>
> Am Sunday 20 September 2009 schrieb Marco Guazzone:
>> On Wed, Sep 16, 2009 at 9:52 AM, Marco Guazzone
>>
>> [new free functions]
>
> in begin.hpp:
>
> Why do you use a static cast
>
> return detail::begin_impl<typename
> ExprT::type_category>::apply(static_cast<ExprT const&>(e));
>
> instead of the operator()?
>
> return detail::begin_impl<typename ExprT::type_category>::apply(e());
>

Your right! The result is essentialy the same even if the use of "e()"
implies an additional indirection, that is:
- my version:
  ExprT::type_category>::apply(static_cast<ExprT const&>(e));

- your version (with e()) -- "expanded" view:
  ExprT::type_category>::apply(*static_cast<ExprT const*>(&e)); //
this is what e() would result

Anyway, I think your version is more elegant.
So I vote for you! :)
I send you changes in the attachment. To apply them:

$ patch -p4 < begin_end-remove_static_cast.patch

Cheers,

-- Marco