{"id":20483378,"url":"https://github.com/styczynski/poly-var-cpp","last_synced_at":"2026-06-01T03:31:50.405Z","repository":{"id":79817406,"uuid":"83517346","full_name":"styczynski/poly-var-cpp","owner":"styczynski","description":"Just-for-fun implementation of polymorphic variables in C/C++","archived":false,"fork":false,"pushed_at":"2018-02-13T16:40:10.000Z","size":50,"stargazers_count":1,"open_issues_count":0,"forks_count":0,"subscribers_count":3,"default_branch":"master","last_synced_at":"2025-03-05T16:16:22.718Z","etag":null,"topics":["c-plus-plus","cpp","library","polymorphic","polymorphic-types","variables-and-their-usages"],"latest_commit_sha":null,"homepage":null,"language":"C++","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/styczynski.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2017-03-01T05:53:47.000Z","updated_at":"2021-09-12T12:41:39.000Z","dependencies_parsed_at":null,"dependency_job_id":"14674bf1-0469-4e91-90e2-4f6892ff939d","html_url":"https://github.com/styczynski/poly-var-cpp","commit_stats":null,"previous_names":[],"tags_count":2,"template":false,"template_full_name":null,"purl":"pkg:github/styczynski/poly-var-cpp","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/styczynski%2Fpoly-var-cpp","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/styczynski%2Fpoly-var-cpp/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/styczynski%2Fpoly-var-cpp/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/styczynski%2Fpoly-var-cpp/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/styczynski","download_url":"https://codeload.github.com/styczynski/poly-var-cpp/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/styczynski%2Fpoly-var-cpp/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":33759178,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-05-26T15:22:16.424Z","status":"online","status_checked_at":"2026-06-01T02:00:06.963Z","response_time":115,"last_error":null,"robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":true,"can_crawl_api":true,"host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["c-plus-plus","cpp","library","polymorphic","polymorphic-types","variables-and-their-usages"],"created_at":"2024-11-15T16:17:10.407Z","updated_at":"2026-06-01T03:31:50.397Z","avatar_url":"https://github.com/styczynski.png","language":"C++","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Polymorphic variables in C++\n\n[![Made by Styczynsky Digital Systems][badge sts]][link styczynski]\n\n[![Platform - Node][badge support ccpp]][link styczynski]\n\nJust-for-fun implementation of polymorphic variables in C/C++\n\n```c++\n#include \u003cvar\u003e\n#include \u003cvar_math\u003e\n#include \u003cvar_test\u003e\nusing namespace variable;\n\nint main(void) {\n\n  /* Constructing a polymorphic-type tree */\n\tvar hmap = var::Hashmap;\n\thmap[\"foo\"] = \"bar\";\n\n\tvar a = hmap.ref();\n\tvar ref = {a.ref(), 42};\n\tvar ref2 = {ref.ref(), 69, 25};\n\tvar tree = { {{}, 12, {}}, \"ala\", {{}, 69, {}} };\n\n  vardbg(tree);\n\n\treturn 0;\n}\n\n```\n\n## Usage\n\nClone the repository, go to the directory where it's placed\nand do `make` to get information about functionality of makefile.\n\nIf you want to compile all examples do `make all`\nAnd then run any of the examples by running  `make run-example-aritm`, `make run-example-tree` etc.\n\nThe basic usage looks like this:\n\n```c++\n#include \u003cvar\u003e\nusing namespace variable;\n\nint main() {\n  var x = 0;\n  x += \"2.5\";\n  cout\u003c\u003cx\u003c\u003c\"\\n\";\n\n  return 0;\n}\n```\n\nOr if you want to use printf/scanf style:\n\n```c++\n#include \u003cvar\u003e\nusing namespace variable;\n\nint main() {\n  var x = 0;\n  x += \"2.5\";\n  printf(\"%d\", (int)x);\n\n  return 0;\n}\n```\n\nYou can read the standard input too (floats for example):\n\n```c++\n  var x;\n  cin \u003e\u003e x.castToFloat();\n```\n\nOr:\n```c++\n  var x;\n  scanf(\"%f\", (float*)x);\n```\n\n\n## More examples\n\nCheckout examples/src for details about functionality of the module.\nAlso you can see ./include/var.h to get more details.\n\n[badge sts]: https://img.shields.io/badge/-styczynsky_digital_systems-blue.svg?style=flat-square\u0026logoWidth=20\u0026logo=data%3Aimage%2Fpng%3Bbase64%2CiVBORw0KGgoAAAANSUhEUgAAABYAAAAXCAYAAAAP6L%2BeAAAABmJLR0QA%2FwD%2FAP%2BgvaeTAAAACXBIWXMAAA7DAAAOwwHHb6hkAAAAB3RJTUUH4AgSEh0nVTTLngAAAB1pVFh0Q29tbWVudAAAAAAAQ3JlYXRlZCB3aXRoIEdJTVBkLmUHAAAAm0lEQVQ4y2Pc%2Bkz2PwMNAAs2wVMzk4jSbJY%2BD6ccEwONACMsKIh1JSEgbXKeQdr4PO1cPPQMZiGkoC7bkCQD7%2Fx7znDn35AOClK9PEJSBbNYAJz999UGrOLocsM0KHB5EZ%2FXPxiVMDAwMDD8SP3DwJA6kFka5hJCQOBcDwMDAwPDm3%2FbGBj%2BbR8tNrFUTbiAB8tknHI7%2FuTilAMA9aAwA8miDpgAAAAASUVORK5CYII%3D\n\n[badge support ccpp]: https://img.shields.io/badge/platform-c%2Fc%2B%2B-blue.svg?style=flat-square\u0026logo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zdOz6t3eRC5hIrRBxGw4alYk8Wwu2pNLDWW77LpsESR0hF9RuLeX%0AMgrrxbYcAQA%2FnmDBRZqdmpBHhnLSZJLnHyfp8PlbagIbsuW0%2BKRGpDuRqwMgiIdh0VwhgZJd2kjR%0AuQUxxsG4af5%2BFa3MSBcdGJmYprzK614ziagL7aWThTtF90gUSV3BjUIqUwEVHJdOoBAS8CTuPnio%0ALnVxLRjfm8T8eXzKqvG1kibRIwLP8L%2BNS4%2F65Lwcvrccp%2Bz1a%2BwpGR4JxJIXi6kAsXE4MljPSE%2Bj%0A3w%2BqxOUiMT9pEkUiKaCfNYC9JxZz4fuI%2FgGlbtJ34E8YtQAAAABJRU5ErkJggg%3D%3D\n\n[link styczynski]: http://styczynski.in\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fstyczynski%2Fpoly-var-cpp","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fstyczynski%2Fpoly-var-cpp","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fstyczynski%2Fpoly-var-cpp/lists"}