mirror of
https://gitlab.com/libeigen/eigen.git
synced 2025-04-20 08:39:37 +08:00
bug #360: add value_type typedef to DenseBase/SparseMatrixBase
This commit is contained in:
parent
c460af414e
commit
40258078c6
@ -66,7 +66,14 @@ template<typename Derived> class DenseBase
|
||||
*/
|
||||
typedef typename internal::traits<Derived>::StorageIndex StorageIndex;
|
||||
|
||||
/** The numeric type of the expression' coefficients, e.g. float, double, int or std::complex<float>, etc. */
|
||||
typedef typename internal::traits<Derived>::Scalar Scalar;
|
||||
|
||||
/** The numeric type of the expression' coefficients, e.g. float, double, int or std::complex<float>, etc.
|
||||
*
|
||||
* It is an alias for the Scalar type */
|
||||
typedef Scalar value_type;
|
||||
|
||||
typedef typename internal::packet_traits<Scalar>::type PacketScalar;
|
||||
typedef typename NumTraits<Scalar>::Real RealScalar;
|
||||
|
||||
|
@ -96,6 +96,7 @@ class PlainObjectBase : public internal::dense_xpr_base<Derived>::type
|
||||
|
||||
typedef typename internal::traits<Derived>::StorageKind StorageKind;
|
||||
typedef typename internal::traits<Derived>::Scalar Scalar;
|
||||
|
||||
typedef typename internal::packet_traits<Scalar>::type PacketScalar;
|
||||
typedef typename NumTraits<Scalar>::Real RealScalar;
|
||||
typedef Derived DenseType;
|
||||
|
@ -262,22 +262,25 @@ class SparseMatrix
|
||||
#ifdef EIGEN_PARSED_BY_DOXYGEN
|
||||
/** Preallocates \a reserveSize[\c j] non zeros for each column (resp. row) \c j.
|
||||
*
|
||||
* This function turns the matrix in non-compressed mode */
|
||||
* This function turns the matrix in non-compressed mode.
|
||||
*
|
||||
* The type \c SizesType must expose the following interface:
|
||||
\code
|
||||
typedef value_type;
|
||||
const value_type& operator[](i) const;
|
||||
\endcode
|
||||
* for \c i in the [0,this->outerSize()[ range.
|
||||
* Typical choices include std::vector<int>, Eigen::VectorXi, Eigen::VectorXi::Constant, etc.
|
||||
*/
|
||||
template<class SizesType>
|
||||
inline void reserve(const SizesType& reserveSizes);
|
||||
#else
|
||||
template<class SizesType>
|
||||
inline void reserve(const SizesType& reserveSizes, const typename SizesType::value_type& enableif = typename SizesType::value_type())
|
||||
{
|
||||
EIGEN_UNUSED_VARIABLE(enableif);
|
||||
reserveInnerVectors(reserveSizes);
|
||||
}
|
||||
template<class SizesType>
|
||||
inline void reserve(const SizesType& reserveSizes, const typename SizesType::Scalar& enableif =
|
||||
inline void reserve(const SizesType& reserveSizes, const typename SizesType::value_type& enableif =
|
||||
#if (!EIGEN_COMP_MSVC) || (EIGEN_COMP_MSVC>=1500) // MSVC 2005 fails to compile with this typename
|
||||
typename
|
||||
#endif
|
||||
SizesType::Scalar())
|
||||
SizesType::value_type())
|
||||
{
|
||||
EIGEN_UNUSED_VARIABLE(enableif);
|
||||
reserveInnerVectors(reserveSizes);
|
||||
|
@ -28,6 +28,12 @@ template<typename Derived> class SparseMatrixBase : public EigenBase<Derived>
|
||||
public:
|
||||
|
||||
typedef typename internal::traits<Derived>::Scalar Scalar;
|
||||
|
||||
/** The numeric type of the expression' coefficients, e.g. float, double, int or std::complex<float>, etc.
|
||||
*
|
||||
* It is an alias for the Scalar type */
|
||||
typedef Scalar value_type;
|
||||
|
||||
typedef typename internal::packet_traits<Scalar>::type PacketScalar;
|
||||
typedef typename internal::traits<Derived>::StorageKind StorageKind;
|
||||
typedef typename internal::traits<Derived>::StorageIndex StorageIndex;
|
||||
|
Loading…
x
Reference in New Issue
Block a user