Topic: Zero-size tr1::arrays
Author: gennaro_pruota@yahoo.com (Gennaro Prota)
Date: Thu, 21 Dec 2006 15:44:24 GMT Raw View
On Thu, 21 Dec 2006 07:31:44 GMT, Scott Meyers wrote:
>Boost's fixed-size array rejects zero-sized arrays during compilation
Unless they have changed it back lately it should have support for
zero-sized arrays (when BOOST_NO_TEMPLATE_PARTIAL_SPECIALIZATION is
not defined).
--
Gennaro Prota. C++ developer. For hire.
(to mail me, remove any 'u' from the address)
---
[ comp.std.c++ is moderated. To submit articles, try just posting with ]
[ your news-reader. If that fails, use mailto:std-c++@ncar.ucar.edu ]
[ --- Please see the FAQ before posting. --- ]
[ FAQ: http://www.comeaucomputing.com/csc/faq.html ]
Author: pete@versatilecoding.com (Pete Becker)
Date: Thu, 21 Dec 2006 15:46:14 GMT Raw View
Scott Meyers wrote:
> Boost's fixed-size array rejects zero-sized arrays during compilation,
> and the proposal for tr1::array (N1479 -
> http://www.open-std.org/jtc1/sc22/wg21/docs/papers/2003/n1479.html)
> stated that zero-sized arrays were not allowed. TR1 explicitly allows
> zero-sized arrays, however. Can somebody please explain to me why this
> support was added?
>
Unlike ordinary arrays, tr1's arrays with no elements can be used
meaningfully. They have member functions to give you their size, and you
can get iterators to empty ranges. So there's no need for a special case
rule.
--
-- Pete
Roundhouse Consulting, Ltd. (www.versatilecoding.com)
Author of "The Standard C++ Library Extensions: a Tutorial and
Reference." (www.petebecker.com/tr1book)
---
[ comp.std.c++ is moderated. To submit articles, try just posting with ]
[ your news-reader. If that fails, use mailto:std-c++@ncar.ucar.edu ]
[ --- Please see the FAQ before posting. --- ]
[ FAQ: http://www.comeaucomputing.com/csc/faq.html ]
Author: "Chris Jefferson" <4zumanga@gmail.com>
Date: Thu, 21 Dec 2006 14:46:10 CST Raw View
Scott Meyers wrote:
> Boost's fixed-size array rejects zero-sized arrays during compilation,
> and the proposal for tr1::array (N1479 -
> http://www.open-std.org/jtc1/sc22/wg21/docs/papers/2003/n1479.html)
> stated that zero-sized arrays were not allowed. TR1 explicitly allows
> zero-sized arrays, however. Can somebody please explain to me why this
> support was added?
I can't comment on why this support was added, but I can say that I use
it and find it useful, for example I use tr1::arrays to represent lists
of arguments to a function, and having no arguments is a perfectly
valid situation to be in.
Chris
---
[ comp.std.c++ is moderated. To submit articles, try just posting with ]
[ your news-reader. If that fails, use mailto:std-c++@ncar.ucar.edu ]
[ --- Please see the FAQ before posting. --- ]
[ FAQ: http://www.comeaucomputing.com/csc/faq.html ]
Author: usenet@aristeia.com (Scott Meyers)
Date: Thu, 21 Dec 2006 07:31:44 GMT Raw View
Boost's fixed-size array rejects zero-sized arrays during compilation,
and the proposal for tr1::array (N1479 -
http://www.open-std.org/jtc1/sc22/wg21/docs/papers/2003/n1479.html)
stated that zero-sized arrays were not allowed. TR1 explicitly allows
zero-sized arrays, however. Can somebody please explain to me why this
support was added?
Thanks,
Scott
---
[ comp.std.c++ is moderated. To submit articles, try just posting with ]
[ your news-reader. If that fails, use mailto:std-c++@ncar.ucar.edu ]
[ --- Please see the FAQ before posting. --- ]
[ FAQ: http://www.comeaucomputing.com/csc/faq.html ]