403Webshell
Server IP : 217.160.0.212  /  Your IP : 216.73.216.141
Web Server : Apache
System : Linux www 6.18.51-i1-ampere #1196 SMP Fri Sep 11 20:43:55 CEST 2026 aarch64
User : sws1073854427 ( 1073854427)
PHP Version : 8.4.23
Disable Function : NONE
MySQL : OFF  |  cURL : ON  |  WGET : ON  |  Perl : ON  |  Python : OFF  |  Sudo : OFF  |  Pkexec : OFF
Directory :  /lib/python3/dist-packages/pythran/pythonic/include/itertools/

Upload File :
current_dir [ Writeable ] document_root [ Writeable ]

 

Command :


[ Back ]     

Current File : /lib/python3/dist-packages/pythran/pythonic/include/itertools/combinations.hpp
#ifndef PYTHONIC_INCLUDE_ITERTOOLS_COMBINATIONS_HPP
#define PYTHONIC_INCLUDE_ITERTOOLS_COMBINATIONS_HPP

#include "pythonic/include/types/dynamic_tuple.hpp"
#include "pythonic/include/utils/functor.hpp"

#include <vector>
#include <iterator>

PYTHONIC_NS_BEGIN

namespace itertools
{
  namespace details
  {
    template <class T>
    struct combination_iterator
        : std::iterator<std::forward_iterator_tag,
                        types::dynamic_tuple<typename T::value_type>, ptrdiff_t,
                        types::dynamic_tuple<typename T::value_type> *,
                        types::dynamic_tuple<typename T::value_type> /*no ref*/
                        > {
      std::vector<typename T::value_type> pool;
      std::vector<long> indices;
      long r;
      bool stopped;
      std::vector<typename T::value_type> result;

      combination_iterator() = default;
      combination_iterator(bool);

      template <class Iter>
      combination_iterator(Iter &&pool, long r);

      types::dynamic_tuple<typename T::value_type> operator*() const;
      combination_iterator &operator++();
      bool operator!=(combination_iterator const &other) const;
      bool operator==(combination_iterator const &other) const;
      bool operator<(combination_iterator const &other) const;
    };

    template <class T>
    struct combination : combination_iterator<T> {
      using iterator = combination_iterator<T>;
      using value_type = typename iterator::value_type;

      long num_elts;

      combination() = default;

      template <class Iter>
      combination(Iter &&iter, long elts);
      iterator const &begin() const;
      iterator begin();
      iterator end() const;
    };
  }

  template <typename T0>
  details::combination<
      typename std::remove_cv<typename std::remove_reference<T0>::type>::type>
  combinations(T0 &&iter, long num_elts);

  DEFINE_FUNCTOR(pythonic::itertools, combinations);
}
PYTHONIC_NS_END

/* type inference stuff  {*/
#include "pythonic/include/types/combined.hpp"

template <class E, class T>
struct __combined<E, pythonic::itertools::details::combination<T>> {
  using type =
      typename __combined<E, container<typename pythonic::itertools::details::
                                           combination<T>::value_type>>::type;
};

/* } */

#endif

Youez - 2016 - github.com/yon3zu
LinuXploit