Skip to content

Commit

Permalink
Merge pull request #236 from bluescarni/pr/real_iter
Browse files Browse the repository at this point in the history
real backports from #232
  • Loading branch information
bluescarni committed May 6, 2020
2 parents 5687faf + 775254e commit d259ca4
Show file tree
Hide file tree
Showing 4 changed files with 20 additions and 0 deletions.
4 changes: 4 additions & 0 deletions doc/changelog.rst
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,10 @@ New
Changes
~~~~~~~

- :cpp:class:`~mppp::real` move operations from
:cpp:type:`mpfr_t` have been disabled on MSVC
due to compiler issues
(`#236 <https://github.com/bluescarni/mppp/pull/236>`__).
- Improve the implementation of :cpp:class:`~mppp::real`
binary operators/functions by using the MPFR primitives
more extensively and by handling mixed-precision computations
Expand Down
8 changes: 8 additions & 0 deletions doc/real.rst
Original file line number Diff line number Diff line change
Expand Up @@ -256,6 +256,10 @@ The real class
called on *x*: the resources previously owned by *x* are now owned by ``this``, which
will take care of releasing them when the destructor is called.

.. note::

Due to a compiler bug, this constructor is not available on Microsoft Visual Studio.

:param x: the :cpp:type:`mpfr_t` that will be moved.

.. cpp:function:: ~real()
Expand Down Expand Up @@ -339,6 +343,10 @@ The real class
called on *x*: the resources previously owned by *x* are now owned by ``this``, which
will take care of releasing them when the destructor is called.

.. note::

Due to a compiler bug, this operator is not available on Microsoft Visual Studio.

:param x: the assignment argument.

:return: a reference to ``this``.
Expand Down
4 changes: 4 additions & 0 deletions include/mp++/real.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -398,8 +398,10 @@ class MPPP_DLL_PUBLIC real

// Copy constructor from mpfr_t.
explicit real(const ::mpfr_t);
#if !defined(_MSC_VER) || defined(__clang__)
// Move constructor from mpfr_t.
explicit real(::mpfr_t &&x) : m_mpfr(*x) {}
#endif

// Destructor.
~real();
Expand Down Expand Up @@ -539,8 +541,10 @@ class MPPP_DLL_PUBLIC real
// Copy assignment from mpfr_t.
real &operator=(const ::mpfr_t);

#if !defined(_MSC_VER) || defined(__clang__)
// Move assignment from mpfr_t.
real &operator=(::mpfr_t &&);
#endif

// Check validity.
bool is_valid() const noexcept
Expand Down
4 changes: 4 additions & 0 deletions src/real.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -726,6 +726,8 @@ real &real::operator=(const ::mpfr_t x)
return *this;
}

#if !defined(_MSC_VER) || defined(__clang__)

// Move assignment from mpfr_t.
real &real::operator=(::mpfr_t &&x)
{
Expand All @@ -736,6 +738,8 @@ real &real::operator=(::mpfr_t &&x)
return *this;
}

#endif

// Set to another real.
real &real::set(const real &other)
{
Expand Down

0 comments on commit d259ca4

Please sign in to comment.