~siretart/ubuntu/utopic/blender/libav10

« back to all changes in this revision

Viewing changes to extern/Eigen3/Eigen/src/StlSupport/StdList.h

  • Committer: Package Import Robot
  • Author(s): Matteo F. Vescovi
  • Date: 2012-07-23 08:54:18 UTC
  • mfrom: (14.2.16 sid)
  • mto: (14.2.19 sid)
  • mto: This revision was merged to the branch mainline in revision 42.
  • Revision ID: package-import@ubuntu.com-20120723085418-9foz30v6afaf5ffs
Tags: 2.63a-2
* debian/: Cycles support added (Closes: #658075)
  For now, this top feature has been enabled only
  on [any-amd64 any-i386] architectures because
  of OpenImageIO failing on all others
* debian/: scripts installation path changed
  from /usr/lib to /usr/share:
  + debian/patches/: patchset re-worked for path changing
  + debian/control: "Breaks" field added on yafaray-exporter

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
// This file is part of Eigen, a lightweight C++ template library
 
2
// for linear algebra.
 
3
//
 
4
// Copyright (C) 2009 Hauke Heibel <hauke.heibel@googlemail.com>
 
5
//
 
6
// Eigen is free software; you can redistribute it and/or
 
7
// modify it under the terms of the GNU Lesser General Public
 
8
// License as published by the Free Software Foundation; either
 
9
// version 3 of the License, or (at your option) any later version.
 
10
//
 
11
// Alternatively, you can redistribute it and/or
 
12
// modify it under the terms of the GNU General Public License as
 
13
// published by the Free Software Foundation; either version 2 of
 
14
// the License, or (at your option) any later version.
 
15
//
 
16
// Eigen is distributed in the hope that it will be useful, but WITHOUT ANY
 
17
// WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
 
18
// FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License or the
 
19
// GNU General Public License for more details.
 
20
//
 
21
// You should have received a copy of the GNU Lesser General Public
 
22
// License and a copy of the GNU General Public License along with
 
23
// Eigen. If not, see <http://www.gnu.org/licenses/>.
 
24
 
 
25
#ifndef EIGEN_STDLIST_H
 
26
#define EIGEN_STDLIST_H
 
27
 
 
28
#include "Eigen/src/StlSupport/details.h"
 
29
 
 
30
// Define the explicit instantiation (e.g. necessary for the Intel compiler)
 
31
#if defined(__INTEL_COMPILER) || defined(__GNUC__)
 
32
  #define EIGEN_EXPLICIT_STL_LIST_INSTANTIATION(...) template class std::list<__VA_ARGS__, EIGEN_ALIGNED_ALLOCATOR<__VA_ARGS__> >;
 
33
#else
 
34
  #define EIGEN_EXPLICIT_STL_LIST_INSTANTIATION(...)
 
35
#endif
 
36
 
 
37
/**
 
38
 * This section contains a convenience MACRO which allows an easy specialization of
 
39
 * std::list such that for data types with alignment issues the correct allocator
 
40
 * is used automatically.
 
41
 */
 
42
#define EIGEN_DEFINE_STL_LIST_SPECIALIZATION(...) \
 
43
EIGEN_EXPLICIT_STL_LIST_INSTANTIATION(__VA_ARGS__) \
 
44
namespace std \
 
45
{ \
 
46
  template<typename _Ay> \
 
47
  class list<__VA_ARGS__, _Ay>  \
 
48
    : public list<__VA_ARGS__, EIGEN_ALIGNED_ALLOCATOR<__VA_ARGS__> > \
 
49
  { \
 
50
    typedef list<__VA_ARGS__, EIGEN_ALIGNED_ALLOCATOR<__VA_ARGS__> > list_base; \
 
51
  public: \
 
52
    typedef __VA_ARGS__ value_type; \
 
53
    typedef typename list_base::allocator_type allocator_type; \
 
54
    typedef typename list_base::size_type size_type;  \
 
55
    typedef typename list_base::iterator iterator;  \
 
56
    explicit list(const allocator_type& a = allocator_type()) : list_base(a) {}  \
 
57
    template<typename InputIterator> \
 
58
    list(InputIterator first, InputIterator last, const allocator_type& a = allocator_type()) : list_base(first, last, a) {} \
 
59
    list(const list& c) : list_base(c) {}  \
 
60
    explicit list(size_type num, const value_type& val = value_type()) : list_base(num, val) {} \
 
61
    list(iterator start, iterator end) : list_base(start, end) {}  \
 
62
    list& operator=(const list& x) {  \
 
63
      list_base::operator=(x);  \
 
64
      return *this;  \
 
65
    } \
 
66
  }; \
 
67
}
 
68
 
 
69
// check whether we really need the std::vector specialization
 
70
#if !(defined(_GLIBCXX_VECTOR) && (!EIGEN_GNUC_AT_LEAST(4,1))) /* Note that before gcc-4.1 we already have: std::list::resize(size_type,const T&). */
 
71
 
 
72
namespace std
 
73
{
 
74
 
 
75
#define EIGEN_STD_LIST_SPECIALIZATION_BODY \
 
76
  public:  \
 
77
    typedef T value_type; \
 
78
    typedef typename list_base::allocator_type allocator_type; \
 
79
    typedef typename list_base::size_type size_type;  \
 
80
    typedef typename list_base::iterator iterator;  \
 
81
    typedef typename list_base::const_iterator const_iterator;  \
 
82
    explicit list(const allocator_type& a = allocator_type()) : list_base(a) {}  \
 
83
    template<typename InputIterator> \
 
84
    list(InputIterator first, InputIterator last, const allocator_type& a = allocator_type()) \
 
85
    : list_base(first, last, a) {} \
 
86
    list(const list& c) : list_base(c) {}  \
 
87
    explicit list(size_type num, const value_type& val = value_type()) : list_base(num, val) {} \
 
88
    list(iterator start, iterator end) : list_base(start, end) {}  \
 
89
    list& operator=(const list& x) {  \
 
90
    list_base::operator=(x);  \
 
91
    return *this; \
 
92
  }
 
93
 
 
94
  template<typename T>
 
95
  class list<T,EIGEN_ALIGNED_ALLOCATOR<T> >
 
96
    : public list<EIGEN_WORKAROUND_MSVC_STL_SUPPORT(T),
 
97
                  Eigen::aligned_allocator_indirection<EIGEN_WORKAROUND_MSVC_STL_SUPPORT(T)> >
 
98
  {
 
99
    typedef list<EIGEN_WORKAROUND_MSVC_STL_SUPPORT(T),
 
100
                 Eigen::aligned_allocator_indirection<EIGEN_WORKAROUND_MSVC_STL_SUPPORT(T)> > list_base;
 
101
    EIGEN_STD_LIST_SPECIALIZATION_BODY
 
102
 
 
103
    void resize(size_type new_size)
 
104
    { resize(new_size, T()); }
 
105
 
 
106
    void resize(size_type new_size, const value_type& x)
 
107
    {
 
108
      if (list_base::size() < new_size)
 
109
        list_base::insert(list_base::end(), new_size - list_base::size(), x);
 
110
      else
 
111
        while (new_size < list_base::size()) list_base::pop_back();
 
112
    }
 
113
 
 
114
#if defined(_LIST_)
 
115
    // workaround MSVC std::list implementation
 
116
    void push_back(const value_type& x)
 
117
    { list_base::push_back(x); } 
 
118
    using list_base::insert;  
 
119
    iterator insert(const_iterator position, const value_type& x)
 
120
    { return list_base::insert(position,x); }
 
121
    void insert(const_iterator position, size_type new_size, const value_type& x)
 
122
    { list_base::insert(position, new_size, x); }
 
123
#endif
 
124
  };
 
125
}
 
126
 
 
127
#endif // check whether specialization is actually required
 
128
 
 
129
#endif // EIGEN_STDLIST_H