mirror of
https://github.com/fmtlib/fmt.git
synced 2025-11-28 13:19:48 +01:00
Make classes derived from buffer<T> final to silence the virtual destructor warning. (#1937)
Co-authored-by: Bart Siwek <bsiwek@cisco.com>
This commit is contained in:
@@ -761,7 +761,7 @@ class fixed_buffer_traits {
|
||||
|
||||
// A buffer that writes to an output iterator when flushed.
|
||||
template <typename OutputIt, typename T, typename Traits = buffer_traits>
|
||||
class iterator_buffer : public Traits, public buffer<T> {
|
||||
class iterator_buffer final : public Traits, public buffer<T> {
|
||||
private:
|
||||
OutputIt out_;
|
||||
enum { buffer_size = 256 };
|
||||
@@ -787,7 +787,7 @@ class iterator_buffer : public Traits, public buffer<T> {
|
||||
size_t count() const { return Traits::count() + this->size(); }
|
||||
};
|
||||
|
||||
template <typename T> class iterator_buffer<T*, T> : public buffer<T> {
|
||||
template <typename T> class iterator_buffer<T*, T> final : public buffer<T> {
|
||||
protected:
|
||||
void grow(size_t) final FMT_OVERRIDE {}
|
||||
|
||||
@@ -801,7 +801,7 @@ template <typename T> class iterator_buffer<T*, T> : public buffer<T> {
|
||||
template <typename Container>
|
||||
class iterator_buffer<std::back_insert_iterator<Container>,
|
||||
enable_if_t<is_contiguous<Container>::value,
|
||||
typename Container::value_type>>
|
||||
typename Container::value_type>> final
|
||||
: public buffer<typename Container::value_type> {
|
||||
private:
|
||||
Container& container_;
|
||||
@@ -823,7 +823,7 @@ class iterator_buffer<std::back_insert_iterator<Container>,
|
||||
};
|
||||
|
||||
// A buffer that counts the number of code units written discarding the output.
|
||||
template <typename T = char> class counting_buffer : public buffer<T> {
|
||||
template <typename T = char> class counting_buffer final : public buffer<T> {
|
||||
private:
|
||||
enum { buffer_size = 256 };
|
||||
T data_[buffer_size];
|
||||
|
||||
@@ -651,7 +651,7 @@ enum { inline_buffer_size = 500 };
|
||||
*/
|
||||
template <typename T, size_t SIZE = inline_buffer_size,
|
||||
typename Allocator = std::allocator<T>>
|
||||
class basic_memory_buffer : public detail::buffer<T> {
|
||||
class basic_memory_buffer final : public detail::buffer<T> {
|
||||
private:
|
||||
T store_[SIZE];
|
||||
|
||||
|
||||
@@ -378,7 +378,7 @@ struct ostream_params {
|
||||
static constexpr detail::buffer_size buffer_size;
|
||||
|
||||
// A fast output stream which is not thread-safe.
|
||||
class ostream : private detail::buffer<char> {
|
||||
class ostream final : private detail::buffer<char> {
|
||||
private:
|
||||
file file_;
|
||||
|
||||
|
||||
Reference in New Issue
Block a user