Eigen2Support/Meta.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) 2011 Benoit Jacob <jacob.benoit.1@gmail.com>
5 //
6 // This Source Code Form is subject to the terms of the Mozilla
7 // Public License v. 2.0. If a copy of the MPL was not distributed
8 // with this file, You can obtain one at http://mozilla.org/MPL/2.0/.
9 
10 #ifndef EIGEN2_META_H
11 #define EIGEN2_META_H
12 
13 namespace Eigen {
14 
15 template<typename T>
17 {};
18 
19 struct ei_meta_true { enum { ret = 1 }; };
20 struct ei_meta_false { enum { ret = 0 }; };
21 
22 template<bool Condition, typename Then, typename Else>
23 struct ei_meta_if { typedef Then ret; };
24 
25 template<typename Then, typename Else>
26 struct ei_meta_if <false, Then, Else> { typedef Else ret; };
27 
28 template<typename T, typename U> struct ei_is_same_type { enum { ret = 0 }; };
29 template<typename T> struct ei_is_same_type<T,T> { enum { ret = 1 }; };
30 
31 template<typename T> struct ei_unref { typedef T type; };
32 template<typename T> struct ei_unref<T&> { typedef T type; };
33 
34 template<typename T> struct ei_unpointer { typedef T type; };
35 template<typename T> struct ei_unpointer<T*> { typedef T type; };
36 template<typename T> struct ei_unpointer<T*const> { typedef T type; };
37 
38 template<typename T> struct ei_unconst { typedef T type; };
39 template<typename T> struct ei_unconst<const T> { typedef T type; };
40 template<typename T> struct ei_unconst<T const &> { typedef T & type; };
41 template<typename T> struct ei_unconst<T const *> { typedef T * type; };
42 
43 template<typename T> struct ei_cleantype { typedef T type; };
44 template<typename T> struct ei_cleantype<const T> { typedef typename ei_cleantype<T>::type type; };
45 template<typename T> struct ei_cleantype<const T&> { typedef typename ei_cleantype<T>::type type; };
46 template<typename T> struct ei_cleantype<T&> { typedef typename ei_cleantype<T>::type type; };
47 template<typename T> struct ei_cleantype<const T*> { typedef typename ei_cleantype<T>::type type; };
48 template<typename T> struct ei_cleantype<T*> { typedef typename ei_cleantype<T>::type type; };
49 
53 template<int Y,
54  int InfX = 0,
55  int SupX = ((Y==1) ? 1 : Y/2),
56  bool Done = ((SupX-InfX)<=1 ? true : ((SupX*SupX <= Y) && ((SupX+1)*(SupX+1) > Y))) >
57  // use ?: instead of || just to shut up a stupid gcc 4.3 warning
59 {
60  enum {
61  MidX = (InfX+SupX)/2,
62  TakeInf = MidX*MidX > Y ? 1 : 0,
63  NewInf = int(TakeInf) ? InfX : int(MidX),
64  NewSup = int(TakeInf) ? int(MidX) : SupX
65  };
66  public:
68 };
69 
70 template<int Y, int InfX, int SupX>
71 class ei_meta_sqrt<Y, InfX, SupX, true> { public: enum { ret = (SupX*SupX <= Y) ? SupX : InfX }; };
72 
73 } // end namespace Eigen
74 
75 #endif // EIGEN2_META_H
ei_cleantype< T >::type type
Definition: LDLT.h:16
ei_cleantype< T >::type type
ei_cleantype< T >::type type


tuw_aruco
Author(s): Lukas Pfeifhofer
autogenerated on Mon Jun 10 2019 15:40:54