Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > comp.lang.c++ > #6317

Re: STL list or map?

From Ian Collins <ian-news@hotmail.com>
Newsgroups comp.lang.c++
Subject Re: STL list or map?
Date 2011-06-07 09:53 +1200
Message-ID <9550itFbncU2@mid.individual.net> (permalink)
References <MPG.284c454a9632e28b9896b3@news.eternal-september.org> <iru79a$8d2$1@hoshi.visyn.net> <isi4sj$tno$1@dont-email.me> <953jn6Fbn8U1@mid.individual.net> <isib1r$vgo$1@dont-email.me>

Show all headers | View raw


On 06/ 6/11 10:36 PM, MikeP wrote:
> Ian Collins wrote:
>> On 06/ 6/11 08:52 PM, MikeP wrote:
>>> Kai-Uwe Bux wrote:
>>>
>>>> Elsethread, the suggestion was made to hide this decision as an
>>>> implementation detail of some class. That is a good idea.
>>>
>>> I don't think that it is. This is the perfect opportunity for the OP
>>> to learn about applying the correct container/algo by taking the
>>> required amount of time to do so. Unnecessary abstraction just
>>> delays the decision and gives the application unnatural semantics
>>> and stifles the programmer's level of capability. Use the right tool
>>> for the job.
>>
>> Requirements aren't always invariant.  If we lived in a perfect world,
>> your observations would be correct.  But we don't!
>
> You seem to be trying to make the exception the rule.

No I'm not I'm simply agreeing with the suggestion to hide this decision 
as an implementation detail of some class.  The standard doesn't define 
how standard containers are implemented, it defines how they behave.

> The rule is to only
> code the exceptional case only in the exceptional case and not aberrate
> the common case with the exceptional. If you extrapolate further from
> your suggestion, you will see it is not practical nor is it good
> engineering.

Do what?

> In the OP's case shown above, doing the abstraction of the container/algo
> could be R&D but the final product should be devoid of test harnesses.

Eh?  You completely snipped the OP.

>>>> As the influencing factors are hard to predict, you should write
>>>> your program so that it will be easy to change the data structure.
>>>> Then, implement one that you can easily prove correct. Create unit
>>>> tests. When you change the data structure, those tests will catch
>>>> bugs. Once the other data structure is up and running, you can
>>>> compare performance.
>>>
>>> Again, I disagree (see above).
>>
>> Again, we don't all live in a world of unchanging requirements.
>
> Non-sequitor at best, strawman at worst. Your "case" is moot. (You are
> welcome to try again though but I am not into have overly-general or
> philosophical discussion about it, for it is a well-defined area, at
> least to me it is).

Well good for you.  Yesterday I had to change an object cache from a set 
to a map to facilitate exporting the data to a new external application. 
  Because the choice of container was "an implementation detail of some 
class" only that class had to be modified.

-- 
Ian Collins

Back to comp.lang.c++ | Previous | Next — Previous in thread | Next in thread | Find similar | Unroll thread


Thread

STL list or map? mrc2323@cox.net (Mike Copeland) - 2011-05-29 11:58 -0700
  Re: STL list or map? Kai-Uwe Bux <jkherciueh@gmx.net> - 2011-05-29 21:37 +0200
    Re: STL list or map? "MikeP" <mp011011@some.org> - 2011-06-06 03:52 -0500
      Re: STL list or map? Ian Collins <ian-news@hotmail.com> - 2011-06-06 21:07 +1200
        Re: STL list or map? "MikeP" <mp011011@some.org> - 2011-06-06 05:36 -0500
          Re: STL list or map? Ian Collins <ian-news@hotmail.com> - 2011-06-07 09:53 +1200
            Re: STL list or map? "MikeP" <mp011011@some.org> - 2011-06-06 17:38 -0500
  Re: STL list or map? Rune Allnor <allnor@tele.ntnu.no> - 2011-05-29 23:32 -0700
    Re: STL list or map? "MikeP" <mp011011@some.org> - 2011-06-06 03:55 -0500
      Re: STL list or map? Rune Allnor <allnor@tele.ntnu.no> - 2011-06-06 02:08 -0700
        Re: STL list or map? Alain Ketterlin <alain@dpt-info.u-strasbg.fr> - 2011-06-06 12:23 +0200
          Re: STL list or map? "MikeP" <mp011011@some.org> - 2011-06-06 05:44 -0500
            Re: STL list or map? Rune Allnor <allnor@tele.ntnu.no> - 2011-06-06 04:23 -0700
              Re: STL list or map? "MikeP" <mp011011@some.org> - 2011-06-06 09:06 -0500
                Re: STL list or map? Michael Doubez <michael.doubez@free.fr> - 2011-06-06 08:29 -0700
                Re: STL list or map? "MikeP" <mp011011@some.org> - 2011-06-06 11:10 -0500
                Re: STL list or map? Michael Doubez <michael.doubez@free.fr> - 2011-06-06 14:37 -0700
                Re: STL list or map? "MikeP" <mp011011@some.org> - 2011-06-06 17:22 -0500
                Re: STL list or map? Joshua Maurice <joshuamaurice@gmail.com> - 2011-06-06 15:33 -0700
                Re: STL list or map? Michael Doubez <michael.doubez@free.fr> - 2011-06-07 01:28 -0700
                Re: STL list or map? "MikeP" <mp011011@some.org> - 2011-06-07 07:00 -0500
                Re: STL list or map? Joshua Maurice <joshuamaurice@gmail.com> - 2011-06-07 14:50 -0700
                Re: STL list or map? "MikeP" <mp011011@some.org> - 2011-06-07 06:56 -0500
                Re: STL list or map? Michael Doubez <michael.doubez@free.fr> - 2011-06-07 00:58 -0700
                Re: STL list or map? "MikeP" <mp011011@some.org> - 2011-06-07 06:52 -0500
                Re: STL list or map? "io_x" <a@b.c.invalid> - 2011-06-06 18:20 +0200
                Re: STL list or map? "io_x" <a@b.c.invalid> - 2011-06-07 18:10 +0200
                Re: STL list or map? Keith H Duggar <duggar@alum.mit.edu> - 2011-06-06 09:29 -0700
                Re: STL list or map? "MikeP" <mp011011@some.org> - 2011-06-06 12:42 -0500
  Re: STL list or map? Joshua Maurice <joshuamaurice@gmail.com> - 2011-05-30 00:19 -0700
  Re: STL list or map? Michael Doubez <michael.doubez@free.fr> - 2011-05-30 01:02 -0700
  Re: STL list or map? Juha Nieminen <nospam@thanks.invalid> - 2011-05-30 11:43 +0000
    Re: STL list or map? mrc2323@cox.net (Mike Copeland) - 2011-05-30 14:07 -0700
      Re: STL list or map? Jeff Flinn <TriumphSprint2000@hotmail.com> - 2011-05-31 08:37 -0400
  Re: STL list or map? "K. Frank" <kfrank29.c@gmail.com> - 2011-06-06 17:58 -0700

csiph-web