mirror of
https://gitlab.com/libeigen/eigen.git
synced 2025-08-11 03:09:01 +08:00
remove TVMET_DYNAMIC_MEMORY define and corresponding checks.
This commit is contained in:
parent
5205e88113
commit
8c001c1342
@ -207,25 +207,14 @@ public:
|
|||||||
|
|
||||||
public:
|
public:
|
||||||
/** Default Destructor */
|
/** Default Destructor */
|
||||||
~Matrix() {
|
~Matrix() {}
|
||||||
#if defined(TVMET_DYNAMIC_MEMORY)
|
|
||||||
delete [] m_data;
|
|
||||||
#endif
|
|
||||||
}
|
|
||||||
|
|
||||||
/** Default Constructor. The allocated memory region isn't cleared. If you want
|
/** Default Constructor. The allocated memory region isn't cleared. If you want
|
||||||
a clean use the constructor argument zero. */
|
a clean use the constructor argument zero. */
|
||||||
explicit Matrix()
|
explicit Matrix() {}
|
||||||
#if defined(TVMET_DYNAMIC_MEMORY)
|
|
||||||
: m_data( new value_type[Size] )
|
|
||||||
#endif
|
|
||||||
{ }
|
|
||||||
|
|
||||||
/** Copy Constructor, not explicit! */
|
/** Copy Constructor, not explicit! */
|
||||||
Matrix(const Matrix& rhs)
|
Matrix(const Matrix& rhs)
|
||||||
#if defined(TVMET_DYNAMIC_MEMORY)
|
|
||||||
: m_data( new value_type[Size] )
|
|
||||||
#endif
|
|
||||||
{
|
{
|
||||||
*this = XprMatrix<ConstReference, Rows, Cols>(rhs.const_ref());
|
*this = XprMatrix<ConstReference, Rows, Cols>(rhs.const_ref());
|
||||||
}
|
}
|
||||||
@ -236,9 +225,6 @@ public:
|
|||||||
*/
|
*/
|
||||||
template<class InputIterator>
|
template<class InputIterator>
|
||||||
explicit Matrix(InputIterator first, InputIterator last)
|
explicit Matrix(InputIterator first, InputIterator last)
|
||||||
#if defined(TVMET_DYNAMIC_MEMORY)
|
|
||||||
: m_data( new value_type[Size] )
|
|
||||||
#endif
|
|
||||||
{
|
{
|
||||||
TVMET_RT_CONDITION(static_cast<std::size_t>(std::distance(first, last)) <= Size,
|
TVMET_RT_CONDITION(static_cast<std::size_t>(std::distance(first, last)) <= Size,
|
||||||
"InputIterator doesn't fits in size" )
|
"InputIterator doesn't fits in size" )
|
||||||
@ -251,9 +237,6 @@ public:
|
|||||||
*/
|
*/
|
||||||
template<class InputIterator>
|
template<class InputIterator>
|
||||||
explicit Matrix(InputIterator first, std::size_t sz)
|
explicit Matrix(InputIterator first, std::size_t sz)
|
||||||
#if defined(TVMET_DYNAMIC_MEMORY)
|
|
||||||
: m_data( new value_type[Size] )
|
|
||||||
#endif
|
|
||||||
{
|
{
|
||||||
TVMET_RT_CONDITION(sz <= Size, "InputIterator doesn't fits in size" )
|
TVMET_RT_CONDITION(sz <= Size, "InputIterator doesn't fits in size" )
|
||||||
std::copy(first, first + sz, m_data);
|
std::copy(first, first + sz, m_data);
|
||||||
@ -261,9 +244,6 @@ public:
|
|||||||
|
|
||||||
/** Construct the matrix by value. */
|
/** Construct the matrix by value. */
|
||||||
explicit Matrix(value_type rhs)
|
explicit Matrix(value_type rhs)
|
||||||
#if defined(TVMET_DYNAMIC_MEMORY)
|
|
||||||
: m_data( new value_type[Size] )
|
|
||||||
#endif
|
|
||||||
{
|
{
|
||||||
typedef XprLiteral<value_type> expr_type;
|
typedef XprLiteral<value_type> expr_type;
|
||||||
*this = XprMatrix<expr_type, Rows, Cols>(expr_type(rhs));
|
*this = XprMatrix<expr_type, Rows, Cols>(expr_type(rhs));
|
||||||
@ -272,9 +252,6 @@ public:
|
|||||||
/** Construct a matrix by expression. */
|
/** Construct a matrix by expression. */
|
||||||
template<class E>
|
template<class E>
|
||||||
explicit Matrix(const XprMatrix<E, Rows, Cols>& e)
|
explicit Matrix(const XprMatrix<E, Rows, Cols>& e)
|
||||||
#if defined(TVMET_DYNAMIC_MEMORY)
|
|
||||||
: m_data( new value_type[Size] )
|
|
||||||
#endif
|
|
||||||
{
|
{
|
||||||
*this = e;
|
*this = e;
|
||||||
}
|
}
|
||||||
@ -450,11 +427,7 @@ public: // io
|
|||||||
|
|
||||||
private:
|
private:
|
||||||
/** The data of matrix self. */
|
/** The data of matrix self. */
|
||||||
#if defined(TVMET_DYNAMIC_MEMORY)
|
|
||||||
value_type* m_data;
|
|
||||||
#else
|
|
||||||
value_type m_data[Size];
|
value_type m_data[Size];
|
||||||
#endif
|
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
|
@ -195,25 +195,14 @@ public: // STL interface
|
|||||||
|
|
||||||
public:
|
public:
|
||||||
/** Default Destructor */
|
/** Default Destructor */
|
||||||
~Vector() {
|
~Vector() {}
|
||||||
#if defined(TVMET_DYNAMIC_MEMORY)
|
|
||||||
delete [] m_data;
|
|
||||||
#endif
|
|
||||||
}
|
|
||||||
|
|
||||||
/** Default Constructor. The allocated memory region isn't cleared. If you want
|
/** Default Constructor. The allocated memory region isn't cleared. If you want
|
||||||
a clean use the constructor argument zero. */
|
a clean use the constructor argument zero. */
|
||||||
explicit Vector()
|
explicit Vector() {}
|
||||||
#if defined(TVMET_DYNAMIC_MEMORY)
|
|
||||||
: m_data( new value_type[Size] )
|
|
||||||
#endif
|
|
||||||
{ }
|
|
||||||
|
|
||||||
/** Copy Constructor, not explicit! */
|
/** Copy Constructor, not explicit! */
|
||||||
Vector(const Vector& rhs)
|
Vector(const Vector& rhs)
|
||||||
#if defined(TVMET_DYNAMIC_MEMORY)
|
|
||||||
: m_data( new value_type[Size] )
|
|
||||||
#endif
|
|
||||||
{
|
{
|
||||||
*this = XprVector<ConstReference, Size>(rhs.const_ref());
|
*this = XprVector<ConstReference, Size>(rhs.const_ref());
|
||||||
}
|
}
|
||||||
@ -224,9 +213,6 @@ public:
|
|||||||
*/
|
*/
|
||||||
template<class InputIterator>
|
template<class InputIterator>
|
||||||
explicit Vector(InputIterator first, InputIterator last)
|
explicit Vector(InputIterator first, InputIterator last)
|
||||||
#if defined(TVMET_DYNAMIC_MEMORY)
|
|
||||||
: m_data( new value_type[Size] )
|
|
||||||
#endif
|
|
||||||
{
|
{
|
||||||
TVMET_RT_CONDITION( static_cast<std::size_t>(std::distance(first, last)) <= Size,
|
TVMET_RT_CONDITION( static_cast<std::size_t>(std::distance(first, last)) <= Size,
|
||||||
"InputIterator doesn't fits in size" )
|
"InputIterator doesn't fits in size" )
|
||||||
@ -239,9 +225,6 @@ public:
|
|||||||
*/
|
*/
|
||||||
template<class InputIterator>
|
template<class InputIterator>
|
||||||
explicit Vector(InputIterator first, std::size_t sz)
|
explicit Vector(InputIterator first, std::size_t sz)
|
||||||
#if defined(TVMET_DYNAMIC_MEMORY)
|
|
||||||
: m_data( new value_type[Size] )
|
|
||||||
#endif
|
|
||||||
{
|
{
|
||||||
TVMET_RT_CONDITION( sz <= Size, "InputIterator doesn't fits in size" )
|
TVMET_RT_CONDITION( sz <= Size, "InputIterator doesn't fits in size" )
|
||||||
std::copy(first, first + sz, m_data);
|
std::copy(first, first + sz, m_data);
|
||||||
@ -249,9 +232,6 @@ public:
|
|||||||
|
|
||||||
/** Constructor with initializer for all elements. */
|
/** Constructor with initializer for all elements. */
|
||||||
explicit Vector(value_type rhs)
|
explicit Vector(value_type rhs)
|
||||||
#if defined(TVMET_DYNAMIC_MEMORY)
|
|
||||||
: m_data( new value_type[Size] )
|
|
||||||
#endif
|
|
||||||
{
|
{
|
||||||
typedef XprLiteral<value_type> expr_type;
|
typedef XprLiteral<value_type> expr_type;
|
||||||
*this = XprVector<expr_type, Size>(expr_type(rhs));
|
*this = XprVector<expr_type, Size>(expr_type(rhs));
|
||||||
@ -259,9 +239,6 @@ public:
|
|||||||
|
|
||||||
/** Default Constructor with initializer list. */
|
/** Default Constructor with initializer list. */
|
||||||
explicit Vector(value_type x0, value_type x1)
|
explicit Vector(value_type x0, value_type x1)
|
||||||
#if defined(TVMET_DYNAMIC_MEMORY)
|
|
||||||
: m_data( new value_type[Size] )
|
|
||||||
#endif
|
|
||||||
{
|
{
|
||||||
TVMET_CT_CONDITION(2 <= Size, ArgumentList_is_too_long)
|
TVMET_CT_CONDITION(2 <= Size, ArgumentList_is_too_long)
|
||||||
m_data[0] = x0; m_data[1] = x1;
|
m_data[0] = x0; m_data[1] = x1;
|
||||||
@ -269,9 +246,6 @@ public:
|
|||||||
|
|
||||||
/** Default Constructor with initializer list. */
|
/** Default Constructor with initializer list. */
|
||||||
explicit Vector(value_type x0, value_type x1, value_type x2)
|
explicit Vector(value_type x0, value_type x1, value_type x2)
|
||||||
#if defined(TVMET_DYNAMIC_MEMORY)
|
|
||||||
: m_data( new value_type[Size] )
|
|
||||||
#endif
|
|
||||||
{
|
{
|
||||||
TVMET_CT_CONDITION(3 <= Size, ArgumentList_is_too_long)
|
TVMET_CT_CONDITION(3 <= Size, ArgumentList_is_too_long)
|
||||||
m_data[0] = x0; m_data[1] = x1; m_data[2] = x2;
|
m_data[0] = x0; m_data[1] = x1; m_data[2] = x2;
|
||||||
@ -279,9 +253,6 @@ public:
|
|||||||
|
|
||||||
/** Default Constructor with initializer list. */
|
/** Default Constructor with initializer list. */
|
||||||
explicit Vector(value_type x0, value_type x1, value_type x2, value_type x3)
|
explicit Vector(value_type x0, value_type x1, value_type x2, value_type x3)
|
||||||
#if defined(TVMET_DYNAMIC_MEMORY)
|
|
||||||
: m_data( new value_type[Size] )
|
|
||||||
#endif
|
|
||||||
{
|
{
|
||||||
TVMET_CT_CONDITION(4 <= Size, ArgumentList_is_too_long)
|
TVMET_CT_CONDITION(4 <= Size, ArgumentList_is_too_long)
|
||||||
m_data[0] = x0; m_data[1] = x1; m_data[2] = x2; m_data[3] = x3;
|
m_data[0] = x0; m_data[1] = x1; m_data[2] = x2; m_data[3] = x3;
|
||||||
@ -290,9 +261,6 @@ public:
|
|||||||
/** Default Constructor with initializer list. */
|
/** Default Constructor with initializer list. */
|
||||||
explicit Vector(value_type x0, value_type x1, value_type x2, value_type x3,
|
explicit Vector(value_type x0, value_type x1, value_type x2, value_type x3,
|
||||||
value_type x4)
|
value_type x4)
|
||||||
#if defined(TVMET_DYNAMIC_MEMORY)
|
|
||||||
: m_data( new value_type[Size] )
|
|
||||||
#endif
|
|
||||||
{
|
{
|
||||||
TVMET_CT_CONDITION(5 <= Size, ArgumentList_is_too_long)
|
TVMET_CT_CONDITION(5 <= Size, ArgumentList_is_too_long)
|
||||||
m_data[0] = x0; m_data[1] = x1; m_data[2] = x2; m_data[3] = x3; m_data[4] = x4;
|
m_data[0] = x0; m_data[1] = x1; m_data[2] = x2; m_data[3] = x3; m_data[4] = x4;
|
||||||
@ -301,9 +269,6 @@ public:
|
|||||||
/** Default Constructor with initializer list. */
|
/** Default Constructor with initializer list. */
|
||||||
explicit Vector(value_type x0, value_type x1, value_type x2, value_type x3,
|
explicit Vector(value_type x0, value_type x1, value_type x2, value_type x3,
|
||||||
value_type x4, value_type x5)
|
value_type x4, value_type x5)
|
||||||
#if defined(TVMET_DYNAMIC_MEMORY)
|
|
||||||
: m_data( new value_type[Size] )
|
|
||||||
#endif
|
|
||||||
{
|
{
|
||||||
TVMET_CT_CONDITION(6 <= Size, ArgumentList_is_too_long)
|
TVMET_CT_CONDITION(6 <= Size, ArgumentList_is_too_long)
|
||||||
m_data[0] = x0; m_data[1] = x1; m_data[2] = x2; m_data[3] = x3; m_data[4] = x4;
|
m_data[0] = x0; m_data[1] = x1; m_data[2] = x2; m_data[3] = x3; m_data[4] = x4;
|
||||||
@ -313,9 +278,6 @@ public:
|
|||||||
/** Default Constructor with initializer list. */
|
/** Default Constructor with initializer list. */
|
||||||
explicit Vector(value_type x0, value_type x1, value_type x2, value_type x3,
|
explicit Vector(value_type x0, value_type x1, value_type x2, value_type x3,
|
||||||
value_type x4, value_type x5, value_type x6)
|
value_type x4, value_type x5, value_type x6)
|
||||||
#if defined(TVMET_DYNAMIC_MEMORY)
|
|
||||||
: m_data( new value_type[Size] )
|
|
||||||
#endif
|
|
||||||
{
|
{
|
||||||
TVMET_CT_CONDITION(7 <= Size, ArgumentList_is_too_long)
|
TVMET_CT_CONDITION(7 <= Size, ArgumentList_is_too_long)
|
||||||
m_data[0] = x0; m_data[1] = x1; m_data[2] = x2; m_data[3] = x3; m_data[4] = x4;
|
m_data[0] = x0; m_data[1] = x1; m_data[2] = x2; m_data[3] = x3; m_data[4] = x4;
|
||||||
@ -325,9 +287,6 @@ public:
|
|||||||
/** Default Constructor with initializer list. */
|
/** Default Constructor with initializer list. */
|
||||||
explicit Vector(value_type x0, value_type x1, value_type x2, value_type x3,
|
explicit Vector(value_type x0, value_type x1, value_type x2, value_type x3,
|
||||||
value_type x4, value_type x5, value_type x6, value_type x7)
|
value_type x4, value_type x5, value_type x6, value_type x7)
|
||||||
#if defined(TVMET_DYNAMIC_MEMORY)
|
|
||||||
: m_data( new value_type[Size] )
|
|
||||||
#endif
|
|
||||||
{
|
{
|
||||||
TVMET_CT_CONDITION(8 <= Size, ArgumentList_is_too_long)
|
TVMET_CT_CONDITION(8 <= Size, ArgumentList_is_too_long)
|
||||||
m_data[0] = x0; m_data[1] = x1; m_data[2] = x2; m_data[3] = x3; m_data[4] = x4;
|
m_data[0] = x0; m_data[1] = x1; m_data[2] = x2; m_data[3] = x3; m_data[4] = x4;
|
||||||
@ -338,9 +297,6 @@ public:
|
|||||||
explicit Vector(value_type x0, value_type x1, value_type x2, value_type x3,
|
explicit Vector(value_type x0, value_type x1, value_type x2, value_type x3,
|
||||||
value_type x4, value_type x5, value_type x6, value_type x7,
|
value_type x4, value_type x5, value_type x6, value_type x7,
|
||||||
value_type x8)
|
value_type x8)
|
||||||
#if defined(TVMET_DYNAMIC_MEMORY)
|
|
||||||
: m_data( new value_type[Size] )
|
|
||||||
#endif
|
|
||||||
{
|
{
|
||||||
TVMET_CT_CONDITION(9 <= Size, ArgumentList_is_too_long)
|
TVMET_CT_CONDITION(9 <= Size, ArgumentList_is_too_long)
|
||||||
m_data[0] = x0; m_data[1] = x1; m_data[2] = x2; m_data[3] = x3; m_data[4] = x4;
|
m_data[0] = x0; m_data[1] = x1; m_data[2] = x2; m_data[3] = x3; m_data[4] = x4;
|
||||||
@ -351,9 +307,6 @@ public:
|
|||||||
explicit Vector(value_type x0, value_type x1, value_type x2, value_type x3,
|
explicit Vector(value_type x0, value_type x1, value_type x2, value_type x3,
|
||||||
value_type x4, value_type x5, value_type x6, value_type x7,
|
value_type x4, value_type x5, value_type x6, value_type x7,
|
||||||
value_type x8, value_type x9)
|
value_type x8, value_type x9)
|
||||||
#if defined(TVMET_DYNAMIC_MEMORY)
|
|
||||||
: m_data( new value_type[Size] )
|
|
||||||
#endif
|
|
||||||
{
|
{
|
||||||
TVMET_CT_CONDITION(10 <= Size, ArgumentList_is_too_long)
|
TVMET_CT_CONDITION(10 <= Size, ArgumentList_is_too_long)
|
||||||
m_data[0] = x0; m_data[1] = x1; m_data[2] = x2; m_data[3] = x3; m_data[4] = x4;
|
m_data[0] = x0; m_data[1] = x1; m_data[2] = x2; m_data[3] = x3; m_data[4] = x4;
|
||||||
@ -363,9 +316,6 @@ public:
|
|||||||
/** Construct a vector by expression. */
|
/** Construct a vector by expression. */
|
||||||
template <class E>
|
template <class E>
|
||||||
explicit Vector(const XprVector<E, Size>& e)
|
explicit Vector(const XprVector<E, Size>& e)
|
||||||
#if defined(TVMET_DYNAMIC_MEMORY)
|
|
||||||
: m_data( new value_type[Size] )
|
|
||||||
#endif
|
|
||||||
{
|
{
|
||||||
*this = e;
|
*this = e;
|
||||||
}
|
}
|
||||||
@ -537,11 +487,7 @@ public: // io
|
|||||||
private:
|
private:
|
||||||
/** The data of vector self. */
|
/** The data of vector self. */
|
||||||
|
|
||||||
#if defined(TVMET_DYNAMIC_MEMORY)
|
|
||||||
value_type* m_data;
|
|
||||||
#else
|
|
||||||
value_type m_data[Size];
|
value_type m_data[Size];
|
||||||
#endif
|
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user