<commit_before>#ifndef XEXCEPTION_HPP
#define XEXCEPTION_HPP

#include <exception>
#include <iterator>
#include <sstream>
#include <string>

namespace xt
{

    /*******************
     * broadcast_error *
     *******************/

    class broadcast_error : public std::exception
    {

    public:

        template <class S1, class S2>
        broadcast_error(const S1& lhs, const S2& rhs);

        virtual const char* what() const noexcept;

    private:

        std::string m_message;
    };

    /**********************************
     * broadcast_error implementation *
     **********************************/

    template <class S1, class S2>
    inline broadcast_error::broadcast_error(const S1& lhs, const S2& rhs)
    {
        std::ostringstream buf("Incompatible dimension of arrays:", std::ios_base::ate);

        buf << "\n LHS shape = (";
        using size_type1 = typename S1::value_type;
        std::ostream_iterator<size_type1> iter1(buf, ", ");
        std::copy(lhs.cbegin(), lhs.cend(), iter1);

        buf << ")\n RHS shape = (";
        using size_type2 = typename S2::value_type;
        std::ostream_iterator<size_type2> iter2(buf, ", ");
        std::copy(rhs.cbegin(), rhs.cend(), iter2);
        buf << ")";

        m_message = buf.str();
    }

    inline const char* broadcast_error::what() const noexcept
    {
        return m_message.c_str();
    }

    /*******************
     * transpose_error *
     *******************/

    class transpose_error : public std::exception
    {

    public:

        transpose_error(const std::string& msg);

        virtual const char* what() const noexcept;

    private:

        std::string m_message;
    };

    /**********************************
     * transpose_error implementation *
     **********************************/

    inline transpose_error::transpose_error(const std::string& msg)
        : m_message(msg){};

    inline const char* transpose_error::what() const noexcept
    {
        return m_message.c_str();
    }

    /***************
     * check_index *
     ***************/

    template <class S, class... Args>
    void check_index(const S& shape, Args... args);

    template <class S, class It>
    void check_element_index(const S& shape, It first, It last);

    namespace detail
    {
        template <class S, size_t dim>
        inline void check_index_impl(const S&)
        {
        }

        template <class S, size_t dim, class... Args>
        inline void check_index_impl(const S& shape, size_t i, Args... args)
        {
            if (sizeof...(Args) + 1 > shape.size())
            {
                check_index_impl<S, dim>(shape, args...);
            }
            else<commit_msg>Fix warning: extra ‘;’ [-Wpedantic]<commit_after>#ifndef XEXCEPTION_HPP
#define XEXCEPTION_HPP

#include <exception>
#include <iterator>
#include <sstream>
#include <string>

namespace xt
{

    /*******************
     * broadcast_error *
     *******************/

    class broadcast_error : public std::exception
    {

    public:

        template <class S1, class S2>
        broadcast_error(const S1& lhs, const S2& rhs);

        virtual const char* what() const noexcept;

    private:

        std::string m_message;
    };

    /**********************************
     * broadcast_error implementation *
     **********************************/

    template <class S1, class S2>
    inline broadcast_error::broadcast_error(const S1& lhs, const S2& rhs)
    {
        std::ostringstream buf("Incompatible dimension of arrays:", std::ios_base::ate);

        buf << "\n LHS shape = (";
        using size_type1 = typename S1::value_type;
        std::ostream_iterator<size_type1> iter1(buf, ", ");
        std::copy(lhs.cbegin(), lhs.cend(), iter1);

        buf << ")\n RHS shape = (";
        using size_type2 = typename S2::value_type;
        std::ostream_iterator<size_type2> iter2(buf, ", ");
        std::copy(rhs.cbegin(), rhs.cend(), iter2);
        buf << ")";

        m_message = buf.str();
    }

    inline const char* broadcast_error::what() const noexcept
    {
        return m_message.c_str();
    }

    /*******************
     * transpose_error *
     *******************/

    class transpose_error : public std::exception
    {

    public:

        transpose_error(const std::string& msg);

        virtual const char* what() const noexcept;

    private:

        std::string m_message;
    };

    /**********************************
     * transpose_error implementation *
     **********************************/

    inline transpose_error::transpose_error(const std::string& msg)
        : m_message(msg){}

    inline const char* transpose_error::what() const noexcept
    {
        return m_message.c_str();
    }

    /***************
     * check_index *
     ***************/

    template <class S, class... Args>
    void check_index(const S& shape, Args... args);

    template <class S, class It>
    void check_element_index(const S& shape, It first, It last);

    namespace detail
    {
        template <class S, size_t dim>
        inline void check_index_impl(const S&)
        {
        }

        template <class S, size_t dim, class... Args>
        inline void check_index_impl(const S& shape, size_t i, Args... args)
        {
            if (sizeof...(Args) + 1 > shape.size())
            {
                check_index_impl<S, dim>(shape, args...);
            }
            else
{'fraction_non_alphanumeric': 0.19901225535028352, 'fraction_numerical': 0.00695079568319005, 'mean_word_length': 2.491698595146871, 'pattern_counts': {'":': 0, '<': 41, '<?xml version=': 0, '>': 31, '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': '4097489', 'n_tokens_mistral': 1641, 'n_tokens_neox': 1580, 'n_words': 382}