Re: [C++] Initialization lists with array
From: Leor Zolman (leor_at_bdsoft.com)
Date: 03/30/04
- Next message: Christopher Benson-Manica: "Re: [C] whats the difference between "char" and "Char" ?"
- Previous message: lallous: "Re: returning objects"
- In reply to: Chris \( Val \): "Re: [C++] Initialization lists with array"
- Next in thread: Chris \( Val \): "Re: [C++] Initialization lists with array"
- Reply: Chris \( Val \): "Re: [C++] Initialization lists with array"
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
Date: Tue, 30 Mar 2004 15:04:53 GMT
On Tue, 30 Mar 2004 23:43:27 +1000, "Chris \( Val \)"
<chrisval@bigpond.com.au> wrote:
>
>| > std::string S;
>| > std::cout << S; // Ok...
>| >
>| > std::vector<char> V;
>| > std::cout << V; // Not ok...
>|
>| That should not disqualify std::string from being a container. Adding
>| additional behaviour has never before broken an is-a relation. :-)
>
>But this demonstrates that std::string was not part of the STL, and
>that it was built for completely different purposes.
Chris, why do you seem to be so hung up on string's /history/? Yes, before
the STL existed it was not an STL container. When the Standards committee
voted to incorporate STL into the library, some fancy footwork commenced to
unify (as best they were able to), strings and the STL. The result is that
now strings have a dual-personality; they perform both as faux-fundamental
types and as (restricted) STL containers (restricted as in designed to work
with char types, and not having much application outside of that...since
not too many folks would find great benefit from forging char_traits
specializations for non-character types).
>| >
>| > I would really love to here what the others have to say about
>| > this debate, and what their particular stance is. Then maybe
>| > we could add(in agreement), an brief sentence or two to the
>| > FAQs list for future reference ?
At this point, it looks like about the only thing folks here could agree
upon saying is that there's no common agreement on whether strings should
be considered to be STL containers, and even if there were, it wouldn't
have diddly-squat of an effect on how folks write their code.
But at least I think I've put forth a decent argument against making
emphatic statements denying std::string its container-hood, which was how
this whole thing got started in the first place...
-leor
-- Leor Zolman --- BD Software --- www.bdsoft.com On-Site Training in C/C++, Java, Perl and Unix C++ users: Download BD Software's free STL Error Message Decryptor at: www.bdsoft.com/tools/stlfilt.html
- Next message: Christopher Benson-Manica: "Re: [C] whats the difference between "char" and "Char" ?"
- Previous message: lallous: "Re: returning objects"
- In reply to: Chris \( Val \): "Re: [C++] Initialization lists with array"
- Next in thread: Chris \( Val \): "Re: [C++] Initialization lists with array"
- Reply: Chris \( Val \): "Re: [C++] Initialization lists with array"
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
Relevant Pages
|
|