File tree Expand file tree Collapse file tree 1 file changed +3
-12
lines changed
Expand file tree Collapse file tree 1 file changed +3
-12
lines changed Original file line number Diff line number Diff line change @@ -110,24 +110,16 @@ struct RepeatedFieldBase {};
110110template <size_t kMinSize >
111111class HeapRep {
112112 public:
113- explicit HeapRep (uint32_t capacity) : capacity_(capacity) {
114- StaticallyVerifySize ();
115- }
113+ explicit HeapRep (uint32_t capacity) : capacity_(capacity) {}
116114 // Avoid 'implicitly deleted dtor' warnings on certain compilers.
117115 ~HeapRep () = delete ;
118116
119117 uint32_t capacity () const { return capacity_; }
120118
121- const void * elements () const { return elements_ ; }
122- void * elements () { return elements_ ; }
119+ const void * elements () const { return this + 1 ; }
120+ void * elements () { return this + 1 ; }
123121
124122 private:
125- static constexpr void StaticallyVerifySize () {
126- static_assert (sizeof (HeapRep) == offsetof (HeapRep, elements_),
127- " `elements_` must be the last member of `HeapRep` and "
128- " consume no space." );
129- }
130-
131123 // Align to 8 as sanitizers are picky on the alignment of containers to start
132124 // at 8 byte offsets even when compiling for 32 bit platforms.
133125 union {
@@ -140,7 +132,6 @@ class HeapRep {
140132 // power-of-two sized allocations, which enables Arena optimizations.
141133 char padding_[kMinSize ];
142134 };
143- void * elements_[];
144135};
145136#else
146137template <size_t kMinSize >
You can’t perform that action at this time.
0 commit comments