{"id":17998957,"url":"https://github.com/albin-johansson/nenya","last_synced_at":"2025-08-17T07:32:13.209Z","repository":{"id":131864234,"uuid":"364606257","full_name":"albin-johansson/nenya","owner":"albin-johansson","description":"A small but powerful library for creating strong types, written in C++20.","archived":true,"fork":false,"pushed_at":"2021-05-05T18:12:34.000Z","size":305,"stargazers_count":3,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"main","last_synced_at":"2025-04-04T07:12:23.285Z","etag":null,"topics":["cpp20","header-only","library","modern-cpp","strong-types","tiny","type-safety"],"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/albin-johansson.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":"2021-05-05T14:34:28.000Z","updated_at":"2024-11-17T18:28:20.000Z","dependencies_parsed_at":null,"dependency_job_id":"968ad675-b25b-4cfc-aa29-519b86123f8c","html_url":"https://github.com/albin-johansson/nenya","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/albin-johansson/nenya","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/albin-johansson%2Fnenya","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/albin-johansson%2Fnenya/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/albin-johansson%2Fnenya/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/albin-johansson%2Fnenya/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/albin-johansson","download_url":"https://codeload.github.com/albin-johansson/nenya/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/albin-johansson%2Fnenya/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":270820680,"owners_count":24651515,"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-08-17T02:00:09.016Z","response_time":129,"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":["cpp20","header-only","library","modern-cpp","strong-types","tiny","type-safety"],"created_at":"2024-10-29T22:09:21.792Z","updated_at":"2025-08-17T07:32:12.703Z","avatar_url":"https://github.com/albin-johansson.png","language":"C++","funding_links":[],"categories":[],"sub_categories":[],"readme":"# nenya\n\n[![License](https://img.shields.io/badge/license-MIT-blue.svg)](https://opensource.org/licenses/MIT)\n[![Language](https://img.shields.io/badge/C%2B%2B-20-blue.svg)](https://en.wikipedia.org/wiki/C%2B%2B#Standardization)\n[![CI: Windows](https://github.com/albin-johansson/nenya/actions/workflows/windows.yml/badge.svg?branch=dev)](https://github.com/albin-johansson/nenya/actions/workflows/windows.yml)\n[![CI: Ubuntu](https://github.com/albin-johansson/nenya/actions/workflows/ubuntu.yml/badge.svg?branch=dev)](https://github.com/albin-johansson/nenya/actions/workflows/ubuntu.yml)\n\nA small but powerful library for creating strong types, written in C++20.\n\n## Usage\n\nYou can use nenya to create strong types, i.e. types that behave pretty much exactly as another type, whilst being a unique type to the compiler. This is extremely useful to avoid hard to find errors, such as passing arguments of the same type in the wrong order, etc. This library can produce strong types that inherit almost all operators of the underlying type.\n\n```C++\n\n#include \u003cnenya.hpp\u003e\n\n// This isn't strictly necessary, but it avoids confusing intellisense.\nnamespace tags {\nstruct row_tag;\nstruct col_tag;\nstruct name_tag;\n}\n\n// Strong types for row and column indices\nusing row_t = nenya::strong_type\u003cint, tags::row_tag\u003e;\nusing col_t = nenya::strong_type\u003cint, tags::col_tag\u003e;\n\n// Also works for non-primitive types\nusing name_t = nenya::strong_type\u003cstd::string, tags::name_tag\u003e;\n\n// Strong types help with creating expressive and unambiguous interfaces\nvoid foo(row_t row, col_t column)\n{\n  // ...\n}\n\nvoid bar()\n{\n  row_t row{42};\n  col_t col{123};\n\n  foo(row, col);  // Fine!\n  // foo(col, row);  // Won't compile, this would normally be a subtle bug!\n\n  name_t name{\"Gandalf\"};\n\n  // Call member functions of the underlying type\n  const auto size = name-\u003esize();\n  auto\u0026 ch = name[0];\n}\n\n```\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Falbin-johansson%2Fnenya","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Falbin-johansson%2Fnenya","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Falbin-johansson%2Fnenya/lists"}