Mitch Richling: Example c++ Programs
| Author: | Mitch Richling |
| Updated: | 2023-11-15 |
Table of Contents
1. Introduction
Here you will find several examples of source code intended to illustrate concepts related to the C++ and or the STL. The intent of this page is to help beginning cpp programmers with a few complete examples.
Get it all on github: https://github.com/richmit/ex-cpp/
2. Containers
list.cpp- Demonstrates several list container concepts including splice.
vector.cpp- Demonstrates one of the most useful containers in the cpp!
vector11.cpp- Some C++11 vector goodness
set.cpp- Short demonstration of the set container.
map.cpp- Demonstrates the map container.
unordered_map.cpp- Demonstrates the unordered map container(C++11).
multiset.cpp- Short demonstration of the multiset container.
3. Algorithms
algorithm.cpp- Demonstrates several generic algorithms. (This is a work in progress)
little_algorithm.cpp- Demonstrates things like swap, min, and max. (This is a work in progress)
generic.cpp- Example of how to write generic functions to work with cpp containers.
sort.cpp- Demonstrates the sort, with lambdas (C++11), and
for_each(C++11). numericStuff.cpp- Examples from the numeric header (C++11)
4. Adapters & non-containers
queue.cpp- Demonstrates the use of the queue container adapter. (This is a work in progress)
string.cpp- A few C++ string examples and how the work with C-strings.
5. Threads in C++11
thread01_hello.cpp- Minimal thread example with a function (C++11)
thread02_lambda.cpp- Minimal thread example with a lambda (C++11)
thread03_mutex.cpp- Simple mutex example (C++11)
thread04_condition.cpp- Condition variables and hot potatoes (C++11)
thread05_pool.cpp- Lots of threads in an array (C++11)
dirThreadCPP11.cpp- Working example from the world of UNIX directory processing (C++11) – look here for more info
6. Random standard library stuff
chrono01.cpp- Times and durations with C++11
complex.cpp- Complex numbers (C++11)
regexExample1.cpp- Simple C++11 regular expression example
7. Random C++ language topics
readFileLines.cpp- Reading a file a line at a time
stome.cpp- A well behaved class compatable with STL containers and algorithms (C++11)