Topic: Defect Report: std::array is a sequence that doesn't satisfy


Author: Pete Becker <pete@versatilecoding.com>
Date: Tue, 2 Jan 2007 12:19:21 CST
Raw View
Bo Persson wrote:
> This is based on the current draft, N2134.
>
> The <array> header is given under 23.2 Sequences. Paragraph 23.2.1/3 says
> "Unless otherwise specified, all array operations are as described in 23.1".
>

That's followed by a list of what the operations are, mostly without
explicit descriptions of what those operations do. It's the
specifications of those operations that come from 23.1, just as the
specifications for various operations for other container types come
from 23.1.

> However, array isn't mentioned at all in section 23.1. In particular, Table
> 82 "Sequence requirements" lists several operations (insert, erase, clear)
> that std::array does not have in 23.2.1.
>
> Also, Table 83 "Optional sequence operations" lists several operations that
> std::array does have, but array isn't mentioned.
>

Right: array isn't mentioned in 23.1. Its specification comes from 23.2
and the pieces of 23.1 that are pulled in by reference (such as begin(),
end(), etc.). Similarly, specifications for other container types come
from their specific sections and the pieces of 23.1 that are pulled in
by reference. This gets a bit muddled because 23.1 intermixes advice and
specification. Ignore the advice. What's left is a set of abstract
specifications, used by each of the separate container specifications to
describe some of their details.

--

 -- 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: Pete Becker <pete@versatilecoding.com>
Date: Fri, 5 Jan 2007 10:27:26 CST
Raw View
Bo Persson wrote:
>
> If we go further back to 23.1/1, it says: "Containers are objects that store
> other objects. They control allocation and deallocation of these objects
> through constructors, destructors, insert and erase operations".
>
> It doesn't say here either that a container can choose to not support some
> of the operations.
>

What you have demonstrated is that array does not meet the requirements
for a container. It is what it is, nothing more.

--

 -- 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                      ]