hachem.wtf
aboutsummaryrefslogtreecommitdiff
path: root/tutorial/01_hello.sfinae
diff options
context:
space:
mode:
authorhachem <im@hachem.wtf>2026-09-19 22:04:44 +0200
committerhachem <im@hachem.wtf>2026-09-19 22:04:44 +0200
commit2da2c56c72e7085bd9a52f848df90c6fc701de7f (patch)
tree96cf837a606297aed921b9adaac783940a1aa7cd /tutorial/01_hello.sfinae
parent6487b5b5301f6cb37c95c3571578d5a42adb2a1a (diff)
docs: add tutorial
Diffstat (limited to 'tutorial/01_hello.sfinae')
-rw-r--r--tutorial/01_hello.sfinae24
1 files changed, 24 insertions, 0 deletions
diff --git a/tutorial/01_hello.sfinae b/tutorial/01_hello.sfinae
new file mode 100644
index 0000000..81d84e6
--- /dev/null
+++ b/tutorial/01_hello.sfinae
@@ -0,0 +1,24 @@
+// hello, world
+//
+// there are no strings. there are no string literals. there is ::tuple, a type
+// made of other types, and ::integral_constant<::char, N>, a type that happens
+// to be a character. ::emit prints whatever a type has to say and then a newline
+// there are also no numbers, so every character is its own distance from '\0'
+
+::emit<
+ ::tuple<
+ ::integral_constant<::char, ::difference<'H', '\0'>>,
+ ::integral_constant<::char, ::difference<'e', '\0'>>,
+ ::integral_constant<::char, ::difference<'l', '\0'>>,
+ ::integral_constant<::char, ::difference<'l', '\0'>>,
+ ::integral_constant<::char, ::difference<'o', '\0'>>,
+ ::integral_constant<::char, ::difference<',', '\0'>>,
+ ::integral_constant<::char, ::difference<' ', '\0'>>,
+ ::integral_constant<::char, ::difference<'w', '\0'>>,
+ ::integral_constant<::char, ::difference<'o', '\0'>>,
+ ::integral_constant<::char, ::difference<'r', '\0'>>,
+ ::integral_constant<::char, ::difference<'l', '\0'>>,
+ ::integral_constant<::char, ::difference<'d', '\0'>>,
+ ::integral_constant<::char, ::difference<'!', '\0'>>
+ >
+>::commit;