{"id":23679434,"url":"https://github.com/bardifarsi/singleton","last_synced_at":"2025-10-14T17:32:30.609Z","repository":{"id":232887224,"uuid":"785370557","full_name":"BardiFarsi/SingleTon","owner":"BardiFarsi","description":"This repository contains an implementation of the Singleton Lazy Initialization design pattern in C++20. The Singleton pattern ensures that a class has only one instance and provides a global point of access to that instance.","archived":false,"fork":false,"pushed_at":"2024-07-24T02:11:01.000Z","size":32,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":0,"default_branch":"main","last_synced_at":"2025-05-21T17:41:16.510Z","etag":null,"topics":["concurrency","concurrent-programming","cpp","cpp17","cpp20","lazy-init","lazy-initialization","lazyinitializationexception","multi-thread","multi-threaded","multi-threading","multi-threads","multiprocessing","multithreaded","multithreading","object-oriented-programming","parallel-computing","parallel-programming","singleton","singleton-pattern"],"latest_commit_sha":null,"homepage":"","language":"C++","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"gpl-3.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/BardiFarsi.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":"2024-04-11T18:51:58.000Z","updated_at":"2024-07-24T02:11:04.000Z","dependencies_parsed_at":"2024-11-11T20:00:20.147Z","dependency_job_id":null,"html_url":"https://github.com/BardiFarsi/SingleTon","commit_stats":null,"previous_names":["bardiparsi/singleton","bardifarsi/singleton"],"tags_count":1,"template":false,"template_full_name":null,"purl":"pkg:github/BardiFarsi/SingleTon","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/BardiFarsi%2FSingleTon","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/BardiFarsi%2FSingleTon/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/BardiFarsi%2FSingleTon/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/BardiFarsi%2FSingleTon/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/BardiFarsi","download_url":"https://codeload.github.com/BardiFarsi/SingleTon/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/BardiFarsi%2FSingleTon/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":279020074,"owners_count":26086806,"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","status":"online","status_checked_at":"2025-10-14T02:00:06.444Z","response_time":60,"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":["concurrency","concurrent-programming","cpp","cpp17","cpp20","lazy-init","lazy-initialization","lazyinitializationexception","multi-thread","multi-threaded","multi-threading","multi-threads","multiprocessing","multithreaded","multithreading","object-oriented-programming","parallel-computing","parallel-programming","singleton","singleton-pattern"],"created_at":"2024-12-29T17:43:05.729Z","updated_at":"2025-10-14T17:32:30.594Z","avatar_url":"https://github.com/BardiFarsi.png","language":"C++","readme":"\n# Singleton Pattern with Lazy Initialization in C++\n\nThis project demonstrates the implementation of the Singleton design pattern with lazy initialization in C++. The Singleton pattern ensures that a class has only one instance and provides a global point of access to that instance.\n\n## Features\n\n- **Lazy Initialization**: The Singleton instance is created only when it is first requested.\n- **Thread Safety**: The implementation is thread-safe to guarantee correct behavior in multi-threaded environments.\n- **Expensive Task Simulation**: Includes a method `expensiveTask()` to simulate an expensive operation, showcasing real-world usage scenarios.\n- **Error Handling**: Proper error handling is implemented to handle invalid arguments and other exceptional situations.\n\n## Requirements\n- This project requires C++20 to compile and run successfully.\n\n## Compilers\nThis project is tested and compatible with the following compilers:\n- Mingw g++\n- Microsoft Visual C++ (MSVC)\n\n## License\nThis project is licensed under the GNU General Public License v3.0 - see the LICENSE file for details.\nFeel free to use this content directly in your README.md file on GitHub.\nAuthor: Bardi (Masoud) Parsi\nContact: farsi.masoud@gmail.com\n\n## Usage\n\nTo use the Singleton pattern in your project, follow these steps:\n\n1. Include the `SingleTon.h` header file in your project.\n2. Use the `getInstance()` method to obtain the Singleton instance.\n3. Call the desired methods or perform operations on the Singleton object.\n\n```cpp\n#include \"SingleTon.h\"\n\nint main() {\n    // Obtain the Singleton instance\n    SingleTon* singleton = SingleTon::getInstance();\n\n    // Use the Singleton instance\n    singleton-\u003eexpensiveTask(42);\n\n    return 0;\n}\n","funding_links":[],"categories":[],"sub_categories":[],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fbardifarsi%2Fsingleton","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fbardifarsi%2Fsingleton","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fbardifarsi%2Fsingleton/lists"}