Skip to content
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

String manipulation functions added #259

Open
wants to merge 2 commits into
base: main
Choose a base branch
from

Conversation

NemesisWasAlienToo
Copy link

I have added some basic functionality for compile-time manipulation such as find, count, split and replace.
If this poll request is accepted I will try to add compile-time regex::replace too.

@hanickadot
Copy link
Owner

What's the motivation for this change? Only usage for ctll::fixed_string is ability to store pattern in order to parse it. Also you can always just cast it into std::u32string_view and do the operations there.

@NemesisWasAlienToo
Copy link
Author

NemesisWasAlienToo commented Jun 8, 2022

Im am working on my web framework and in it am using ctre for routing.
I needed these utilitties in order to create the right compile time regex from user input and to later on use it inside my router.

@NemesisWasAlienToo
Copy link
Author

NemesisWasAlienToo commented Jun 12, 2022

What should i do now to get it to merge?

@hanickadot
Copy link
Owner

Explain me why it needs to be part of CTRE and not your library. Seems like your functions are pretty standalone. What's the additional value for CTRE?

@NemesisWasAlienToo
Copy link
Author

NemesisWasAlienToo commented Jun 12, 2022

It can be used to implement ctre::repace functionality and do compile time regex replacement.
And besides I think it can be useful to have compile time string manipulation facilities at hand.
Since other libraries might try to use ctre and they need to implememt these functions every time and later find a way to construct ctll::fixed_string from their own version of it.
So i can be beneficial to have them at hand.

@hanickadot
Copy link
Owner

It's a lot of maybe. Nothing you are currently trying to add is needed for CTRE. I would prefer to merge or see complete replace implementation if you want so. Then I can decide what's needed and in which form.

@NemesisWasAlienToo
Copy link
Author

Fair enough

@brouhaha
Copy link

I desperately needed the ability to concatenate a ctll::fixed_string template parameter with a string literal in the template, and found this very useful as I didn't previously have any idea how to do that myself. I'm not trying to disagree with the idea that this doesn't need to be in the ctre package, but if it hadn't been in this pull request, I probably would have been pestering someone for assistance.
I used ideas from this together with an idea from https://stackoverflow.com/a/62823211 to get a slightly different variant.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants