{"id":15047798,"url":"https://github.com/massimo-marino/memvar","last_synced_at":"2025-04-10T01:23:31.670Z","repository":{"id":162666677,"uuid":"107677702","full_name":"massimo-marino/memvar","owner":"massimo-marino","description":"A C++ implementation of a variable with memory of its previous values.","archived":false,"fork":false,"pushed_at":"2025-02-18T18:20:04.000Z","size":114,"stargazers_count":3,"open_issues_count":0,"forks_count":1,"subscribers_count":1,"default_branch":"master","last_synced_at":"2025-03-24T03:05:02.404Z","etag":null,"topics":["cpp","cpp17","cpp20","timestamped-variable","timetagged-variable","variable-with-memory"],"latest_commit_sha":null,"homepage":"","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/massimo-marino.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-10-20T12:52:28.000Z","updated_at":"2025-02-21T20:02:57.000Z","dependencies_parsed_at":"2025-02-16T08:44:21.787Z","dependency_job_id":null,"html_url":"https://github.com/massimo-marino/memvar","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/massimo-marino%2Fmemvar","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/massimo-marino%2Fmemvar/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/massimo-marino%2Fmemvar/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/massimo-marino%2Fmemvar/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/massimo-marino","download_url":"https://codeload.github.com/massimo-marino/memvar/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":248138658,"owners_count":21053914,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","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":["cpp","cpp17","cpp20","timestamped-variable","timetagged-variable","variable-with-memory"],"created_at":"2024-09-24T21:04:50.039Z","updated_at":"2025-04-10T01:23:31.636Z","avatar_url":"https://github.com/massimo-marino.png","language":"C++","funding_links":[],"categories":[],"sub_categories":[],"readme":"# memvar\n\nC++17 implementation of a variable with memory of its past values.\n\n## Requirements\n\n`cmake 3.26.3` is used to compile the sources.\n\nThe cmake files compile with `C++20`.\n\nThe unit tests are implemented in googletest: be sure you have installed googletest to compile.\n\nTo run the performance tests, a RAM of 16GB is needed. If less RAM is available, just reduce the value of `historyCapacity` (line 16 in perfTest.cpp).\n\n## Run Unit Tests\n\n```bash\n$ git clone https://github.com:massimo-marino/memvar.git\n$ cd memvar/unitTests\n$ mkdir build\n$ cd build\n$ cmake ..\n$ make\n$ ./memvar-unit-tests\n```\nIf needed (because cmake fails), copy `FindGMock.cmake` to the Modules directory of cmake.\n\nIn my installation located in my home, it is in `~/cmake-3.26.3-linux-x86_64/share/cmake-3.26/Modules/`\n\n## Run Performance Tests\n\n```bash\n$ git clone https://github.com:massimo-marino/memvar.git\n$ cd memvar/perfTests\n$ mkdir build\n$ cd build\n$ cmake ..\n$ make\n$ ./perfTests\n```\n\n## How to Use it\n\nSee the source code and the unit tests for examples of use.\n\n## Example: Yet Another Way to Compute the Fibonacci Numbers\n```C++\nvoid fibonacciNumbers()\n{\n  // The type stored in the memvar\n  using memvarType = uint64_t;\n  // define the memvar with a history capacity of 100 values\n  // and store fib(0) = 0\n  memvar::memvar\u003cmemvarType\u003e fibs{0, 100};\n  // store fib(1) = 1\n  fibs = 1;\n  // compute and store fib(2) = fib(1) + fib(0)\n  // through fib(93) = fib(92) + fib(91)\n  for (int i = 1; i \u003c= 92; ++i)\n  {\n    // compute fib(n+1) = fib(n) + fib(n-1)\n    fibs += fibs(1);\n  }\n  // print the first 94 fibonacci numbers\n  std::cout \u003c\u003c \"fibs: \"; fibs.printHistoryData();\n}\n```\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmassimo-marino%2Fmemvar","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fmassimo-marino%2Fmemvar","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmassimo-marino%2Fmemvar/lists"}