Title: do not depend on lifetime of user object in `TokenList` · Issue #424 · cppcheck-opensource/simplecpp · GitHub
Open Graph Title: do not depend on lifetime of user object in `TokenList` · Issue #424 · cppcheck-opensource/simplecpp
X Title: do not depend on lifetime of user object in `TokenList` · Issue #424 · cppcheck-opensource/simplecpp
Description: TokenList depends on a mutable std::vector
Open Graph Description: TokenList depends on a mutable std::vector
X Description: TokenList depends on a mutable std::vector<std::string> object which holds the files of files which have been tokenized. This seems dangerous as it ties to the lifetime of another object. In ...
Opengraph URL: https://github.com/cppcheck-opensource/simplecpp/issues/424
X: @github
Domain: github.com
{"@context":"https://schema.org","@type":"DiscussionForumPosting","headline":"do not depend on lifetime of user object in `TokenList`","articleBody":"`TokenList` depends on a mutable `std::vector\u003cstd::string\u003e` object which holds the files of files which have been tokenized. This seems dangerous as it ties to the lifetime of another object. In some cases this vector is not even necessary to be owned by the user since it is not used outside of the `TokenList`. It looks the list this could just be owned by `TokenList`\n\nThis supported by the fact that the copy constructors and assignment operators copy the reference which means that two different instances will modify that \"global\" vector which is obviously wrong and will cause issues.\n\nThere was some usage which provides the input file via that vector parameter instead of (or additionally) to the filename parameter. This allows to tokenize multiples explicitly but I am not sure if that is even necessary. This might have contributed to the assumption that it is necessary to provide that vector.","author":{"url":"https://github.com/firewave","@type":"Person","name":"firewave"},"datePublished":"2025-04-07T07:02:50.000Z","interactionStatistic":{"@type":"InteractionCounter","interactionType":"https://schema.org/CommentAction","userInteractionCount":3},"url":"https://github.com/424/simplecpp/issues/424"}
| route-pattern | /_view_fragments/issues/show/:user_id/:repository/:id/issue_layout(.:format) |
| route-controller | voltron_issues_fragments |
| route-action | issue_layout |
| fetch-nonce | v2:59aaaffc-a44f-15f8-218d-cb7cf264499a |
| current-catalog-service-hash | 81bb79d38c15960b92d99bca9288a9108c7a47b18f2423d0f6438c5b7bcd2114 |
| request-id | 92A2:391A54:40A70E:587A57:6A4DA1C5 |
| html-safe-nonce | fcd48ff6071d9073e96a6bf72d92dd1e33efc53b67799ae85b9aeee7541824a4 |
| visitor-payload | eyJyZWZlcnJlciI6IiIsInJlcXVlc3RfaWQiOiI5MkEyOjM5MUE1NDo0MEE3MEU6NTg3QTU3OjZBNERBMUM1IiwidmlzaXRvcl9pZCI6IjYxNTQyMTA1MzY1ODgxNTczODEiLCJyZWdpb25fZWRnZSI6ImlhZCIsInJlZ2lvbl9yZW5kZXIiOiJpYWQifQ== |
| visitor-hmac | d63ac86f32d590d2484017055d3d55fc4721719fd87f9468ff7e2d4ef4179e23 |
| hovercard-subject-tag | issue:2975834963 |
| github-keyboard-shortcuts | repository,issues,copilot |
| google-site-verification | Apib7-x98H0j5cPqHWwSMm6dNU4GmODRoqxLiDzdx9I |
| octolytics-url | https://collector.github.com/github/collect |
| analytics-location | / |
| fb:app_id | 1401488693436528 |
| apple-itunes-app | app-id=1477376905, app-argument=https://github.com/_view_fragments/issues/show/cppcheck-opensource/simplecpp/424/issue_layout |
| twitter:image | https://opengraph.githubassets.com/5c5d24471e1966db5a1bff5a3eecef759d500e45d9a646e95ddc5ca10f681f16/cppcheck-opensource/simplecpp/issues/424 |
| twitter:card | summary_large_image |
| og:image | https://opengraph.githubassets.com/5c5d24471e1966db5a1bff5a3eecef759d500e45d9a646e95ddc5ca10f681f16/cppcheck-opensource/simplecpp/issues/424 |
| og:image:alt | TokenList depends on a mutable std::vector |
| og:image:width | 1200 |
| og:image:height | 600 |
| og:site_name | GitHub |
| og:type | object |
| og:author:username | firewave |
| hostname | github.com |
| expected-hostname | github.com |
| None | 06b8a6144231bf3a234f1c2e9993861e07ce98a905912b114aa386c2d7e84b33 |
| turbo-cache-control | no-preview |
| go-import | github.com/cppcheck-opensource/simplecpp git https://github.com/cppcheck-opensource/simplecpp.git |
| octolytics-dimension-user_id | 278097703 |
| octolytics-dimension-user_login | cppcheck-opensource |
| octolytics-dimension-repository_id | 33434464 |
| octolytics-dimension-repository_nwo | cppcheck-opensource/simplecpp |
| octolytics-dimension-repository_public | true |
| octolytics-dimension-repository_is_fork | false |
| octolytics-dimension-repository_network_root_id | 33434464 |
| octolytics-dimension-repository_network_root_nwo | cppcheck-opensource/simplecpp |
| turbo-body-classes | logged-out env-production page-responsive |
| disable-turbo | false |
| browser-stats-url | https://api.github.com/_private/browser/stats |
| browser-errors-url | https://api.github.com/_private/browser/errors |
| release | 7f13faa65cccc9b729d674da83335d5dcfdfd193 |
| ui-target | full |
| theme-color | #1e2327 |
| color-scheme | light dark |
Links:
Viewport: width=device-width