-
Notifications
You must be signed in to change notification settings - Fork 83
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
empty_init convenience #63
Comments
A |
That will work. The reason I mention the enum alternative, is that when I had to investigate the binary size of a large embedded project, I found a |
I suppose, we should mark |
It's also why I never created an empty_init constant initially. The four extra characters "_t()" did not seem like.a big deal. :) Users will always create constants if they want them, maybe even shorter names than the ones we might provide. (We could even just create a type alias for |
I think the mental pattern to assign a global value (think |
There is an issue for C++17 inline constant is good general solution, but for integers or tags the enum solution works with older compilers as well. |
Enum, if we're talking about unscoped enums, has the potential to be converted to |
|
Wait, no, this was only true for static class members. Namespace-scope Maybe we need to add |
I'm not a fan of the |
Honestly, I don't see the point of |
Sounds fine to me. So in this case, usage would be of the form: |
Yes. |
And in the case where |
Yes, we're fine. Namespace-scope constants have internal linkage by default. |
@pdimov Do you remember why bind couldn't have the placeholder constants in GCC versions before 4?
|
|
No, I don't. |
Looking at the history, it was probably a precompiled header problem. |
* Added a convenience instance of empty_init_t. Closes #63.
Instantiating
boost::empty_value
with arguments is done using theempty_init_t
tag. This means that we have to write something likebase(empty_init_t{}, args...
.Can we add an
empty_init
instance of that tag, so we can writebase(empty_init, args...)
?We can avoid the usual problems of header-only instantiations of a global object by changing
struct empty_init_t {};
intoenum empty_init_t { empty_init };
.The text was updated successfully, but these errors were encountered: