|
Boost : |
Subject: Re: [boost] [non Boost] Template troubles.
From: Robert Jones (robertgbjones_at_[hidden])
Date: 2008-12-10 05:55:53
On Wed, Dec 10, 2008 at 10:20 AM, Neil Groves <neil_at_[hidden]>wrote:
>
> Neither of these are exact matches... is this deliberate? Or did you mean:
>
> template<typename T, std::size_t sz>
> void assign(T (&assignee)[sz][sz], const T(&value)[sz][sz])
> {
> }
>
> I wondered this, because this modification makes it compile on Visual C++
> because it is an exact match.
>
>
Hi Neil
Ultimately the signature you suggest is what I want to call, however I was
hoping to achieve this via recursive instantiation, largely because looping
over one index in the implementation is easily achieved with a for_each
loop and a bind() call, whereas looping over two indices is rather
cumbersome.
In practise there's also some other house keeping, which makes the
recursive instantiation approach quite attractive.
The exact match case you present is spot on, and in fact was my first cut
at this functionality. What I'm unclear on is why the single dimensional
case
is not also an exact match with appropriate inferring of T.
Thanks for your thoughts.
- Rob.
Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk