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

Consider adding remove_member_cv_ref and copy_member_cv_ref #139

Open
ldionne opened this issue Apr 17, 2017 · 2 comments
Open

Consider adding remove_member_cv_ref and copy_member_cv_ref #139

ldionne opened this issue Apr 17, 2017 · 2 comments

Comments

@ldionne
Copy link
Member

ldionne commented Apr 17, 2017

Taken from https://lists.boost.org/Archives/boost/2017/04/234374.php:

In "member qualifier features", I'm missing remove_member_cv_ref (obvious semantics) and copy_member_cv_ref (copies cv+ref from one member pointer to another.)

and your reply in https://lists.boost.org/Archives/boost/2017/04/234446.php:

I'm slightly hesitant to add remove_member_cv_ref (remove_member_qualifiers?), because it doesn't quite mirror <type_traits>. Would this also remove noexcept/transaction_safe? I'm conflicted about copy_member_cv_ref, because I'm not sure whether it would be more useful to copy them to a function type or value type.

@pdimov
Copy link
Member

pdimov commented Apr 17, 2017

I admit I don't have a use case for copy_member_cv_ref, so take this suggestion with a grain of salt. copy_cv is often useful for types (T cv, U -> U cv), but the analogy may not hold here.

@willwray
Copy link

willwray commented Jul 26, 2018

FYI I have a use case for copy_member_qualifiers including noexcept along with cv/ref (so the target then has to be a function type).

My application is type reflection where each C++ compound has a reflected version (denoted here with a capital or capitalised acronym):

  1. type -> Type
  2. type const -> CV<Type const>
  3. type& -> Ref<Type&>
  4. ret(args...) const && noexcept -> Fun<Ret(Args...) const && noexcept>

(2) needs a copy_cv, (3) needs a copy_ref and (4) needs this copy_cvref_noexcept

Using the actual qualifiers in the reflected type saves inventing a scheme for encoding and decoding the qualifiers.

This is just FYI, not a request to add this trait to callable_traits.

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

No branches or pull requests

4 participants