Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations gkittelson on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

linked list class 1

Status
Not open for further replies.

citten32

Technical User
Oct 18, 2004
1
US
I've been banging my head and can't get around this. What is a good example of an easy copy constructor, constructor, and destructor (declaration and definition)for a simple linked list in a class? There are a ton on the web, but they're all complicated and use more advanced C++ techniques. What happened to simplicity?
 
>What happened to simplicity

It's there. It's in C++.

std::list in STL is a linked list that is part of the C++ standard. Using it is not very complicated.



/Per

"It was a work of art, flawless, sublime. A triumph equaled only by its monumental failure."
 
std::list is easy to use, but it's certainly not easy to read when you look at the code in the <list> header file. :)
 
Yeah, I've always wondered what they were smoking when they wrote the STL code. I dont know about you, I've never felt variables named _T and such were very informative.
 
There are perfectly valid resaons for STL looking as it does. Basically, STL wasn't designed to be a documentation.

For more info see
where PJ Plauger (the one implementing STL) explains why it looks like it does.


/Per

&quot;It was a work of art, flawless, sublime. A triumph equaled only by its monumental failure.&quot;
 
Well I can see doing it like that for efficiency and preventing name conflicts... But someone must have an unencrypted version of the code somewhere that they later obfuscate into those ugly STL headers. I think it would be easier to create the grand unification theory than to understand those STL headers. :)
 
>But someone must have an unencrypted version
If you'd read the thread in the link I provided you'd know that is not the case.

>ugly STL headers

"Ugly" is obviously in the eye of the beholder. So, STL's style doesn't conform with your preferences? Tough luck.

>I think it would be easier to create the grand unification thory

Specially since we know the answer: 42

>than to understand those STL headers.

As long as you know how to use it, you don't need to dig into the implementation. And using STL is really trivial.
STL wasn't designed to be a tutorial.

/Per

&quot;It was a work of art, flawless, sublime. A triumph equaled only by its monumental failure.&quot;
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top