macro for "construct on first use"#1629
Merged
danielhochman merged 1 commit intomasterfrom Sep 13, 2017
Merged
Conversation
mattklein123
approved these changes
Sep 12, 2017
Member
mattklein123
left a comment
There was a problem hiding this comment.
Very nice. I like it. @htuch any thoughts?
htuch
reviewed
Sep 13, 2017
Member
htuch
left a comment
There was a problem hiding this comment.
I like it as well. Two suggestions for further boiler plate reduction that came up while reading this PR. While we can keep the base CONSTRUCT_ON_FIRST_USE macro as it's flexible and applies everywhere, we could layer on top of that:
- A macro to generate the method/function body when the method is only a wrapper around the macro. This will make declaring non-POD statics in classes and anonymous namespaces as simple as the POD variants.
- Could have a specialized string variant as well that avoids needing to
std::stringeverywhere. This one I don't feel that strongly about.
Contributor
Author
|
@htuch i considered the first option. some functions are static, some are const, some are override, so there's not really a prevailing form. i'll merge this in its current form and if the function becomes more prevalent in one form in the future we can create a macro then. |
jpsim
pushed a commit
that referenced
this pull request
Nov 28, 2022
Signed-off-by: Jose Nino <jnino@lyft.com> Signed-off-by: JP Simard <jp@jpsim.com>
jpsim
pushed a commit
that referenced
this pull request
Nov 29, 2022
Signed-off-by: Jose Nino <jnino@lyft.com> Signed-off-by: JP Simard <jp@jpsim.com>
mathetake
added a commit
that referenced
this pull request
Mar 3, 2026
**Description** This adds a new field 'prefix' as discussed in #1639. tldr is that the existing "version" field has been overused in various and confusing ways. Notably for OpenAI, it was literally used for expressing the prefix of the endpoints and not really a version in any sense. **Related Issues/PRs (if applicable)** Closes #1639 Closes #1629 --------- Signed-off-by: Takeshi Yoneda <t.y.mathetake@gmail.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Implements https://isocpp.org/wiki/faq/ctors#static-init-order-on-first-use in macro form. I decided to try and take a more general approach than implement
SINGLETON_STRINGonly. Could be convinced otherwise.