-
Notifications
You must be signed in to change notification settings - Fork 387
Replace custom BaseString with std::string and std::basic_string #5682
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
Conversation
Co-authored-by: max-charlamb <44248479+max-charlamb@users.noreply.github.com>
Co-authored-by: max-charlamb <44248479+max-charlamb@users.noreply.github.com>
Co-authored-by: max-charlamb <44248479+max-charlamb@users.noreply.github.com>
Co-authored-by: max-charlamb <44248479+max-charlamb@users.noreply.github.com>
…erloads Co-authored-by: max-charlamb <44248479+max-charlamb@users.noreply.github.com>
Co-authored-by: max-charlamb <44248479+max-charlamb@users.noreply.github.com>
Co-authored-by: max-charlamb <44248479+max-charlamb@users.noreply.github.com>
…ions Co-authored-by: max-charlamb <44248479+max-charlamb@users.noreply.github.com>
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Pull request overview
This PR removes the custom BaseString template class (~150 lines) from util.h and replaces it with standard library string types (std::string and std::basic_string<WCHAR>). The change modernizes the codebase by leveraging STL instead of maintaining custom string implementations.
Changes:
- Removed custom
BaseStringtemplate class and replaced type definitions withstd::stringandstd::basic_string<WCHAR> - Updated method calls from
GetLength()to standardlength()and added explicitc_str()calls where implicit conversions previously occurred - Added explicit
WString()constructor wrapping for Format objects in string concatenation expressions to work withstd::basic_string's operator+
Reviewed changes
Copilot reviewed 3 out of 3 changed files in this pull request and generated 1 comment.
| File | Description |
|---|---|
| src/SOS/Strike/util.h | Removed BaseString template class, updated typedefs to use STL types, and added .c_str() calls in Format conversion operator and TableOutput methods |
| src/SOS/Strike/util.cpp | Updated string concatenations with Format objects to use explicit WString() wrapping, changed GetLength() to length(), and added intermediate pointer variable for ArrayHolder |
| src/SOS/Strike/strike.cpp | Added explicit WString() wrapping for Format object concatenations and updated all ExtOut calls to use .c_str() on String objects across all platform-specific sections |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
…uirements Co-authored-by: max-charlamb <44248479+max-charlamb@users.noreply.github.com>
Replace BaseString in util.h with std::string and std::basic_string
This PR replaces the custom
BaseStringtemplate class with standard STL string types as suggested in the PR review comment from PR #5594.Plan:
Changes made:
BaseStringtemplate class from util.h (150+ lines of code)Stringtypedef fromBaseString<char, strlen, strcpy_s>tostd::stringWStringtypedef fromBaseString<WCHAR, _wcslen, wcscpy_s>tostd::basic_string<WCHAR>GetLength()calls tolength()(std::string standard method).c_str()calls where neededWString()constructor wrappingoperator WString(), but it's not invoked when used with std::string's operator+. Therefore, explicit wrapping withWString()is necessary..c_str()on string parametersExtOut,DMLOut, etc.), explicitly call.c_str()to convert toPCSTRTesting:
Original prompt
💡 You can make Copilot smarter by setting up custom instructions, customizing its development environment and configuring Model Context Protocol (MCP) servers. Learn more Copilot coding agent tips in the docs.