Browse code

WIP: Add implementation

Robert Cranston authored on 18/06/2023 16:41:24
Showing 1 changed files
... ...
@@ -2,6 +2,10 @@
2 2
 
3 3
 **C**oncept-based **R**elaying **Any** C++14 type.
4 4
 
5
+For a usage example, see `tests/crany.cpp`.
6
+
7
+For a diagram visualizing the implementation, see `doc/crany.dot.png`.
8
+
5 9
 [`crany`]: https://git.rcrnstn.net/rcrnstn/crany
6 10
 
7 11
 ## References
Browse code

WIP: Add references

Robert Cranston authored on 05/08/2022 03:19:52
Showing 1 changed files
... ...
@@ -4,6 +4,63 @@
4 4
 
5 5
 [`crany`]: https://git.rcrnstn.net/rcrnstn/crany
6 6
 
7
+## References
8
+
9
+The references below focus on the timeline and online resources.
10
+
11
+This work builds on that of many others:
12
+
13
+-   Chris Cleeland, Douglas Schmidt, Timothy Harrison
14
+    -   External Polymorphism
15
+        -   1996, Proceedings of the 3rd Pattern Languages of Programming Conference, [paper](https://www.dre.vanderbilt.edu/~schmidt/PDF/C++-EP.pdf)
16
+-   Kevlin Henney
17
+    -   Valued Conversions
18
+        -   2000, C++ Report, [paper](https://citeseerx.ist.psu.edu/viewdoc/download?doi=10.1.1.374.2252&rep=rep1&type=pdf)
19
+-   Sean Parent
20
+    -   Runtime Concepts: Generic Programming and Runtime Polymorphism
21
+        -   Unpublished, [paper](https://stlab.cc/legacy/runtime-concepts.html)
22
+    -   Concept-Based Runtime Polymorphism
23
+        -   2007, BoostCon, [slides](https://stlab.cc/legacy/figures/Boost_poly.pdf)
24
+    -   Value Semantics and Concept-based Polymorphism
25
+        -   2012, C++Now, [talk](https://www.youtube.com/watch?v=_BpMYeUFXv8), [slides](https://sean-parent.stlab.cc/papers-and-presentations/#value-semantics-and-concept-based-polymorphism)
26
+    -   Inheritance Is The Base Class of Evil
27
+        -   2013, GoingNative, [talk](https://www.youtube.com/watch?v=bIhUE5uUFOA), [slides](https://sean-parent.stlab.cc/papers-and-presentations/#inheritance-is-the-base-class-of-evil)
28
+    -   Better Code: Runtime Polymorphism
29
+        -   2017, NDC, [talk](https://www.youtube.com/watch?v=QGcVXgEVMJg), [slides](https://sean-parent.stlab.cc/papers-and-presentations/#better-code-runtime-polymorphism)
30
+-   Louis Dionne
31
+    -   Runtime Polymorphism: Back to the Basics
32
+        -   2017, CppCon, [talk](https://www.youtube.com/watch?v=gVGtNFg4ay0), [slides](https://ldionne.com/cppcon-2017-runtime-polymorphism)
33
+        -   2018, ACCU, [talk](https://www.youtube.com/watch?v=H8lFldGvt9w), [slides](https://ldionne.com/accu-2018-runtime-polymorphism)
34
+        -   2018, C++Now, [talk](https://www.youtube.com/watch?v=OtU51Ytfe04), [slides](https://ldionne.com/cppnow-2018-runtime-polymorphism)
35
+
36
+Other related work:
37
+
38
+-   Zach Laine
39
+    -   Pragmatic Type Erasure: Solving OOP Problems w/ Elegant Design Pattern
40
+        -   2014, CppCon, [talk](https://www.youtube.com/watch?v=0I0FD3N5cgM)
41
+-   Sy Brand
42
+    -   Dynamic Polymorphism with Metaclasses and Code Injection
43
+        -   2020, CppCon, [talk](https://www.youtube.com/watch?v=8c6BAQcYF_E)
44
+-   Klaus Igelberger
45
+    -   Breaking Dependencies: Type Erasure - A Design Analysis
46
+        -   2021, CppCon, [talk](https://www.youtube.com/watch?v=4eeESJQk-mw&t=23m26s)
47
+
48
+Related projects:
49
+
50
+-   Adobe's [Poly](https://stlab.adobe.com/group__poly__related.html) (of which Sean Parent was a principal contributor)
51
+-   Louis Dionne's [Dyno](https://github.com/ldionne/dyno)
52
+-   Facebook's [Folly Poly](https://github.com/facebook/folly/blob/main/folly/docs/Poly.md)
53
+
54
+Related patterns:
55
+-   Adapter pattern
56
+    -   [Wikipedia](https://en.wikipedia.org/wiki/Adapter_pattern)
57
+    -   [GoF Design Patterns](https://en.wikipedia.org/wiki/Design_Patterns)
58
+-   Decorator pattern
59
+    -   [Wikipedia](https://en.wikipedia.org/wiki/Decorator_pattern)
60
+    -   [GoF Design Patterns](https://en.wikipedia.org/wiki/Design_Patterns)
61
+-   External Polymorphism pattern
62
+    -   [WikiWikiWeb](https://wiki.c2.com/?ExternalPolymorphism)
63
+
7 64
 ## Build system
8 65
 
9 66
 This project supports [CMake][] and uses [`cmake-common`][]. There are several
Browse code

Add project

Robert Cranston authored on 05/08/2022 02:53:33
Showing 1 changed files
... ...
@@ -4,6 +4,95 @@
4 4
 
5 5
 [`crany`]: https://git.rcrnstn.net/rcrnstn/crany
6 6
 
7
+## Build system
8
+
9
+This project supports [CMake][] and uses [`cmake-common`][]. There are several
10
+ways to use it in other CMake-based projects:
11
+
12
+-   With [`find_package`][]: ([Package][] and) [install][] it on the system.
13
+
14
+-   With [`add_subdirectory`][]: Bundle it.
15
+
16
+-   With [`FetchContent`][]: Download it as part of the CMake configure step.
17
+
18
+-   With [`cmake-common`][]: Use any of the above methods through a simplified
19
+    interface.
20
+
21
+As usual, use [`add_dependencies`][] or [`target_link_libraries`][] (or
22
+`cmake-common`'s `DEPENDENCIES_*`) to declare the dependency.
23
+
24
+[CMake]: https://cmake.org
25
+[`cmake-common`]: https://git.rcrnstn.net/rcrnstn/cmake-common
26
+[`FetchContent`]: https://cmake.org/cmake/help/v3.14/module/FetchContent.html
27
+[`add_subdirectory`]: https://cmake.org/cmake/help/v3.14/command/add_subdirectory.html
28
+[`find_package`]: https://cmake.org/cmake/help/v3.14/command/find_package.html
29
+[Package]: #Package
30
+[Install]: #Install
31
+[`add_dependencies`]: https://cmake.org/cmake/help/v3.14/command/add_dependencies.html
32
+[`target_link_libraries`]: https://cmake.org/cmake/help/v3.14/command/target_link_libraries.html
33
+
34
+### Configure and generate
35
+
36
+To configure and generate a build tree, use `cmake`:
37
+
38
+```sh
39
+cmake -B _build
40
+```
41
+
42
+To set the build type, pass e.g. `-D`[`CMAKE_BUILD_TYPE`][]`=Release`.
43
+
44
+[`cmake`]: https://cmake.org/cmake/help/v3.14/manual/cmake.1.html#generate-a-project-buildsystem
45
+[`CMAKE_BUILD_TYPE`]: https://cmake.org/cmake/help/v3.14/variable/CMAKE_BUILD_TYPE.html
46
+
47
+### Build
48
+
49
+To build, use [`cmake --build`][]:
50
+
51
+```sh
52
+cmake --build _build
53
+```
54
+
55
+To disable building tests, pass `-D`[`BUILD_TESTING`][]`=OFF`.
56
+
57
+[`cmake --build`]: https://cmake.org/cmake/help/v3.14/manual/cmake.1.html#build-a-project
58
+[`BUILD_TESTING`]: https://cmake.org/cmake/help/v3.14/module/CTest.html
59
+
60
+### Test
61
+
62
+To run tests, use [`ctest`][]:
63
+
64
+```sh
65
+(cd _build && ctest)
66
+```
67
+
68
+To show output from failing tests, pass `--output-on-failure`. To show output
69
+from all tests, pass `--verbose`.
70
+
71
+[`ctest`]: https://cmake.org/cmake/help/v3.14/manual/ctest.1.html
72
+
73
+### Package
74
+
75
+To package, use [`cpack`][]:
76
+
77
+```sh
78
+(cd _build && cpack)
79
+```
80
+
81
+[`cpack`]: https://cmake.org/cmake/help/v3.14/manual/cpack.1.html
82
+
83
+### Install
84
+
85
+To install onto the current system, use [`cmake --install`][]:
86
+
87
+```sh
88
+cmake --install _build
89
+```
90
+
91
+To set the prefix, pass e.g. `-D`[`CMAKE_INSTALL_PREFIX`][]`="$HOME/.local"`.
92
+
93
+[`cmake --install`]: https://cmake.org/cmake/help/v3.14/manual/cmake.1.html#install-a-project
94
+[`CMAKE_INSTALL_PREFIX`]: https://cmake.org/cmake/help/v3.14/variable/CMAKE_INSTALL_PREFIX.html
95
+
7 96
 ## License
8 97
 
9 98
 Licensed under the [ISC License][] unless otherwise noted, see the
Browse code

Add license

Robert Cranston authored on 05/08/2022 02:45:08
Showing 1 changed files
... ...
@@ -3,3 +3,11 @@
3 3
 **C**oncept-based **R**elaying **Any** C++14 type.
4 4
 
5 5
 [`crany`]: https://git.rcrnstn.net/rcrnstn/crany
6
+
7
+## License
8
+
9
+Licensed under the [ISC License][] unless otherwise noted, see the
10
+[`LICENSE`][] file.
11
+
12
+[ISC License]: https://choosealicense.com/licenses/isc
13
+[`LICENSE`]: LICENSE
Browse code

Add readme

Robert Cranston authored on 05/08/2022 02:44:58
Showing 1 changed files
1 1
new file mode 100644
... ...
@@ -0,0 +1,5 @@
1
+# [`crany`][]
2
+
3
+**C**oncept-based **R**elaying **Any** C++14 type.
4
+
5
+[`crany`]: https://git.rcrnstn.net/rcrnstn/crany