<commit_before>/*
 * Copyright (C) 2013-2014 Morwenn
 *
 * static_math is free software; you can redistribute it and/or modify
 * it under the terms of the GNU Lesser General Public License as
 * published by the Free Software Foundation, either version 3 of
 * the License, or (at your option) any later version.
 *
 * static_math is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
 * GNU Lesser General Public License for more details.
 *
 * You should have received a copy of the GNU Lesser General Public
 * License along with this program. If not,
 * see <http://www.gnu.org/licenses/>.
 */
#ifndef SMATH_UTILS_TYPE_TRAITS_H_
#define SMATH_UTILS_TYPE_TRAITS_H_

////////////////////////////////////////////////////////////
// Headers
////////////////////////////////////////////////////////////
#include <type_traits>

namespace smath
{
    template<typename T, typename U>
    using greater_of = std::conditional<
        sizeof(T) >= sizeof(U),
        T,
        U
    >;

    template<typename T, typename U>
    using lesser_of = std::conditional<
        sizeof(T) <= sizeof(U),
        T,
        U
    >;

    template<typename...>
    struct is_integral;

    template<typename T>
    struct is_integral<T>:
        public std::is_integral<T>
    {};

    template<typename T, typename U, typename... Args>
    struct is_integral<T, U, Args...>:
        public std::conditional<
            is_integral<T>::value,
            is_integral<U, Args...>,
            std::false_type
        >::type
    {};
}
<commit_msg>Slightly simplified type_traits.<commit_after>/*
 * Copyright (C) 2013-2014 Morwenn
 *
 * static_math is free software; you can redistribute it and/or modify
 * it under the terms of the GNU Lesser General Public License as
 * published by the Free Software Foundation, either version 3 of
 * the License, or (at your option) any later version.
 *
 * static_math is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
 * GNU Lesser General Public License for more details.
 *
 * You should have received a copy of the GNU Lesser General Public
 * License along with this program. If not,
 * see <http://www.gnu.org/licenses/>.
 */
#ifndef SMATH_UTILS_TYPE_TRAITS_H_
#define SMATH_UTILS_TYPE_TRAITS_H_

////////////////////////////////////////////////////////////
// Headers
////////////////////////////////////////////////////////////
#include <type_traits>

namespace smath
{
    ////////////////////////////////////////////////////////////
    // Size traits

    template<typename T, typename U>
    using greater_of = std::conditional<
        sizeof(T) >= sizeof(U),
        T,
        U
    >;

    template<typename T, typename U>
    using lesser_of = std::conditional<
        sizeof(T) <= sizeof(U),
        T,
        U
    >;

    ////////////////////////////////////////////////////////////
    // Variadic is_integral

    template<typename...>
    struct is_integral;

    template<typename T>
    struct is_integral<T>:
        std::is_integral<T>
    {};

    template<typename T, typename U, typename... Args>
    struct is_integral<T, U, Args...>:
        std::conditional_t<
            is_integral<T>::value,
            is_integral<U, Args...>,
            std::false_type
        >::type
    {};
}

{'fraction_non_alphanumeric': 0.1878563283922463, 'fraction_numerical': 0.005131128848346636, 'mean_word_length': 1.9144518272425248, 'pattern_counts': {'":': 0, '<': 35, '<?xml version=': 0, '>': 35, 'https://': 0, 'lorem ipsum': 0, 'www.': 2, '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': '7472870', 'n_tokens_mistral': 968, 'n_tokens_neox': 906, 'n_words': 328}