The W3C Inside! C++ Tutorial
Dedication
To Mike "parksie" Parks.
Never really known, but never really forgotten either.
Why a tutorial?
There are many tutorials and books about C++. But nearly all of them have one problem in common: they are outdated. The C++ standard was first fixed in 1998, yet still many tutorials on the web, not to mention books that were published earlier and not revised, show C++ the way it was used before the standard was published.
As I realized when I became moderator of the C++ forum at GalahTech, there is a real need for a C++ tutorial that teaches you the language from the ground up, using all the help that the C++ standard library gives the programmer who knows how to use it and teaching even the more complex aspects of C++ in a way that is understandable even to first-time programmers. A tutorial that not only teaches the core language, but also how to avoid reinventing the wheel by giving a good overview of what is already available in the C++ standard library and popular public libraries such as Boost. A tutorial that teaches how to use the portability of C++ to write programs that work in UNIX just as well as in Windows, with only a recompile needed.
This is my (and some other people's) attempt to give the world such a tutorial. It is targeted at the first-time programmer just as much as a switch-overs from other languages. If you come from Visual Basic, I advise you to forget most of what you learned in Visual Basic and think of yourself as first-time programmers too. It's easier to learn C++ that way, trust me.
What this tutorial teaches
After you've done this tutorial you should
- know the basic and advanced features of the C++ programming language: functions, classes, templates.
- know the basic and intermediate features of the C++ standard library: strings, streams, containers, algorithms.
- know enough about the advanced features of the C++ standard library to not get lost when you need them: locales, custom allocators and char_traits, special iterators.
- know the usage of the basic Boost libraries: String Tokenizer, Lexical Cast and some others.
- have an overview of other Boost libraries: Spirit, Regex, Thread and many more.
What this tutorial doesn't teach
This tutorial teaches you none of the following:
Graphical programming. Unless you use a class library such as wxWindows or GTK+, graphical programming is highly dependent on the operating system and does not fit into this (cross-platform) tutorial.
I might at some point write a tutorial or at least some articles on graphical programming. I especially want to convey my experiences with the Windows shell, which is a true nightmare to program.
- Game programming. Again, without libraries such as OpenGL, game programming is platform-bound. Besides, game programming is very complex and I don't know all that much about it myself.
- Network and internet programming. While sockets can be written nearly platform-independent, this is a topic I've never really studied myself. When I want to use the internet, I program in Java :)
Copyright
This tutorial and all code in it is © 2003-2004 the above authors. Permission to copy and use the code is granted under the BSD license:
Copyright (c) 2003-2004, Sebastian Redl et al.
All rights reserved.
Redistribution and use in source and binary forms, with or without modification,
are permitted provided that the following conditions are met:
* Redistributions of source code must retain the above copyright notice,
this list of conditions and the following disclaimer.
* Redistributions in binary form must reproduce the above copyright notice,
this list of conditions and the following disclaimer in the documentation
and/or other materials provided with the distribution.
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR
ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
(INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON
ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
The tutorial itself may not be copied, even in part, without prior written permission of the author of the respective sections.