C++Talk.NET Forum Index C++Talk.NET
C++ language newsgroups
 
Archives   FAQFAQ   SearchSearch   MemberlistMemberlist   UsergroupsUsergroups   RegisterRegister 
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 

Zero-size tr1::arrays

 
Post new topic   Reply to topic    C++Talk.NET Forum Index -> C++ language, library and standards
View previous topic :: View next topic  
Author Message
Scott Meyers
Guest





PostPosted: Thu Dec 21, 2006 10:10 am    Post subject: Zero-size tr1::arrays Reply with quote



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 ]
Back to top
Chris Jefferson
Guest





PostPosted: Thu Dec 21, 2006 8:46 pm    Post subject: Re: Zero-size tr1::arrays Reply with quote



Scott Meyers wrote:
Quote:
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 ]
Back to top
Gennaro Prota
Guest





PostPosted: Thu Dec 21, 2006 9:44 pm    Post subject: Re: Zero-size tr1::arrays Reply with quote



On Thu, 21 Dec 2006 07:31:44 GMT, Scott Meyers wrote:

Quote:
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 ]
Back to top
Pete Becker
Guest





PostPosted: Thu Dec 21, 2006 9:46 pm    Post subject: Re: Zero-size tr1::arrays Reply with quote

Scott Meyers wrote:
Quote:
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 ]
Back to top
Display posts from previous:   
Post new topic   Reply to topic    C++Talk.NET Forum Index -> C++ language, library and standards All times are GMT
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum


Powered by phpBB © 2001, 2006 phpBB Group
SEO toolkit © 2004-2006 webmedic.