11 #ifndef EIGEN_RETURNBYVALUE_H
12 #define EIGEN_RETURNBYVALUE_H
23 template<
typename Derived>
24 struct traits<ReturnByValue<Derived> >
25 :
public traits<typename traits<Derived>::ReturnType>
31 Flags = (traits<typename traits<Derived>::ReturnType>::Flags
43 template<
typename Derived,
int n,
typename PlainObject>
44 struct nested_eval<ReturnByValue<Derived>, n, PlainObject>
46 typedef typename traits<Derived>::ReturnType type;
51 template<
typename Derived>
class ReturnByValue
52 :
public internal::dense_xpr_base< ReturnByValue<Derived> >::type, internal::no_assignment_operator
55 typedef typename internal::traits<Derived>::ReturnType ReturnType;
57 typedef typename internal::dense_xpr_base<ReturnByValue>::type Base;
58 EIGEN_DENSE_PUBLIC_INTERFACE(ReturnByValue)
60 template<typename Dest>
62 inline
void evalTo(Dest& dst)
const
63 {
static_cast<const Derived*
>(
this)->evalTo(dst); }
64 EIGEN_DEVICE_FUNC
inline Index rows()
const {
return static_cast<const Derived*
>(
this)->rows(); }
65 EIGEN_DEVICE_FUNC
inline Index cols()
const {
return static_cast<const Derived*
>(
this)->cols(); }
67 #ifndef EIGEN_PARSED_BY_DOXYGEN
68 #define Unusable YOU_ARE_TRYING_TO_ACCESS_A_SINGLE_COEFFICIENT_IN_A_SPECIAL_EXPRESSION_WHERE_THAT_IS_NOT_ALLOWED_BECAUSE_THAT_WOULD_BE_INEFFICIENT
70 Unusable(
const Unusable&) {}
71 Unusable& operator=(
const Unusable&) {
return *
this;}
73 const Unusable& coeff(Index)
const {
return *
reinterpret_cast<const Unusable*
>(
this); }
74 const Unusable& coeff(Index,Index)
const {
return *
reinterpret_cast<const Unusable*
>(
this); }
75 Unusable& coeffRef(Index) {
return *
reinterpret_cast<Unusable*
>(
this); }
76 Unusable& coeffRef(Index,Index) {
return *
reinterpret_cast<Unusable*
>(
this); }
81 template<
typename Derived>
82 template<
typename OtherDerived>
85 other.evalTo(derived());
95 template<
typename Derived>
96 struct evaluator<ReturnByValue<Derived> >
97 :
public evaluator<typename internal::traits<Derived>::ReturnType>
99 typedef ReturnByValue<Derived> XprType;
100 typedef typename internal::traits<Derived>::ReturnType PlainObject;
101 typedef evaluator<PlainObject> Base;
103 EIGEN_DEVICE_FUNC
explicit evaluator(
const XprType& xpr)
104 : m_result(xpr.rows(), xpr.cols())
106 ::new (static_cast<Base*>(
this)) Base(m_result);
107 xpr.evalTo(m_result);
111 PlainObject m_result;
118 #endif // EIGEN_RETURNBYVALUE_H
const unsigned int DirectAccessBit
Definition: Constants.h:149
Derived & operator=(const DenseBase< OtherDerived > &other)
Definition: Assign.h:39
Definition: Eigen_Colamd.h:54
const unsigned int EvalBeforeNestingBit
Definition: Constants.h:65