Hello World

This commit is contained in:
hexlocation 2025-02-07 16:43:06 +01:00
parent 929ae9001d
commit 441d7c50d9
Signed by: hex
GPG key ID: A19EFFAAF8C00FCF
3 changed files with 133 additions and 36 deletions

View file

@ -1,20 +1,31 @@
[ {
"file-explorer", "file-explorer": true,
"global-search", "global-search": true,
"switcher", "switcher": true,
"graph", "graph": true,
"backlink", "backlink": true,
"canvas", "canvas": true,
"outgoing-link", "outgoing-link": true,
"tag-pane", "tag-pane": true,
"page-preview", "properties": false,
"daily-notes", "page-preview": true,
"templates", "daily-notes": true,
"note-composer", "templates": true,
"command-palette", "note-composer": true,
"editor-status", "command-palette": true,
"bookmarks", "slash-command": false,
"outline", "editor-status": true,
"word-count", "bookmarks": true,
"file-recovery" "markdown-importer": false,
] "zk-prefixer": false,
"random-note": false,
"outline": true,
"word-count": true,
"slides": false,
"audio-recorder": false,
"workspaces": false,
"file-recovery": true,
"publish": false,
"sync": false,
"webviewer": false
}

View file

@ -13,10 +13,12 @@
"state": { "state": {
"type": "markdown", "type": "markdown",
"state": { "state": {
"file": "postgres/postgres.md", "file": "cpp/C++.md",
"mode": "source", "mode": "source",
"source": false "source": false
} },
"icon": "lucide-file",
"title": "C++"
} }
} }
] ]
@ -38,8 +40,11 @@
"state": { "state": {
"type": "file-explorer", "type": "file-explorer",
"state": { "state": {
"sortOrder": "alphabetical" "sortOrder": "alphabetical",
} "autoReveal": false
},
"icon": "lucide-folder-closed",
"title": "Files"
} }
}, },
{ {
@ -54,7 +59,9 @@
"collapseAll": false, "collapseAll": false,
"extraContext": false, "extraContext": false,
"sortOrder": "alphabetical" "sortOrder": "alphabetical"
} },
"icon": "lucide-search",
"title": "Search"
} }
}, },
{ {
@ -62,7 +69,9 @@
"type": "leaf", "type": "leaf",
"state": { "state": {
"type": "bookmarks", "type": "bookmarks",
"state": {} "state": {},
"icon": "lucide-bookmark",
"title": "Bookmarks"
} }
} }
] ]
@ -85,7 +94,7 @@
"state": { "state": {
"type": "backlink", "type": "backlink",
"state": { "state": {
"file": "postgres/postgres.md", "file": "cpp/C++.md",
"collapseAll": false, "collapseAll": false,
"extraContext": false, "extraContext": false,
"sortOrder": "alphabetical", "sortOrder": "alphabetical",
@ -93,7 +102,9 @@
"searchQuery": "", "searchQuery": "",
"backlinkCollapsed": false, "backlinkCollapsed": false,
"unlinkedCollapsed": true "unlinkedCollapsed": true
} },
"icon": "links-coming-in",
"title": "Backlinks for C++"
} }
}, },
{ {
@ -102,10 +113,12 @@
"state": { "state": {
"type": "outgoing-link", "type": "outgoing-link",
"state": { "state": {
"file": "postgres/postgres.md", "file": "cpp/C++.md",
"linksCollapsed": false, "linksCollapsed": false,
"unlinkedCollapsed": true "unlinkedCollapsed": true
} },
"icon": "links-going-out",
"title": "Outgoing links from C++"
} }
}, },
{ {
@ -115,8 +128,12 @@
"type": "tag", "type": "tag",
"state": { "state": {
"sortOrder": "frequency", "sortOrder": "frequency",
"useHierarchy": true "useHierarchy": true,
} "showSearch": false,
"searchQuery": ""
},
"icon": "lucide-tags",
"title": "Tags"
} }
}, },
{ {
@ -125,8 +142,13 @@
"state": { "state": {
"type": "outline", "type": "outline",
"state": { "state": {
"file": "postgres/postgres.md" "file": "cpp/C++.md",
} "followCursor": false,
"showSearch": false,
"searchQuery": ""
},
"icon": "lucide-list",
"title": "Outline of C++"
} }
}, },
{ {
@ -134,7 +156,9 @@
"type": "leaf", "type": "leaf",
"state": { "state": {
"type": "git-view", "type": "git-view",
"state": {} "state": {},
"icon": "git-pull-request",
"title": "Source Control"
} }
} }
], ],
@ -157,10 +181,11 @@
}, },
"active": "b4e153fb6dd107ad", "active": "b4e153fb6dd107ad",
"lastOpenFiles": [ "lastOpenFiles": [
"postgres/postgres.md",
"cpp/C++.md",
"README.md", "README.md",
"Untitled.canvas", "Untitled.canvas",
"2024-09-08.md", "2024-09-08.md",
"postgres/postgres.md",
"docker/docker-compose.md", "docker/docker-compose.md",
"docker/docker.md" "docker/docker.md"
] ]

61
cpp/C++.md Normal file
View file

@ -0,0 +1,61 @@
## Template
Templates are a way to dynamically "generate" functions from a template that accept user-defined arguments. They can be used instead of overloading a function. Example:
```cpp
#include <iostream>
using namespace std;
// One function works for all data types. This would work
// even for user defined types if operator '>' is overloaded
// Type (i/d) Func Arg Arg
template <typename T> T myMax(T x, T y)
{
return (x > y) ? x : y;
}
int main()
{
// Call myMax for int
cout << myMax<int>(3, 7) << endl;
// call myMax for double
cout << myMax<double>(3.0, 7.0) << endl;
// call myMax for char
cout << myMax<char>('g', 'e') << endl;
return 0;
}
```
Source: https://www.geeksforgeeks.org/templates-cpp/
## Overloading functions
Overloading a function is a way to make a function execute different instructions when different types of arguments are passed using the same function name.
```cpp
#include <iostream>
using namespace std;
void add(int a, int b)
{
cout << "sum = " << (a + b);
}
void add(double a, double b)
{
cout << endl << "sum = " << (a + b);
}
// Driver code
int main()
{
add(10, 2);
add(5.3, 6.2);
return 0;
}
```
Source: https://www.geeksforgeeks.org/function-overloading-c/