Recover compile-time size from seq(A,B) when A and B are fixed values. (c++11 only)

This commit is contained in:
Gael Guennebaud
2017-01-19 20:34:18 +01:00
parent 54f3fbee24
commit 4d302a080c
4 changed files with 46 additions and 12 deletions

View File

@@ -28,6 +28,10 @@ template<int N> struct fix_t {
}
fix_t<-N> operator-() const { return fix_t<-N>(); }
template<int M>
fix_t<N+M> operator+(fix_t<M>) const { return fix_t<N+M>(); }
template<int M>
fix_t<N-M> operator-(fix_t<M>) const { return fix_t<N-M>(); }
#if EIGEN_HAS_CXX14
// Needed in C++14 to allow fix<N>():

View File

@@ -163,6 +163,13 @@ struct is_symbolic {
enum { value = internal::is_convertible<T,BaseExpr<T> >::value };
};
// Specialization for functions, because is_convertible fails in this case.
// Useful in c++98/11 mode when testing is_symbolic<decltype(fix<N>)>
template<typename T>
struct is_symbolic<T (*)()> {
enum { value = false };
};
/** Represents the actual value of a symbol identified by its tag
*
* It is the return type of SymbolValue::operator=, and most of the time this is only way it is used.