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

<tuple>: Can we eliminate _Tuple_val? #191

Open
StephanTLavavej opened this issue Oct 18, 2019 · 0 comments
Open

<tuple>: Can we eliminate _Tuple_val? #191

StephanTLavavej opened this issue Oct 18, 2019 · 0 comments
Labels
enhancement Something can be improved vNext Breaks binary compatibility

Comments

@StephanTLavavej
Copy link
Member

StephanTLavavej commented Oct 18, 2019

_Tuple_val deals with uses-allocator construction:

STL/stl/inc/tuple

Lines 158 to 182 in 957fe99

template <class _Ty>
struct _Tuple_val { // stores each value in a tuple
constexpr _Tuple_val() : _Val() {}
template <class _Other>
constexpr _Tuple_val(_Other&& _Arg) : _Val(_STD forward<_Other>(_Arg)) {}
template <class _Alloc, class... _Other, enable_if_t<!uses_allocator_v<_Ty, _Alloc>, int> = 0>
_Tuple_val(const _Alloc&, allocator_arg_t, _Other&&... _Arg) : _Val(_STD forward<_Other>(_Arg)...) {}
template <class _Alloc, class... _Other,
enable_if_t<conjunction_v<uses_allocator<_Ty, _Alloc>,
is_constructible<_Ty, allocator_arg_t, const _Alloc&, _Other...>>,
int> = 0>
_Tuple_val(const _Alloc& _Al, allocator_arg_t, _Other&&... _Arg)
: _Val(allocator_arg, _Al, _STD forward<_Other>(_Arg)...) {}
template <class _Alloc, class... _Other,
enable_if_t<conjunction_v<uses_allocator<_Ty, _Alloc>,
negation<is_constructible<_Ty, allocator_arg_t, const _Alloc&, _Other...>>>,
int> = 0>
_Tuple_val(const _Alloc& _Al, allocator_arg_t, _Other&&... _Arg) : _Val(_STD forward<_Other>(_Arg)..., _Al) {}
_Ty _Val;
};

However, I believe that it would be possible to fuse this behavior into tuple itself, avoiding this extra object. That could improve throughput, and generally simplify tuple's representation (at the cost of more tuple constructor complexity, but that battle has been thoroughly lost).

In theory, I believe we could do this without breaking bincompat, but this would be a fairly significant change, so it's probably vNext.

vNext note: Resolving this issue will require breaking binary compatibility. We won't be able to accept pull requests for this issue until the vNext branch is available. See #169 for more information.

@StephanTLavavej StephanTLavavej added enhancement Something can be improved vNext Breaks binary compatibility labels Oct 18, 2019
@CaseyCarter CaseyCarter changed the title <tuple>: Can we eliminate _Tuple_val? <tuple>: Can we eliminate _Tuple_val? Dec 14, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement Something can be improved vNext Breaks binary compatibility
Projects
None yet
Development

No branches or pull requests

1 participant