Remove dependency on boost.format, remove unfettered use of auto in order to move towards C++03 compatibility, use BOOST_THROW_EXCEPTION.

This commit is contained in:
Nick Thompson
2018-10-24 14:29:22 -06:00
parent 9167594533
commit ada03a59d7
4 changed files with 46 additions and 32 deletions

View File

@ -8,11 +8,12 @@
#define BOOST_INTEGER_EXTENDED_EUCLIDEAN_HPP
#include <tuple>
#include <limits>
#include <stdexcept>
#include <boost/throw_exception.hpp>
namespace boost { namespace integer {
// From "The Joy of Factoring", Algorithm 2.7.
// Should the tuple be a named tuple? Is that possible?
// Solves mx + ny = gcd(m,n). Returns tuple with (gcd(m,n), x, y).
// Is this the natural ordering?, or must people simply have to read the docs?
template<class Z>
@ -27,7 +28,7 @@ std::tuple<Z, Z, Z> extended_euclidean(Z m, Z n)
if (m < 1 || n < 1)
{
throw std::domain_error("Arguments must be strictly positive.\n");
BOOST_THROW_EXCEPTION(std::domain_error("Arguments must be strictly positive.\n"));
}
bool swapped = false;
if (m < n)