First commit of extensively revised documentation including examples for all items and using Quickbook code snippets in the text. TODO Compile failure in common_factor_ct example. Derived html files NOT saved.

This commit is contained in:
pabristow
2015-01-27 11:53:20 +00:00
parent c5370a9705
commit 2de3837ca6
13 changed files with 845 additions and 302 deletions

View File

@@ -6,6 +6,9 @@
// See http://www.boost.org/libs/integer for documentation.
//! \file
//! \brief Compile-time evaluation of specified (least and fast) integer types.
// Revision History
// 22 Sep 01 Added value-based integer templates. (Daryle Walker)
// 01 Apr 01 Modified to use new <boost/limits.hpp> header. (John Maddock)
@@ -42,15 +45,16 @@ namespace boost
// fast integers from least integers
// int_fast_t<> works correctly for unsigned too, in spite of the name.
template< typename LeastInt >
struct int_fast_t
{
typedef LeastInt fast;
struct int_fast_t
{
typedef LeastInt fast;
typedef fast type;
}; // imps may specialize
//! \cond DETAIL
namespace detail{
// convert category to type
// convert category to type
template< int Category > struct int_least_helper {}; // default is empty
template< int Category > struct uint_least_helper {}; // default is empty
@@ -104,8 +108,8 @@ namespace boost
template <> struct exact_unsigned_base_helper<sizeof(boost::ulong_long_type)* CHAR_BIT> { typedef boost::ulong_long_type exact; };
#endif
} // namespace detail
//! \endcond // DETAIL
// integer templates specifying number of bits ---------------------------//
@@ -138,7 +142,7 @@ namespace boost
"No suitable unsigned integer type with the requested number of bits is available.");
#if (defined(__BORLANDC__) || defined(__CODEGEAR__)) && defined(BOOST_NO_INTEGRAL_INT64_T)
// It's really not clear why this workaround should be needed... shrug I guess! JM
BOOST_STATIC_CONSTANT(int, s =
BOOST_STATIC_CONSTANT(int, s =
6 +
(Bits <= ::std::numeric_limits<unsigned long>::digits) +
(Bits <= ::std::numeric_limits<unsigned int>::digits) +
@@ -147,7 +151,7 @@ namespace boost
typedef typename detail::int_least_helper< ::boost::uint_t<Bits>::s>::least least;
#else
typedef typename boost::detail::uint_least_helper
<
<
#ifdef BOOST_HAS_LONG_LONG
(Bits <= (int)(sizeof(boost::long_long_type) * CHAR_BIT)) +
#else
@@ -171,7 +175,7 @@ namespace boost
#else
template< long MaxValue > // maximum value to require support
#endif
struct int_max_value_t
struct int_max_value_t
{
typedef typename boost::detail::int_least_helper
<
@@ -193,7 +197,7 @@ namespace boost
#else
template< long MinValue > // minimum value to require support
#endif
struct int_min_value_t
struct int_min_value_t
{
typedef typename boost::detail::int_least_helper
<
@@ -216,12 +220,12 @@ namespace boost
#else
template< unsigned long MaxValue > // minimum value to require support
#endif
struct uint_value_t
struct uint_value_t
{
#if (defined(__BORLANDC__) || defined(__CODEGEAR__))
// It's really not clear why this workaround should be needed... shrug I guess! JM
#if defined(BOOST_NO_INTEGRAL_INT64_T)
BOOST_STATIC_CONSTANT(unsigned, which =
BOOST_STATIC_CONSTANT(unsigned, which =
1 +
(MaxValue <= ::boost::integer_traits<unsigned long>::const_max) +
(MaxValue <= ::boost::integer_traits<unsigned int>::const_max) +
@@ -229,7 +233,7 @@ namespace boost
(MaxValue <= ::boost::integer_traits<unsigned char>::const_max));
typedef typename detail::int_least_helper< ::boost::uint_value_t<MaxValue>::which>::least least;
#else // BOOST_NO_INTEGRAL_INT64_T
BOOST_STATIC_CONSTANT(unsigned, which =
BOOST_STATIC_CONSTANT(unsigned, which =
1 +
(MaxValue <= ::boost::integer_traits<boost::ulong_long_type>::const_max) +
(MaxValue <= ::boost::integer_traits<unsigned long>::const_max) +
@@ -240,7 +244,7 @@ namespace boost
#endif // BOOST_NO_INTEGRAL_INT64_T
#else
typedef typename boost::detail::uint_least_helper
<
<
#if !defined(BOOST_NO_INTEGRAL_INT64_T) && defined(BOOST_HAS_LONG_LONG)
(MaxValue <= ::boost::integer_traits<boost::ulong_long_type>::const_max) +
#else
@@ -255,7 +259,6 @@ namespace boost
typedef typename int_fast_t<least>::type fast;
};
} // namespace boost
#endif // BOOST_INTEGER_HPP

View File

@@ -5,7 +5,9 @@
// accompanying file LICENSE_1_0.txt or copy at
// http://www.boost.org/LICENSE_1_0.txt)
// See http://www.boost.org for updates, documentation, and revision history.
// See http://www.boost.org for updates, documentation, and revision history.
//! \file
//! \brief Include both GCD and LCM.
#ifndef BOOST_INTEGER_COMMON_FACTOR_HPP
#define BOOST_INTEGER_COMMON_FACTOR_HPP

View File

@@ -5,7 +5,9 @@
// accompanying file LICENSE_1_0.txt or copy at
// http://www.boost.org/LICENSE_1_0.txt)
// See http://www.boost.org for updates, documentation, and revision history.
// See http://www.boost.org for updates, documentation, and revision history.
//! \file
//! \brief Evaluate Greatest Common Divisor at compile-time.
#ifndef BOOST_INTEGER_COMMON_FACTOR_CT_HPP
#define BOOST_INTEGER_COMMON_FACTOR_CT_HPP
@@ -17,9 +19,10 @@ namespace boost
{
namespace integer
{
// Warning: this is from 1.58 in namespace boost::integer and no longer in namespace boost::math.
// Implementation details --------------------------------------------------//
//! \cond DETAIL
namespace detail
{
// Build GCD with Euclid's recursive algorithm
@@ -71,7 +74,7 @@ namespace detail
};
} // namespace detail
//! \endcond // DETAIL
// Compile-time greatest common divisor evaluator class declaration --------//

View File

@@ -4,13 +4,15 @@
// use, modify, sell and distribute this software is granted provided this
// copyright notice appears in all copies. This software is provided "as is"
// without express or implied warranty, and with no claim as to its suitability
// for any purpose.
// for any purpose.
// boostinspect:nolicense (don't complain about the lack of a Boost license)
// (Paul Moore hasn't been in contact for years, so there's no way to change the
// license.)
// See http://www.boost.org for updates, documentation, and revision history.
// See http://www.boost.org for updates, documentation, and revision history.
//! \file
//! \brief Evaluate Least Common Multiple at compile-time.
#ifndef BOOST_INTEGER_COMMON_FACTOR_RT_HPP
#define BOOST_INTEGER_COMMON_FACTOR_RT_HPP
@@ -31,7 +33,7 @@ namespace boost
{
namespace integer
{
// Warning: this is from 1.58 in namespace boost::interger and no longer in namespace boost::math.
// Forward declarations for function templates -----------------------------//
@@ -75,6 +77,7 @@ public:
// Implementation details --------------------------------------------------//
//! \cond DETAIL
namespace detail
{
@@ -387,9 +390,13 @@ namespace detail
}
} // namespace detail
//! \endcond // DETAIL
// Greatest common divisor evaluator member function definition ------------//
// Greatest common divisor operator() evaluator member function definition ------------//
//! Evaluation operator() for Greatest Common Divisor (GCD) of two arguments.
//! \tparam IntegerType must be an integral constant http://en.cppreference.com/w/cpp/types/integral_constant
//! \param a first_argument_type
//! \param b second_argument_type
template < typename IntegerType >
inline
@@ -405,7 +412,11 @@ gcd_evaluator<IntegerType>::operator ()
// Least common multiple evaluator member function definition --------------//
//! Evaluates Least Common Multiplier of two arguments.
//! \tparam IntegerType must be an integral constant http://en.cppreference.com/w/cpp/types/integral_constant
//! \tparam IntegerType must be an integral constant http://en.cppreference.com/w/cpp/types/integral_constant
//! \param a first_argument_type
//! \param b second_argument_type
template < typename IntegerType >
inline
typename lcm_evaluator<IntegerType>::result_type
@@ -420,6 +431,10 @@ lcm_evaluator<IntegerType>::operator ()
// Greatest common divisor and least common multiple function definitions --//
//! Function for Greatest Common Divisor (GCD) of two arguments.
//! \tparam IntegerType must be an integral constant http://en.cppreference.com/w/cpp/types/integral_constant
//! \param a first_argument_type
//! \param b second_argument_type
template < typename IntegerType >
inline
@@ -435,6 +450,11 @@ gcd
return solver( a, b );
}
//! Function for Least Common Multiplier (LCM) of two arguments.
//! \tparam IntegerType must be an integral constant http://en.cppreference.com/w/cpp/types/integral_constant
//! \param a first_argument_type
//! \param b second_argument_type
template < typename IntegerType >
inline
IntegerType

View File

@@ -1,15 +1,18 @@
// -----------------------------------------------------------
// integer_log2.hpp
//
// Gives the integer part of the logarithm, in base 2, of a
// given number. Behavior is undefined if the argument is <= 0.
//
// Copyright (c) 2003-2004, 2008 Gennaro Prota
//
// 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)
//
//! \file
//! \brief Function integer_log2 gives the integer part of the logarithm, in base 2, of a
//! given number (at run-time). Behavior is undefined if the argument is <= 0.
//
//! \note For analogous compile-time computation of log2 see static_log2.
//! \sa http::www.boost.org/doc/integer
// -----------------------------------------------------------
#ifndef BOOST_INTEGER_INTEGER_LOG2_HPP
@@ -24,6 +27,8 @@
namespace boost {
//! \cond DETAIL
namespace detail {
template <typename T>
@@ -46,7 +51,6 @@ namespace boost {
}
// helper to find the maximum power of two
// less than p (more involved than necessary,
// to avoid PTS)
@@ -82,9 +86,8 @@ namespace boost {
#endif
};
} // detail
//! \endcond // DETAIL
// ---------
// integer_log2
@@ -104,9 +107,6 @@ namespace boost {
}
}
#endif // include guard
#endif // BOOST_INTEGER_INTEGER_LOG2_HPP include guard

View File

@@ -5,7 +5,10 @@
// accompanying file LICENSE_1_0.txt or copy at
// http://www.boost.org/LICENSE_1_0.txt)
// See http://www.boost.org for updates, documentation, and revision history.
// See http://www.boost.org for updates, documentation, and revision history.
//! \file
//! \brief Compile-time integer mask evaluation.
#ifndef BOOST_INTEGER_INTEGER_MASK_HPP
#define BOOST_INTEGER_INTEGER_MASK_HPP
@@ -35,7 +38,6 @@
namespace boost
{
// Specified single-bit mask class declaration -----------------------------//
// (Lowest bit starts counting at 0.)

View File

@@ -10,6 +10,11 @@
//
// ---------------------------------------------------
// See http://www.boost.org/libs/integer for documentation.
//! \file
//! \brief Compile-time calculation of integer part of the logarithm, in base 2, of a given number.
//! \note For a run-time calculation of log2, see function integer_log2 at integer_log2.hpp.
// ------------------------------------------------------------------------- //
@@ -20,6 +25,8 @@
namespace boost {
//! \cond DETAIL
namespace detail {
namespace static_log2_impl {
@@ -99,8 +106,7 @@ namespace boost {
}
} // detail
//! \endcond // DETAIL
// --------------------------------------
// static_log2<x>
@@ -120,7 +126,7 @@ namespace boost {
template <>
struct static_log2<0> { };
}
} // namespace boost

View File

@@ -5,7 +5,9 @@
// accompanying file LICENSE_1_0.txt or copy at
// http://www.boost.org/LICENSE_1_0.txt)
// See http://www.boost.org for updates, documentation, and revision history.
// See http://www.boost.org for updates, documentation, and revision history.
//! \file
//! \brief Compile-time evaluation of extrema: minimum or maximum of two values, signed or unsigned.
#ifndef BOOST_INTEGER_STATIC_MIN_MAX_HPP
#define BOOST_INTEGER_STATIC_MIN_MAX_HPP

View File

@@ -5,6 +5,8 @@
// LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
// See http://www.boost.org/libs/integer for documentation.
//! \file
//! \brief Include all Boost.Integer files.
#ifndef BOOST_INTEGER_FWD_HPP
#define BOOST_INTEGER_FWD_HPP

View File

@@ -8,10 +8,15 @@
* $Id$
*
* Idea by Beman Dawes, Ed Brey, Steve Cleary, and Nathan Myers
*/
// See http://www.boost.org/libs/integer for documentation.
//! \file
//! \brief integer traits
//! \sa http://www.boost.org/libs/integer
#ifndef BOOST_INTEGER_TRAITS_HPP
#define BOOST_INTEGER_TRAITS_HPP
@@ -47,6 +52,7 @@ public:
BOOST_STATIC_CONSTANT(bool, is_integral = false);
};
//! \cond DETAIL
namespace detail {
template<class T, T min_val, T max_val>
class integer_traits_base
@@ -70,6 +76,7 @@ const T integer_traits_base<T, min_val, max_val>::const_max;
#endif
} // namespace detail
//! \endcond // DETAIL
template<>
class integer_traits<bool>