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

Different deduction guides in paper and implementation of indirect #497

Closed
Ukilele opened this issue Jan 13, 2025 · 4 comments
Closed

Different deduction guides in paper and implementation of indirect #497

Ukilele opened this issue Jan 13, 2025 · 4 comments

Comments

@Ukilele
Copy link
Collaborator

Ukilele commented Jan 13, 2025

Hey, I just realized that the deduction guides described in the proposal D3019R12 are different from the ones in the implementation of indirect.

Proposal:

template <class Value>
indirect(Value) -> indirect<Value>;

template <class Allocator, class Value>
indirect(allocator_arg_t, Allocator, Value) -> indirect<Value,
         typename allocator_traits<Allocator>::template rebind_alloc<Value>>;

Implementation

template <typename Value>
indirect(Value) -> indirect<Value>;

template <typename Value>
indirect(std::in_place_t, Value) -> indirect<Value>;

template <typename Alloc, typename Value>
indirect(std::allocator_arg_t, Alloc, std::in_place_t, Value) -> indirect<
    Value, typename std::allocator_traits<Alloc>::template rebind_alloc<Value>>;

Not sure what the right solution here is, but I at least wanted to report it asap.

@Ukilele
Copy link
Collaborator Author

Ukilele commented Jan 13, 2025

While we are at it, a small follow-up question regarding deduction guides and CTAD: Does https://www.open-std.org/jtc1/sc22/wg21/docs/papers/2021/p1518r2.html somehow also apply to indirect?

I.e. should it be:

- constexpr indirect(allocator_arg_t, const Allocator& a, const indirect& other);
+ constexpr indirect(allocator_arg_t, const type_identity_t<Allocator>& a, const indirect& other);

- constexpr indirect(allocator_arg_t, const Allocator& a, indirect&& other);
+ constexpr indirect(allocator_arg_t, const type_identity_t<Allocator>& a, indirect&& other);

I am not sure, but I got reminded of P1518 and at least wanted to mention it.

@jbcoe
Copy link
Owner

jbcoe commented Jan 14, 2025

Thanks @Ukilele. The implementation should be brought in line with the proposal (on this front and others).

@jbcoe
Copy link
Owner

jbcoe commented Jan 14, 2025

I'm not sure about P1518. I'll have to dig in and follow up next week. What do you think the right direction is?

Possibly related: microsoft/STL#4060

We're currently consistent with tuple: https://eel.is/c++draft/tuple.tuple which might be the right way to be.

@jbcoe
Copy link
Owner

jbcoe commented Jan 15, 2025

Issue fixed by #500

Follow-up question raised as a new issue in #501

@jbcoe jbcoe closed this as completed Jan 15, 2025
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

No branches or pull requests

2 participants