mirror of
https://gitlab.com/libeigen/eigen.git
synced 2026-04-10 11:34:33 +08:00
Use m_ prefix consistently for private/protected member variables
libeigen/eigen!2168 Co-authored-by: Rasmus Munk Larsen <rmlarsen@gmail.com>
This commit is contained in:
@@ -34,7 +34,7 @@ class TupleImpl<N, T1, Ts...> {
|
||||
template <typename U1 = T1,
|
||||
typename EnableIf = std::enable_if_t<std::is_default_constructible<U1>::value &&
|
||||
reduce_all<std::is_default_constructible<Ts>::value...>::value>>
|
||||
constexpr EIGEN_DEVICE_FUNC TupleImpl() : head_{}, tail_{} {}
|
||||
constexpr EIGEN_DEVICE_FUNC TupleImpl() : m_head{}, m_tail{} {}
|
||||
|
||||
// Element constructor.
|
||||
template <typename U1, typename... Us,
|
||||
@@ -45,45 +45,45 @@ class TupleImpl<N, T1, Ts...> {
|
||||
// this does not look like a copy/move constructor.
|
||||
N > 1 || std::is_convertible<U1, T1>::value)>>
|
||||
constexpr EIGEN_DEVICE_FUNC TupleImpl(U1&& arg1, Us&&... args)
|
||||
: head_(std::forward<U1>(arg1)), tail_(std::forward<Us>(args)...) {}
|
||||
: m_head(std::forward<U1>(arg1)), m_tail(std::forward<Us>(args)...) {}
|
||||
|
||||
// The first stored value.
|
||||
EIGEN_DEVICE_FUNC EIGEN_ALWAYS_INLINE T1& head() { return head_; }
|
||||
EIGEN_DEVICE_FUNC EIGEN_ALWAYS_INLINE T1& head() { return m_head; }
|
||||
|
||||
EIGEN_DEVICE_FUNC EIGEN_ALWAYS_INLINE const T1& head() const { return head_; }
|
||||
EIGEN_DEVICE_FUNC EIGEN_ALWAYS_INLINE const T1& head() const { return m_head; }
|
||||
|
||||
// The tail values.
|
||||
EIGEN_DEVICE_FUNC EIGEN_ALWAYS_INLINE TupleImpl<N - 1, Ts...>& tail() { return tail_; }
|
||||
EIGEN_DEVICE_FUNC EIGEN_ALWAYS_INLINE TupleImpl<N - 1, Ts...>& tail() { return m_tail; }
|
||||
|
||||
EIGEN_DEVICE_FUNC EIGEN_ALWAYS_INLINE const TupleImpl<N - 1, Ts...>& tail() const { return tail_; }
|
||||
EIGEN_DEVICE_FUNC EIGEN_ALWAYS_INLINE const TupleImpl<N - 1, Ts...>& tail() const { return m_tail; }
|
||||
|
||||
EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE void swap(TupleImpl& other) {
|
||||
using numext::swap;
|
||||
swap(head_, other.head_);
|
||||
swap(tail_, other.tail_);
|
||||
swap(m_head, other.m_head);
|
||||
swap(m_tail, other.m_tail);
|
||||
}
|
||||
|
||||
template <typename... UTypes>
|
||||
EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE TupleImpl& operator=(const TupleImpl<N, UTypes...>& other) {
|
||||
head_ = other.head_;
|
||||
tail_ = other.tail_;
|
||||
m_head = other.m_head;
|
||||
m_tail = other.m_tail;
|
||||
return *this;
|
||||
}
|
||||
|
||||
template <typename... UTypes>
|
||||
EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE TupleImpl& operator=(TupleImpl<N, UTypes...>&& other) {
|
||||
head_ = std::move(other.head_);
|
||||
tail_ = std::move(other.tail_);
|
||||
m_head = std::move(other.m_head);
|
||||
m_tail = std::move(other.m_tail);
|
||||
return *this;
|
||||
}
|
||||
|
||||
private:
|
||||
// Allow related tuples to reference head_/tail_.
|
||||
// Allow related tuples to reference m_head/m_tail.
|
||||
template <size_t M, typename... UTypes>
|
||||
friend class TupleImpl;
|
||||
|
||||
T1 head_;
|
||||
TupleImpl<N - 1, Ts...> tail_;
|
||||
T1 m_head;
|
||||
TupleImpl<N - 1, Ts...> m_tail;
|
||||
};
|
||||
|
||||
// Empty tuple specialization.
|
||||
|
||||
@@ -155,16 +155,16 @@ class ArithmeticSequenceRange {
|
||||
static constexpr Index SizeAtCompileTime = SizeAtCompileTime_;
|
||||
static constexpr Index IncrAtCompileTime = IncrAtCompileTime_;
|
||||
|
||||
constexpr ArithmeticSequenceRange(Index first, Index size, Index incr) : first_{first}, size_{size}, incr_{incr} {}
|
||||
constexpr ArithmeticSequenceRange(Index first, Index size, Index incr) : m_first{first}, m_size{size}, m_incr{incr} {}
|
||||
constexpr Index operator[](Index i) const { return first() + i * incr(); }
|
||||
constexpr Index first() const noexcept { return first_.value(); }
|
||||
constexpr Index size() const noexcept { return size_.value(); }
|
||||
constexpr Index incr() const noexcept { return incr_.value(); }
|
||||
constexpr Index first() const noexcept { return m_first.value(); }
|
||||
constexpr Index size() const noexcept { return m_size.value(); }
|
||||
constexpr Index incr() const noexcept { return m_incr.value(); }
|
||||
|
||||
private:
|
||||
variable_if_dynamicindex<Index, int(FirstAtCompileTime)> first_;
|
||||
variable_if_dynamic<Index, int(SizeAtCompileTime)> size_;
|
||||
variable_if_dynamicindex<Index, int(IncrAtCompileTime)> incr_;
|
||||
variable_if_dynamicindex<Index, int(FirstAtCompileTime)> m_first;
|
||||
variable_if_dynamic<Index, int(SizeAtCompileTime)> m_size;
|
||||
variable_if_dynamicindex<Index, int(IncrAtCompileTime)> m_incr;
|
||||
};
|
||||
|
||||
template <typename FirstType, typename SizeType, typename IncrType, int NestedSizeAtCompileTime>
|
||||
@@ -221,14 +221,14 @@ class SingleRange {
|
||||
static constexpr Index SizeAtCompileTime = Index(1);
|
||||
static constexpr Index IncrAtCompileTime = Index(1); // Needs to be 1 to be treated as block-like.
|
||||
|
||||
constexpr SingleRange(Index v) noexcept : value_(v) {}
|
||||
constexpr SingleRange(Index v) noexcept : m_value(v) {}
|
||||
constexpr Index operator[](Index) const noexcept { return first(); }
|
||||
constexpr Index first() const noexcept { return value_.value(); }
|
||||
constexpr Index first() const noexcept { return m_value.value(); }
|
||||
constexpr Index size() const noexcept { return SizeAtCompileTime; }
|
||||
constexpr Index incr() const noexcept { return IncrAtCompileTime; }
|
||||
|
||||
private:
|
||||
variable_if_dynamicindex<Index, int(ValueAtCompileTime)> value_;
|
||||
variable_if_dynamicindex<Index, int(ValueAtCompileTime)> m_value;
|
||||
};
|
||||
|
||||
template <typename T>
|
||||
@@ -280,14 +280,14 @@ class AllRange {
|
||||
static constexpr Index FirstAtCompileTime = Index(0);
|
||||
static constexpr Index SizeAtCompileTime = SizeAtCompileTime_;
|
||||
static constexpr Index IncrAtCompileTime = Index(1);
|
||||
constexpr AllRange(Index size) : size_(size) {}
|
||||
constexpr AllRange(Index size) : m_size(size) {}
|
||||
constexpr Index operator[](Index i) const noexcept { return i; }
|
||||
constexpr Index first() const noexcept { return FirstAtCompileTime; }
|
||||
constexpr Index size() const noexcept { return size_.value(); }
|
||||
constexpr Index size() const noexcept { return m_size.value(); }
|
||||
constexpr Index incr() const noexcept { return IncrAtCompileTime; }
|
||||
|
||||
private:
|
||||
variable_if_dynamic<Index, int(SizeAtCompileTime)> size_;
|
||||
variable_if_dynamic<Index, int(SizeAtCompileTime)> m_size;
|
||||
};
|
||||
|
||||
template <int NestedSizeAtCompileTime>
|
||||
|
||||
@@ -34,104 +34,104 @@ class MaxSizeVector {
|
||||
public:
|
||||
// Construct a new MaxSizeVector, reserve n elements.
|
||||
EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE explicit MaxSizeVector(size_t n)
|
||||
: reserve_(n), size_(0), data_(static_cast<T*>(internal::handmade_aligned_malloc(n * sizeof(T), alignment))) {}
|
||||
: m_reserve(n), m_size(0), m_data(static_cast<T*>(internal::handmade_aligned_malloc(n * sizeof(T), alignment))) {}
|
||||
|
||||
// Construct a new MaxSizeVector, reserve and resize to n.
|
||||
// Copy the init value to all elements.
|
||||
EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE MaxSizeVector(size_t n, const T& init)
|
||||
: reserve_(n), size_(n), data_(static_cast<T*>(internal::handmade_aligned_malloc(n * sizeof(T), alignment))) {
|
||||
: m_reserve(n), m_size(n), m_data(static_cast<T*>(internal::handmade_aligned_malloc(n * sizeof(T), alignment))) {
|
||||
size_t i = 0;
|
||||
EIGEN_TRY {
|
||||
for (; i < size_; ++i) {
|
||||
new (&data_[i]) T(init);
|
||||
for (; i < m_size; ++i) {
|
||||
new (&m_data[i]) T(init);
|
||||
}
|
||||
}
|
||||
EIGEN_CATCH(...) {
|
||||
// Construction failed, destruct in reverse order:
|
||||
for (; (i + 1) > 0; --i) {
|
||||
data_[i - 1].~T();
|
||||
m_data[i - 1].~T();
|
||||
}
|
||||
internal::handmade_aligned_free(data_);
|
||||
internal::handmade_aligned_free(m_data);
|
||||
EIGEN_THROW;
|
||||
}
|
||||
}
|
||||
|
||||
EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE ~MaxSizeVector() {
|
||||
for (size_t i = size_; i > 0; --i) {
|
||||
data_[i - 1].~T();
|
||||
for (size_t i = m_size; i > 0; --i) {
|
||||
m_data[i - 1].~T();
|
||||
}
|
||||
internal::handmade_aligned_free(data_);
|
||||
internal::handmade_aligned_free(m_data);
|
||||
}
|
||||
|
||||
void resize(size_t n) {
|
||||
eigen_assert(n <= reserve_);
|
||||
for (; size_ < n; ++size_) {
|
||||
new (&data_[size_]) T;
|
||||
eigen_assert(n <= m_reserve);
|
||||
for (; m_size < n; ++m_size) {
|
||||
new (&m_data[m_size]) T;
|
||||
}
|
||||
for (; size_ > n; --size_) {
|
||||
data_[size_ - 1].~T();
|
||||
for (; m_size > n; --m_size) {
|
||||
m_data[m_size - 1].~T();
|
||||
}
|
||||
eigen_assert(size_ == n);
|
||||
eigen_assert(m_size == n);
|
||||
}
|
||||
|
||||
// Append new elements (up to reserved size).
|
||||
EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE void push_back(const T& t) {
|
||||
eigen_assert(size_ < reserve_);
|
||||
new (&data_[size_++]) T(t);
|
||||
eigen_assert(m_size < m_reserve);
|
||||
new (&m_data[m_size++]) T(t);
|
||||
}
|
||||
|
||||
// For C++03 compatibility this only takes one argument
|
||||
template <class X>
|
||||
EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE void emplace_back(const X& x) {
|
||||
eigen_assert(size_ < reserve_);
|
||||
new (&data_[size_++]) T(x);
|
||||
eigen_assert(m_size < m_reserve);
|
||||
new (&m_data[m_size++]) T(x);
|
||||
}
|
||||
|
||||
EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE const T& operator[](size_t i) const {
|
||||
eigen_assert(i < size_);
|
||||
return data_[i];
|
||||
eigen_assert(i < m_size);
|
||||
return m_data[i];
|
||||
}
|
||||
|
||||
EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE T& operator[](size_t i) {
|
||||
eigen_assert(i < size_);
|
||||
return data_[i];
|
||||
eigen_assert(i < m_size);
|
||||
return m_data[i];
|
||||
}
|
||||
|
||||
EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE T& back() {
|
||||
eigen_assert(size_ > 0);
|
||||
return data_[size_ - 1];
|
||||
eigen_assert(m_size > 0);
|
||||
return m_data[m_size - 1];
|
||||
}
|
||||
|
||||
EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE const T& back() const {
|
||||
eigen_assert(size_ > 0);
|
||||
return data_[size_ - 1];
|
||||
eigen_assert(m_size > 0);
|
||||
return m_data[m_size - 1];
|
||||
}
|
||||
|
||||
EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE void pop_back() {
|
||||
eigen_assert(size_ > 0);
|
||||
data_[--size_].~T();
|
||||
eigen_assert(m_size > 0);
|
||||
m_data[--m_size].~T();
|
||||
}
|
||||
|
||||
EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE size_t size() const { return size_; }
|
||||
EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE size_t size() const { return m_size; }
|
||||
|
||||
EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE bool empty() const { return size_ == 0; }
|
||||
EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE bool empty() const { return m_size == 0; }
|
||||
|
||||
EIGEN_DEVICE_FUNC constexpr T* data() { return data_; }
|
||||
EIGEN_DEVICE_FUNC constexpr T* data() { return m_data; }
|
||||
|
||||
EIGEN_DEVICE_FUNC constexpr const T* data() const { return data_; }
|
||||
EIGEN_DEVICE_FUNC constexpr const T* data() const { return m_data; }
|
||||
|
||||
EIGEN_DEVICE_FUNC constexpr T* begin() { return data_; }
|
||||
EIGEN_DEVICE_FUNC constexpr T* begin() { return m_data; }
|
||||
|
||||
EIGEN_DEVICE_FUNC constexpr T* end() { return data_ + size_; }
|
||||
EIGEN_DEVICE_FUNC constexpr T* end() { return m_data + m_size; }
|
||||
|
||||
EIGEN_DEVICE_FUNC constexpr const T* begin() const { return data_; }
|
||||
EIGEN_DEVICE_FUNC constexpr const T* begin() const { return m_data; }
|
||||
|
||||
EIGEN_DEVICE_FUNC constexpr const T* end() const { return data_ + size_; }
|
||||
EIGEN_DEVICE_FUNC constexpr const T* end() const { return m_data + m_size; }
|
||||
|
||||
private:
|
||||
size_t reserve_;
|
||||
size_t size_;
|
||||
T* data_;
|
||||
size_t m_reserve;
|
||||
size_t m_size;
|
||||
T* m_data;
|
||||
};
|
||||
|
||||
} // namespace Eigen
|
||||
|
||||
@@ -188,10 +188,10 @@ template <typename IndexType>
|
||||
class ValueExpr : BaseExpr<ValueExpr<IndexType>> {
|
||||
public:
|
||||
constexpr ValueExpr() = default;
|
||||
constexpr ValueExpr(IndexType val) : value_(val) {}
|
||||
constexpr ValueExpr(IndexType val) : m_value(val) {}
|
||||
template <typename... Tags, typename... Types>
|
||||
constexpr IndexType eval_impl(const SymbolValue<Tags, Types>&...) const {
|
||||
return value_;
|
||||
return m_value;
|
||||
}
|
||||
template <typename... Tags, typename... Types>
|
||||
static constexpr IndexType eval_at_compile_time_impl(const SymbolValue<Tags, Types>&...) {
|
||||
@@ -199,7 +199,7 @@ class ValueExpr : BaseExpr<ValueExpr<IndexType>> {
|
||||
}
|
||||
|
||||
protected:
|
||||
IndexType value_;
|
||||
IndexType m_value;
|
||||
};
|
||||
|
||||
// Specialization for compile-time value,
|
||||
@@ -232,10 +232,10 @@ class SymbolValue<Tag, Index> : public BaseExpr<SymbolValue<Tag, Index>> {
|
||||
constexpr SymbolValue() = default;
|
||||
|
||||
/** Default constructor from the value \a val */
|
||||
constexpr SymbolValue(Index val) : value_(val) {}
|
||||
constexpr SymbolValue(Index val) : m_value(val) {}
|
||||
|
||||
/** \returns the stored value of the symbol */
|
||||
constexpr Index value() const { return value_; }
|
||||
constexpr Index value() const { return m_value; }
|
||||
|
||||
/** \returns the stored value of the symbol at compile time, or Undefined if not known. */
|
||||
static constexpr Index value_at_compile_time() { return Index(Undefined); }
|
||||
@@ -251,7 +251,7 @@ class SymbolValue<Tag, Index> : public BaseExpr<SymbolValue<Tag, Index>> {
|
||||
}
|
||||
|
||||
protected:
|
||||
Index value_;
|
||||
Index m_value;
|
||||
};
|
||||
|
||||
template <typename Tag, int N>
|
||||
|
||||
Reference in New Issue
Block a user