11#ifndef EIGEN_RETURNBYVALUE_H
12#define EIGEN_RETURNBYVALUE_H
14#include "./InternalHeaderCheck.h"
20template<
typename Derived>
21struct traits<ReturnByValue<Derived> >
22 :
public traits<typename traits<Derived>::ReturnType>
28 Flags = (traits<typename traits<Derived>::ReturnType>::Flags
40template<
typename Derived,
int n,
typename PlainObject>
41struct nested_eval<ReturnByValue<Derived>, n, PlainObject>
43 typedef typename traits<Derived>::ReturnType type;
52template<
typename Derived>
class ReturnByValue
53 :
public internal::dense_xpr_base< ReturnByValue<Derived> >::type, internal::no_assignment_operator
56 typedef typename internal::traits<Derived>::ReturnType ReturnType;
58 typedef typename internal::dense_xpr_base<ReturnByValue>::type Base;
59 EIGEN_DENSE_PUBLIC_INTERFACE(ReturnByValue)
61 template<
typename Dest>
63 inline void evalTo(Dest& dst)
const
64 {
static_cast<const Derived*
>(
this)->evalTo(dst); }
65 EIGEN_DEVICE_FUNC EIGEN_CONSTEXPR
66 inline Index rows() const EIGEN_NOEXCEPT {
return static_cast<const Derived*
>(
this)->rows(); }
67 EIGEN_DEVICE_FUNC EIGEN_CONSTEXPR
68 inline Index cols() const EIGEN_NOEXCEPT {
return static_cast<const Derived*
>(
this)->cols(); }
70#ifndef EIGEN_PARSED_BY_DOXYGEN
71#define Unusable YOU_ARE_TRYING_TO_ACCESS_A_SINGLE_COEFFICIENT_IN_A_SPECIAL_EXPRESSION_WHERE_THAT_IS_NOT_ALLOWED_BECAUSE_THAT_WOULD_BE_INEFFICIENT
73 Unusable(
const Unusable&) {}
74 Unusable& operator=(
const Unusable&) {
return *
this;}
76 const Unusable& coeff(
Index)
const {
return *
reinterpret_cast<const Unusable*
>(
this); }
77 const Unusable& coeff(
Index,
Index)
const {
return *
reinterpret_cast<const Unusable*
>(
this); }
78 Unusable& coeffRef(
Index) {
return *
reinterpret_cast<Unusable*
>(
this); }
79 Unusable& coeffRef(
Index,
Index) {
return *
reinterpret_cast<Unusable*
>(
this); }
84template<
typename Derived>
85template<
typename OtherDerived>
88 other.evalTo(derived());
98template<
typename Derived>
99struct evaluator<ReturnByValue<Derived> >
100 :
public evaluator<typename internal::traits<Derived>::ReturnType>
102 typedef ReturnByValue<Derived> XprType;
103 typedef typename internal::traits<Derived>::ReturnType PlainObject;
104 typedef evaluator<PlainObject> Base;
106 EIGEN_DEVICE_FUNC
explicit evaluator(
const XprType& xpr)
107 : m_result(xpr.rows(), xpr.cols())
109 ::new (
static_cast<Base*
>(
this)) Base(m_result);
110 xpr.evalTo(m_result);
114 PlainObject m_result;
Derived & operator=(const DenseBase< OtherDerived > &other)
Definition: Assign.h:41
const unsigned int EvalBeforeNestingBit
Definition: Constants.h:72
const unsigned int DirectAccessBit
Definition: Constants.h:157
Namespace containing all symbols from the Eigen library.
Definition: B01_Experimental.dox:1
EIGEN_DEFAULT_DENSE_INDEX_TYPE Index
The Index type as used for the API.
Definition: Meta.h:59