<commit_before>//=======================================================================
// Copyright (c) 2014-2015 <NAME>
// Distributed under the terms of the MIT License.
// (See accompanying file LICENSE or copy at
//  http://opensource.org/licenses/MIT)
//=======================================================================

#ifndef CPP_UTILS_PARALLEL_HPP
#define CPP_UTILS_PARALLEL_HPP

#include "parallel.hpp"

namespace cpp {

template<bool Parallel>
struct thread_pool {
    //Does not do anything by default
};

template<>
struct thread_pool<true> : default_thread_pool<> {
    //Simply inherits from default thread pool
};

//parallel versions

template<typename Container, typename Functor>
void maybe_parallel_foreach(thread_pool<true>& thread_pool, const Container& container, Functor&& fun){
    parallel_foreach(thread_pool, container, std::forward<Functor>(fun));
}

template<typename Iterator, typename Functor>
void maybe_parallel_foreach(thread_pool<true>& thread_pool, Iterator first, Iterator last, Functor&& fun){
    parallel_foreach(thread_pool, first, last, std::forward<Functor>(fun));
}

template<typename Container, typename Functor>
void maybe_parallel_foreach_i(thread_pool<true>& thread_pool, const Container& container, Functor&& fun){
    parallel_foreach_i(thread_pool, container, std::forward<Functor>(fun));
}

template<typename Iterator, typename Functor>
void maybe_parallel_foreach_i(thread_pool<true>& thread_pool, Iterator it, Iterator end, Functor&& fun){
    parallel_foreach_i(thread_pool, it, end, std::forward<Functor>(fun));
}

template<typename Iterator, typename Iterator2, typename Functor>
void maybe_parallel_foreach_pair_i(thread_pool<true>& thread_pool, Iterator it, Iterator end, Iterator2 iit, Iterator2 ilast, Functor&& fun){
    parallel_foreach_pair_i(thread_pool, it, end, iit, ilast, std::forward<Functor>(fun));
}

template<typename Functor>
void maybe_parallel_foreach_n(thread_pool<true>& thread_pool, std::size_t first, std::size_t last, Functor&& fun){
    parallel_foreach_n(thread_pool, first, last, std::forward<Functor>(fun));
}

//non-parallel versions

template<typename Container, typename Functor>
void maybe_parallel_foreach(thread_pool<false>& /*thread_pool*/, const Container& container, Functor&& fun){
    foreach(container, fun);
}

template<typename Iterator, typename Functor>
void maybe_parallel_foreach(thread_pool<false>& /*thread_pool*/, Iterator first, Iterator last, Functor&& fun){
    foreach(first, last, fun);
}

template<typename Container, typename Functor>
void maybe_parallel_foreach_i(thread_pool<false>& /*thread_pool*/, const Container& container, Functor&& fun){
    foreach_i(container, fun);
}

template<typename Iterator, typename Functor>
void maybe_parallel_foreach_i(thread_pool<false>& /*thread_pool*/, Iterator it, Iterator end, Functor&& fun){
    foreach_i(it, end);
}

template<typename Iterator, typename Iterator2, typename Functor>
void maybe_parallel_foreach_pair_i(thread_pool<false>& /*thread_pool*/, Iterator it, Iterator end, Iterator2 iit, Iterator2 ilast, Functor&& fun){
    cpp_unused(ilast);

    for(std::size_t i = 0; it != end; ++it, ++iit, ++i){
        fun(*it, *iit, i);
    }
}

template<typename functor>
void maybe_parallel_foreach_n(thread_pool<false>& /*thread_pool*/, std::size_t first, std::size_t last, functor&& fun){
    foreach_n(first, last, fun);
}

} //end of dll namespace

#endif
<commit_msg>Fix include guard<commit_after>//=======================================================================
// Copyright (c) 2014-2015 <NAME>
// Distributed under the terms of the MIT License.
// (See accompanying file LICENSE or copy at
//  http://opensource.org/licenses/MIT)
//=======================================================================

#ifndef CPP_UTILS_MAYBE_PARALLEL_HPP
#define CPP_UTILS_MAYBE_PARALLEL_HPP

#include "parallel.hpp"

namespace cpp {

template<bool Parallel>
struct thread_pool {
    //Does not do anything by default
};

template<>
struct thread_pool<true> : default_thread_pool<> {
    //Simply inherits from default thread pool
};

//parallel versions

template<typename Container, typename Functor>
void maybe_parallel_foreach(thread_pool<true>& thread_pool, const Container& container, Functor&& fun){
    parallel_foreach(thread_pool, container, std::forward<Functor>(fun));
}

template<typename Iterator, typename Functor>
void maybe_parallel_foreach(thread_pool<true>& thread_pool, Iterator first, Iterator last, Functor&& fun){
    parallel_foreach(thread_pool, first, last, std::forward<Functor>(fun));
}

template<typename Container, typename Functor>
void maybe_parallel_foreach_i(thread_pool<true>& thread_pool, const Container& container, Functor&& fun){
    parallel_foreach_i(thread_pool, container, std::forward<Functor>(fun));
}

template<typename Iterator, typename Functor>
void maybe_parallel_foreach_i(thread_pool<true>& thread_pool, Iterator it, Iterator end, Functor&& fun){
    parallel_foreach_i(thread_pool, it, end, std::forward<Functor>(fun));
}

template<typename Iterator, typename Iterator2, typename Functor>
void maybe_parallel_foreach_pair_i(thread_pool<true>& thread_pool, Iterator it, Iterator end, Iterator2 iit, Iterator2 ilast, Functor&& fun){
    parallel_foreach_pair_i(thread_pool, it, end, iit, ilast, std::forward<Functor>(fun));
}

template<typename Functor>
void maybe_parallel_foreach_n(thread_pool<true>& thread_pool, std::size_t first, std::size_t last, Functor&& fun){
    parallel_foreach_n(thread_pool, first, last, std::forward<Functor>(fun));
}

//non-parallel versions

template<typename Container, typename Functor>
void maybe_parallel_foreach(thread_pool<false>& /*thread_pool*/, const Container& container, Functor&& fun){
    foreach(container, fun);
}

template<typename Iterator, typename Functor>
void maybe_parallel_foreach(thread_pool<false>& /*thread_pool*/, Iterator first, Iterator last, Functor&& fun){
    foreach(first, last, fun);
}

template<typename Container, typename Functor>
void maybe_parallel_foreach_i(thread_pool<false>& /*thread_pool*/, const Container& container, Functor&& fun){
    foreach_i(container, fun);
}

template<typename Iterator, typename Functor>
void maybe_parallel_foreach_i(thread_pool<false>& /*thread_pool*/, Iterator it, Iterator end, Functor&& fun){
    foreach_i(it, end);
}

template<typename Iterator, typename Iterator2, typename Functor>
void maybe_parallel_foreach_pair_i(thread_pool<false>& /*thread_pool*/, Iterator it, Iterator end, Iterator2 iit, Iterator2 ilast, Functor&& fun){
    cpp_unused(ilast);

    for(std::size_t i = 0; it != end; ++it, ++iit, ++i){
        fun(*it, *iit, i);
    }
}

template<typename functor>
void maybe_parallel_foreach_n(thread_pool<false>& /*thread_pool*/, std::size_t first, std::size_t last, functor&& fun){
    foreach_n(first, last, fun);
}

} //end of dll namespace

#endif

{'fraction_non_alphanumeric': 0.1579252390611417, 'fraction_numerical': 0.004346566212691973, 'mean_word_length': 6.980346820809249, 'pattern_counts': {'":': 0, '<': 73, '<?xml version=': 0, '>': 73, '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': '464999', 'n_tokens_mistral': 2155, 'n_tokens_neox': 2086, 'n_words': 534}