WPILibC++ 2023.4.3
details.h
Go to the documentation of this file.
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
18namespace Eigen {
19
20 // This one is needed to prevent reimplementing the whole std::vector.
21 template <class T>
23 {
24 public:
25 typedef std::size_t size_type;
26 typedef std::ptrdiff_t difference_type;
27 typedef T* pointer;
28 typedef const T* const_pointer;
29 typedef T& reference;
30 typedef const T& const_reference;
31 typedef T value_type;
32
33 template<class U>
34 struct rebind
35 {
37 };
38
41 aligned_allocator_indirection(const EIGEN_ALIGNED_ALLOCATOR<T>& ) {}
42 template<class U>
44 template<class U>
45 aligned_allocator_indirection(const EIGEN_ALIGNED_ALLOCATOR<U>& ) {}
47 };
48
49#if EIGEN_COMP_MSVC
50
51 // sometimes, MSVC detects, at compile time, that the argument x
52 // in std::vector::resize(size_t s,T x) won't be aligned and generate an error
53 // even if this function is never called. Whence this little wrapper.
54#define EIGEN_WORKAROUND_MSVC_STL_SUPPORT(T) \
55 typename Eigen::internal::conditional< \
56 Eigen::internal::is_arithmetic<T>::value, \
57 T, \
58 Eigen::internal::workaround_msvc_stl_support<T> \
59 >::type
60
61 namespace internal {
62 template<typename T> struct workaround_msvc_stl_support : public T
63 {
64 inline workaround_msvc_stl_support() : T() {}
65 inline workaround_msvc_stl_support(const T& other) : T(other) {}
66 inline operator T& () { return *static_cast<T*>(this); }
67 inline operator const T& () const { return *static_cast<const T*>(this); }
68 template<typename OtherT>
69 inline T& operator=(const OtherT& other)
70 { T::operator=(other); return *this; }
71 inline workaround_msvc_stl_support& operator=(const workaround_msvc_stl_support& other)
72 { T::operator=(other); return *this; }
73 };
74 }
75
76#else
77
78#define EIGEN_WORKAROUND_MSVC_STL_SUPPORT(T) T
79
80#endif
81
82}
83
84#endif // EIGEN_STL_DETAILS_H
Definition: details.h:23
T * pointer
Definition: details.h:27
aligned_allocator_indirection(const aligned_allocator_indirection< U > &)
Definition: details.h:43
std::ptrdiff_t difference_type
Definition: details.h:26
~aligned_allocator_indirection()
Definition: details.h:46
const T * const_pointer
Definition: details.h:28
T & reference
Definition: details.h:29
T value_type
Definition: details.h:31
aligned_allocator_indirection(const EIGEN_ALIGNED_ALLOCATOR< U > &)
Definition: details.h:45
std::size_t size_type
Definition: details.h:25
aligned_allocator_indirection(const aligned_allocator_indirection &)
Definition: details.h:40
aligned_allocator_indirection()
Definition: details.h:39
aligned_allocator_indirection(const EIGEN_ALIGNED_ALLOCATOR< T > &)
Definition: details.h:41
const T & const_reference
Definition: details.h:30
#define EIGEN_ALIGNED_ALLOCATOR
Definition: details.h:15
Namespace containing all symbols from the Eigen library.
Definition: MatrixExponential.h:16
Definition: Eigen_Colamd.h:50
aligned_allocator_indirection< U > other
Definition: details.h:36