Topic: Container requirements post conditions and the unordered associated containers.


Author: pete@versatilecoding.com (Pete Becker)
Date: Sat, 28 Jul 2007 14:31:42 GMT
Raw View
On 2007-07-28 00:33:33 -0400, pchapin@sover.net ("Peter C. Chapin") said:

> I'm looking at document N2135 (draft standard). Table 80 in section 23.1
> on container requirements shows the expression X(a) with post-condition
> X(a) == a.
>
> However, section 23.1.3 on the unordered associated containers says that
> the expression a == b need not be valid for those containers. What then
> is the meaning of the post condition in Table 80 for the unordered
> associative containers?
>
> Intuitively it is clear what is intended (well... I think it is clear
> anyway). However, it seems like this could be clarified. Or perhaps it
> is and I'm just missing it?
>

It looks like an oversight in grafting the unordered container
requirements onto the existing container requirements. Doug Gregor is
working on reformulating the container requirements as concepts
(assuming they'll get into the language), and I expect this will be
fixed as part of that effort.

--
  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: David Abrahams <dave@boost-consulting.com>
Date: Wed, 1 Aug 2007 08:48:54 CST
Raw View
on Sat Jul 28 2007, pchapin-AT-sover.net ("Peter C. Chapin") wrote:

> I'm looking at document N2135 (draft standard). Table 80 in section 23.1
> on container requirements shows the expression X(a) with post-condition
> X(a) == a.
>
> However, section 23.1.3 on the unordered associated containers says that
> the expression a == b need not be valid for those containers. What then
> is the meaning of the post condition in Table 80 for the unordered
> associative containers?

Frankly I'm surprised we'd drop the requirement for operator==,
considering that these containers have O(1) lookup.  Equality can
always be tested with O(N) efficiency.  Maybe it's for the maps, where
we might not want to require equality comparability on the values
(only the keys).  But then, we'd have the same exception for the
ordered associatives.  Very confusing...

--
Dave Abrahams
Boost Consulting
http://www.boost-consulting.com

The Astoria Seminar ==> http://www.astoriaseminar.com

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