Difference between revisions of "CPP"
From ProgrammingExamples
Daviddoria (Talk | contribs) (→Boost) |
Daviddoria (Talk | contribs) |
||
(59 intermediate revisions by 4 users not shown) | |||
Line 2: | Line 2: | ||
A statically typed, free-form, multi-paradigm, compiled, general-purpose programming language. It is regarded as a "middle-level" language, as it comprises a combination of both high-level and low-level language features. It was developed by Bjarne Stroustrup starting in 1979 at Bell Labs as an enhancement to the C programming language and originally named C with Classes. It was renamed C++ in 1983. (http://en.wikipedia.org/wiki/C++) | A statically typed, free-form, multi-paradigm, compiled, general-purpose programming language. It is regarded as a "middle-level" language, as it comprises a combination of both high-level and low-level language features. It was developed by Bjarne Stroustrup starting in 1979 at Bell Labs as an enhancement to the C programming language and originally named C with Classes. It was renamed C++ in 1983. (http://en.wikipedia.org/wiki/C++) | ||
---- | ---- | ||
− | === | + | === Formatting === |
+ | * [[CPP/Formatting/Decimals|Number of decimals (fixed and setprecision)]] | ||
+ | |||
+ | === General Examples === | ||
+ | * [[CPP/decltype|Get the type of a variable or function]] | ||
+ | * [[CPP/bind|Bind different sets of arguments to a function]] | ||
+ | * [[CPP/Pragma|Compile time output (pragma message)]] | ||
+ | * [[CPP/CustomIterator|A custom iterator]] | ||
+ | * [[CPP/StaticConstInitialization|Static const initialization]] | ||
+ | * [[CPP/StaticInheritance|Static inheritance]] | ||
+ | * [[CPP/StaticFunction|Static function]] | ||
+ | * [[CPP/recursion|Recursion - a recursive function]] | ||
+ | * [[CPP/unique_ptr|unique_ptr]] | ||
+ | * [[CPP/Functor|Functor]] | ||
+ | * [[CPP/ReturnByReference|Return a value by reference]] | ||
+ | * [[CPP/IntToHex|Convert an int to hex]] | ||
+ | * [[CPP/HexToInt|Convert a hex number to an int]] | ||
+ | * [[CPP/AnonymousNamespace|Anonymous namespace]] | ||
* [[CPP/2DVector|2D Vector]] | * [[CPP/2DVector|2D Vector]] | ||
* [[CPP/AlphebetizeString|Alphabetize a vector of strings]] | * [[CPP/AlphebetizeString|Alphabetize a vector of strings]] | ||
Line 14: | Line 31: | ||
* [[CPP/DefaultArguments|Default arguments]] | * [[CPP/DefaultArguments|Default arguments]] | ||
* [[CPP/Enum|Enum]] | * [[CPP/Enum|Enum]] | ||
− | * [[CPP/Exceptions|Exceptions]] | + | * [[CPP/Exceptions|Exceptions (try/catch)]] |
* [[CPP/Infinity|Infinity]] | * [[CPP/Infinity|Infinity]] | ||
* [[CPP/Logging|Logging]] | * [[CPP/Logging|Logging]] | ||
Line 26: | Line 43: | ||
* [[CPP/Switch|Switch]] | * [[CPP/Switch|Switch]] | ||
* [[CPP/Typedef|Typedef]] | * [[CPP/Typedef|Typedef]] | ||
+ | * [[CPP/KeepSortedList|Keeping a Sorted List of Custom Records]] | ||
=== I/O === | === I/O === | ||
Line 37: | Line 55: | ||
* [[CPP/Strings/Concatenate|Concatenate]] | * [[CPP/Strings/Concatenate|Concatenate]] | ||
* [[CPP/Strings/CountCharacters|Count characters]] | * [[CPP/Strings/CountCharacters|Count characters]] | ||
− | * [[CPP/Strings/Split|Split]] | + | * [[CPP/Strings/Split|Split/parse]] |
* [[CPP/Strings/Case_Conversion|Case conversion]] | * [[CPP/Strings/Case_Conversion|Case conversion]] | ||
* [[CPP/Strings/SingleCharacterTag|Find the contents of a single character tag]] | * [[CPP/Strings/SingleCharacterTag|Find the contents of a single character tag]] | ||
+ | * [[CPP/Strings/FindAndReplace|Replace a substring with a replacement string (find and replace)]] | ||
+ | * [[CPP/Strings/Find|Find the position of a substring]] | ||
+ | * [[CPP/Strings/DetectPunctuation|Detect punctuation (ispunct)]] | ||
=== Classes === | === Classes === | ||
− | |||
* [[CPP/Classes/ConstructorInheritance|Constructor inheritance]] | * [[CPP/Classes/ConstructorInheritance|Constructor inheritance]] | ||
* [[CPP/Classes/InitializationList|Initialization list]] | * [[CPP/Classes/InitializationList|Initialization list]] | ||
Line 52: | Line 72: | ||
* [[CPP/Classes/Singleton|Singleton]] | * [[CPP/Classes/Singleton|Singleton]] | ||
* [[CPP/Classes/Conversion Function|Conversion Function]] | * [[CPP/Classes/Conversion Function|Conversion Function]] | ||
+ | |||
+ | === Templates === | ||
+ | * [[CPP/Templates/FunctionTemplateHeaderOnly|Function template (header only)]] | ||
+ | * [[CPP/Templates/FunctionTemplateExplicitInstantiation|Function template (explicit instantiation)]] | ||
+ | * [[CPP/FunctionTemplateSpecialization|Function template specialization]] | ||
+ | * [[CPP/Templates/ClassTemplateHeaderOnly|Class template (header only)]] | ||
+ | * [[CPP/Templates/ClassTemplateExplicitInstantiation|Class template (explicit instantiation)]] | ||
+ | * [[CPP/Templates/MemberFunctionTemplate|A member function template]] | ||
+ | * [[CPP/Templates/PartialClassSpecialization|Partially specialize a class template]] | ||
=== Loops === | === Loops === | ||
Line 59: | Line 88: | ||
=== STL Data Structures === | === STL Data Structures === | ||
− | *[[CPP/STL/ | + | *[[CPP/STL/Complex|Complex]] |
− | *[[CPP/STL/ | + | *[[CPP/STL/Heap|Heap]] |
*[[CPP/STL/List|List]] | *[[CPP/STL/List|List]] | ||
− | |||
− | |||
*[[CPP/STL/Map|Map]] | *[[CPP/STL/Map|Map]] | ||
*[[CPP/STL/MultiMap|MultiMap]] | *[[CPP/STL/MultiMap|MultiMap]] | ||
+ | *[[CPP/STL/MultiSet|MultiSet]] | ||
*[[CPP/STL/Pair|Pair]] | *[[CPP/STL/Pair|Pair]] | ||
*[[CPP/STL/PriorityQueue|Priority queue]] | *[[CPP/STL/PriorityQueue|Priority queue]] | ||
*[[CPP/STL/Queue|Queue]] | *[[CPP/STL/Queue|Queue]] | ||
+ | *[[CPP/STL/Stack|Stack]] | ||
+ | *[[CPP/STL/String|String]] | ||
*[[CPP/STL/Tuple|Tuple]] | *[[CPP/STL/Tuple|Tuple]] | ||
+ | *[[CPP/STL/IteratorFromObject|Iterator from object]] | ||
+ | |||
+ | ==== Vector ==== | ||
+ | *[[CPP/STL/Vector|Vector]] | ||
+ | *[[CPP/STL/Vector/RemoveElement|Remove an element from a vector]] delete, erase | ||
+ | *[[CPP/STL/Vector/Reverse|Reverse the elements in a vector]] | ||
+ | |||
+ | ==== Set ==== | ||
+ | *[[CPP/STL/Set|Set]] | ||
+ | *[[CPP/STL/Set/RemoveElement|Remove an element from a set]] | ||
+ | *[[CPP/STL/Set/MergeSets|Merge sets]] | ||
+ | *[[CPP/STL/Set/SearchForElement|Search for an element (find)]] | ||
+ | *[[CPP/STL/Set/SetCustomClass|Custom class]] | ||
+ | *[[CPP/STL/Set/SetCustomComparison|Custom comparison operator]] | ||
+ | *[[CPP/STL/Set/BoundedInsert|A custom function to insert an element into the set only if it is less than an element currently in the set, and keep the same size]] | ||
=== STL Algorithms === | === STL Algorithms === | ||
Line 77: | Line 122: | ||
* [[CPP/STL/RandomData|Random data (std::generate)]] | * [[CPP/STL/RandomData|Random data (std::generate)]] | ||
* [[CPP/STL/ForEach|ForEach]] | * [[CPP/STL/ForEach|ForEach]] | ||
+ | * [[CPP/STL/VectorMinAndMax|VectorMinAndMax]] | ||
=== Debugging === | === Debugging === | ||
Line 86: | Line 132: | ||
=== C++0x === | === C++0x === | ||
+ | *[[CPP/C++0x/TheBigFive|The Big Five]] | ||
+ | *[[CPP/C++0x/VectorInitialization|Vector initialization]] | ||
+ | *[[CPP/C++0x/VectorMinMax|VectorMinMax]] | ||
*[[CPP/C++0x/Hash|Hash]] | *[[CPP/C++0x/Hash|Hash]] | ||
+ | *[[CPP/C++0x/UnorderedSet|Unordered set]] | ||
+ | *[[CPP/C++0x/Lambda|Lambda]] | ||
=== Math === | === Math === | ||
Line 92: | Line 143: | ||
*[[CPP/Math/MinMax|Min and Max]] | *[[CPP/Math/MinMax|Min and Max]] | ||
*[[CPP/Math/Trig|Trig functions]] | *[[CPP/Math/Trig|Trig functions]] | ||
− | *[[CPP/Math/SumVector|Sum elements in a vector]] | + | *[[CPP/Math/SumVector|Sum elements in a vector (accumulate)]] |
+ | *[[CPP/Math/Pi|Mathematic constant Pi = 3.14...]] | ||
+ | *[[CPP/Math/Median|Median of a vector]] | ||
=== C-Style Programming Techniques === | === C-Style Programming Techniques === | ||
Line 101: | Line 154: | ||
* [[CPP/FunctionPointer|Function pointer]] | * [[CPP/FunctionPointer|Function pointer]] | ||
* [[CPP/VariableNumberOfArguments|Variable number of function arguments]] | * [[CPP/VariableNumberOfArguments|Variable number of function arguments]] | ||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
=== Utility === | === Utility === | ||
* [[CPP/Template Print|Generic Print]] | * [[CPP/Template Print|Generic Print]] | ||
* [[CPP/DataType Converter | Generic DataType Converter]] | * [[CPP/DataType Converter | Generic DataType Converter]] | ||
+ | * [[CPP/Sockets | Sockets]] | ||
+ | * [[CPP/PThreads | PThreads]] | ||
+ | * [[CPP/TCPSocket | TCPSocket]] | ||
+ | * [[CPP/Typeof | Typeof]] |
Latest revision as of 08:58, 20 November 2016
Contents
C++
A statically typed, free-form, multi-paradigm, compiled, general-purpose programming language. It is regarded as a "middle-level" language, as it comprises a combination of both high-level and low-level language features. It was developed by Bjarne Stroustrup starting in 1979 at Bell Labs as an enhancement to the C programming language and originally named C with Classes. It was renamed C++ in 1983. (http://en.wikipedia.org/wiki/C++)
Formatting
General Examples
- Get the type of a variable or function
- Bind different sets of arguments to a function
- Compile time output (pragma message)
- A custom iterator
- Static const initialization
- Static inheritance
- Static function
- Recursion - a recursive function
- unique_ptr
- Functor
- Return a value by reference
- Convert an int to hex
- Convert a hex number to an int
- Anonymous namespace
- 2D Vector
- Alphabetize a vector of strings
- Pad a number with zeros
- Binary input and output
- Execute a linux command
- Casting
- Keyboard input
- Command line arguments
- Deep copy
- Default arguments
- Enum
- Exceptions (try/catch)
- Infinity
- Logging
- Namespaces
- NAN (not a number)
- Overload operator
- Parallel sort
- Random numbers
- StringStream
- Struct
- Switch
- Typedef
- Keeping a Sorted List of Custom Records
I/O
Strings
- Compare strings
- Concatenate
- Count characters
- Split/parse
- Case conversion
- Find the contents of a single character tag
- Replace a substring with a replacement string (find and replace)
- Find the position of a substring
- Detect punctuation (ispunct)
Classes
- Constructor inheritance
- Initialization list
- Derived class
- Down casting
- Friend class
- Nested classes
- Pure virtual function
- Singleton
- Conversion Function
Templates
- Function template (header only)
- Function template (explicit instantiation)
- Function template specialization
- Class template (header only)
- Class template (explicit instantiation)
- A member function template
- Partially specialize a class template
Loops
STL Data Structures
- Complex
- Heap
- List
- Map
- MultiMap
- MultiSet
- Pair
- Priority queue
- Queue
- Stack
- String
- Tuple
- Iterator from object
Vector
Set
- Set
- Remove an element from a set
- Merge sets
- Search for an element (find)
- Custom class
- Custom comparison operator
- A custom function to insert an element into the set only if it is less than an element currently in the set, and keep the same size
STL Algorithms
- Random shuffle
- Sort a vector
- Find the different elements in two containers (set_difference)
- Random data (std::generate)
- ForEach
- VectorMinAndMax
Debugging
C++ TR1
C++0x
Math
- Exponential function
- Min and Max
- Trig functions
- Sum elements in a vector (accumulate)
- Mathematic constant Pi = 3.14...
- Median of a vector