mirror of
https://gitlab.com/libeigen/eigen.git
synced 2025-06-04 18:54:00 +08:00
Workaround various "returning reference to temporary" warnings.
This commit is contained in:
parent
6ccf97f3e6
commit
80ed5bd90c
@ -26,13 +26,6 @@
|
|||||||
* This module depends on: Core.
|
* This module depends on: Core.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
namespace Eigen {
|
|
||||||
|
|
||||||
/** The type used to identify a general sparse storage. */
|
|
||||||
struct Sparse {};
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
#include "src/SparseCore/SparseUtil.h"
|
#include "src/SparseCore/SparseUtil.h"
|
||||||
#include "src/SparseCore/SparseMatrixBase.h"
|
#include "src/SparseCore/SparseMatrixBase.h"
|
||||||
#include "src/SparseCore/SparseAssign.h"
|
#include "src/SparseCore/SparseAssign.h"
|
||||||
|
@ -1221,7 +1221,9 @@ struct evaluator<Diagonal<ArgType, DiagIndex> >
|
|||||||
|
|
||||||
typedef typename XprType::Index Index;
|
typedef typename XprType::Index Index;
|
||||||
typedef typename XprType::Scalar Scalar;
|
typedef typename XprType::Scalar Scalar;
|
||||||
typedef typename XprType::CoeffReturnType CoeffReturnType;
|
// FIXME having to check whether ArgType is sparse here i not very nice.
|
||||||
|
typedef typename internal::conditional<!internal::is_same<typename ArgType::StorageKind,Sparse>::value,
|
||||||
|
typename XprType::CoeffReturnType,Scalar>::type CoeffReturnType;
|
||||||
|
|
||||||
EIGEN_DEVICE_FUNC CoeffReturnType coeff(Index row, Index) const
|
EIGEN_DEVICE_FUNC CoeffReturnType coeff(Index row, Index) const
|
||||||
{
|
{
|
||||||
|
@ -449,6 +449,9 @@ enum Action {GetAction, SetAction};
|
|||||||
/** The type used to identify a dense storage. */
|
/** The type used to identify a dense storage. */
|
||||||
struct Dense {};
|
struct Dense {};
|
||||||
|
|
||||||
|
/** The type used to identify a general sparse storage. */
|
||||||
|
struct Sparse {};
|
||||||
|
|
||||||
/** The type used to identify a permutation storage. */
|
/** The type used to identify a permutation storage. */
|
||||||
struct PermutationStorage {};
|
struct PermutationStorage {};
|
||||||
|
|
||||||
|
@ -143,7 +143,7 @@ class CompressedStorage
|
|||||||
}
|
}
|
||||||
|
|
||||||
/** Like at(), but the search is performed in the range [start,end) */
|
/** Like at(), but the search is performed in the range [start,end) */
|
||||||
inline const Scalar& atInRange(size_t start, size_t end, Index key, const Scalar& defaultValue = Scalar(0)) const
|
inline Scalar atInRange(size_t start, size_t end, Index key, const Scalar &defaultValue = Scalar(0)) const
|
||||||
{
|
{
|
||||||
if (start>=end)
|
if (start>=end)
|
||||||
return defaultValue;
|
return defaultValue;
|
||||||
|
@ -179,7 +179,7 @@ class SparseMatrix
|
|||||||
|
|
||||||
/** \returns the value of the matrix at position \a i, \a j
|
/** \returns the value of the matrix at position \a i, \a j
|
||||||
* This function returns Scalar(0) if the element is an explicit \em zero */
|
* This function returns Scalar(0) if the element is an explicit \em zero */
|
||||||
inline const Scalar& coeff(Index row, Index col) const
|
inline Scalar coeff(Index row, Index col) const
|
||||||
{
|
{
|
||||||
eigen_assert(row>=0 && row<rows() && col>=0 && col<cols());
|
eigen_assert(row>=0 && row<rows() && col>=0 && col<cols());
|
||||||
|
|
||||||
@ -1297,7 +1297,7 @@ struct evaluator<SparseMatrix<_Scalar,_Options,_Index> >
|
|||||||
operator const SparseMatrixType&() const { return *m_matrix; }
|
operator const SparseMatrixType&() const { return *m_matrix; }
|
||||||
|
|
||||||
typedef typename DenseCoeffsBase<SparseMatrixType,ReadOnlyAccessors>::CoeffReturnType CoeffReturnType;
|
typedef typename DenseCoeffsBase<SparseMatrixType,ReadOnlyAccessors>::CoeffReturnType CoeffReturnType;
|
||||||
CoeffReturnType coeff(Index row, Index col) const
|
Scalar coeff(Index row, Index col) const
|
||||||
{ return m_matrix->coeff(row,col); }
|
{ return m_matrix->coeff(row,col); }
|
||||||
|
|
||||||
Scalar& coeffRef(Index row, Index col)
|
Scalar& coeffRef(Index row, Index col)
|
||||||
|
Loading…
x
Reference in New Issue
Block a user