<commit_before>#ifndef TAKEWHILE__H__
#define TAKEWHILE__H__

#include <utility>

namespace iter {

    //Forward declarations of TakeWhile and takewhile
    template <typename FilterFunc, typename Container>
    class TakeWhile;

    template <typename FilterFunc, typename Container>
    TakeWhile<FilterFunc, Container> takewhile(FilterFunc, Container &);

    template <typename FilterFunc, typename Container>
    class TakeWhile {
        friend TakeWhile takewhile<FilterFunc, Container>(
                FilterFunc, Container &);

        // Type of the Container::Iterator, but since the name of that 
        // iterator can be anything, we have to grab it with this
        using contained_iter_type =
            decltype(std::declval<Container>().begin());

        // The type returned when dereferencing the Container::Iterator
        using contained_iter_ret =
            decltype(std::declval<contained_iter_type>().operator*());

        private:
            Container & container;
            FilterFunc filter_func;
            
            // Value constructor for use only in the takewhile function
            TakeWhile(FilterFunc filter_func, Container & container) :
                container(container),
                filter_func(filter_func)
            { }
            TakeWhile () = delete;
            TakeWhile & operator=(const TakeWhile &) = delete;
            // Default copy constructor used

        public:
            class Iterator {
                private:
                    contained_iter_type sub_iter;
                    const contained_iter_type sub_end;
                    FilterFunc filter_func;

                    // increment until the iterator points to is true on the 
                    // predicate.  Called by constructor and operator++
                    void check_current() {
                        if (!this->filter_func(*this->sub_iter)) {
                            this->sub_iter = this->sub_end;
                        }
                    }

                public:
                    Iterator (contained_iter_type iter,
                            contained_iter_type end,
                            FilterFunc filter_func) :
                        sub_iter(iter),
                        sub_end(end),
                        filter_func(filter_func)
                    { <commit_msg>Shortens usings in takewhile<commit_after>#ifndef TAKEWHILE__H__
#define TAKEWHILE__H__

#include <utility>

namespace iter {

    //Forward declarations of TakeWhile and takewhile
    template <typename FilterFunc, typename Container>
    class TakeWhile;

    template <typename FilterFunc, typename Container>
    TakeWhile<FilterFunc, Container> takewhile(FilterFunc, Container &);

    template <typename FilterFunc, typename Container>
    class TakeWhile {
        private:
            Container & container;
            FilterFunc filter_func;

            friend TakeWhile takewhile<FilterFunc, Container>(
                    FilterFunc, Container &);

            // Type of the Container::Iterator, but since the name of that 
            // iterator can be anything, we have to grab it with this
            using contained_iter_type = decltype(container.begin());

            // The type returned when dereferencing the Container::Iterator
            using contained_iter_ret = decltype(container.begin().operator*());

            // Value constructor for use only in the takewhile function
            TakeWhile(FilterFunc filter_func, Container & container) :
                container(container),
                filter_func(filter_func)
            { }

            TakeWhile () = delete;
            TakeWhile & operator=(const TakeWhile &) = delete;
            // Default copy constructor used

        public:
            class Iterator {
                private:
                    contained_iter_type sub_iter;
                    const contained_iter_type sub_end;
                    FilterFunc filter_func;

                    // increment until the iterator points to is true on the 
                    // predicate.  Called by constructor and operator++
                    void check_current() {
                        if (!this->filter_func(*this->sub_iter)) {
                            this->sub_iter = this->sub_end;
                        }
                    }

                public:
                    Iterator (contained_iter_type iter,
                            contained_iter_type end,
                            FilterFunc filter_func) :
                        sub_iter(iter),
                        sub_end(end),
                        filter_func(filter_func)
                    { 
{'fraction_non_alphanumeric': 0.06512515910055156, 'fraction_numerical': 0.0, 'mean_word_length': 1.5652883569096845, 'pattern_counts': {'":': 0, '<': 17, '<?xml version=': 0, '>': 25, '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': '5123642', 'n_tokens_mistral': 1097, 'n_tokens_neox': 1013, 'n_words': 305}