<commit_before>#ifndef PROTOZERO_BUFFER_FIXED_HPP
#define PROTOZERO_BUFFER_FIXED_HPP

/*****************************************************************************

protozero - Minimalistic protocol buffer decoder and encoder in C++.

This file is from https://github.com/mapbox/protozero where you can find more
documentation.

*****************************************************************************/

/**
 * @file buffer_fixed.hpp
 *
 * @brief Contains the fixed_size_buffer_adaptor class.
 */

#include "buffer_tmpl.hpp"
#include "config.hpp"

#include <algorithm>
#include <cstddef>
#include <iterator>
#include <stdexcept>

namespace protozero {

/**
 * This class can be used instead of std::string if you want to create a
 * vector tile in a fixed-size buffer. Any operation that needs more space
 * than is available will fail with a std::length_error exception.
 *
 * As user of this class you should not rely on anything here beyond the
 * constructors and the data(), size(), and capacity() member functions.
 * The use of everything else is for the protozero library only.
 */
class fixed_size_buffer_adaptor {

    char* m_data;
    std::size_t m_capacity;
    std::size_t m_size;

public:

    /**
     * Constructor.
     *
     * @param data Pointer to some memory allocated for the buffer.
     * @param capacity Number of bytes available.
     */
    fixed_size_buffer_adaptor(char* data, std::size_t capacity) :
        m_data(data),
        m_capacity(capacity),
        m_size(0) {
    }

    /**
     * Constructor.
     *
     * @param container Some container class supporting the member functions
     *        data() and size().
     */
    template <typename T>
    explicit fixed_size_buffer_adaptor(T& container) :
        fixed_size_buffer_adaptor(container.data(), container.size()) {
    }<commit_msg>Remove delegating constructor because clang-tidy doesn't like it<commit_after>#ifndef PROTOZERO_BUFFER_FIXED_HPP
#define PROTOZERO_BUFFER_FIXED_HPP

/*****************************************************************************

protozero - Minimalistic protocol buffer decoder and encoder in C++.

This file is from https://github.com/mapbox/protozero where you can find more
documentation.

*****************************************************************************/

/**
 * @file buffer_fixed.hpp
 *
 * @brief Contains the fixed_size_buffer_adaptor class.
 */

#include "buffer_tmpl.hpp"
#include "config.hpp"

#include <algorithm>
#include <cstddef>
#include <iterator>
#include <stdexcept>

namespace protozero {

/**
 * This class can be used instead of std::string if you want to create a
 * vector tile in a fixed-size buffer. Any operation that needs more space
 * than is available will fail with a std::length_error exception.
 *
 * As user of this class you should not rely on anything here beyond the
 * constructors and the data(), size(), and capacity() member functions.
 * The use of everything else is for the protozero library only.
 */
class fixed_size_buffer_adaptor {

    char* m_data;
    std::size_t m_capacity;
    std::size_t m_size = 0;

public:

    /**
     * Constructor.
     *
     * @param data Pointer to some memory allocated for the buffer.
     * @param capacity Number of bytes available.
     */
    fixed_size_buffer_adaptor(char* data, std::size_t capacity) noexcept :
        m_data(data),
        m_capacity(capacity) {
    }

    /**
     * Constructor.
     *
     * @param container Some container class supporting the member functions
     *        data() and size().
     */
    template <typename T>
    explicit fixed_size_buffer_adaptor(T& container) :
        m_data(container.data()),
        m_capacity(container.size()) {
    }
{'fraction_non_alphanumeric': 0.16586151368760063, 'fraction_numerical': 0.0005367686527106817, 'mean_word_length': 3.688050314465409, 'pattern_counts': {'":': 0, '<': 13, '<?xml version=': 0, '>': 13, 'https://': 2, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '1667341', 'n_tokens_mistral': 1050, 'n_tokens_neox': 1011, 'n_words': 344}