Skip to content

Commit 0d27189

Browse files
committed
utils: std::forward related fixes
std::forward were replace std::move for fixed type context where it does not make sense. Some redundant comment were removed as they declare obvious actions under them.
1 parent de614f9 commit 0d27189

File tree

2 files changed

+4
-7
lines changed

2 files changed

+4
-7
lines changed

src/Buffer/Buffer.hpp

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -276,8 +276,7 @@ class Buffer {
276276
Buffer& operator = (const Buffer& buf) = delete;
277277
Buffer(Buffer &&other) noexcept
278278
{
279-
/* Call move assignment operator. */
280-
*this = std::forward<Buffer>(other);
279+
*this = std::move(other);
281280
}
282281
Buffer &operator=(Buffer &&other) noexcept
283282
{

src/Utils/Mempool.hpp

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -48,8 +48,7 @@ class MempoolStats {
4848
MempoolStats() = default;
4949
MempoolStats(MempoolStats &&other) noexcept
5050
{
51-
/* Call move assignment operator. */
52-
*this = std::forward<MempoolStats>(other);
51+
*this = std::move<MempoolStats>(other);
5352
}
5453
MempoolStats &operator=(MempoolStats &&other) noexcept
5554
{
@@ -136,15 +135,14 @@ class MempoolInstance : public MempoolStats<ENABLE_STATS> {
136135
MempoolInstance &operator=(const MempoolInstance &other) = delete;
137136
MempoolInstance(MempoolInstance &&other) noexcept
138137
{
139-
/* Call move assignment operator. */
140-
*this = std::forward<MempoolInstance>(other);
138+
*this = std::move(other);
141139
}
142140
MempoolInstance &operator=(MempoolInstance &&other) noexcept
143141
{
144142
if (this == &other)
145143
return *this;
146144
/* Move base class. */
147-
MempoolStats<ENABLE_STATS>::operator=(std::forward<MempoolInstance>(other));
145+
MempoolStats<ENABLE_STATS>::operator=(std::move(other));
148146
std::swap(m_SlabList, other.m_SlabList);
149147
std::swap(m_FreeList, other.m_FreeList);
150148
std::swap(m_SlabDataBeg, other.m_SlabDataBeg);

0 commit comments

Comments
 (0)