Compare commits

..

7 Commits

Author SHA1 Message Date
0d964fe6fc Add, and update, documentation build targets. 2016-10-10 11:39:50 -05:00
14020f6f6c Merge branch 'develop' 2015-03-09 08:10:54 +01:00
66ae9dc182 Merge branch 'develop' 2015-01-18 20:04:57 +02:00
603f412c1b Merge branch 'develop' 2015-01-13 20:54:39 +02:00
de8b1d86f4 Merge branch 'develop' 2015-01-13 19:50:23 +02:00
163c26a2d4 Merge branch 'develop' 2015-01-13 18:44:48 +02:00
7d41c244ea Merge branch 'develop' 2014-06-08 01:38:20 +03:00
14 changed files with 62 additions and 124 deletions

View File

@ -24,9 +24,9 @@ programming problems.
class lcm_evaluator; class lcm_evaluator;
template < typename IntegerType > template < typename IntegerType >
constexpr IntegerType gcd( IntegerType const &a, IntegerType const &b ); IntegerType gcd( IntegerType const &a, IntegerType const &b );
template < typename IntegerType > template < typename IntegerType >
constexpr IntegerType lcm( IntegerType const &a, IntegerType const &b ); IntegerType lcm( IntegerType const &a, IntegerType const &b );
typedef ``['see-below]`` static_gcd_type; typedef ``['see-below]`` static_gcd_type;
@ -54,8 +54,7 @@ programming problems.
typedef IntegerType second_argument_type; typedef IntegerType second_argument_type;
// Function object interface // Function object interface
constexpr result_type operator ()( result_type operator ()( first_argument_type const &a,
first_argument_type const &a,
second_argument_type const &b ) const; second_argument_type const &b ) const;
}; };
@ -71,9 +70,6 @@ the GCD function template. If a numeric type wants to customize evaluations
of its greatest common divisors, then the type should specialize on the of its greatest common divisors, then the type should specialize on the
gcd_evaluator class template. gcd_evaluator class template.
Note that these function objects are `constexpr` in C++14 and later only.
They are also declared `noexcept` when appropriate.
[endsect] [endsect]
[section LCM Function Object] [section LCM Function Object]
@ -90,8 +86,7 @@ They are also declared `noexcept` when appropriate.
typedef IntegerType second_argument_type; typedef IntegerType second_argument_type;
// Function object interface // Function object interface
constexpr result_type operator ()( result_type operator ()( first_argument_type const &a,
first_argument_type const &a,
second_argument_type const &b ) const; second_argument_type const &b ) const;
}; };
@ -108,9 +103,6 @@ of the LCM function template. If a numeric type wants to customize
evaluations of its least common multiples, then the type should evaluations of its least common multiples, then the type should
specialize on the lcm_evaluator class template. specialize on the lcm_evaluator class template.
Note that these function objects are constexpr in C++14 and later only.
They are also declared `noexcept` when appropriate.
[endsect] [endsect]
[section:run_time Run-time GCD & LCM Determination] [section:run_time Run-time GCD & LCM Determination]
@ -118,10 +110,10 @@ They are also declared `noexcept` when appropriate.
[*Header: ] [@../../../../boost/math/common_factor_rt.hpp <boost/math/common_factor_rt.hpp>] [*Header: ] [@../../../../boost/math/common_factor_rt.hpp <boost/math/common_factor_rt.hpp>]
template < typename IntegerType > template < typename IntegerType >
constexpr IntegerType boost::math::gcd( IntegerType const &a, IntegerType const &b ); IntegerType boost::math::gcd( IntegerType const &a, IntegerType const &b );
template < typename IntegerType > template < typename IntegerType >
constexpr IntegerType boost::math::lcm( IntegerType const &a, IntegerType const &b ); IntegerType boost::math::lcm( IntegerType const &a, IntegerType const &b );
The boost::math::gcd function template returns the greatest common The boost::math::gcd function template returns the greatest common
(nonnegative) divisor of the two integers passed to it. (nonnegative) divisor of the two integers passed to it.
@ -132,9 +124,6 @@ IntegerType, which is also the return type. Internally, these function
templates use an object of the corresponding version of the templates use an object of the corresponding version of the
gcd_evaluator and lcm_evaluator class templates, respectively. gcd_evaluator and lcm_evaluator class templates, respectively.
Note that these functions are constexpr in C++14 and later only.
They are also declared `noexcept` when appropriate.
[endsect] [endsect]
[section:compile_time Compile time GCD and LCM determination] [section:compile_time Compile time GCD and LCM determination]

View File

@ -3,7 +3,7 @@
<meta http-equiv="Content-Type" content="text/html; charset=US-ASCII"> <meta http-equiv="Content-Type" content="text/html; charset=US-ASCII">
<title>Removed from library: Standard Integer Types</title> <title>Removed from library: Standard Integer Types</title>
<link rel="stylesheet" href="../../../../../doc/src/boostbook.css" type="text/css"> <link rel="stylesheet" href="../../../../../doc/src/boostbook.css" type="text/css">
<meta name="generator" content="DocBook XSL Stylesheets V1.77.1"> <meta name="generator" content="DocBook XSL Stylesheets V1.78.1">
<link rel="home" href="../index.html" title="Boost.Integer"> <link rel="home" href="../index.html" title="Boost.Integer">
<link rel="up" href="../index.html" title="Boost.Integer"> <link rel="up" href="../index.html" title="Boost.Integer">
<link rel="prev" href="history.html" title="History"> <link rel="prev" href="history.html" title="History">

View File

@ -3,7 +3,7 @@
<meta http-equiv="Content-Type" content="text/html; charset=US-ASCII"> <meta http-equiv="Content-Type" content="text/html; charset=US-ASCII">
<title>History</title> <title>History</title>
<link rel="stylesheet" href="../../../../../doc/src/boostbook.css" type="text/css"> <link rel="stylesheet" href="../../../../../doc/src/boostbook.css" type="text/css">
<meta name="generator" content="DocBook XSL Stylesheets V1.77.1"> <meta name="generator" content="DocBook XSL Stylesheets V1.78.1">
<link rel="home" href="../index.html" title="Boost.Integer"> <link rel="home" href="../index.html" title="Boost.Integer">
<link rel="up" href="../index.html" title="Boost.Integer"> <link rel="up" href="../index.html" title="Boost.Integer">
<link rel="prev" href="minmax.html" title="Compile time min/max calculation"> <link rel="prev" href="minmax.html" title="Compile time min/max calculation">

View File

@ -3,7 +3,7 @@
<meta http-equiv="Content-Type" content="text/html; charset=US-ASCII"> <meta http-equiv="Content-Type" content="text/html; charset=US-ASCII">
<title>Integer Type Selection</title> <title>Integer Type Selection</title>
<link rel="stylesheet" href="../../../../../doc/src/boostbook.css" type="text/css"> <link rel="stylesheet" href="../../../../../doc/src/boostbook.css" type="text/css">
<meta name="generator" content="DocBook XSL Stylesheets V1.77.1"> <meta name="generator" content="DocBook XSL Stylesheets V1.78.1">
<link rel="home" href="../index.html" title="Boost.Integer"> <link rel="home" href="../index.html" title="Boost.Integer">
<link rel="up" href="../index.html" title="Boost.Integer"> <link rel="up" href="../index.html" title="Boost.Integer">
<link rel="prev" href="traits.html" title="Integer Traits"> <link rel="prev" href="traits.html" title="Integer Traits">
@ -26,7 +26,7 @@
<div class="titlepage"><div><div><h2 class="title" style="clear: both"> <div class="titlepage"><div><div><h2 class="title" style="clear: both">
<a name="boost_integer.integer"></a><a class="link" href="integer.html" title="Integer Type Selection">Integer Type Selection</a> <a name="boost_integer.integer"></a><a class="link" href="integer.html" title="Integer Type Selection">Integer Type Selection</a>
</h2></div></div></div> </h2></div></div></div>
<div class="toc"><dl> <div class="toc"><dl class="toc">
<dt><span class="section"><a href="integer.html#boost_integer.integer.synopsis">Synopsis</a></span></dt> <dt><span class="section"><a href="integer.html#boost_integer.integer.synopsis">Synopsis</a></span></dt>
<dt><span class="section"><a href="integer.html#boost_integer.integer.easiest">Easiest-to-Manipulate <dt><span class="section"><a href="integer.html#boost_integer.integer.easiest">Easiest-to-Manipulate
Types</a></span></dt> Types</a></span></dt>

View File

@ -3,7 +3,7 @@
<meta http-equiv="Content-Type" content="text/html; charset=US-ASCII"> <meta http-equiv="Content-Type" content="text/html; charset=US-ASCII">
<title>Compile Time log2 Calculation</title> <title>Compile Time log2 Calculation</title>
<link rel="stylesheet" href="../../../../../doc/src/boostbook.css" type="text/css"> <link rel="stylesheet" href="../../../../../doc/src/boostbook.css" type="text/css">
<meta name="generator" content="DocBook XSL Stylesheets V1.77.1"> <meta name="generator" content="DocBook XSL Stylesheets V1.78.1">
<link rel="home" href="../index.html" title="Boost.Integer"> <link rel="home" href="../index.html" title="Boost.Integer">
<link rel="up" href="../index.html" title="Boost.Integer"> <link rel="up" href="../index.html" title="Boost.Integer">
<link rel="prev" href="mask.html" title="Integer Masks"> <link rel="prev" href="mask.html" title="Integer Masks">
@ -26,7 +26,7 @@
<div class="titlepage"><div><div><h2 class="title" style="clear: both"> <div class="titlepage"><div><div><h2 class="title" style="clear: both">
<a name="boost_integer.log2"></a><a class="link" href="log2.html" title="Compile Time log2 Calculation">Compile Time log2 Calculation</a> <a name="boost_integer.log2"></a><a class="link" href="log2.html" title="Compile Time log2 Calculation">Compile Time log2 Calculation</a>
</h2></div></div></div> </h2></div></div></div>
<div class="toc"><dl> <div class="toc"><dl class="toc">
<dt><span class="section"><a href="log2.html#boost_integer.log2.synopsis">Synopsis</a></span></dt> <dt><span class="section"><a href="log2.html#boost_integer.log2.synopsis">Synopsis</a></span></dt>
<dt><span class="section"><a href="log2.html#boost_integer.log2.usage">Usage</a></span></dt> <dt><span class="section"><a href="log2.html#boost_integer.log2.usage">Usage</a></span></dt>
<dt><span class="section"><a href="log2.html#boost_integer.log2.demonstration_program">Demonstration <dt><span class="section"><a href="log2.html#boost_integer.log2.demonstration_program">Demonstration

View File

@ -3,7 +3,7 @@
<meta http-equiv="Content-Type" content="text/html; charset=US-ASCII"> <meta http-equiv="Content-Type" content="text/html; charset=US-ASCII">
<title>Integer Masks</title> <title>Integer Masks</title>
<link rel="stylesheet" href="../../../../../doc/src/boostbook.css" type="text/css"> <link rel="stylesheet" href="../../../../../doc/src/boostbook.css" type="text/css">
<meta name="generator" content="DocBook XSL Stylesheets V1.77.1"> <meta name="generator" content="DocBook XSL Stylesheets V1.78.1">
<link rel="home" href="../index.html" title="Boost.Integer"> <link rel="home" href="../index.html" title="Boost.Integer">
<link rel="up" href="../index.html" title="Boost.Integer"> <link rel="up" href="../index.html" title="Boost.Integer">
<link rel="prev" href="integer.html" title="Integer Type Selection"> <link rel="prev" href="integer.html" title="Integer Type Selection">
@ -26,7 +26,7 @@
<div class="titlepage"><div><div><h2 class="title" style="clear: both"> <div class="titlepage"><div><div><h2 class="title" style="clear: both">
<a name="boost_integer.mask"></a><a class="link" href="mask.html" title="Integer Masks">Integer Masks</a> <a name="boost_integer.mask"></a><a class="link" href="mask.html" title="Integer Masks">Integer Masks</a>
</h2></div></div></div> </h2></div></div></div>
<div class="toc"><dl> <div class="toc"><dl class="toc">
<dt><span class="section"><a href="mask.html#boost_integer.mask.overview">Overview</a></span></dt> <dt><span class="section"><a href="mask.html#boost_integer.mask.overview">Overview</a></span></dt>
<dt><span class="section"><a href="mask.html#boost_integer.mask.synopsis">Synopsis</a></span></dt> <dt><span class="section"><a href="mask.html#boost_integer.mask.synopsis">Synopsis</a></span></dt>
<dt><span class="section"><a href="mask.html#boost_integer.mask.single_bit_mask_class_template">Single <dt><span class="section"><a href="mask.html#boost_integer.mask.single_bit_mask_class_template">Single

View File

@ -3,7 +3,7 @@
<meta http-equiv="Content-Type" content="text/html; charset=US-ASCII"> <meta http-equiv="Content-Type" content="text/html; charset=US-ASCII">
<title>Compile time min/max calculation</title> <title>Compile time min/max calculation</title>
<link rel="stylesheet" href="../../../../../doc/src/boostbook.css" type="text/css"> <link rel="stylesheet" href="../../../../../doc/src/boostbook.css" type="text/css">
<meta name="generator" content="DocBook XSL Stylesheets V1.77.1"> <meta name="generator" content="DocBook XSL Stylesheets V1.78.1">
<link rel="home" href="../index.html" title="Boost.Integer"> <link rel="home" href="../index.html" title="Boost.Integer">
<link rel="up" href="../index.html" title="Boost.Integer"> <link rel="up" href="../index.html" title="Boost.Integer">
<link rel="prev" href="log2.html" title="Compile Time log2 Calculation"> <link rel="prev" href="log2.html" title="Compile Time log2 Calculation">
@ -26,7 +26,7 @@
<div class="titlepage"><div><div><h2 class="title" style="clear: both"> <div class="titlepage"><div><div><h2 class="title" style="clear: both">
<a name="boost_integer.minmax"></a><a class="link" href="minmax.html" title="Compile time min/max calculation">Compile time min/max calculation</a> <a name="boost_integer.minmax"></a><a class="link" href="minmax.html" title="Compile time min/max calculation">Compile time min/max calculation</a>
</h2></div></div></div> </h2></div></div></div>
<div class="toc"><dl> <div class="toc"><dl class="toc">
<dt><span class="section"><a href="minmax.html#boost_integer.minmax.synopsis">Synopsis</a></span></dt> <dt><span class="section"><a href="minmax.html#boost_integer.minmax.synopsis">Synopsis</a></span></dt>
<dt><span class="section"><a href="minmax.html#boost_integer.minmax.usage">Usage</a></span></dt> <dt><span class="section"><a href="minmax.html#boost_integer.minmax.usage">Usage</a></span></dt>
<dt><span class="section"><a href="minmax.html#boost_integer.minmax.example">Example</a></span></dt> <dt><span class="section"><a href="minmax.html#boost_integer.minmax.example">Example</a></span></dt>

View File

@ -3,7 +3,7 @@
<meta http-equiv="Content-Type" content="text/html; charset=US-ASCII"> <meta http-equiv="Content-Type" content="text/html; charset=US-ASCII">
<title>Integer Traits</title> <title>Integer Traits</title>
<link rel="stylesheet" href="../../../../../doc/src/boostbook.css" type="text/css"> <link rel="stylesheet" href="../../../../../doc/src/boostbook.css" type="text/css">
<meta name="generator" content="DocBook XSL Stylesheets V1.77.1"> <meta name="generator" content="DocBook XSL Stylesheets V1.78.1">
<link rel="home" href="../index.html" title="Boost.Integer"> <link rel="home" href="../index.html" title="Boost.Integer">
<link rel="up" href="../index.html" title="Boost.Integer"> <link rel="up" href="../index.html" title="Boost.Integer">
<link rel="prev" href="../index.html" title="Boost.Integer"> <link rel="prev" href="../index.html" title="Boost.Integer">
@ -26,7 +26,7 @@
<div class="titlepage"><div><div><h2 class="title" style="clear: both"> <div class="titlepage"><div><div><h2 class="title" style="clear: both">
<a name="boost_integer.traits"></a><a class="link" href="traits.html" title="Integer Traits">Integer Traits</a> <a name="boost_integer.traits"></a><a class="link" href="traits.html" title="Integer Traits">Integer Traits</a>
</h2></div></div></div> </h2></div></div></div>
<div class="toc"><dl> <div class="toc"><dl class="toc">
<dt><span class="section"><a href="traits.html#boost_integer.traits.motivation">Motivation</a></span></dt> <dt><span class="section"><a href="traits.html#boost_integer.traits.motivation">Motivation</a></span></dt>
<dt><span class="section"><a href="traits.html#boost_integer.traits.synopsis">Synopsis</a></span></dt> <dt><span class="section"><a href="traits.html#boost_integer.traits.synopsis">Synopsis</a></span></dt>
<dt><span class="section"><a href="traits.html#boost_integer.traits.description">Description</a></span></dt> <dt><span class="section"><a href="traits.html#boost_integer.traits.description">Description</a></span></dt>

View File

@ -3,7 +3,7 @@
<meta http-equiv="Content-Type" content="text/html; charset=US-ASCII"> <meta http-equiv="Content-Type" content="text/html; charset=US-ASCII">
<title>Boost.Integer</title> <title>Boost.Integer</title>
<link rel="stylesheet" href="../../../../doc/src/boostbook.css" type="text/css"> <link rel="stylesheet" href="../../../../doc/src/boostbook.css" type="text/css">
<meta name="generator" content="DocBook XSL Stylesheets V1.77.1"> <meta name="generator" content="DocBook XSL Stylesheets V1.78.1">
<link rel="home" href="index.html" title="Boost.Integer"> <link rel="home" href="index.html" title="Boost.Integer">
<link rel="next" href="boost_integer/traits.html" title="Integer Traits"> <link rel="next" href="boost_integer/traits.html" title="Integer Traits">
</head> </head>
@ -50,7 +50,7 @@
</div> </div>
<div class="toc"> <div class="toc">
<p><b>Table of Contents</b></p> <p><b>Table of Contents</b></p>
<dl> <dl class="toc">
<dt><span class="section"><a href="index.html#boost_integer.overview">Overview</a></span></dt> <dt><span class="section"><a href="index.html#boost_integer.overview">Overview</a></span></dt>
<dt><span class="section"><a href="boost_integer/traits.html">Integer Traits</a></span></dt> <dt><span class="section"><a href="boost_integer/traits.html">Integer Traits</a></span></dt>
<dt><span class="section"><a href="boost_integer/integer.html">Integer Type Selection</a></span></dt> <dt><span class="section"><a href="boost_integer/integer.html">Integer Type Selection</a></span></dt>
@ -219,7 +219,7 @@
</div> </div>
</div> </div>
<table xmlns:rev="http://www.cs.rpi.edu/~gregod/boost/tools/doc/revision" width="100%"><tr> <table xmlns:rev="http://www.cs.rpi.edu/~gregod/boost/tools/doc/revision" width="100%"><tr>
<td align="left"><p><small>Last revised: March 28, 2017 at 17:56:42 GMT</small></p></td> <td align="left"><p><small>Last revised: June 01, 2014 at 19:57:36 GMT</small></p></td>
<td align="right"><div class="copyright-footer"></div></td> <td align="right"><div class="copyright-footer"></div></td>
</tr></table> </tr></table>
<hr> <hr>

View File

@ -22,10 +22,6 @@
#include <climits> // for CHAR_MIN #include <climits> // for CHAR_MIN
#include <boost/detail/workaround.hpp> #include <boost/detail/workaround.hpp>
#ifndef BOOST_NO_CXX11_NOEXCEPT
#include <boost/type_traits/is_arithmetic.hpp>
#endif
#ifdef BOOST_MSVC #ifdef BOOST_MSVC
#pragma warning(push) #pragma warning(push)
#pragma warning(disable:4127 4244) // Conditional expression is constant #pragma warning(disable:4127 4244) // Conditional expression is constant
@ -36,15 +32,14 @@ namespace boost
namespace integer namespace integer
{ {
#define BOOST_INT_NOEXCEPT(T) BOOST_NOEXCEPT_IF(boost::is_arithmetic<T>::value)
// Forward declarations for function templates -----------------------------// // Forward declarations for function templates -----------------------------//
template < typename IntegerType > template < typename IntegerType >
BOOST_CXX14_CONSTEXPR IntegerType gcd( IntegerType const &a, IntegerType const &b )BOOST_INT_NOEXCEPT(IntegerType); IntegerType gcd( IntegerType const &a, IntegerType const &b );
template < typename IntegerType > template < typename IntegerType >
BOOST_CXX14_CONSTEXPR IntegerType lcm( IntegerType const &a, IntegerType const &b )BOOST_INT_NOEXCEPT(IntegerType); IntegerType lcm( IntegerType const &a, IntegerType const &b );
// Greatest common divisor evaluator class declaration ---------------------// // Greatest common divisor evaluator class declaration ---------------------//
@ -57,8 +52,8 @@ public:
typedef IntegerType result_type, first_argument_type, second_argument_type; typedef IntegerType result_type, first_argument_type, second_argument_type;
// Function object interface // Function object interface
BOOST_CXX14_CONSTEXPR result_type operator ()( first_argument_type const &a, result_type operator ()( first_argument_type const &a,
second_argument_type const &b )const BOOST_INT_NOEXCEPT(IntegerType) ; second_argument_type const &b ) const;
}; // boost::integer::gcd_evaluator }; // boost::integer::gcd_evaluator
@ -73,8 +68,8 @@ public:
typedef IntegerType result_type, first_argument_type, second_argument_type; typedef IntegerType result_type, first_argument_type, second_argument_type;
// Function object interface // Function object interface
BOOST_CXX14_CONSTEXPR result_type operator ()( first_argument_type const &a, result_type operator ()( first_argument_type const &a,
second_argument_type const &b )const BOOST_INT_NOEXCEPT(IntegerType) ; second_argument_type const &b ) const;
}; // boost::integer::lcm_evaluator }; // boost::integer::lcm_evaluator
@ -85,12 +80,12 @@ namespace detail
{ {
// Greatest common divisor for rings (including unsigned integers) // Greatest common divisor for rings (including unsigned integers)
template < typename RingType > template < typename RingType >
BOOST_CXX14_CONSTEXPR RingType RingType
gcd_euclidean gcd_euclidean
( (
RingType a, RingType a,
RingType b RingType b
)BOOST_INT_NOEXCEPT(RingType) )
{ {
// Avoid repeated construction // Avoid repeated construction
#ifndef __BORLANDC__ #ifndef __BORLANDC__
@ -115,12 +110,12 @@ namespace detail
// Greatest common divisor for (signed) integers // Greatest common divisor for (signed) integers
template < typename IntegerType > template < typename IntegerType >
inline inline
BOOST_CXX14_CONSTEXPR IntegerType IntegerType
gcd_integer gcd_integer
( (
IntegerType const & a, IntegerType const & a,
IntegerType const & b IntegerType const & b
)BOOST_INT_NOEXCEPT(IntegerType) )
{ {
// Avoid repeated construction // Avoid repeated construction
IntegerType const zero = static_cast<IntegerType>( 0 ); IntegerType const zero = static_cast<IntegerType>( 0 );
@ -131,12 +126,12 @@ namespace detail
// Greatest common divisor for unsigned binary integers // Greatest common divisor for unsigned binary integers
template < typename BuiltInUnsigned > template < typename BuiltInUnsigned >
BOOST_CXX14_CONSTEXPR BuiltInUnsigned BuiltInUnsigned
gcd_binary gcd_binary
( (
BuiltInUnsigned u, BuiltInUnsigned u,
BuiltInUnsigned v BuiltInUnsigned v
)BOOST_INT_NOEXCEPT(BuiltInUnsigned) )
{ {
if ( u && v ) if ( u && v )
{ {
@ -195,12 +190,12 @@ namespace detail
// Least common multiple for rings (including unsigned integers) // Least common multiple for rings (including unsigned integers)
template < typename RingType > template < typename RingType >
inline inline
BOOST_CXX14_CONSTEXPR RingType RingType
lcm_euclidean lcm_euclidean
( (
RingType const & a, RingType const & a,
RingType const & b RingType const & b
)BOOST_INT_NOEXCEPT(RingType) )
{ {
RingType const zero = static_cast<RingType>( 0 ); RingType const zero = static_cast<RingType>( 0 );
RingType const temp = gcd_euclidean( a, b ); RingType const temp = gcd_euclidean( a, b );
@ -210,13 +205,13 @@ namespace detail
// Least common multiple for (signed) integers // Least common multiple for (signed) integers
template < typename IntegerType > template < typename IntegerType >
inline BOOST_CXX14_CONSTEXPR inline
IntegerType IntegerType
lcm_integer lcm_integer
( (
IntegerType const & a, IntegerType const & a,
IntegerType const & b IntegerType const & b
)BOOST_INT_NOEXCEPT(IntegerType) )
{ {
// Avoid repeated construction // Avoid repeated construction
IntegerType const zero = static_cast<IntegerType>( 0 ); IntegerType const zero = static_cast<IntegerType>( 0 );
@ -230,7 +225,7 @@ namespace detail
template < typename T, bool IsSpecialized, bool IsSigned > template < typename T, bool IsSpecialized, bool IsSigned >
struct gcd_optimal_evaluator_helper_t struct gcd_optimal_evaluator_helper_t
{ {
BOOST_CXX14_CONSTEXPR T operator ()( T const &a, T const &b )BOOST_INT_NOEXCEPT(T) T operator ()( T const &a, T const &b )
{ {
return gcd_euclidean( a, b ); return gcd_euclidean( a, b );
} }
@ -239,7 +234,7 @@ namespace detail
template < typename T > template < typename T >
struct gcd_optimal_evaluator_helper_t< T, true, true > struct gcd_optimal_evaluator_helper_t< T, true, true >
{ {
BOOST_CXX14_CONSTEXPR T operator ()( T const &a, T const &b )BOOST_INT_NOEXCEPT(T) T operator ()( T const &a, T const &b )
{ {
return gcd_integer( a, b ); return gcd_integer( a, b );
} }
@ -248,7 +243,7 @@ namespace detail
template < typename T > template < typename T >
struct gcd_optimal_evaluator struct gcd_optimal_evaluator
{ {
BOOST_CXX14_CONSTEXPR T operator ()( T const &a, T const &b )BOOST_INT_NOEXCEPT(T) T operator ()( T const &a, T const &b )
{ {
typedef ::std::numeric_limits<T> limits_type; typedef ::std::numeric_limits<T> limits_type;
@ -264,7 +259,7 @@ namespace detail
template < typename T > template < typename T >
struct gcd_optimal_evaluator struct gcd_optimal_evaluator
{ {
BOOST_CXX14_CONSTEXPR T operator ()( T const &a, T const &b )BOOST_INT_NOEXCEPT(T) T operator ()( T const &a, T const &b )
{ {
return gcd_integer( a, b ); return gcd_integer( a, b );
} }
@ -274,7 +269,7 @@ namespace detail
// Specialize for the built-in integers // Specialize for the built-in integers
#define BOOST_PRIVATE_GCD_UF( Ut ) \ #define BOOST_PRIVATE_GCD_UF( Ut ) \
template < > struct gcd_optimal_evaluator<Ut> \ template < > struct gcd_optimal_evaluator<Ut> \
{ BOOST_CXX14_CONSTEXPR Ut operator ()( Ut a, Ut b ) const BOOST_INT_NOEXCEPT(Ut) { return gcd_binary( a, b ); } } { Ut operator ()( Ut a, Ut b ) const { return gcd_binary( a, b ); } }
BOOST_PRIVATE_GCD_UF( unsigned char ); BOOST_PRIVATE_GCD_UF( unsigned char );
BOOST_PRIVATE_GCD_UF( unsigned short ); BOOST_PRIVATE_GCD_UF( unsigned short );
@ -295,7 +290,7 @@ namespace detail
#define BOOST_PRIVATE_GCD_SF( St, Ut ) \ #define BOOST_PRIVATE_GCD_SF( St, Ut ) \
template < > struct gcd_optimal_evaluator<St> \ template < > struct gcd_optimal_evaluator<St> \
{ BOOST_CXX14_CONSTEXPR St operator ()( St a, St b ) const BOOST_INT_NOEXCEPT(St) { Ut const a_abs = \ { St operator ()( St a, St b ) const { Ut const a_abs = \
static_cast<Ut>( a < 0 ? -a : +a ), b_abs = static_cast<Ut>( \ static_cast<Ut>( a < 0 ? -a : +a ), b_abs = static_cast<Ut>( \
b < 0 ? -b : +b ); return static_cast<St>( \ b < 0 ? -b : +b ); return static_cast<St>( \
gcd_optimal_evaluator<Ut>()(a_abs, b_abs) ); } } gcd_optimal_evaluator<Ut>()(a_abs, b_abs) ); } }
@ -321,7 +316,7 @@ namespace detail
template < typename T, bool IsSpecialized, bool IsSigned > template < typename T, bool IsSpecialized, bool IsSigned >
struct lcm_optimal_evaluator_helper_t struct lcm_optimal_evaluator_helper_t
{ {
BOOST_CXX14_CONSTEXPR T operator ()( T const &a, T const &b )BOOST_INT_NOEXCEPT(T) T operator ()( T const &a, T const &b )
{ {
return lcm_euclidean( a, b ); return lcm_euclidean( a, b );
} }
@ -330,7 +325,7 @@ namespace detail
template < typename T > template < typename T >
struct lcm_optimal_evaluator_helper_t< T, true, true > struct lcm_optimal_evaluator_helper_t< T, true, true >
{ {
BOOST_CXX14_CONSTEXPR T operator ()( T const &a, T const &b )BOOST_INT_NOEXCEPT(T) T operator ()( T const &a, T const &b )
{ {
return lcm_integer( a, b ); return lcm_integer( a, b );
} }
@ -339,7 +334,7 @@ namespace detail
template < typename T > template < typename T >
struct lcm_optimal_evaluator struct lcm_optimal_evaluator
{ {
BOOST_CXX14_CONSTEXPR T operator ()( T const &a, T const &b )BOOST_INT_NOEXCEPT(T) T operator ()( T const &a, T const &b )
{ {
typedef ::std::numeric_limits<T> limits_type; typedef ::std::numeric_limits<T> limits_type;
@ -355,7 +350,7 @@ namespace detail
template < typename T > template < typename T >
struct lcm_optimal_evaluator struct lcm_optimal_evaluator
{ {
BOOST_CXX14_CONSTEXPR T operator ()( T const &a, T const &b )BOOST_INT_NOEXCEPT(T) T operator ()( T const &a, T const &b )
{ {
return lcm_integer( a, b ); return lcm_integer( a, b );
} }
@ -364,13 +359,13 @@ namespace detail
// Functions to find the GCD or LCM in the best way // Functions to find the GCD or LCM in the best way
template < typename T > template < typename T >
inline BOOST_CXX14_CONSTEXPR inline
T T
gcd_optimal gcd_optimal
( (
T const & a, T const & a,
T const & b T const & b
)BOOST_INT_NOEXCEPT(T) )
{ {
gcd_optimal_evaluator<T> solver; gcd_optimal_evaluator<T> solver;
@ -378,13 +373,13 @@ namespace detail
} }
template < typename T > template < typename T >
inline BOOST_CXX14_CONSTEXPR inline
T T
lcm_optimal lcm_optimal
( (
T const & a, T const & a,
T const & b T const & b
)BOOST_INT_NOEXCEPT(T) )
{ {
lcm_optimal_evaluator<T> solver; lcm_optimal_evaluator<T> solver;
@ -397,13 +392,13 @@ namespace detail
// Greatest common divisor evaluator member function definition ------------// // Greatest common divisor evaluator member function definition ------------//
template < typename IntegerType > template < typename IntegerType >
inline BOOST_CXX14_CONSTEXPR inline
typename gcd_evaluator<IntegerType>::result_type typename gcd_evaluator<IntegerType>::result_type
gcd_evaluator<IntegerType>::operator () gcd_evaluator<IntegerType>::operator ()
( (
first_argument_type const & a, first_argument_type const & a,
second_argument_type const & b second_argument_type const & b
) const BOOST_INT_NOEXCEPT(IntegerType) ) const
{ {
return detail::gcd_optimal( a, b ); return detail::gcd_optimal( a, b );
} }
@ -412,13 +407,13 @@ gcd_evaluator<IntegerType>::operator ()
// Least common multiple evaluator member function definition --------------// // Least common multiple evaluator member function definition --------------//
template < typename IntegerType > template < typename IntegerType >
inline BOOST_CXX14_CONSTEXPR inline
typename lcm_evaluator<IntegerType>::result_type typename lcm_evaluator<IntegerType>::result_type
lcm_evaluator<IntegerType>::operator () lcm_evaluator<IntegerType>::operator ()
( (
first_argument_type const & a, first_argument_type const & a,
second_argument_type const & b second_argument_type const & b
) const BOOST_INT_NOEXCEPT(IntegerType) ) const
{ {
return detail::lcm_optimal( a, b ); return detail::lcm_optimal( a, b );
} }
@ -427,13 +422,13 @@ lcm_evaluator<IntegerType>::operator ()
// Greatest common divisor and least common multiple function definitions --// // Greatest common divisor and least common multiple function definitions --//
template < typename IntegerType > template < typename IntegerType >
inline BOOST_CXX14_CONSTEXPR inline
IntegerType IntegerType
gcd gcd
( (
IntegerType const & a, IntegerType const & a,
IntegerType const & b IntegerType const & b
) BOOST_INT_NOEXCEPT(IntegerType) )
{ {
gcd_evaluator<IntegerType> solver; gcd_evaluator<IntegerType> solver;
@ -441,13 +436,13 @@ gcd
} }
template < typename IntegerType > template < typename IntegerType >
inline BOOST_CXX14_CONSTEXPR inline
IntegerType IntegerType
lcm lcm
( (
IntegerType const & a, IntegerType const & a,
IntegerType const & b IntegerType const & b
) BOOST_INT_NOEXCEPT(IntegerType) )
{ {
lcm_evaluator<IntegerType> solver; lcm_evaluator<IntegerType> solver;

View File

@ -63,7 +63,7 @@ struct low_bits_mask_t
typedef typename uint_t<Bits>::least least; typedef typename uint_t<Bits>::least least;
typedef typename uint_t<Bits>::fast fast; typedef typename uint_t<Bits>::fast fast;
BOOST_STATIC_CONSTANT( least, sig_bits = (~(least(~(least( 0u ))) << Bits )) ); BOOST_STATIC_CONSTANT( least, sig_bits = (~( ~(least( 0u )) << Bits )) );
BOOST_STATIC_CONSTANT( fast, sig_bits_fast = fast(sig_bits) ); BOOST_STATIC_CONSTANT( fast, sig_bits_fast = fast(sig_bits) );
BOOST_STATIC_CONSTANT( std::size_t, bit_count = Bits ); BOOST_STATIC_CONSTANT( std::size_t, bit_count = Bits );

View File

@ -159,8 +159,6 @@ template <static_min_max_unsigned_type Value1, static_min_max_unsigned_type Valu
struct static_unsigned_max; struct static_unsigned_max;
namespace integer
{
// From <boost/integer/common_factor_ct.hpp> // From <boost/integer/common_factor_ct.hpp>
#ifdef BOOST_NO_INTEGRAL_INT64_T #ifdef BOOST_NO_INTEGRAL_INT64_T
@ -182,7 +180,6 @@ template < typename IntegerType >
template < typename IntegerType > template < typename IntegerType >
class lcm_evaluator; class lcm_evaluator;
} // namespace integer
} // namespace boost } // namespace boost

View File

@ -19,7 +19,6 @@ test-suite integer
[ compile static_log2_include_test.cpp ] [ compile static_log2_include_test.cpp ]
[ compile static_min_max_include_test.cpp ] [ compile static_min_max_include_test.cpp ]
[ compile integer_fwd_include_test.cpp ] [ compile integer_fwd_include_test.cpp ]
[ compile gcd_constexpr14_test.cpp ]
[ compile-fail fail_int_exact.cpp ] [ compile-fail fail_int_exact.cpp ]
[ compile-fail fail_int_fast.cpp ] [ compile-fail fail_int_fast.cpp ]
[ compile-fail fail_int_least.cpp ] [ compile-fail fail_int_least.cpp ]

View File

@ -1,42 +0,0 @@
// (C) Copyright John Maddock 2017.
// Distributed under the Boost Software License, Version 1.0. (See
// accompanying file LICENSE_1_0.txt or copy at
// http://www.boost.org/LICENSE_1_0.txt)
#include <boost/integer/common_factor.hpp>
#ifndef BOOST_NO_CXX14_CONSTEXPR
void test_constexpr()
{
constexpr const boost::int64_t i = 347 * 463 * 727;
constexpr const boost::int64_t j = 191 * 347 * 281;
constexpr const boost::int64_t k = boost::integer::gcd(i, j);
constexpr const boost::int64_t l = boost::integer::lcm(i, j);
static_assert(k == 347, "Expected result not found in constexpr gcd.");
static_assert(l == 6268802158037, "Expected result not found in constexpr lcm.");
}
#endif
#ifndef BOOST_NO_CXX11_NOEXCEPT
void test_noexcept()
{
static_assert(noexcept(boost::integer::gcd(static_cast<unsigned char>(2), static_cast<unsigned char>(4))), "Expected a noexcept function.");
static_assert(noexcept(boost::integer::gcd(static_cast<char>(2), static_cast<char>(4))), "Expected a noexcept function.");
static_assert(noexcept(boost::integer::gcd(static_cast<signed char>(2), static_cast<signed char>(4))), "Expected a noexcept function.");
static_assert(noexcept(boost::integer::gcd(static_cast<short>(2), static_cast<short>(4))), "Expected a noexcept function.");
static_assert(noexcept(boost::integer::gcd(static_cast<unsigned short>(2), static_cast<unsigned short>(4))), "Expected a noexcept function.");
static_assert(noexcept(boost::integer::gcd(static_cast<int>(2), static_cast<int>(4))), "Expected a noexcept function.");
static_assert(noexcept(boost::integer::gcd(static_cast<unsigned int>(2), static_cast<unsigned int>(4))), "Expected a noexcept function.");
static_assert(noexcept(boost::integer::gcd(static_cast<long>(2), static_cast<long>(4))), "Expected a noexcept function.");
static_assert(noexcept(boost::integer::gcd(static_cast<unsigned long>(2), static_cast<unsigned long>(4))), "Expected a noexcept function.");
static_assert(noexcept(boost::integer::gcd(static_cast<long long>(2), static_cast<long long>(4))), "Expected a noexcept function.");
static_assert(noexcept(boost::integer::gcd(static_cast<unsigned long long>(2), static_cast<unsigned long long>(4))), "Expected a noexcept function.");
}
#endif