|
You are here |
gpfault.net | ||
| | | | |
eyakubovich.github.io
|
|
| | | | | Suppose we need to write a factory function that constructs a runtime polymorphic object. For the purposes of this post, let's say we want to construct a concrete shape object - a rectangle, triangle, or an ellipse. Here are our basic declarations: 1 2 3 4 5 6 7 8... | |
| | | | |
entangledlogs.com
|
|
| | | | | Generic Programming: Generating part of programs Introduction Generic Programming: Programming with generic parameters to avoid unnecessary code duplication and encourage code reuse. Polymorphism is also another technique to solve code reuse Puts implicit constraints on the generic types that are to be fulfilled by concrete types. template T adder(T LHS, T RHS) { return LHS + RHS; } struct Foo { inv Val = 0; } Foo f = adder(Foo{}, Foo{}): In this code snippet, we assume that Foo meets the requirement tha... | |
| | | | |
blog.molecular-matters.com
|
|
| | | | | I recently had the need to retrieve the type of a template argument as a human-readable string for debugging purposes, but without using RTTI - so typeid and type_info were out of the question. After a bit of trial and error, I came up with the following solution. I thought it was a nice little... | |
| | | | |
notes.volution.ro
|
|
| | | About the many types of hash functions, their use-cases, dos and don'ts, with suggestions for currently accepted algorithms. | ||