mirror of
https://github.com/boostorg/iterator.git
synced 2025-05-09 23:23:54 +00:00
Added support for int128 to counting_iterator.
This commit is contained in:
parent
abe6fbfd4b
commit
eb0d01126a
@ -67,11 +67,21 @@ namespace detail
|
||||
|
||||
# if defined(BOOST_HAS_LONG_LONG)
|
||||
template <>
|
||||
struct is_numeric< ::boost::long_long_type>
|
||||
struct is_numeric<boost::long_long_type>
|
||||
: boost::true_type {};
|
||||
|
||||
template <>
|
||||
struct is_numeric< ::boost::ulong_long_type>
|
||||
struct is_numeric<boost::ulong_long_type>
|
||||
: boost::true_type {};
|
||||
# endif
|
||||
|
||||
# if defined(BOOST_HAS_INT128)
|
||||
template <>
|
||||
struct is_numeric<boost::int128_type>
|
||||
: boost::true_type {};
|
||||
|
||||
template <>
|
||||
struct is_numeric<boost::uint128_type>
|
||||
: boost::true_type {};
|
||||
# endif
|
||||
|
||||
@ -86,6 +96,21 @@ namespace detail
|
||||
typedef typename boost::detail::numeric_traits<T>::difference_type type;
|
||||
};
|
||||
|
||||
# if defined(BOOST_HAS_INT128)
|
||||
// std::numeric_limits, which is used by numeric_traits, is not specialized for __int128 in some standard libraries
|
||||
template <>
|
||||
struct numeric_difference<boost::int128_type>
|
||||
{
|
||||
typedef boost::int128_type type;
|
||||
};
|
||||
|
||||
template <>
|
||||
struct numeric_difference<boost::uint128_type>
|
||||
{
|
||||
typedef boost::int128_type type;
|
||||
};
|
||||
# endif
|
||||
|
||||
template <class Incrementable, class CategoryOrTraversal, class Difference>
|
||||
struct counting_iterator_base
|
||||
{
|
||||
|
@ -271,8 +271,12 @@ int main()
|
||||
test_integer<long>();
|
||||
test_integer<unsigned long>();
|
||||
#if defined(BOOST_HAS_LONG_LONG)
|
||||
test_integer< ::boost::long_long_type>();
|
||||
test_integer< ::boost::ulong_long_type>();
|
||||
test_integer<boost::long_long_type>();
|
||||
test_integer<boost::ulong_long_type>();
|
||||
#endif
|
||||
#if defined(BOOST_HAS_INT128)
|
||||
test_integer<boost::int128_type>();
|
||||
test_integer<boost::uint128_type>();
|
||||
#endif
|
||||
|
||||
// Test user-defined type.
|
||||
|
Loading…
x
Reference in New Issue
Block a user