{"id":16609335,"url":"https://github.com/willbrennan/learn_stl","last_synced_at":"2025-03-23T14:31:12.953Z","repository":{"id":48959037,"uuid":"106976546","full_name":"WillBrennan/learn_stl","owner":"WillBrennan","description":"Learning how the C++ Standard Library works; by implementation","archived":false,"fork":false,"pushed_at":"2021-07-26T19:28:54.000Z","size":84,"stargazers_count":26,"open_issues_count":4,"forks_count":5,"subscribers_count":4,"default_branch":"master","last_synced_at":"2025-03-18T21:09:00.191Z","etag":null,"topics":["cpp","cpp-course","cpp-library","cpp17","learning-by-doing","learning-cplusplus"],"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/WillBrennan.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":".github/FUNDING.yml","license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null},"funding":{"patreon":"WillBrennan"}},"created_at":"2017-10-15T02:01:42.000Z","updated_at":"2024-05-18T02:11:07.000Z","dependencies_parsed_at":"2022-08-31T04:00:32.486Z","dependency_job_id":null,"html_url":"https://github.com/WillBrennan/learn_stl","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/WillBrennan%2Flearn_stl","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/WillBrennan%2Flearn_stl/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/WillBrennan%2Flearn_stl/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/WillBrennan%2Flearn_stl/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/WillBrennan","download_url":"https://codeload.github.com/WillBrennan/learn_stl/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":245115760,"owners_count":20563229,"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","cpp-course","cpp-library","cpp17","learning-by-doing","learning-cplusplus"],"created_at":"2024-10-12T01:28:48.721Z","updated_at":"2025-03-23T14:31:12.539Z","avatar_url":"https://github.com/WillBrennan.png","language":"C++","readme":"# Learn STL\n### Learning about the C++ Standard Library by Implementation\nEver wondered how std::tuple is implemented? How std::get works? Well I started implementing this to find out just that.\n\nThe standard library heavily relies on many [C++ Idioms](https://en.wikibooks.org/wiki/More_C%2B%2B_Idioms) and unusual language features, by implementing the library you can get a bit more familiar with them!\n\nEach of the components have documentation in *[/docs](https://github.com/WillBrennan/learn_stl/tree/master/docs)* explaining how they work, what idioms the use, and whats interesting about them. \n\nHopefully you'll find this an interesting read!\n\nFeel free to submit a PR adding more components or improving library / documentation!\n\n### Vocab Types\n#### [`any`](https://github.com/WillBrennan/learn_stl/blob/master/docs/any.md)\nAny is the de-facto type-erasure method in C++, it provides type-safe container for single values of any type. The implementation provides an introduction to polymorphism in C++.\n\n#### [`optional`](https://github.com/WillBrennan/learn_stl/blob/master/docs/optional.md)\nHow can you store an object without a default-constructor on the stack? Well with a `union` is how, but what is this weird special type.\n\n#### [`tuple`](https://github.com/WillBrennan/learn_stl/blob/master/docs/tuple.md)\nTuple heavily depends on variadic templates and `std::index_sequence`, and isn't obvious how its implemented. It's a refreshing look at \nfeatures which aren't used day-to-day.\n\n#### [`variant`](https://github.com/WillBrennan/learn_stl/blob/master/docs/variant.md)\nAnother component thats heavily dependent on variadic templates, it employs more template metaprogramming tricks than `tuple`. It also provides an interesting use case of `aligned_storage`.\n\n### Containers\n#### [`array`](https://github.com/WillBrennan/learn_stl/blob/master/docs/array.md)\nArray is deceptively simple, but how are its constructors and destructors implicity declared? Why is array constexpr but vector isn't, and what is aggregate-initialization?\nUnderstanding Array requires a strong comprehension of these often over-looked language features.\n\n#### [`vector`](https://github.com/WillBrennan/learn_stl/blob/master/docs/vector.md)\nEveryone knows `std::vector` right? But why is reserving so important? And what is `std::allocator` and why wrap it in `std::allocator_traits`?\n\n#### [`valarray`](https://github.com/WillBrennan/learn_stl/blob/master/docs/valarray.md)\n`valarray` provides an introduction to expression-templates. It stores elements in a vector, and it provides element-wise unary and binary operations. It won't create any temporaries and will only perform one iteration as it evaluates the expression for each resultant element.\n\n### Memory Mangement\n#### [`unique_ptr`](https://github.com/WillBrennan/learn_stl/blob/master/docs/memory.md#unique_ptr)\n`unique_ptr` is pretty simple, but its always good to understand what `std::default_deleter` does and how dangerous aggregate initialisation can be\n\n#### [`addressof`](https://github.com/WillBrennan/learn_stl/blob/master/docs/memory.md#addressof)\n`addressof` might seem like a verbose way of calling `\u0026T`; but why does it exist? And why is it constexpr in C++17 and what does a constexpr pointer mean? \n\n#### [`allocator`](https://github.com/WillBrennan/learn_stl/blob/master/docs/memory.md#allocator)\n`allocator` is relatively simple, but why does it define `is_always_equal` and `propagate_on_container_move_assignment`.\n\n","funding_links":["https://patreon.com/WillBrennan"],"categories":[],"sub_categories":[],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fwillbrennan%2Flearn_stl","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fwillbrennan%2Flearn_stl","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fwillbrennan%2Flearn_stl/lists"}