<commit_before>#ifndef array_view_hh_INCLUDED
#define array_view_hh_INCLUDED

#include <vector>
#include <initializer_list>

namespace Kakoune
{

// An ArrayView provides a typed, non owning view of a memory
// range with an interface similar to std::vector.
template<typename T>
class ArrayView
{
public:
    using size_t = std::size_t;

    ArrayView()
        : m_pointer(nullptr), m_size(0) {}

    ArrayView(const T& oneval)
        : m_pointer(&oneval), m_size(1) {}

    ArrayView(const T* pointer, size_t size)
        : m_pointer(pointer), m_size(size) {}

    ArrayView(const T* begin, const T* end)
        : m_pointer(begin), m_size(end - begin) {}

    template<typename Iterator>
    ArrayView(const Iterator& begin, const Iterator& end)
        : m_pointer(&(*begin)), m_size(end - begin) {}

    template<typename Alloc>
    ArrayView(const std::vector<T, Alloc>& v)
        : m_pointer(&v[0]), m_size(v.size()) {}

    ArrayView(const std::initializer_list<T>& v)
        : m_pointer(v.begin()), m_size(v.size()) {}

    const T* pointer() const { return m_pointer; }
    size_t size() const { return m_size; }
    const T& operator[](size_t n) const { return *(m_pointer + n); }

    const T* begin() const { return m_pointer; }
    const T* end()   const { return m_pointer+m_size; }

    using reverse_iterator = std::reverse_iterator<const T*>;
    reverse_iterator rbegin() const { return reverse_iterator(m_pointer+m_size); }
    reverse_iterator rend()   const { return reverse_iterator(m_pointer); }

    const T& front() const { return *m_pointer; }
    const T& back()  const { return *(m_pointer + m_size - 1); }

    bool empty() const { return m_size == 0; }

    ArrayView subrange(size_t first, size_t count) const
    {<commit_msg>Add a from C array constructor to ArrayView<commit_after>#ifndef array_view_hh_INCLUDED
#define array_view_hh_INCLUDED

#include <vector>
#include <initializer_list>

namespace Kakoune
{

// An ArrayView provides a typed, non owning view of a memory
// range with an interface similar to std::vector.
template<typename T>
class ArrayView
{
public:
    using size_t = std::size_t;

    ArrayView()
        : m_pointer(nullptr), m_size(0) {}

    ArrayView(const T& oneval)
        : m_pointer(&oneval), m_size(1) {}

    ArrayView(const T* pointer, size_t size)
        : m_pointer(pointer), m_size(size) {}

    ArrayView(const T* begin, const T* end)
        : m_pointer(begin), m_size(end - begin) {}

    template<size_t N>
    ArrayView(const T(&array)[N]) : m_pointer(array), m_size(N) {}

    template<typename Iterator>
    ArrayView(const Iterator& begin, const Iterator& end)
        : m_pointer(&(*begin)), m_size(end - begin) {}

    template<typename Alloc>
    ArrayView(const std::vector<T, Alloc>& v)
        : m_pointer(&v[0]), m_size(v.size()) {}

    ArrayView(const std::initializer_list<T>& v)
        : m_pointer(v.begin()), m_size(v.size()) {}

    const T* pointer() const { return m_pointer; }
    size_t size() const { return m_size; }
    const T& operator[](size_t n) const { return *(m_pointer + n); }

    const T* begin() const { return m_pointer; }
    const T* end()   const { return m_pointer+m_size; }

    using reverse_iterator = std::reverse_iterator<const T*>;
    reverse_iterator rbegin() const { return reverse_iterator(m_pointer+m_size); }
    reverse_iterator rend()   const { return reverse_iterator(m_pointer); }

    const T& front() const { return *m_pointer; }
    const T& back()  const { return *(m_pointer + m_size - 1); }

    bool empty() const { return m_size == 0; }

    ArrayView subrange(size_t first, size_t count) const
    {
{'fraction_non_alphanumeric': 0.12962455467251302, 'fraction_numerical': 0.0027404768429706767, 'mean_word_length': 3.6378653113087673, 'pattern_counts': {'":': 0, '<': 20, '<?xml version=': 0, '>': 20, 'https://': 0, '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': '462715', 'n_tokens_mistral': 1229, 'n_tokens_neox': 1197, 'n_words': 323}