Standard C++ Library

Discussion in 'C++' started by June Lee, Apr 2, 2008.

  1. June Lee

    June Lee Guest

    is it true that Standard C++ Library is pretty much include functions
    similar to the following java packages???

    java.io
    java.lang
    java.util

    http://www.cplusplus.com/reference/

    It seem to me the Standard C++ Library have headers to mainipulate
    string / characters, doing I/O, and data structure like Stack, Queue,
    HashMap, Vector, time, bitwise operation, exception, iterator on a
    collection ... etc

    which pretty similar to above "very core" java package
    June Lee, Apr 2, 2008
    #1
    1. Advertising

  2. June Lee

    Guest

    On Apr 1, 7:49 pm, June Lee <> wrote:
    > is it true that Standard C++ Library is pretty much include functions
    > similar to the following java packages???
    >
    > java.io
    > java.lang
    > java.util
    >
    > http://www.cplusplus.com/reference/
    >
    > It seem to me the Standard C++ Library have headers to mainipulate
    > string / characters, doing I/O, and data structure like Stack, Queue,
    > HashMap, Vector, time, bitwise operation, exception, iterator on a
    > collection ... etc
    >
    > which pretty similar to above "very core" java package


    Yes, C++ is a very portable general purpose language that runs on
    platforms ranging from super computers to embedded devices. Many of
    these platforms and applications which run on them do not require
    everything all the time, so it doesn't make sense to stuff GUI,
    networking, threading, etc. all into the standard library.
    , Apr 2, 2008
    #2
    1. Advertising

  3. June Lee

    June Lee Guest

    So there are 3 types of library / header in C++?

    CRT (C runtime library)
    Standard C++ Library
    Platform SDK for Visual C++

    where CRT is low level code like doing all the bit and bytes
    where Platform SDK is high level code doing all those Web Service,
    Security, Message Queue, UI / GUI, COM, HTTP / networking stuff?

    any other must have / used alot kind of library for C++ that
    programmer use alot besides the above 3 library?

    >Yes, C++ is a very portable general purpose language that runs on
    >platforms ranging from super computers to embedded devices. Many of
    >these platforms and applications which run on them do not require
    >everything all the time, so it doesn't make sense to stuff GUI,
    >networking, threading, etc. all into the standard library.
    June Lee, Apr 2, 2008
    #3
  4. June Lee

    Ian Collins Guest

    June Lee wrote:

    [Please don't top-post]

    >
    > where CRT is low level code like doing all the bit and bytes
    > where Platform SDK is high level code doing all those Web Service,
    > Security, Message Queue, UI / GUI, COM, HTTP / networking stuff?
    >
    > any other must have / used alot kind of library for C++ that
    > programmer use alot besides the above 3 library?
    >
    >> Yes, C++ is a very portable general purpose language that runs on
    >> platforms ranging from super computers to embedded devices. Many of
    >> these platforms and applications which run on them do not require
    >> everything all the time, so it doesn't make sense to stuff GUI,
    >> networking, threading, etc. all into the standard library.


    > So there are 3 types of library / header in C++?
    >
    > CRT (C runtime library)
    > Standard C++ Library
    > Platform SDK for Visual C++


    No, there's the C++ standard library, which includes the C standard library.

    Anything else is platform specific.

    There are several cross-platform libraries that are in widespread use,
    boot being one.

    --
    Ian Collins.
    Ian Collins, Apr 2, 2008
    #4
  5. June Lee

    Razii Guest

    On Tue, 01 Apr 2008 17:49:24 -0700, June Lee <> wrote:

    >It seem to me the Standard C++ Library have headers to mainipulate
    >string / characters, doing I/O, and data structure like Stack, Queue,
    >HashMap, Vector, time, bitwise operation, exception, iterator on a
    >collection ... etc


    Where is this HashMap container in the Standard C++ Library? Poor "Bo
    Persson" can't find it. Something he needs to speed up the word
    counting benchmark, which for now is more than 2 times slower.
    Razii, Apr 2, 2008
    #5
  6. On Wed, 02 Apr 2008 14:20:00 +1300, Ian Collins wrote:

    > June Lee wrote:
    >
    > [Please don't top-post]
    >

    (...)
    >> So there are 3 types of library / header in C++?
    >>
    >> CRT (C runtime library)
    >> Standard C++ Library
    >> Platform SDK for Visual C++

    >
    > No, there's the C++ standard library, which includes the C standard library.
    >
    > Anything else is platform specific.
    >
    > There are several cross-platform libraries that are in widespread use,
    > boot being one.
    >


    To the OP -

    Ian meant "... widespread use, /boost/ being one." (cf. www.boost.org)

    - Anand


    --
    ROT-13 email address to reply
    Anand Hariharan, Apr 2, 2008
    #6
  7. June Lee

    Guest

    On Apr 1, 10:25 pm, Razii <> wrote:
    > On Tue, 01 Apr 2008 17:49:24 -0700, June Lee <> wrote:
    > >It seem to me the Standard C++ Library have headers to mainipulate
    > >string / characters, doing I/O, and data structure like Stack, Queue,
    > >HashMap, Vector, time, bitwise operation, exception, iterator on a
    > >collection ... etc

    >
    > Where is this HashMap container in the Standard C++ Library? Poor "Bo
    > Persson" can't find it. Something he needs to speed up the word
    > counting benchmark, which for now is more than 2 times slower.


    What are you babbling about?
    , Apr 2, 2008
    #7
  8. June Lee

    Ian Collins Guest

    Anand Hariharan wrote:
    > On Wed, 02 Apr 2008 14:20:00 +1300, Ian Collins wrote:
    >
    >> June Lee wrote:
    >>
    >> [Please don't top-post]
    >>

    > (...)
    >>> So there are 3 types of library / header in C++?
    >>>
    >>> CRT (C runtime library)
    >>> Standard C++ Library
    >>> Platform SDK for Visual C++

    >> No, there's the C++ standard library, which includes the C standard library.
    >>
    >> Anything else is platform specific.
    >>
    >> There are several cross-platform libraries that are in widespread use,
    >> boot being one.
    >>

    >
    > To the OP -
    >
    > Ian meant "... widespread use, /boost/ being one." (cf. www.boost.org)
    >

    :)

    --
    Ian Collins.
    Ian Collins, Apr 2, 2008
    #8
  9. June Lee

    Razii Guest

    On Tue, 1 Apr 2008 20:53:36 -0700 (PDT), wrote:


    >What are you babbling about?


    :)

    Where is the HashMap container in c++ standard library?

    Got it this time?

    It makes a big difference in speed if you use std::map vs HashMap in
    some situations. So where is the HashMap?
    Razii, Apr 2, 2008
    #9
  10. In article <>,
    Razii <> wrote:
    >On Tue, 1 Apr 2008 20:53:36 -0700 (PDT), wrote:
    >
    >
    >>What are you babbling about?

    >
    >:)


    Not sure why I am responding to what is mostly trolling but I'll take
    your smiley and respond to face value.

    >Where is the HashMap container in c++ standard library?


    std::tr1::unordered_map

    >It makes a big difference in speed if you use std::map vs HashMap in
    >some situations. So where is the HashMap?


    There's a key in the above sentence: "in some situation"

    In many situation, both would do the job fine.
    In some situation, a hash map is better.
    In some situation, a balanced tree map is better
    In some situation, a hash map is totally unacceptable.
    In some situation, a balanced tree map is totally unacceptable.

    Learning to figure out in which of the above situation you are is a
    very important part of programming.

    What are your requirements?
    What are the typical performance requirements?
    What are the worst case scenario requirements?

    There are fairly fundamental performance differences between balanced
    tree algorithm and hash algorith, one of the potentially important one
    is worst case scenario search complexity. If like the
    pseudo-benchmarks you write, you are only concerned about best
    performance in one particular situation, the best solution might be
    different than if you must make sure that your application performs
    well in most cases and never ever perform worse than a set target.

    If you are interested to learn, have a look at:
    http://en.wikipedia.org/wiki/Hash_table
    http://en.wikipedia.org/wiki/Red_black_tree

    Note that the C++ standard doesn't requires that std::map be
    implemented as a red-black tree. It only states complexity
    requirements. Library implementors are free to choose whatever
    algorithm they wish as long as it meets the requirements.

    Yan
    Yannick Tremblay, Apr 2, 2008
    #10
  11. June Lee

    Guest

    On Apr 2, 12:16 am, Razii <> wrote:
    > On Tue, 1 Apr 2008 20:53:36 -0700 (PDT), wrote:
    > >What are you babbling about?

    >
    > :)
    >
    > Where is the HashMap container in c++ standard library?
    >
    > Got it this time?
    >
    > It makes a big difference in speed if you use std::map vs HashMap in
    > some situations. So where is the HashMap?


    Two questions: Why did you troll this thread? Have you ever written
    a piece of production software in your life?
    , Apr 2, 2008
    #11
  12. June Lee

    Razii Guest

    On 02 Apr 2008 11:11:51 GMT, (Yannick Tremblay)
    wrote:

    >>Where is the HashMap container in c++ standard library?

    >
    >std::tr1::unordered_map


    WC2.cpp(12) : fatal error C1083: Cannot open include file:
    'tr1/unordered_map': No such file or directory

    >>It makes a big difference in speed if you use std::map vs HashMap in
    >>some situations. So where is the HashMap?

    >
    >There's a key in the above sentence: "in some situation"
    >
    >In many situation, both would do the job fine.


    In this case, word counting app, the speed will improve greatly by
    using hashmap (that's my guess). The hashmap can be converted back to
    ordered at the end by transferring it into ordered map.

    >If like the pseudo-benchmarks you write..


    It was not my 'benchmarks'. Someone, here on this newsgroup, gave me
    this page:

    http://www.digitalmars.com/d/2.0/cppstrings.html

    and asked me to write Java version. I have no Java (or any
    programming) experience but still, without any problem, wrote a
    version that is 2.3 times faster than the C++ version cited on the
    above page (for 40 MB text files)

    http://pastebin.com/f529d07e5

    How do you explain that?
    Razii, Apr 2, 2008
    #12
  13. June Lee

    Razii Guest

    On Wed, 2 Apr 2008 04:47:50 -0700 (PDT), wrote:

    >Have you ever written
    >a piece of production software in your life?


    Nor did I ever claim that's what I do for living :)
    Razii, Apr 2, 2008
    #13
  14. June Lee

    Guest

    On Apr 2, 7:05 am, Razii <> wrote:
    > On Wed, 2 Apr 2008 04:47:50 -0700 (PDT), wrote:
    > >Have you ever written
    > >a piece of production software in your life?

    >
    > Nor did I ever claim that's what I do for living :)


    That's obvious, as you seem to be capable of toy programs only and
    don't seem to understand the complexities of developing robust
    software that performs well.

    Why don't you include Python in your benchmarks? I'm sure Java and C+
    + would beat the fool out of it, and yet it is used by Google,
    YouTube, NASA, Industrial Light and Magic, and many other large
    organizations to real production work. Just the same, you could burst
    in their front doors waving your arms like a maniac telling them that
    it is too slow. Maybe they'd listen to you. Maybe they'd call
    security. I think it's worth a shot.
    , Apr 2, 2008
    #14
  15. June Lee

    Razii Guest

    On Wed, 2 Apr 2008 05:22:22 -0700 (PDT), wrote:

    >Why don't you include Python in your benchmarks?


    Why don't you? Let me see a Python and Perl version.

    >I'm sure Java and C+
    >+ would beat the fool out of it, and yet it is used by Google,
    >YouTube, NASA, Industrial Light and Magic, and many other large
    >organizations to real production work.


    I never claimed speed is everything, but that's the topic we have been
    discussing, for fun obviously.

    >Just the same, you could burst
    >in their front doors waving your arms like a maniac telling them that
    >it is too slow. Maybe they'd listen to you. Maybe they'd call
    >security. I think it's worth a shot.


    now that's funny :)

    How come you have FIDE in your email?
    Razii, Apr 2, 2008
    #15
  16. June Lee

    James Kanze Guest

    On Apr 2, 3:20 am, Ian Collins <> wrote:
    > June Lee wrote:
    > > where CRT is low level code like doing all the bit and bytes
    > > where Platform SDK is high level code doing all those Web Service,
    > > Security, Message Queue, UI / GUI, COM, HTTP / networking stuff?


    > > any other must have / used alot kind of library for C++ that
    > > programmer use alot besides the above 3 library?


    > >> Yes, C++ is a very portable general purpose language that runs on
    > >> platforms ranging from super computers to embedded devices. Many of
    > >> these platforms and applications which run on them do not require
    > >> everything all the time, so it doesn't make sense to stuff GUI,
    > >> networking, threading, etc. all into the standard library.


    > > So there are 3 types of library / header in C++?


    > > CRT (C runtime library)
    > > Standard C++ Library
    > > Platform SDK for Visual C++


    > No, there's the C++ standard library, which includes the C
    > standard library.


    > Anything else is platform specific.


    > There are several cross-platform libraries that are in
    > widespread use, boot being one.


    So which is it: anything else is platform specific, or there are
    several cross-platform libraries? And I'm pretty sure you mean
    Boost, not boot. (Not that that's the only cross-platform
    library around.)

    --
    James Kanze (GABI Software) email:
    Conseils en informatique orientée objet/
    Beratung in objektorientierter Datenverarbeitung
    9 place Sémard, 78210 St.-Cyr-l'École, France, +33 (0)1 30 23 00 34
    James Kanze, Apr 2, 2008
    #16
  17. In article <>,
    Razii <> wrote:
    >On 02 Apr 2008 11:11:51 GMT, (Yannick Tremblay)
    >wrote:
    >
    >>>Where is the HashMap container in c++ standard library?

    >>
    >>std::tr1::unordered_map

    >
    >WC2.cpp(12) : fatal error C1083: Cannot open include file:
    >'tr1/unordered_map': No such file or directory


    Read your platform documentation and figure out if it supports TR1.
    If not, obtain a TR1 library (dinkumware comes to mind)

    >>>It makes a big difference in speed if you use std::map vs HashMap in
    >>>some situations. So where is the HashMap?

    >>
    >>There's a key in the above sentence: "in some situation"
    >>
    >>In many situation, both would do the job fine.

    >
    >In this case, word counting app, the speed will improve greatly by
    >using hashmap (that's my guess). The hashmap can be converted back to

    ^^^^^^^^^^^^^^^^^
    Don't you see a problem in the above?
    Haven't you read what peoples have been trying to tell you?
    Here's one again: "Don't guess. Measure"

    >ordered at the end by transferring it into ordered map.


    Might be in the general case. Howver, if you write a word sorter
    using a hash table, it is possible that you would encounter data that
    would trigger a worse case scenario performance. So you could write
    your program, claim it is very fast and I could make it incredibly
    slow simply by feeding it specifically chosen data. Not really
    something you'd want to expose to the world.

    Interestingly, you deleted the rest of my hash vs balanced tree
    comparaison and links that explain that.
    Yannick Tremblay, Apr 2, 2008
    #17
  18. June Lee

    Default User Guest

    Razii wrote:


    > Where is this HashMap container in the Standard C++ Library? Poor "Bo
    > Persson" can't find it. Something he needs to speed up the word
    > counting benchmark, which for now is more than 2 times slower.


    *plonk*




    Brian
    Default User, Apr 2, 2008
    #18
  19. June Lee

    Razii Guest

    On 02 Apr 2008 14:44:59 GMT, (Yannick Tremblay)
    wrote:

    >In article <>,
    >Razii <> wrote:
    >>On 02 Apr 2008 11:11:51 GMT, (Yannick Tremblay)
    >>wrote:
    >>
    >>>>Where is the HashMap container in c++ standard library?
    >>>
    >>>std::tr1::unordered_map

    >>
    >>WC2.cpp(12) : fatal error C1083: Cannot open include file:
    >>'tr1/unordered_map': No such file or directory

    >
    >Read your platform documentation and figure out if it supports TR1.
    >If not, obtain a TR1 library (dinkumware comes to mind)


    How is it standard when VC++ doesn't have it?

    >>>In many situation, both would do the job fine.

    >>
    >>In this case, word counting app, the speed will improve greatly by
    >>using hashmap (that's my guess). The hashmap can be converted back to

    > ^^^^^^^^^^^^^^^^^
    >Don't you see a problem in the above?
    >Haven't you read what peoples have been trying to tell you?
    >Here's one again: "Don't guess. Measure"


    I have already tested this on java version and using ordered map made
    it much slower.

    >>ordered at the end by transferring it into ordered map.

    >
    >Might be in the general case. Howver, if you write a word sorter
    >using a hash table, it is possible that you would encounter data that
    >would trigger a worse case scenario performance. So you could write
    >your program, claim it is very fast and I could make it incredibly
    >slow simply by feeding it specifically chosen data. Not really
    >something you'd want to expose to the world.


    I doubt it's that easy to trigger worse case scenario. You will need
    to read hashing algorithm and then write a bible size book with
    specifically chosen data.

    >Interestingly, you deleted the rest of my hash vs balanced tree
    >comparaison and links that explain that.


    There was nothing new in the rest of your post. I have seen
    Wikipedia's articles before.
    Razii, Apr 2, 2008
    #19
  20. June Lee

    stan Guest

    Razii wrote:
    > On 02 Apr 2008 14:44:59 GMT, (Yannick Tremblay)
    > wrote:
    >
    >>In article <>,
    >>Razii <> wrote:
    >>>On 02 Apr 2008 11:11:51 GMT, (Yannick Tremblay)
    >>>wrote:
    >>>
    >>>>>Where is the HashMap container in c++ standard library?
    >>>>
    >>>>std::tr1::unordered_map
    >>>
    >>>WC2.cpp(12) : fatal error C1083: Cannot open include file:
    >>>'tr1/unordered_map': No such file or directory

    >>
    >>Read your platform documentation and figure out if it supports TR1.
    >>If not, obtain a TR1 library (dinkumware comes to mind)

    >
    > How is it standard when VC++ doesn't have it?


    Maybe if you stick with programing, you'll come to understand that MS is
    the poster child for disregarding standards. Ever heard of the phrase
    embrace and extend?
    >
    >>>>In many situation, both would do the job fine.
    >>>
    >>>In this case, word counting app, the speed will improve greatly by
    >>>using hashmap (that's my guess). The hashmap can be converted back to

    >> ^^^^^^^^^^^^^^^^^
    >>Don't you see a problem in the above?
    >>Haven't you read what peoples have been trying to tell you?
    >>Here's one again: "Don't guess. Measure"

    >
    > I have already tested this on java version and using ordered map made
    > it much slower.


    So the answer is "no I don't get it"?
    >
    >>>ordered at the end by transferring it into ordered map.

    >>
    >>Might be in the general case. Howver, if you write a word sorter
    >>using a hash table, it is possible that you would encounter data that
    >>would trigger a worse case scenario performance. So you could write
    >>your program, claim it is very fast and I could make it incredibly
    >>slow simply by feeding it specifically chosen data. Not really
    >>something you'd want to expose to the world.

    >
    > I doubt it's that easy to trigger worse case scenario. You will need
    > to read hashing algorithm and then write a bible size book with
    > specifically chosen data.


    I'll go out on a limb here and guess that you're self taught. You might
    want to consider a course in algorithms if you're really interested in
    programming. You clearly seem concerned with appearances as evidenced by
    your taunts. You can't even imagine how much it would improve your
    standing with programmers if you could replace "doubt" and "guess"
    with a clear, correct, and concise analysis of an algorithm.
    >
    >>Interestingly, you deleted the rest of my hash vs balanced tree
    >>comparaison and links that explain that.

    >
    > There was nothing new in the rest of your post. I have seen
    > Wikipedia's articles before.


    And your reading skills have already been clearly demonstrated.
    >
    >
    stan, Apr 3, 2008
    #20
    1. Advertising

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. Fredrik Lundh
    Replies:
    0
    Views:
    423
    Fredrik Lundh
    Feb 4, 2005
  2. Daniel Bickett
    Replies:
    0
    Views:
    375
    Daniel Bickett
    Feb 4, 2005
  3. steve.leach

    How standard is the standard library?

    steve.leach, Apr 18, 2005, in forum: Python
    Replies:
    1
    Views:
    372
    Christos TZOTZIOY Georgiou
    Apr 18, 2005
  4. funkyj
    Replies:
    5
    Views:
    1,106
    funkyj
    Jan 20, 2006
  5. Carmen Sei
    Replies:
    4
    Views:
    820
    James Kanze
    Mar 5, 2008
Loading...

Share This Page