Skip to content

Commit 4e91fa0

Browse files
committed
⚡ Fix the size of tuples of empty objects
Problem: - A tuple containing distinct empty objects requires at least 1 byte for each, when it could be 1 byte total. Solution: - Apply `[[no_unique_address]]` to tuple elements so that a tuple of empty objects is minimal.
1 parent df5ae34 commit 4e91fa0

File tree

2 files changed

+144
-134
lines changed

2 files changed

+144
-134
lines changed

include/stdx/tuple.hpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -102,7 +102,7 @@ template <std::size_t Index, typename T, typename... Ts> struct element {
102102
return std::forward<T>(value);
103103
}
104104

105-
T value;
105+
[[no_unique_address]] T value;
106106

107107
private:
108108
[[nodiscard]] friend auto operator==(element const &x, element const &y)

0 commit comments

Comments
 (0)