Eigen  3.4.90 (git rev 5a9f66fb35d03a4da9ef8976e67a61b30aa16dcf)
 
Loading...
Searching...
No Matches
NoAlias.h
1// This file is part of Eigen, a lightweight C++ template library
2// for linear algebra.
3//
4// Copyright (C) 2009 Gael Guennebaud <[email protected]>
5//
6// This Source Code Form is subject to the terms of the Mozilla
7// Public License v. 2.0. If a copy of the MPL was not distributed
8// with this file, You can obtain one at http://mozilla.org/MPL/2.0/.
9
10#ifndef EIGEN_NOALIAS_H
11#define EIGEN_NOALIAS_H
12
13// IWYU pragma: private
14#include "./InternalHeaderCheck.h"
15
16namespace Eigen {
17
33template <typename ExpressionType, template <typename> class StorageBase>
34class NoAlias {
35 public:
36 typedef typename ExpressionType::Scalar Scalar;
37
38 EIGEN_DEVICE_FUNC explicit NoAlias(ExpressionType& expression) : m_expression(expression) {}
39
40 template <typename OtherDerived>
41 EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE ExpressionType& operator=(const StorageBase<OtherDerived>& other) {
42 call_assignment_no_alias(m_expression, other.derived(),
43 internal::assign_op<Scalar, typename OtherDerived::Scalar>());
44 return m_expression;
45 }
46
47 template <typename OtherDerived>
48 EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE ExpressionType& operator+=(const StorageBase<OtherDerived>& other) {
49 call_assignment_no_alias(m_expression, other.derived(),
50 internal::add_assign_op<Scalar, typename OtherDerived::Scalar>());
51 return m_expression;
52 }
53
54 template <typename OtherDerived>
55 EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE ExpressionType& operator-=(const StorageBase<OtherDerived>& other) {
56 call_assignment_no_alias(m_expression, other.derived(),
57 internal::sub_assign_op<Scalar, typename OtherDerived::Scalar>());
58 return m_expression;
59 }
60
61 EIGEN_DEVICE_FUNC ExpressionType& expression() const { return m_expression; }
62
63 protected:
64 ExpressionType& m_expression;
65};
66
95template <typename Derived>
99
100} // end namespace Eigen
101
102#endif // EIGEN_NOALIAS_H
Base class for all dense matrices, vectors, and expressions.
Definition MatrixBase.h:52
Pseudo expression providing an operator = assuming no aliasing.
Definition NoAlias.h:34
Namespace containing all symbols from the Eigen library.
Definition Core:137