|Re: [eigen] ideas about the corner types|
[ Thread Index |
| More lists.tuxfamily.org/eigen Archives
- To: eigen <eigen@xxxxxxxxxxxxxxxxxxx>
- Subject: Re: [eigen] ideas about the corner types
- From: Gael Guennebaud <gael.guennebaud@xxxxxxxxx>
- Date: Fri, 5 Feb 2010 11:48:33 +0100
- Dkim-signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=domainkey-signature:mime-version:received:in-reply-to:references :date:message-id:subject:from:to:content-type; bh=4DLTmORunT8uXEVzTeYvJId73+lxgi8QgKv6iEqz9Fw=; b=N/cgRHqrkY+oTr+5G67iZNStIMe/+zP2DhsvbigZdPSHBNU8kPIfOr1w+OIo+lneiw NdLD1kMbsm+0j1xPywNp4l8f3X47UUKvIUdQs/gK8X54F21CIvN1ELNkemxicn9tezFf 8KUvD4UJMIBYa8qLbBQywZJla/JfyX/6jLhDk=
- Domainkey-signature: a=rsa-sha1; c=nofws; d=gmail.com; s=gamma; h=mime-version:in-reply-to:references:date:message-id:subject:from:to :content-type; b=GC5ZRIMgpnHQQQCSqFhIBJDbDTNRpdPM/RkmCiQ6IUWd/aBA+rn6PJHPSG1FsTqbo/ 0GgQU3NdoygbAS/AtLrIdsXtkrLCFbNMW2AryM6nychfth14pEqJvjf5twDljLN4LiWb Prn+SfbCQJ6zMyooiiQjoXBF3h9rUM28vIyks=
On Fri, Feb 5, 2010 at 11:43 AM, Thomas Capricelli <orzel@xxxxxxxxxxxxxxx>
Something i dont understand: why do we need to use a trick to make a compile-time parameter to look like a runtime one ?
Why not (as is done in other parts of eigen) do corner<TopLeft>(3,3) and makes this explicit ?
sure, ideally I would prefer your suggestion but c++ is such that the trick has the advantage of not needing the template prefix (in template code):
(The trick could still be used in the eigen2 compatibility stuff to keep the old api)
In data venerdì 05 febbraio 2010 10:45:21, Benoit Jacob ha scritto:
> >> Currently matrix.corner(TopLeft,3,3) takes TopLeft as a runtime
> >> parameter. This is based around the assumption that the compiler
> >> resolves this at compile time. In practice that seems to work although
> >> I only checked GCC. Here's an idea to resolve this at runtime: let
> >> TopLeft be an object of type CornerType<TopLeft_t>, etc... taking a
> >> common template CornerType type allows to write the function only
> >> once, yet have a guarantee that that stuff resolves at compile time.
> > Sounds good, and that does not change the API right ?
> No API change, assuming that nobody was perverse enough to actually
> pass a runtime variable, whose value actually isn't known at compile
> time, as the corner type.