Standard C++ Library

J

June Lee

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
 
L

lbonafide

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.
 
J

June Lee

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?
 
I

Ian Collins

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?
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.
 
R

Razii

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.
 
A

Anand Hariharan

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
 
L

lbonafide

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?
 
I

Ian Collins

Anand said:
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)
:)
 
R

Razii

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?
 
Y

Yannick Tremblay


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
 
L

lbonafide

:)

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?
 
R

Razii

std::tr1::unordered_map

WC2.cpp(12) : fatal error C1083: Cannot open include file:
'tr1/unordered_map': No such file or directory
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?
 
L

lbonafide

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.
 
R

Razii

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?
 
J

James Kanze

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.)
 
Y

Yannick Tremblay

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)
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.
 
D

Default User

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
 
R

Razii

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?
^^^^^^^^^^^^^^^^^
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.
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.
 
S

stan

Razii said:
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?
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"?
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.
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.
 

Ask a Question

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

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,769
Messages
2,569,580
Members
45,054
Latest member
TrimKetoBoost

Latest Threads

Top