Please, help us to better know about our user community by answering the following short survey: https://forms.gle/wpyrxWi18ox9Z5ae9
Eigen  3.4.0
details.h
1 // This file is part of Eigen, a lightweight C++ template library
2 // for linear algebra.
3 //
4 // Copyright (C) 2009 Gael Guennebaud <gael.guennebaud@inria.fr>
5 // Copyright (C) 2009 Hauke Heibel <hauke.heibel@googlemail.com>
6 //
7 // This Source Code Form is subject to the terms of the Mozilla
8 // Public License v. 2.0. If a copy of the MPL was not distributed
9 // with this file, You can obtain one at http://mozilla.org/MPL/2.0/.
10 
11 #ifndef EIGEN_STL_DETAILS_H
12 #define EIGEN_STL_DETAILS_H
13 
14 #ifndef EIGEN_ALIGNED_ALLOCATOR
15  #define EIGEN_ALIGNED_ALLOCATOR Eigen::aligned_allocator
16 #endif
17 
18 #include <cstddef>
19 
20 namespace Eigen {
21 
22  // This one is needed to prevent reimplementing the whole std::vector.
23  template <class T>
24  class aligned_allocator_indirection : public EIGEN_ALIGNED_ALLOCATOR<T>
25  {
26  public:
27  typedef std::size_t size_type;
28  typedef std::ptrdiff_t difference_type;
29  typedef T* pointer;
30  typedef const T* const_pointer;
31  typedef T& reference;
32  typedef const T& const_reference;
33  typedef T value_type;
34 
35  template<class U>
36  struct rebind
37  {
38  typedef aligned_allocator_indirection<U> other;
39  };
40 
41  aligned_allocator_indirection() {}
42  aligned_allocator_indirection(const aligned_allocator_indirection& ) : EIGEN_ALIGNED_ALLOCATOR<T>() {}
43  aligned_allocator_indirection(const EIGEN_ALIGNED_ALLOCATOR<T>& ) {}
44  template<class U>
45  aligned_allocator_indirection(const aligned_allocator_indirection<U>& ) {}
46  template<class U>
47  aligned_allocator_indirection(const EIGEN_ALIGNED_ALLOCATOR<U>& ) {}
48  ~aligned_allocator_indirection() {}
49  };
50 
51 #if EIGEN_COMP_MSVC
52 
53  // sometimes, MSVC detects, at compile time, that the argument x
54  // in std::vector::resize(size_t s,T x) won't be aligned and generate an error
55  // even if this function is never called. Whence this little wrapper.
56 #define EIGEN_WORKAROUND_MSVC_STL_SUPPORT(T) \
57  typename Eigen::internal::conditional< \
58  Eigen::internal::is_arithmetic<T>::value, \
59  T, \
60  Eigen::internal::workaround_msvc_stl_support<T> \
61  >::type
62 
63  namespace internal {
64  template<typename T> struct workaround_msvc_stl_support : public T
65  {
66  inline workaround_msvc_stl_support() : T() {}
67  inline workaround_msvc_stl_support(const T& other) : T(other) {}
68  inline operator T& () { return *static_cast<T*>(this); }
69  inline operator const T& () const { return *static_cast<const T*>(this); }
70  template<typename OtherT>
71  inline T& operator=(const OtherT& other)
72  { T::operator=(other); return *this; }
73  inline workaround_msvc_stl_support& operator=(const workaround_msvc_stl_support& other)
74  { T::operator=(other); return *this; }
75  };
76  }
77 
78 #else
79 
80 #define EIGEN_WORKAROUND_MSVC_STL_SUPPORT(T) T
81 
82 #endif
83 
84 }
85 
86 #endif // EIGEN_STL_DETAILS_H
Eigen
Namespace containing all symbols from the Eigen library.
Definition: Core:141