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:
@@ -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