Boost logo

Boost :

Subject: Re: [boost] [Range] Support for array references, svn:executable on headers
From: Jeffrey Lee Hellrung, Jr. (jeffrey.hellrung_at_[hidden])
Date: 2011-05-14 00:06:02


On Fri, May 13, 2011 at 6:14 PM, Bryce Lelbach <blelbach_at_[hidden]> wrote:

> On 2011.05.13_17.55.50, Steven Watanabe wrote:
> > Why do you expect this to work? range_size doesn't support
> > references at all.
> Ah, I didn't realize range_size doesn't support references at all. In that
> case,
> why not add those specializations, as well?
>
> > Why should a reference to an array be special?
>
> Why should an array be special? If the metafunction is defined for a
> particular
> type, and a logical definition exists for the qualified forms of said type,
> then the metafunction should work for the qualified forms, IMHO.
>
> > Doesn't range_size<char const[5]> work?
>
> It works, but char const[5] is not char const (&)[5].
>
> Thanks Steven.
>

I had always understood the Boost.Range metafunctions to operate exclusively
on at-most-const-qualified range types (explicitly: not references). Sounds
like you're looking for a specialization of range_size et al. that looks
like

template< class Range > struct range_size< Range& > : range_size< Range > {
};

I don't know what the downsides of including such specializations are for
all the Boost.Range metafunctions. Can you present a (more) compelling
argument for such specializations other than "because we can"?

- Jeff


Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk