@@ -156,9 +156,10 @@ struct SC::String
156156
157157 IGrowableBuffer::DirectAccess& da;
158158
159- GrowableImplementation (String& string, IGrowableBuffer::DirectAccess& da);
160- ~GrowableImplementation ();
161- bool tryGrowTo (size_t newSize);
159+ GrowableImplementation (String& string, IGrowableBuffer::DirectAccess& da) noexcept ;
160+ ~GrowableImplementation () noexcept ;
161+ void finalize () noexcept ;
162+ bool tryGrowTo (size_t newSize) noexcept ;
162163 };
163164
164165 StringEncoding encoding;
@@ -208,20 +209,32 @@ SC_COMPILER_EXTERN template struct SC_COMPILER_EXPORT SmallString<1024 * sizeof(
208209
209210// Enables File library from reading data from file descriptor into a String
210211template <>
211- struct SC_COMPILER_EXPORT GrowableBuffer<String> final : public IGrowableBuffer
212+ struct SC_COMPILER_EXPORT GrowableBuffer<String> : public IGrowableBuffer
212213{
213214 String::GrowableImplementation gi;
214- GrowableBuffer (String& string) : gi(string, IGrowableBuffer::directAccess) {}
215- virtual bool tryGrowTo (size_t newSize) override { return gi.tryGrowTo (newSize); }
216- static auto getEncodingFor (const String& str) { return str.getEncoding (); }
215+ GrowableBuffer (String& string)
216+ : IGrowableBuffer(&GrowableBuffer::tryGrowTo), gi(string, IGrowableBuffer::directAccess)
217+ {}
218+ static bool tryGrowTo (IGrowableBuffer& gb, size_t newSize) noexcept
219+ {
220+ return static_cast <GrowableBuffer&>(gb).gi .tryGrowTo (newSize);
221+ }
222+ static auto getEncodingFor (const String& str) noexcept { return str.getEncoding (); }
223+ void finalize () noexcept { gi.finalize (); }
217224};
218225
219226template <int N>
220- struct SC_COMPILER_EXPORT GrowableBuffer<SmallString<N>> final : public IGrowableBuffer
227+ struct SC_COMPILER_EXPORT GrowableBuffer<SmallString<N>> : public IGrowableBuffer
221228{
222229 String::GrowableImplementation gi;
223- GrowableBuffer (String& string) : gi(string, IGrowableBuffer::directAccess) {}
224- virtual bool tryGrowTo (size_t newSize) override { return gi.tryGrowTo (newSize); }
225- static auto getEncodingFor (const SmallString<N>& str) { return str.getEncoding (); }
230+ GrowableBuffer (String& string)
231+ : IGrowableBuffer(&GrowableBuffer::tryGrowTo), gi(string, IGrowableBuffer::directAccess)
232+ {}
233+ static bool tryGrowTo (IGrowableBuffer& gb, size_t newSize) noexcept
234+ {
235+ return static_cast <GrowableBuffer&>(gb).gi .tryGrowTo (newSize);
236+ }
237+ static auto getEncodingFor (const SmallString<N>& str) noexcept { return str.getEncoding (); }
238+ void finalize () noexcept { gi.finalize (); }
226239};
227240} // namespace SC
0 commit comments