summaryrefslogtreecommitdiffstats
path: root/contrib/python/pythran/pythran/pythonic/builtins/list.hpp
blob: 9c793954b34c47611cda1bad92f9dfba0eeaa030 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
#ifndef PYTHONIC_BUILTIN_LIST_HPP
#define PYTHONIC_BUILTIN_LIST_HPP

#include "pythonic/include/builtins/list.hpp"

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

#include <iterator>
#include <type_traits>

PYTHONIC_NS_BEGIN

namespace builtins
{

  namespace anonymous
  {

    inline types::empty_list list()
    {
      return types::empty_list();
    }

    inline types::empty_list list(types::empty_list)
    {
      return types::empty_list();
    }

    template <class Iterable>
    types::list<typename std::decay<typename std::iterator_traits<
        typename std::remove_reference<Iterable>::type::iterator>::value_type>::
                    type>
    list(Iterable &&t)
    {
      return types::list<typename std::decay<
          typename std::iterator_traits<typename std::remove_reference<
              Iterable>::type::iterator>::value_type>::type>(t.begin(),
                                                             t.end());
    }
  }
}
PYTHONIC_NS_END

#endif