diff --git a/.obsidian/core-plugins.json b/.obsidian/core-plugins.json index 9405bfd..c89a841 100644 --- a/.obsidian/core-plugins.json +++ b/.obsidian/core-plugins.json @@ -1,20 +1,31 @@ -[ - "file-explorer", - "global-search", - "switcher", - "graph", - "backlink", - "canvas", - "outgoing-link", - "tag-pane", - "page-preview", - "daily-notes", - "templates", - "note-composer", - "command-palette", - "editor-status", - "bookmarks", - "outline", - "word-count", - "file-recovery" -] \ No newline at end of file +{ + "file-explorer": true, + "global-search": true, + "switcher": true, + "graph": true, + "backlink": true, + "canvas": true, + "outgoing-link": true, + "tag-pane": true, + "properties": false, + "page-preview": true, + "daily-notes": true, + "templates": true, + "note-composer": true, + "command-palette": true, + "slash-command": false, + "editor-status": true, + "bookmarks": true, + "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 +} \ No newline at end of file diff --git a/.obsidian/workspace.json b/.obsidian/workspace.json index f44aace..87fe35a 100644 --- a/.obsidian/workspace.json +++ b/.obsidian/workspace.json @@ -13,10 +13,12 @@ "state": { "type": "markdown", "state": { - "file": "postgres/postgres.md", + "file": "cpp/C++.md", "mode": "source", "source": false - } + }, + "icon": "lucide-file", + "title": "C++" } } ] @@ -38,8 +40,11 @@ "state": { "type": "file-explorer", "state": { - "sortOrder": "alphabetical" - } + "sortOrder": "alphabetical", + "autoReveal": false + }, + "icon": "lucide-folder-closed", + "title": "Files" } }, { @@ -54,7 +59,9 @@ "collapseAll": false, "extraContext": false, "sortOrder": "alphabetical" - } + }, + "icon": "lucide-search", + "title": "Search" } }, { @@ -62,7 +69,9 @@ "type": "leaf", "state": { "type": "bookmarks", - "state": {} + "state": {}, + "icon": "lucide-bookmark", + "title": "Bookmarks" } } ] @@ -85,7 +94,7 @@ "state": { "type": "backlink", "state": { - "file": "postgres/postgres.md", + "file": "cpp/C++.md", "collapseAll": false, "extraContext": false, "sortOrder": "alphabetical", @@ -93,7 +102,9 @@ "searchQuery": "", "backlinkCollapsed": false, "unlinkedCollapsed": true - } + }, + "icon": "links-coming-in", + "title": "Backlinks for C++" } }, { @@ -102,10 +113,12 @@ "state": { "type": "outgoing-link", "state": { - "file": "postgres/postgres.md", + "file": "cpp/C++.md", "linksCollapsed": false, "unlinkedCollapsed": true - } + }, + "icon": "links-going-out", + "title": "Outgoing links from C++" } }, { @@ -115,8 +128,12 @@ "type": "tag", "state": { "sortOrder": "frequency", - "useHierarchy": true - } + "useHierarchy": true, + "showSearch": false, + "searchQuery": "" + }, + "icon": "lucide-tags", + "title": "Tags" } }, { @@ -125,8 +142,13 @@ "state": { "type": "outline", "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", "state": { "type": "git-view", - "state": {} + "state": {}, + "icon": "git-pull-request", + "title": "Source Control" } } ], @@ -157,10 +181,11 @@ }, "active": "b4e153fb6dd107ad", "lastOpenFiles": [ + "postgres/postgres.md", + "cpp/C++.md", "README.md", "Untitled.canvas", "2024-09-08.md", - "postgres/postgres.md", "docker/docker-compose.md", "docker/docker.md" ] diff --git a/cpp/C++.md b/cpp/C++.md new file mode 100644 index 0000000..93ed88d --- /dev/null +++ b/cpp/C++.md @@ -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 +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 T myMax(T x, T y) +{ + return (x > y) ? x : y; +} + +int main() +{ + // Call myMax for int + cout << myMax(3, 7) << endl; + // call myMax for double + cout << myMax(3.0, 7.0) << endl; + // call myMax for char + cout << myMax('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 +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/ \ No newline at end of file