12#ifndef EIGEN_RETURNBYVALUE_H
13#define EIGEN_RETURNBYVALUE_H
16#include "./InternalHeaderCheck.h"
22template <
typename Derived>
23struct traits<ReturnByValue<Derived> > :
public traits<typename traits<Derived>::ReturnType> {
39template <
typename Derived,
int n,
typename PlainObject>
40struct nested_eval<ReturnByValue<Derived>, n, PlainObject> {
41 using type =
typename traits<Derived>::ReturnType;
50template <
typename Derived>
51class ReturnByValue :
public internal::dense_xpr_base<ReturnByValue<Derived> >::type, internal::no_assignment_operator {
53 using ReturnType =
typename internal::traits<Derived>::ReturnType;
55 using Base =
typename internal::dense_xpr_base<ReturnByValue>::type;
56 EIGEN_DENSE_PUBLIC_INTERFACE(ReturnByValue)
58 template <
typename Dest>
59 EIGEN_DEVICE_FUNC
inline void evalTo(Dest& dst)
const {
60 static_cast<const Derived*
>(
this)->evalTo(dst);
62 EIGEN_DEVICE_FUNC
constexpr Index rows() const noexcept {
return static_cast<const Derived*
>(
this)->rows(); }
63 EIGEN_DEVICE_FUNC
constexpr Index cols() const noexcept {
return static_cast<const Derived*
>(
this)->cols(); }
65#ifndef EIGEN_PARSED_BY_DOXYGEN
67 YOU_ARE_TRYING_TO_ACCESS_A_SINGLE_COEFFICIENT_IN_A_SPECIAL_EXPRESSION_WHERE_THAT_IS_NOT_ALLOWED_BECAUSE_THAT_WOULD_BE_INEFFICIENT
69 Unusable(
const Unusable&) {}
70 Unusable& operator=(
const Unusable&) {
return *
this; }
72 const Unusable& coeff(Index)
const {
return *
reinterpret_cast<const Unusable*
>(
this); }
73 const Unusable& coeff(Index, Index)
const {
return *
reinterpret_cast<const Unusable*
>(
this); }
74 Unusable& coeffRef(Index) {
return *
reinterpret_cast<Unusable*
>(
this); }
75 Unusable& coeffRef(Index, Index) {
return *
reinterpret_cast<Unusable*
>(
this); }
80template <
typename Derived>
81template <
typename OtherDerived>
83 other.evalTo(derived());
93template <
typename Derived>
94struct evaluator<ReturnByValue<Derived> > :
public evaluator<typename internal::traits<Derived>::ReturnType> {
95 using XprType = ReturnByValue<Derived>;
96 using PlainObject =
typename internal::traits<Derived>::ReturnType;
97 using Base = evaluator<PlainObject>;
99 EIGEN_DEVICE_FUNC
explicit evaluator(
const XprType& xpr) : m_result(xpr.rows(), xpr.cols()) {
100 internal::construct_at<Base>(
this, m_result);
101 xpr.evalTo(m_result);
105 PlainObject m_result;
constexpr Derived & operator=(const DenseBase< OtherDerived > &other)
Definition Assign.h:41
constexpr unsigned int DirectAccessBit
Definition Constants.h:160
constexpr unsigned int EvalBeforeNestingBit
Definition Constants.h:75