00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011 #ifndef EIGEN_STL_DETAILS_H
00012 #define EIGEN_STL_DETAILS_H
00013
00014 #ifndef EIGEN_ALIGNED_ALLOCATOR
00015 #define EIGEN_ALIGNED_ALLOCATOR Eigen::aligned_allocator
00016 #endif
00017
00018 namespace Eigen {
00019
00020
00021 template <class T>
00022 class aligned_allocator_indirection : public EIGEN_ALIGNED_ALLOCATOR<T>
00023 {
00024 public:
00025 typedef size_t size_type;
00026 typedef ptrdiff_t difference_type;
00027 typedef T* pointer;
00028 typedef const T* const_pointer;
00029 typedef T& reference;
00030 typedef const T& const_reference;
00031 typedef T value_type;
00032
00033 template<class U>
00034 struct rebind
00035 {
00036 typedef aligned_allocator_indirection<U> other;
00037 };
00038
00039 aligned_allocator_indirection() {}
00040 aligned_allocator_indirection(const aligned_allocator_indirection& ) : EIGEN_ALIGNED_ALLOCATOR<T>() {}
00041 aligned_allocator_indirection(const EIGEN_ALIGNED_ALLOCATOR<T>& ) {}
00042 template<class U>
00043 aligned_allocator_indirection(const aligned_allocator_indirection<U>& ) {}
00044 template<class U>
00045 aligned_allocator_indirection(const EIGEN_ALIGNED_ALLOCATOR<U>& ) {}
00046 ~aligned_allocator_indirection() {}
00047 };
00048
00049 #ifdef _MSC_VER
00050
00051
00052
00053
00054 #define EIGEN_WORKAROUND_MSVC_STL_SUPPORT(T) \
00055 typename Eigen::internal::conditional< \
00056 Eigen::internal::is_arithmetic<T>::value, \
00057 T, \
00058 Eigen::internal::workaround_msvc_stl_support<T> \
00059 >::type
00060
00061 namespace internal {
00062 template<typename T> struct workaround_msvc_stl_support : public T
00063 {
00064 inline workaround_msvc_stl_support() : T() {}
00065 inline workaround_msvc_stl_support(const T& other) : T(other) {}
00066 inline operator T& () { return *static_cast<T*>(this); }
00067 inline operator const T& () const { return *static_cast<const T*>(this); }
00068 template<typename OtherT>
00069 inline T& operator=(const OtherT& other)
00070 { T::operator=(other); return *this; }
00071 inline workaround_msvc_stl_support& operator=(const workaround_msvc_stl_support& other)
00072 { T::operator=(other); return *this; }
00073 };
00074 }
00075
00076 #else
00077
00078 #define EIGEN_WORKAROUND_MSVC_STL_SUPPORT(T) T
00079
00080 #endif
00081
00082 }
00083
00084 #endif // EIGEN_STL_DETAILS_H