{"id":13418042,"url":"https://github.com/sftrabbit/CppPatterns-Patterns","last_synced_at":"2025-03-15T02:32:29.008Z","repository":{"id":29930192,"uuid":"33476335","full_name":"sftrabbit/CppPatterns-Patterns","owner":"sftrabbit","description":"A repository of modern C++ patterns curated by the community.","archived":false,"fork":false,"pushed_at":"2022-08-15T15:42:39.000Z","size":209,"stargazers_count":1426,"open_issues_count":19,"forks_count":224,"subscribers_count":129,"default_branch":"master","last_synced_at":"2024-08-05T02:01:23.597Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":"","language":"C++","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"cc0-1.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/sftrabbit.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE.txt","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2015-04-06T10:09:05.000Z","updated_at":"2024-07-25T18:05:49.000Z","dependencies_parsed_at":"2022-09-10T18:50:28.397Z","dependency_job_id":null,"html_url":"https://github.com/sftrabbit/CppPatterns-Patterns","commit_stats":null,"previous_names":["sftrabbit/cppsamples-samples"],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/sftrabbit%2FCppPatterns-Patterns","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/sftrabbit%2FCppPatterns-Patterns/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/sftrabbit%2FCppPatterns-Patterns/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/sftrabbit%2FCppPatterns-Patterns/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/sftrabbit","download_url":"https://codeload.github.com/sftrabbit/CppPatterns-Patterns/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":221532188,"owners_count":16838913,"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":[],"created_at":"2024-07-30T22:00:57.781Z","updated_at":"2025-03-15T02:32:29.002Z","avatar_url":"https://github.com/sftrabbit.png","language":"C++","readme":"# C++ Patterns - Patterns\n\n[C++ Patterns](https://cpppatterns.com/) is a repository of code patterns\nillustrating a modern\nand idiomatic approach to writing C++. The aim is to provide\nbeginner to intermediate C++ developers a reference for solving common\nproblems in C++. As the C++ language and library evolve, which they\nhave been doing rapidly since the release of C++11, these patterns\nwill be updated to match the current state-of-the-art in idiomatic C++\ndevelopment.\n\nThis repository contains the source for the patterns themselves, which\nis used when building the C++ Patterns web front-end. For the front-end\nsource, see [sftrabbit/CppPatterns-Web](https://github.com/sftrabbit/CppPatterns-Web).\n\n## Contributing\n\nTo contribute new patterns or edit existing ones, please fork this\nrepository and submit pull requests for your changes. Please read\nthe following guidelines before contributing.\n\n### TODO list\n\nFor sample ideas, please see the\n[issues page](https://github.com/sftrabbit/CppPatterns-Patterns/issues)\nfor suggestions. If you don't feel like writing patterns yourself,\nfeel free to add suggestions to this page.\n\n## Guidelines\n\n### What makes a good pattern?\n\nA good pattern:\n\n- uses only modern C++ language and standard library features.\n- is generic and therefore widely applicable.\n- is understandable for C++ beginners.\n- acts as a starting point for learning about C++ features.\n\n### File names\n\nEach pattern is a `.cpp` file that exists within a category and a\nsection. In the repository, these files have the following path:\n\n    \u003ccategory\u003e/\u003csection\u003e/\u003cpattern\u003e.cpp\n\nThe categories are very broad and it is not expected that new\ncategories will be added any time soon. If your pattern does not\nfit into an existing section, feel free to create a new section.\nEvery category and section contains a `TITLE` file, giving the\nname of that category or section.\n\nWhen the web front-end is built, numeric prefixes are stripped from\ncategory names and the section is removed. For example, the following\npattern source:\n\n    1-common-tasks/classes/pimpl.cpp\n\nis given the following page in the web front-end:\n\n    common-tasks/pimpl.html\n\nThe purpose of removing the section directory is to ensure URLs do\nnot change when moving patterns between sections. For this reason,\nall pattern file names within a category must be unique.\n\nEven if the title of a pattern changes, please avoid changing the\nfile name. If the pattern changes significantly enough for the\nfile name to change, then it should be a new pattern.\n\n### File format\n\nEvery pattern `.cpp` file must be structured as follows:\n\n    // Title\n    // Tag1, Tag2\n\n    Example code\n\n    // Intent paragraph\n    //\n    // Description paragraph #1\n    //\n    // Description paragraph #2\n\n    Hidden code\n\nThe title comment and tags comment must each be a single line. The\ntags comment is optional. The tags line should be a comma separated\nlist of tags.\n\nThe intent and description are processed as an extended form of\n[Markdown](http://daringfireball.net/projects/markdown/), which means\nthat they support formatting such as italics, bold text, links, lists,\nand line references.\n\nThe example code section is displayed on the pattern page and should\ncontain everything required to understand the pattern. The hidden code\nsection should contain any additional code that is required in order\nfor the file to compile and is not shown on the pattern page.\n\nPlease keep to a width of approximately 70 characters for those who\nmight view the source without wrapping.\n\n### Markdown extensions\n\nThe pattern description is processed as a form of Markdown with the\nfollowing extensions:\n\n1.  Line references are added with the `[XX-YY]` syntax. The `-YY` is\n    optional and used to denote a range of lines. An exclamation mark\n    after the opening bracket causes the output to be capitalized.\n\n    The numbers provided should denote line numbers in the original\n    `.cpp` file. They will be offset automatically when building the\n    web front-end.\n\n    For example, `[10]` may expand to `line 8`, `[10-14]` may expand\n    to `lines 8-12`, and `[!15]` may expand to `Line 13` (note the\n    capital L).\n\n2.  To simplify links to [cppreference.com](http://en.cppreference.com/w/),\n    any link whose URL begins with `c/` or `cpp/` will automatically link\n    to the appropriate page on cppreference.com.\n\n### Code style\n\nThe only strict requirement on code style is that it should be\nidiomatic and modern C++. The exact formatting of code is not too\nimportant - in fact, variations in style can be useful.\n\nThere are a few simple guidelines:\n\n-   Avoid using `auto` for two reasons: firstly, the patterns are\n    intended to be used as a reference for beginner C++ developers,\n    and the types involved are important to help with their\n    understanding; secondly, a consensus has not been reached on when\n    it is appropriate to use `auto`.\n\n-   Use the uniform initialisation syntax where possible.\n\n-   Name entities with generic names (`foo`, `bar`, `func`, `x`, etc.).\n\n-   Keep the example code as simple as possible. Give the bare minimum\n    required to understand the pattern.\n\n-   Do not use inline comments for explaining the pattern - that's what\n    the pattern description should do. Use inline comments only as a\n    placeholder for omitted code.\n\n### Writing style\n\nThe writing style for the intent and description are also not strict.\nHowever, there are a few guidelines that should be kept in mind:\n\n-   Use the personal pronoun \"we\" when describing the pattern, as\n    though you and the reader wrote this code together. It helps\n    to make the description more personable.\n\n-   Use line references whenever appropriate. It allows the reader\n    cross-reference between the code and the description.\n\n-   The intent should be a simple sentence or two describing what\n    the purpose of the pattern is.\n","funding_links":[],"categories":["TODO scan for Android support in followings","Websites","C++"],"sub_categories":[],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fsftrabbit%2FCppPatterns-Patterns","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fsftrabbit%2FCppPatterns-Patterns","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fsftrabbit%2FCppPatterns-Patterns/lists"}