Added thirdparty: boost library

This commit is contained in:
Viacheslav Demydiuk
2024-01-06 19:55:56 +02:00
parent bf49f439e1
commit bccd1e7051
15683 changed files with 3239840 additions and 0 deletions
+18
View File
@@ -0,0 +1,18 @@
// config.hpp ---------------------------------------------------------------//
// Copyright 2012 Vicente J. Botet Escriba
// Distributed under the Boost Software License, Version 1.0.
// See http://www.boost.org/LICENSE_1_0.txt
#ifndef BOOST_RATIO_CONFIG_HPP
#define BOOST_RATIO_CONFIG_HPP
// This header is no longer useful and is only retained for compatibility
#include <cstdint>
#define BOOST_RATIO_INTMAX_C INTMAX_C
#endif // #ifndef BOOST_RATIO_CONFIG_HPP
+53
View File
@@ -0,0 +1,53 @@
#ifndef BOOST_RATIO_DETAIL_GCD_LCM_HPP
#define BOOST_RATIO_DETAIL_GCD_LCM_HPP
// Copyright 2023 Peter Dimov
// Distributed under the Boost Software License, Version 1.0.
// https://www.boost.org/LICENSE_1_0.txt
#include <type_traits>
#include <cstdint>
namespace boost
{
namespace ratio_detail
{
template<std::intmax_t A> struct abs_: std::integral_constant<std::intmax_t, A < 0? -A: A>
{
};
template<> struct abs_<INTMAX_MIN>: std::integral_constant<std::intmax_t, INTMAX_MIN>
{
};
template<std::intmax_t A, std::intmax_t B> struct gcd_: public gcd_<B, A % B>
{
};
template<std::intmax_t A> struct gcd_<A, 0>: std::integral_constant<std::intmax_t, A>
{
};
template<std::intmax_t A, std::intmax_t B> struct lcm_: std::integral_constant<std::intmax_t, (A / gcd_<A, B>::value) * B>
{
};
template<> struct lcm_<0, 0>: std::integral_constant<std::intmax_t, 0>
{
};
//
template<std::intmax_t A, std::intmax_t B> struct gcd: abs_< gcd_<A, B>::value >
{
};
template<std::intmax_t A, std::intmax_t B> struct lcm: abs_< lcm_<A, B>::value >
{
};
} // namespace ratio_detail
} // namespace boost
#endif // BOOST_RATIO_DETAIL_GCD_LCM_HPP
+32
View File
@@ -0,0 +1,32 @@
#ifndef BOOST_RATIO_DETAIL_IS_EVENLY_DIVISIBLE_BY_HPP
#define BOOST_RATIO_DETAIL_IS_EVENLY_DIVISIBLE_BY_HPP
// Copyright 2023 Peter Dimov
// Distributed under the Boost Software License, Version 1.0.
// https://www.boost.org/LICENSE_1_0.txt
#include <type_traits>
#include <cstdint>
namespace boost
{
namespace ratio_detail
{
template<std::intmax_t A, std::intmax_t B> struct is_evenly_divisible_by_: std::integral_constant<bool, A % B == 0>
{
};
template<std::intmax_t A> struct is_evenly_divisible_by_<A, 0>: std::false_type
{
};
template<class R1, class R2> struct is_evenly_divisible_by: std::integral_constant<bool,
is_evenly_divisible_by_<R1::num, R2::num>::value && is_evenly_divisible_by_<R2::den, R1::den>::value>
{
};
} // namespace ratio_detail
} // namespace boost
#endif // BOOST_RATIO_DETAIL_IS_EVENLY_DIVISIBLE_BY_HPP
+28
View File
@@ -0,0 +1,28 @@
#ifndef BOOST_RATIO_DETAIL_IS_RATIO_HPP
#define BOOST_RATIO_DETAIL_IS_RATIO_HPP
// Copyright 2023 Peter Dimov
// Distributed under the Boost Software License, Version 1.0.
// https://www.boost.org/LICENSE_1_0.txt
#include <boost/ratio/ratio_fwd.hpp>
#include <type_traits>
#include <cstdint>
namespace boost
{
namespace ratio_detail
{
template<class T> struct is_ratio: std::false_type
{
};
template<std::intmax_t A, std::intmax_t B> struct is_ratio< boost::ratio<A, B> >: std::true_type
{
};
} // namespace ratio_detail
} // namespace boost
#endif // BOOST_RATIO_DETAIL_IS_RATIO_HPP
+14
View File
@@ -0,0 +1,14 @@
// include.hpp ---------------------------------------------------------------//
// Copyright 2011 Vicente J. Botet Escriba
// Distributed under the Boost Software License, Version 1.0.
// See http://www.boost.org/LICENSE_1_0.txt
#ifndef BOOST_RATIO_INCLUDE_HPP
#define BOOST_RATIO_INCLUDE_HPP
#include <boost/ratio/ratio.hpp>
#include <boost/ratio/ratio_io.hpp>
#endif // BOOST_RATIO_INCLUDE_HPP
+49
View File
@@ -0,0 +1,49 @@
// ratio.hpp ---------------------------------------------------------------//
// Copyright 2008 Howard Hinnant
// Copyright 2008 Beman Dawes
// Copyright 2009 Vicente J. Botet Escriba
// Distributed under the Boost Software License, Version 1.0.
// See http://www.boost.org/LICENSE_1_0.txt
/*
This code was derived by Beman Dawes from Howard Hinnant's time2_demo prototype.
Many thanks to Howard for making his code available under the Boost license.
The original code was modified to conform to Boost conventions and to section
20.4 Compile-time rational arithmetic [ratio], of the C++ committee working
paper N2798.
See http://www.open-std.org/jtc1/sc22/wg21/docs/papers/2008/n2798.pdf.
time2_demo contained this comment:
Much thanks to Andrei Alexandrescu,
Walter Brown,
Peter Dimov,
Jeff Garland,
Terry Golubiewski,
Daniel Krugler,
Anthony Williams.
*/
// The way overflow is managed for ratio_less is taken from llvm/libcxx/include/ratio
#ifndef BOOST_RATIO_RATIO_HPP
#define BOOST_RATIO_RATIO_HPP
#include <boost/ratio/ratio_fwd.hpp>
#include <boost/ratio/detail/gcd_lcm.hpp>
namespace boost
{
// extension used by Chrono
template <class R1, class R2> using ratio_gcd = typename ratio<
ratio_detail::gcd<R1::num, R2::num>::value,
ratio_detail::lcm<R1::den, R2::den>::value>::type;
} // namespace boost
#endif // BOOST_RATIO_RATIO_HPP
+83
View File
@@ -0,0 +1,83 @@
// ratio_fwd.hpp ---------------------------------------------------------------//
// Copyright 2008 Howard Hinnant
// Copyright 2008 Beman Dawes
// Copyright 2009 Vicente J. Botet Escriba
// Distributed under the Boost Software License, Version 1.0.
// See http://www.boost.org/LICENSE_1_0.txt
/*
This code was derived by Beman Dawes from Howard Hinnant's time2_demo prototype.
Many thanks to Howard for making his code available under the Boost license.
The original code was modified to conform to Boost conventions and to section
20.4 Compile-time rational arithmetic [ratio], of the C++ committee working
paper N2798.
See http://www.open-std.org/jtc1/sc22/wg21/docs/papers/2008/n2798.pdf.
time2_demo contained this comment:
Much thanks to Andrei Alexandrescu,
Walter Brown,
Peter Dimov,
Jeff Garland,
Terry Golubiewski,
Daniel Krugler,
Anthony Williams.
*/
// The way overflow is managed for ratio_less is taken from llvm/libcxx/include/ratio
#ifndef BOOST_RATIO_RATIO_FWD_HPP
#define BOOST_RATIO_RATIO_FWD_HPP
#include <ratio>
namespace boost
{
//----------------------------------------------------------------------------//
// //
// 20.6 Compile-time rational arithmetic [ratio] //
// //
//----------------------------------------------------------------------------//
// ratio
using std::ratio;
// ratio arithmetic
using std::ratio_add;
using std::ratio_subtract;
using std::ratio_multiply;
using std::ratio_divide;
// ratio comparison
using std::ratio_equal;
using std::ratio_not_equal;
using std::ratio_less;
using std::ratio_less_equal;
using std::ratio_greater;
using std::ratio_greater_equal;
// convenience SI typedefs
using std::atto;
using std::femto;
using std::pico;
using std::nano;
using std::micro;
using std::milli;
using std::centi;
using std::deci;
using std::deca;
using std::hecto;
using std::kilo;
using std::mega;
using std::giga;
using std::tera;
using std::peta;
using std::exa;
} // namespace boost
#endif // BOOST_RATIO_RATIO_FWD_HPP
+543
View File
@@ -0,0 +1,543 @@
// ratio_io
//
// (C) Copyright Howard Hinnant
// (C) Copyright 2010 Vicente J. Botet Escriba
// Use, modification and distribution are subject to 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).
//
// This code was adapted by Vicente from Howard Hinnant's experimental work
// on chrono i/o under lvm/libc++ to Boost
#ifndef BOOST_RATIO_RATIO_IO_HPP
#define BOOST_RATIO_RATIO_IO_HPP
/*
ratio_io synopsis
#include <ratio>
#include <string>
namespace boost
{
template <class Ratio, class CharT>
struct ratio_string
{
static basic_string<CharT> prefix();
static basic_string<CharT> symbol();
};
} // boost
*/
#include <boost/ratio/ratio.hpp>
#include <string>
#include <sstream>
namespace boost {
template <class Ratio, class CharT>
struct ratio_string
{
static std::basic_string<CharT> symbol() {return prefix();}
static std::basic_string<CharT> prefix();
};
template <class Ratio, class CharT>
std::basic_string<CharT>
ratio_string<Ratio, CharT>::prefix()
{
std::basic_ostringstream<CharT> os;
os << CharT('[') << Ratio::num << CharT('/')
<< Ratio::den << CharT(']');
return os.str();
}
// atto
template <>
struct ratio_string<atto, char>
{
static std::string symbol() {return std::string(1, 'a');}
static std::string prefix() {return std::string("atto");}
};
template <>
struct ratio_string<atto, char16_t>
{
static std::u16string symbol() {return std::u16string(1, u'a');}
static std::u16string prefix() {return std::u16string(u"atto");}
};
template <>
struct ratio_string<atto, char32_t>
{
static std::u32string symbol() {return std::u32string(1, U'a');}
static std::u32string prefix() {return std::u32string(U"atto");}
};
template <>
struct ratio_string<atto, wchar_t>
{
static std::wstring symbol() {return std::wstring(1, L'a');}
static std::wstring prefix() {return std::wstring(L"atto");}
};
// femto
template <>
struct ratio_string<femto, char>
{
static std::string symbol() {return std::string(1, 'f');}
static std::string prefix() {return std::string("femto");}
};
template <>
struct ratio_string<femto, char16_t>
{
static std::u16string symbol() {return std::u16string(1, u'f');}
static std::u16string prefix() {return std::u16string(u"femto");}
};
template <>
struct ratio_string<femto, char32_t>
{
static std::u32string symbol() {return std::u32string(1, U'f');}
static std::u32string prefix() {return std::u32string(U"femto");}
};
template <>
struct ratio_string<femto, wchar_t>
{
static std::wstring symbol() {return std::wstring(1, L'f');}
static std::wstring prefix() {return std::wstring(L"femto");}
};
// pico
template <>
struct ratio_string<pico, char>
{
static std::string symbol() {return std::string(1, 'p');}
static std::string prefix() {return std::string("pico");}
};
template <>
struct ratio_string<pico, char16_t>
{
static std::u16string symbol() {return std::u16string(1, u'p');}
static std::u16string prefix() {return std::u16string(u"pico");}
};
template <>
struct ratio_string<pico, char32_t>
{
static std::u32string symbol() {return std::u32string(1, U'p');}
static std::u32string prefix() {return std::u32string(U"pico");}
};
template <>
struct ratio_string<pico, wchar_t>
{
static std::wstring symbol() {return std::wstring(1, L'p');}
static std::wstring prefix() {return std::wstring(L"pico");}
};
// nano
template <>
struct ratio_string<nano, char>
{
static std::string symbol() {return std::string(1, 'n');}
static std::string prefix() {return std::string("nano");}
};
template <>
struct ratio_string<nano, char16_t>
{
static std::u16string symbol() {return std::u16string(1, u'n');}
static std::u16string prefix() {return std::u16string(u"nano");}
};
template <>
struct ratio_string<nano, char32_t>
{
static std::u32string symbol() {return std::u32string(1, U'n');}
static std::u32string prefix() {return std::u32string(U"nano");}
};
template <>
struct ratio_string<nano, wchar_t>
{
static std::wstring symbol() {return std::wstring(1, L'n');}
static std::wstring prefix() {return std::wstring(L"nano");}
};
// micro
template <>
struct ratio_string<micro, char>
{
static std::string symbol() {return std::string("\xC2\xB5");}
static std::string prefix() {return std::string("micro");}
};
template <>
struct ratio_string<micro, char16_t>
{
static std::u16string symbol() {return std::u16string(1, u'\xB5');}
static std::u16string prefix() {return std::u16string(u"micro");}
};
template <>
struct ratio_string<micro, char32_t>
{
static std::u32string symbol() {return std::u32string(1, U'\xB5');}
static std::u32string prefix() {return std::u32string(U"micro");}
};
template <>
struct ratio_string<micro, wchar_t>
{
static std::wstring symbol() {return std::wstring(1, L'\xB5');}
static std::wstring prefix() {return std::wstring(L"micro");}
};
// milli
template <>
struct ratio_string<milli, char>
{
static std::string symbol() {return std::string(1, 'm');}
static std::string prefix() {return std::string("milli");}
};
template <>
struct ratio_string<milli, char16_t>
{
static std::u16string symbol() {return std::u16string(1, u'm');}
static std::u16string prefix() {return std::u16string(u"milli");}
};
template <>
struct ratio_string<milli, char32_t>
{
static std::u32string symbol() {return std::u32string(1, U'm');}
static std::u32string prefix() {return std::u32string(U"milli");}
};
template <>
struct ratio_string<milli, wchar_t>
{
static std::wstring symbol() {return std::wstring(1, L'm');}
static std::wstring prefix() {return std::wstring(L"milli");}
};
// centi
template <>
struct ratio_string<centi, char>
{
static std::string symbol() {return std::string(1, 'c');}
static std::string prefix() {return std::string("centi");}
};
template <>
struct ratio_string<centi, char16_t>
{
static std::u16string symbol() {return std::u16string(1, u'c');}
static std::u16string prefix() {return std::u16string(u"centi");}
};
template <>
struct ratio_string<centi, char32_t>
{
static std::u32string symbol() {return std::u32string(1, U'c');}
static std::u32string prefix() {return std::u32string(U"centi");}
};
template <>
struct ratio_string<centi, wchar_t>
{
static std::wstring symbol() {return std::wstring(1, L'c');}
static std::wstring prefix() {return std::wstring(L"centi");}
};
// deci
template <>
struct ratio_string<deci, char>
{
static std::string symbol() {return std::string(1, 'd');}
static std::string prefix() {return std::string("deci");}
};
template <>
struct ratio_string<deci, char16_t>
{
static std::u16string symbol() {return std::u16string(1, u'd');}
static std::u16string prefix() {return std::u16string(u"deci");}
};
template <>
struct ratio_string<deci, char32_t>
{
static std::u32string symbol() {return std::u32string(1, U'd');}
static std::u32string prefix() {return std::u32string(U"deci");}
};
template <>
struct ratio_string<deci, wchar_t>
{
static std::wstring symbol() {return std::wstring(1, L'd');}
static std::wstring prefix() {return std::wstring(L"deci");}
};
// unit
// deca
template <>
struct ratio_string<deca, char>
{
static std::string symbol() {return std::string("da");}
static std::string prefix() {return std::string("deca");}
};
template <>
struct ratio_string<deca, char16_t>
{
static std::u16string symbol() {return std::u16string(u"da");}
static std::u16string prefix() {return std::u16string(u"deca");}
};
template <>
struct ratio_string<deca, char32_t>
{
static std::u32string symbol() {return std::u32string(U"da");}
static std::u32string prefix() {return std::u32string(U"deca");}
};
template <>
struct ratio_string<deca, wchar_t>
{
static std::wstring symbol() {return std::wstring(L"da");}
static std::wstring prefix() {return std::wstring(L"deca");}
};
// hecto
template <>
struct ratio_string<hecto, char>
{
static std::string symbol() {return std::string(1, 'h');}
static std::string prefix() {return std::string("hecto");}
};
template <>
struct ratio_string<hecto, char16_t>
{
static std::u16string symbol() {return std::u16string(1, u'h');}
static std::u16string prefix() {return std::u16string(u"hecto");}
};
template <>
struct ratio_string<hecto, char32_t>
{
static std::u32string symbol() {return std::u32string(1, U'h');}
static std::u32string prefix() {return std::u32string(U"hecto");}
};
template <>
struct ratio_string<hecto, wchar_t>
{
static std::wstring symbol() {return std::wstring(1, L'h');}
static std::wstring prefix() {return std::wstring(L"hecto");}
};
// kilo
template <>
struct ratio_string<kilo, char>
{
static std::string symbol() {return std::string(1, 'k');}
static std::string prefix() {return std::string("kilo");}
};
template <>
struct ratio_string<kilo, char16_t>
{
static std::u16string symbol() {return std::u16string(1, u'k');}
static std::u16string prefix() {return std::u16string(u"kilo");}
};
template <>
struct ratio_string<kilo, char32_t>
{
static std::u32string symbol() {return std::u32string(1, U'k');}
static std::u32string prefix() {return std::u32string(U"kilo");}
};
template <>
struct ratio_string<kilo, wchar_t>
{
static std::wstring symbol() {return std::wstring(1, L'k');}
static std::wstring prefix() {return std::wstring(L"kilo");}
};
// mega
template <>
struct ratio_string<mega, char>
{
static std::string symbol() {return std::string(1, 'M');}
static std::string prefix() {return std::string("mega");}
};
template <>
struct ratio_string<mega, char16_t>
{
static std::u16string symbol() {return std::u16string(1, u'M');}
static std::u16string prefix() {return std::u16string(u"mega");}
};
template <>
struct ratio_string<mega, char32_t>
{
static std::u32string symbol() {return std::u32string(1, U'M');}
static std::u32string prefix() {return std::u32string(U"mega");}
};
template <>
struct ratio_string<mega, wchar_t>
{
static std::wstring symbol() {return std::wstring(1, L'M');}
static std::wstring prefix() {return std::wstring(L"mega");}
};
// giga
template <>
struct ratio_string<giga, char>
{
static std::string symbol() {return std::string(1, 'G');}
static std::string prefix() {return std::string("giga");}
};
template <>
struct ratio_string<giga, char16_t>
{
static std::u16string symbol() {return std::u16string(1, u'G');}
static std::u16string prefix() {return std::u16string(u"giga");}
};
template <>
struct ratio_string<giga, char32_t>
{
static std::u32string symbol() {return std::u32string(1, U'G');}
static std::u32string prefix() {return std::u32string(U"giga");}
};
template <>
struct ratio_string<giga, wchar_t>
{
static std::wstring symbol() {return std::wstring(1, L'G');}
static std::wstring prefix() {return std::wstring(L"giga");}
};
// tera
template <>
struct ratio_string<tera, char>
{
static std::string symbol() {return std::string(1, 'T');}
static std::string prefix() {return std::string("tera");}
};
template <>
struct ratio_string<tera, char16_t>
{
static std::u16string symbol() {return std::u16string(1, u'T');}
static std::u16string prefix() {return std::u16string(u"tera");}
};
template <>
struct ratio_string<tera, char32_t>
{
static std::u32string symbol() {return std::u32string(1, U'T');}
static std::u32string prefix() {return std::u32string(U"tera");}
};
template <>
struct ratio_string<tera, wchar_t>
{
static std::wstring symbol() {return std::wstring(1, L'T');}
static std::wstring prefix() {return std::wstring(L"tera");}
};
// peta
template <>
struct ratio_string<peta, char>
{
static std::string symbol() {return std::string(1, 'P');}
static std::string prefix() {return std::string("peta");}
};
template <>
struct ratio_string<peta, char16_t>
{
static std::u16string symbol() {return std::u16string(1, u'P');}
static std::u16string prefix() {return std::u16string(u"peta");}
};
template <>
struct ratio_string<peta, char32_t>
{
static std::u32string symbol() {return std::u32string(1, U'P');}
static std::u32string prefix() {return std::u32string(U"peta");}
};
template <>
struct ratio_string<peta, wchar_t>
{
static std::wstring symbol() {return std::wstring(1, L'P');}
static std::wstring prefix() {return std::wstring(L"peta");}
};
// exa
template <>
struct ratio_string<exa, char>
{
static std::string symbol() {return std::string(1, 'E');}
static std::string prefix() {return std::string("exa");}
};
template <>
struct ratio_string<exa, char16_t>
{
static std::u16string symbol() {return std::u16string(1, u'E');}
static std::u16string prefix() {return std::u16string(u"exa");}
};
template <>
struct ratio_string<exa, char32_t>
{
static std::u32string symbol() {return std::u32string(1, U'E');}
static std::u32string prefix() {return std::u32string(U"exa");}
};
template <>
struct ratio_string<exa, wchar_t>
{
static std::wstring symbol() {return std::wstring(1, L'E');}
static std::wstring prefix() {return std::wstring(L"exa");}
};
}
#endif // BOOST_RATIO_RATIO_IO_HPP