[Range] Support for array references, svn:executable on headers

Boost.Range does not support array reference types. I'd like to add the specializations/overloads/code to Boost.Range to support array reference types (I have commit rights). Neil, is this alright? Does anyone see any see any problems with such changes? (some) of the places where changes are needed: 2011.05.13_18.45.33< VeXocide> it works perfectly fine with char const [5], but not with char const (&)[5] [snip] 2011.05.13_18.47.12< VeXocide> this probably means it's missing a whole bunch of specializations, because the other functions don't seem to support it either [snip] 2011.05.13_18.57.41< wash> VeXocide: where else do you believe changes would need to be made? 2011.05.13_18.58.43< VeXocide> wash, as far as I can tell (I've only checked a few) all functions at http://www.boost.org/doc/libs/1_46_1/libs/range/doc/html/range/reference/con... and http://www.boost.org/doc/libs/1_46_1/libs/range/doc/html/range/reference/con... need to have the specializations added 2011.05.13_18.59.49< VeXocide> an, range_end supports T (&a)[sz] 2011.05.13_18.59.51< VeXocide> ah * 2011.05.13_19.00.12< VeXocide> hmz 2011.05.13_19.01.42< VeXocide> range_difference doesn't 2011.05.13_19.01.53< wash> *nods* 2011.05.13_19.02.30< VeXocide> range_iterator and range_const_iterator don't either 2011.05.13_19.04.12< VeXocide> hmz One test case demonstrating the problem: #include <boost/range.hpp> #include <iostream> #include <typeinfo> int main(void) { std::cout << typeid(boost::range_size<char const (&)[5]>::type).name() << std::endl; return 0; } P.S. A number of the headers in Boost.Range have the svn:excecutable property. Can I remove this property from said headers? -- Bryce Lelbach aka wash boost-spirit.com px.cct.lsu.edu github.com/lll-project

AMDG On 05/13/2011 05:08 PM, Bryce Lelbach wrote:
Boost.Range does not support array reference types. I'd like to add the specializations/overloads/code to Boost.Range to support array reference types (I have commit rights). Neil, is this alright? Does anyone see any see any problems with such changes?
(some) of the places where changes are needed:
<snip>
One test case demonstrating the problem:
#include <boost/range.hpp>
#include <iostream> #include <typeinfo>
int main(void) { std::cout << typeid(boost::range_size<char const (&)[5]>::type).name() << std::endl; return 0; }
Why do you expect this to work? range_size doesn't support references at all. Why should a reference to an array be special? Doesn't range_size<char const[5]> work?
P.S. A number of the headers in Boost.Range have the svn:excecutable property. Can I remove this property from said headers?
Please do. In Christ, Steven Watanabe

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. -- Bryce Lelbach aka wash boost-spirit.com px.cct.lsu.edu github.com/lll-project

On Fri, May 13, 2011 at 6:14 PM, Bryce Lelbach <blelbach@cct.lsu.edu> 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

On Sat, May 14, 2011 at 1:08 AM, Bryce Lelbach <blelbach@cct.lsu.edu> wrote:
Boost.Range does not support array reference types. I'd like to add the specializations/overloads/code to Boost.Range to support array reference types (I have commit rights). Neil, is this alright? Does anyone see any see any problems with such changes?
I would like to understand the motivation for the additional specializations and overloads. To be honest, at the moment I have not understood why we would want to add a special-case for array reference types. Would you please explain the use case? I very rarely use native arrays in this manner so it is entirely possible that I have not encountered a valid use-case that you are attempting to implement. My concern currently is two fold: 1. I don't understand why we would want to add reference support to Boost.Range meta-functions for arrays 2. If we did want to support reference types for Boost.Range meta-functions, why would they only be supported for arrays?
P.S. A number of the headers in Boost.Range have the svn:excecutable property. Can I remove this property from said headers?
Yes please do.
-- Bryce Lelbach aka wash boost-spirit.com px.cct.lsu.edu github.com/lll-project
Regards, Neil Groves
participants (4)
-
Bryce Lelbach
-
Jeffrey Lee Hellrung, Jr.
-
Neil Groves
-
Steven Watanabe