<commit_before>/**
 * \file dcs/algorithm/lexicographic_partition.hpp
 *
 * \brief Generate a set partition in lexicographic order.
 *
 * This code is mainly based on [1,2].
 *
 * References:
 * -# <NAME>.
 *    "Efficient Generation of Set Partitions"
 *    2002.
 * -# <NAME>.
 *    "The Art of Computer Programming, Volume 4, Fascicle 3",
 *    Addison-Wesley, 2004.
 * .
 *
 * \author <NAME> (<EMAIL>)
 * \author <NAME> (<EMAIL>)
 *
 * <hr/>
 *
 * Copyright (C) 2012       <NAME>
 *                          [Distributed Computing System (DCS) Group,
 *                           Computer Science Institute,
 *                           Department of Science and Technological Innovation,
 *                           University of Piemonte Orientale,
 *                           Alessandria (Italy)]
 *
 * This file is part of dcsxx-commons.
 *
 * dcsxx-commons is free software: you can redistribute it and/or modify
 * it under the terms of the GNU General Public License as published
 * by the Free Software Foundation, either version 3 of the License, or
 * (at your option) any later version.
 *
 * dcsxx-commons 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 General Public License for more details.
 *
 * You should have received a copy of the GNU General Public License
 * along with dcsxx-commons.  If not, see <http://www.gnu.org/licenses/>.
 */

#ifndef DCS_COMMONS_ALGORITHM_PARTITION_HPP
#define DCS_COMMONS_ALGORITHM_PARTITION_HPP

#include <algorithm>
#include <cstddef>
#include <dcs/assert.hpp>
#include <dcs/debug.hpp>
#include <dcs/exception.hpp>
#include <iostream>
#include <iterator>
#include <stdexcept>
#include <vector>


namespace dcs { namespace algorithm {

template <typename ValueT>
struct partition_traits
{
	typedef ValueT value_type;
	typedef ::std::vector<value_type> element_container;
	typedef typename element_container::elementor element_iterator;
	typedef typename element_container::const_elementor element_const_iterator;
	typedef ::std::vector<element_container> subset_container;
	typedef typename subset_container::iterator subset_iterator;
	typedef typename subset_container::const_iterator subset_const_iterator;
};

class lexicographic_partition
{
	protected: typedef ::std::vector< ::std::size_t > restricted_growth_string_type;
	protected: typedef restricted_growth_string_type const& reference;
	protected: typedef restricted_growth_string_type const* pointer;
	public: typedef lexicographic_partition self_type;
	public: typedef typename restricted_growth_string_type::iterator iterator;
	public: typedef typename restricted_growth_string_type::const_iterator const_iterator;


	public: explicit lexicographic_partition(::std::size_t n, bool first = true)
	: n_(n),<commit_msg>(bugfix:minor) Wrong type names for element iterators.<commit_after>/**
 * \file dcs/algorithm/lexicographic_partition.hpp
 *
 * \brief Generate a set partition in lexicographic order.
 *
 * This code is mainly based on [1,2].
 *
 * References:
 * -# M. Orlov.
 *    "Efficient Generation of Set Partitions"
 *    2002.
 * -# D. Knuth.
 *    "The Art of Computer Programming, Volume 4, Fascicle 3",
 *    Addison-Wesley, 2004.
 * .
 *
 * \author <NAME> (<EMAIL>)
 * \author <NAME> (<EMAIL>)
 *
 * <hr/>
 *
 * Copyright (C) 2012       <NAME>
 *                          [Distributed Computing System (DCS) Group,
 *                           Computer Science Institute,
 *                           Department of Science and Technological Innovation,
 *                           University of Piemonte Orientale,
 *                           Alessandria (Italy)]
 *
 * This file is part of dcsxx-commons.
 *
 * dcsxx-commons is free software: you can redistribute it and/or modify
 * it under the terms of the GNU General Public License as published
 * by the Free Software Foundation, either version 3 of the License, or
 * (at your option) any later version.
 *
 * dcsxx-commons 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 General Public License for more details.
 *
 * You should have received a copy of the GNU General Public License
 * along with dcsxx-commons.  If not, see <http://www.gnu.org/licenses/>.
 */

#ifndef DCS_COMMONS_ALGORITHM_PARTITION_HPP
#define DCS_COMMONS_ALGORITHM_PARTITION_HPP

#include <algorithm>
#include <cstddef>
#include <dcs/assert.hpp>
#include <dcs/debug.hpp>
#include <dcs/exception.hpp>
#include <iostream>
#include <iterator>
#include <stdexcept>
#include <vector>


namespace dcs { namespace algorithm {

template <typename ValueT>
struct partition_traits
{
	typedef ValueT value_type;
	typedef ::std::vector<value_type> element_container;
	typedef typename element_container::iterator element_iterator;
	typedef typename element_container::const_iterator element_const_iterator;
	typedef ::std::vector<element_container> subset_container;
	typedef typename subset_container::iterator subset_iterator;
	typedef typename subset_container::const_iterator subset_const_iterator;
};

class lexicographic_partition
{
	protected: typedef ::std::vector< ::std::size_t > restricted_growth_string_type;
	protected: typedef restricted_growth_string_type const& reference;
	protected: typedef restricted_growth_string_type const* pointer;
	public: typedef lexicographic_partition self_type;
	public: typedef typename restricted_growth_string_type::iterator iterator;
	public: typedef typename restricted_growth_string_type::const_iterator const_iterator;


	public: explicit lexicographic_partition(::std::size_t n, bool first = true)
	: n_(n),
{'fraction_non_alphanumeric': 0.08731665228645384, 'fraction_numerical': 0.005867126833477136, 'mean_word_length': 3.9879518072289155, 'pattern_counts': {'":': 0, '<': 45, '<?xml version=': 0, '>': 45, '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': '4016833', 'n_tokens_mistral': 1726, 'n_tokens_neox': 1613, 'n_words': 539}