Back to home page

EIC code displayed by LXR

 
 

    


File indexing completed on 2025-12-13 10:26:07

0001 // This file is part of Eigen, a lightweight C++ template library
0002 // for linear algebra.
0003 //
0004 // Copyright (C) 2009 Gael Guennebaud <gael.guennebaud@inria.fr>
0005 // Copyright (C) 2009 Hauke Heibel <hauke.heibel@googlemail.com>
0006 //
0007 // This Source Code Form is subject to the terms of the Mozilla
0008 // Public License v. 2.0. If a copy of the MPL was not distributed
0009 // with this file, You can obtain one at http://mozilla.org/MPL/2.0/.
0010 
0011 #ifndef EIGEN_STL_DETAILS_H
0012 #define EIGEN_STL_DETAILS_H
0013 
0014 #ifndef EIGEN_ALIGNED_ALLOCATOR
0015   #define EIGEN_ALIGNED_ALLOCATOR RivetEigen::aligned_allocator
0016 #endif
0017 
0018 namespace RivetEigen {
0019 
0020   // This one is needed to prevent reimplementing the whole std::vector.
0021   template <class T>
0022   class aligned_allocator_indirection : public EIGEN_ALIGNED_ALLOCATOR<T>
0023   {
0024   public:
0025     typedef std::size_t     size_type;
0026     typedef std::ptrdiff_t  difference_type;
0027     typedef T*              pointer;
0028     typedef const T*        const_pointer;
0029     typedef T&              reference;
0030     typedef const T&        const_reference;
0031     typedef T               value_type;
0032 
0033     template<class U>
0034     struct rebind
0035     {
0036       typedef aligned_allocator_indirection<U> other;
0037     };
0038 
0039     aligned_allocator_indirection() {}
0040     aligned_allocator_indirection(const aligned_allocator_indirection& ) : EIGEN_ALIGNED_ALLOCATOR<T>() {}
0041     aligned_allocator_indirection(const EIGEN_ALIGNED_ALLOCATOR<T>& ) {}
0042     template<class U>
0043     aligned_allocator_indirection(const aligned_allocator_indirection<U>& ) {}
0044     template<class U>
0045     aligned_allocator_indirection(const EIGEN_ALIGNED_ALLOCATOR<U>& ) {}
0046     ~aligned_allocator_indirection() {}
0047   };
0048 
0049 #if EIGEN_COMP_MSVC
0050 
0051   // sometimes, MSVC detects, at compile time, that the argument x
0052   // in std::vector::resize(size_t s,T x) won't be aligned and generate an error
0053   // even if this function is never called. Whence this little wrapper.
0054 #define EIGEN_WORKAROUND_MSVC_STL_SUPPORT(T) \
0055   typename RivetEigen::internal::conditional< \
0056     RivetEigen::internal::is_arithmetic<T>::value, \
0057     T, \
0058     RivetEigen::internal::workaround_msvc_stl_support<T> \
0059   >::type
0060 
0061   namespace internal {
0062   template<typename T> struct workaround_msvc_stl_support : public T
0063   {
0064     inline workaround_msvc_stl_support() : T() {}
0065     inline workaround_msvc_stl_support(const T& other) : T(other) {}
0066     inline operator T& () { return *static_cast<T*>(this); }
0067     inline operator const T& () const { return *static_cast<const T*>(this); }
0068     template<typename OtherT>
0069     inline T& operator=(const OtherT& other)
0070     { T::operator=(other); return *this; }
0071     inline workaround_msvc_stl_support& operator=(const workaround_msvc_stl_support& other)
0072     { T::operator=(other); return *this; }
0073   };
0074   }
0075 
0076 #else
0077 
0078 #define EIGEN_WORKAROUND_MSVC_STL_SUPPORT(T) T
0079 
0080 #endif
0081 
0082 }
0083 
0084 #endif // EIGEN_STL_DETAILS_H