Skip to content

Commit 5d212c8

Browse files
committed
Fix missing operator++
1 parent 5aaa62d commit 5d212c8

File tree

1 file changed

+30
-0
lines changed

1 file changed

+30
-0
lines changed

include/boost/decimal/decimal_fast128_t.hpp

Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -334,6 +334,12 @@ BOOST_DECIMAL_EXPORT class decimal_fast128_t final
334334
friend constexpr auto operator+(const decimal_fast128_t& rhs) noexcept -> decimal_fast128_t;
335335
friend constexpr auto operator-(decimal_fast128_t rhs) noexcept -> decimal_fast128_t;
336336

337+
// Increment and Decrement
338+
constexpr auto operator++() noexcept -> decimal_fast128_t&;
339+
constexpr auto operator++(int) noexcept -> decimal_fast128_t; // NOLINT : C++14 so constexpr implies const
340+
constexpr auto operator--() noexcept -> decimal_fast128_t&;
341+
constexpr auto operator--(int) noexcept -> decimal_fast128_t; // NOLINT : C++14 so constexpr implies const
342+
337343
// Binary arithmetic operators
338344
friend constexpr auto operator+(const decimal_fast128_t& lhs, const decimal_fast128_t& rhs) noexcept -> decimal_fast128_t;
339345
friend constexpr auto operator-(const decimal_fast128_t& lhs, const decimal_fast128_t& rhs) noexcept -> decimal_fast128_t;
@@ -1327,6 +1333,30 @@ constexpr auto decimal_fast128_t::operator/=(const Integer rhs) noexcept
13271333
return *this;
13281334
}
13291335

1336+
constexpr auto decimal_fast128_t::operator++() noexcept -> decimal_fast128_t&
1337+
{
1338+
constexpr decimal_fast128_t one {1, 0};
1339+
*this = *this + one;
1340+
return *this;
1341+
}
1342+
1343+
constexpr auto decimal_fast128_t::operator++(int) noexcept -> decimal_fast128_t
1344+
{
1345+
return ++(*this);
1346+
}
1347+
1348+
constexpr auto decimal_fast128_t::operator--() noexcept -> decimal_fast128_t&
1349+
{
1350+
constexpr decimal_fast128_t one {1, 0};
1351+
*this = *this - one;
1352+
return *this;
1353+
}
1354+
1355+
constexpr auto decimal_fast128_t::operator--(int) noexcept -> decimal_fast128_t
1356+
{
1357+
return --(*this);
1358+
}
1359+
13301360
constexpr decimal_fast128_t::operator bool() const noexcept
13311361
{
13321362
constexpr decimal_fast128_t zero {0, 0};

0 commit comments

Comments
 (0)