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
+34
View File
@@ -0,0 +1,34 @@
/*!
@file
Defines `boost::hana::detail::operators::adl`.
Copyright Louis Dionne 2013-2022
Distributed under the Boost Software License, Version 1.0.
(See accompanying file LICENSE.md or copy at http://boost.org/LICENSE_1_0.txt)
*/
#ifndef BOOST_HANA_DETAIL_OPERATORS_ADL_HPP
#define BOOST_HANA_DETAIL_OPERATORS_ADL_HPP
#include <boost/hana/config.hpp>
namespace boost { namespace hana { namespace detail { namespace operators {
//! @ingroup group-details
//! Enables [ADL](http://en.cppreference.com/w/cpp/language/adl) in the
//! `hana::detail::operators` namespace.
//!
//! This is used by containers in Hana as a quick way to automatically
//! define the operators associated to some concepts, in conjunction
//! with the `detail::xxx_operators` family of metafunctions.
//!
//! Note that `adl` can be passed template arguments to make it unique
//! amongst a set of derived classes. This allows a set of derived classes
//! not to possess a common base class, which would disable the EBO when
//! many of these derived classes are stored in a Hana container. If EBO
//! is not a concern, `adl<>` can simply be used.
template <typename ...>
struct adl { };
}} }} // end namespace boost::hana
#endif // !BOOST_HANA_DETAIL_OPERATORS_ADL_HPP
+78
View File
@@ -0,0 +1,78 @@
/*!
@file
Defines arithmetic operators.
Copyright Louis Dionne 2013-2022
Distributed under the Boost Software License, Version 1.0.
(See accompanying file LICENSE.md or copy at http://boost.org/LICENSE_1_0.txt)
*/
#ifndef BOOST_HANA_DETAIL_OPERATORS_ARITHMETIC_HPP
#define BOOST_HANA_DETAIL_OPERATORS_ARITHMETIC_HPP
#include <boost/hana/config.hpp>
#include <boost/hana/core/tag_of.hpp>
#include <boost/hana/fwd/div.hpp>
#include <boost/hana/fwd/minus.hpp>
#include <boost/hana/fwd/mod.hpp>
#include <boost/hana/fwd/mult.hpp>
#include <boost/hana/fwd/negate.hpp>
#include <boost/hana/fwd/plus.hpp>
#include <type_traits>
namespace boost { namespace hana { namespace detail {
template <typename Tag>
struct arithmetic_operators {
static constexpr bool value = false;
};
namespace operators {
template <typename X, typename Y, typename = typename std::enable_if<
detail::arithmetic_operators<typename hana::tag_of<X>::type>::value ||
detail::arithmetic_operators<typename hana::tag_of<Y>::type>::value
>::type>
constexpr auto operator+(X&& x, Y&& y)
{ return hana::plus(static_cast<X&&>(x), static_cast<Y&&>(y)); }
template <typename X, typename Y, typename = typename std::enable_if<
detail::arithmetic_operators<typename hana::tag_of<X>::type>::value ||
detail::arithmetic_operators<typename hana::tag_of<Y>::type>::value
>::type>
constexpr auto operator-(X&& x, Y&& y)
{ return hana::minus(static_cast<X&&>(x), static_cast<Y&&>(y)); }
template <typename X, typename = typename std::enable_if<
detail::arithmetic_operators<typename hana::tag_of<X>::type>::value
>::type>
constexpr auto operator-(X&& x)
{ return hana::negate(static_cast<X&&>(x)); }
template <typename X, typename Y, typename = typename std::enable_if<
detail::arithmetic_operators<typename hana::tag_of<X>::type>::value ||
detail::arithmetic_operators<typename hana::tag_of<Y>::type>::value
>::type>
constexpr auto operator*(X&& x, Y&& y)
{ return hana::mult(static_cast<X&&>(x), static_cast<Y&&>(y)); }
template <typename X, typename Y, typename = typename std::enable_if<
detail::arithmetic_operators<typename hana::tag_of<X>::type>::value ||
detail::arithmetic_operators<typename hana::tag_of<Y>::type>::value
>::type>
constexpr auto operator/(X&& x, Y&& y)
{ return hana::div(static_cast<X&&>(x), static_cast<Y&&>(y)); }
template <typename X, typename Y, typename = typename std::enable_if<
detail::arithmetic_operators<typename hana::tag_of<X>::type>::value ||
detail::arithmetic_operators<typename hana::tag_of<Y>::type>::value
>::type>
constexpr auto operator%(X&& x, Y&& y)
{ return hana::mod(static_cast<X&&>(x), static_cast<Y&&>(y)); }
} // end namespace operators
} }} // end namespace boost::hana
#endif // !BOOST_HANA_DETAIL_OPERATORS_ARITHMETIC_HPP
+52
View File
@@ -0,0 +1,52 @@
/*!
@file
Defines operators for Comparables.
Copyright Louis Dionne 2013-2022
Distributed under the Boost Software License, Version 1.0.
(See accompanying file LICENSE.md or copy at http://boost.org/LICENSE_1_0.txt)
*/
#ifndef BOOST_HANA_DETAIL_OPERATORS_COMPARABLE_HPP
#define BOOST_HANA_DETAIL_OPERATORS_COMPARABLE_HPP
#include <boost/hana/config.hpp>
#include <boost/hana/core/tag_of.hpp>
#include <boost/hana/fwd/equal.hpp>
#include <boost/hana/fwd/not_equal.hpp>
#include <type_traits>
namespace boost { namespace hana { namespace detail {
template <typename Tag>
struct comparable_operators {
static constexpr bool value = false;
};
namespace operators {
template <typename X, typename Y, typename = typename std::enable_if<
!detail::has_idempotent_tag<X>::value &&
!detail::has_idempotent_tag<Y>::value &&
(detail::comparable_operators<
typename hana::tag_of<X>::type>::value ||
detail::comparable_operators<
typename hana::tag_of<Y>::type>::value)
>::type>
constexpr auto operator==(X&& x, Y&& y)
{ return hana::equal(static_cast<X&&>(x), static_cast<Y&&>(y)); }
template <typename X, typename Y, typename = typename std::enable_if<
!detail::has_idempotent_tag<X>::value &&
!detail::has_idempotent_tag<Y>::value &&
(detail::comparable_operators<
typename hana::tag_of<X>::type>::value ||
detail::comparable_operators<
typename hana::tag_of<Y>::type>::value)
>::type>
constexpr auto operator!=(X&& x, Y&& y)
{ return hana::not_equal(static_cast<X&&>(x), static_cast<Y&&>(y)); }
} // end namespace operators
} }} // end namespace boost::hana
#endif // !BOOST_HANA_DETAIL_OPERATORS_COMPARABLE_HPP
+40
View File
@@ -0,0 +1,40 @@
/*!
@file
Defines operators for Iterables.
Copyright Louis Dionne 2013-2022
Distributed under the Boost Software License, Version 1.0.
(See accompanying file LICENSE.md or copy at http://boost.org/LICENSE_1_0.txt)
*/
#ifndef BOOST_HANA_DETAIL_OPERATORS_ITERABLE_HPP
#define BOOST_HANA_DETAIL_OPERATORS_ITERABLE_HPP
#include <boost/hana/config.hpp>
#include <boost/hana/fwd/at.hpp>
namespace boost { namespace hana { namespace detail {
template <typename Derived>
struct iterable_operators {
template <typename N>
constexpr decltype(auto) operator[](N&& n) & {
return hana::at(static_cast<Derived&>(*this),
static_cast<N&&>(n));
}
template <typename N>
constexpr decltype(auto) operator[](N&& n) const& {
return hana::at(static_cast<Derived const&>(*this),
static_cast<N&&>(n));
}
template <typename N>
constexpr decltype(auto) operator[](N&& n) && {
return hana::at(static_cast<Derived&&>(*this),
static_cast<N&&>(n));
}
};
} }} // end namespace boost::hana
#endif // !BOOST_HANA_DETAIL_OPERATORS_ITERABLE_HPP
+51
View File
@@ -0,0 +1,51 @@
/*!
@file
Defines logical operators.
Copyright Louis Dionne 2013-2022
Distributed under the Boost Software License, Version 1.0.
(See accompanying file LICENSE.md or copy at http://boost.org/LICENSE_1_0.txt)
*/
#ifndef BOOST_HANA_DETAIL_OPERATORS_LOGICAL_HPP
#define BOOST_HANA_DETAIL_OPERATORS_LOGICAL_HPP
#include <boost/hana/config.hpp>
#include <boost/hana/core/tag_of.hpp>
#include <boost/hana/fwd/and.hpp>
#include <boost/hana/fwd/not.hpp>
#include <boost/hana/fwd/or.hpp>
#include <type_traits>
namespace boost { namespace hana { namespace detail {
template <typename Tag>
struct logical_operators {
static constexpr bool value = false;
};
namespace operators {
template <typename X, typename Y, typename = typename std::enable_if<
detail::logical_operators<typename hana::tag_of<X>::type>::value ||
detail::logical_operators<typename hana::tag_of<Y>::type>::value
>::type>
constexpr auto operator||(X&& x, Y&& y)
{ return hana::or_(static_cast<X&&>(x), static_cast<Y&&>(y)); }
template <typename X, typename Y, typename = typename std::enable_if<
detail::logical_operators<typename hana::tag_of<X>::type>::value ||
detail::logical_operators<typename hana::tag_of<Y>::type>::value
>::type>
constexpr auto operator&&(X&& x, Y&& y)
{ return hana::and_(static_cast<X&&>(x), static_cast<Y&&>(y)); }
template <typename X, typename = typename std::enable_if<
detail::logical_operators<typename hana::tag_of<X>::type>::value
>::type>
constexpr auto operator!(X&& x)
{ return hana::not_(static_cast<X&&>(x)); }
} // end namespace operators
} }} // end namespace boost::hana
#endif // !BOOST_HANA_DETAIL_OPERATORS_LOGICAL_HPP
+35
View File
@@ -0,0 +1,35 @@
/*!
@file
Defines operators for Monads.
Copyright Louis Dionne 2013-2022
Distributed under the Boost Software License, Version 1.0.
(See accompanying file LICENSE.md or copy at http://boost.org/LICENSE_1_0.txt)
*/
#ifndef BOOST_HANA_DETAIL_OPERATORS_MONAD_HPP
#define BOOST_HANA_DETAIL_OPERATORS_MONAD_HPP
#include <boost/hana/config.hpp>
#include <boost/hana/core/tag_of.hpp>
#include <boost/hana/fwd/chain.hpp>
#include <type_traits>
namespace boost { namespace hana { namespace detail {
template <typename Tag>
struct monad_operators {
static constexpr bool value = false;
};
namespace operators {
template <typename Xs, typename F, typename = typename std::enable_if<
detail::monad_operators<typename hana::tag_of<Xs>::type>::value
>::type>
constexpr auto operator|(Xs&& xs, F&& f)
{ return hana::chain(static_cast<Xs&&>(xs), static_cast<F&&>(f)); }
} // end namespace operators
} }} // end namespace boost::hana
#endif // !BOOST_HANA_DETAIL_OPERATORS_MONAD_HPP
+60
View File
@@ -0,0 +1,60 @@
/*!
@file
Defines operators for Orderables.
Copyright Louis Dionne 2013-2022
Distributed under the Boost Software License, Version 1.0.
(See accompanying file LICENSE.md or copy at http://boost.org/LICENSE_1_0.txt)
*/
#ifndef BOOST_HANA_DETAIL_OPERATORS_ORDERABLE_HPP
#define BOOST_HANA_DETAIL_OPERATORS_ORDERABLE_HPP
#include <boost/hana/config.hpp>
#include <boost/hana/core/tag_of.hpp>
#include <boost/hana/fwd/greater.hpp>
#include <boost/hana/fwd/greater_equal.hpp>
#include <boost/hana/fwd/less.hpp>
#include <boost/hana/fwd/less_equal.hpp>
#include <type_traits>
namespace boost { namespace hana { namespace detail {
template <typename Tag>
struct orderable_operators {
static constexpr bool value = false;
};
namespace operators {
template <typename X, typename Y, typename = typename std::enable_if<
detail::orderable_operators<typename hana::tag_of<X>::type>::value ||
detail::orderable_operators<typename hana::tag_of<Y>::type>::value
>::type>
constexpr auto operator<(X&& x, Y&& y)
{ return hana::less(static_cast<X&&>(x), static_cast<Y&&>(y)); }
template <typename X, typename Y, typename = typename std::enable_if<
detail::orderable_operators<typename hana::tag_of<X>::type>::value ||
detail::orderable_operators<typename hana::tag_of<Y>::type>::value
>::type>
constexpr auto operator>(X&& x, Y&& y)
{ return hana::greater(static_cast<X&&>(x), static_cast<Y&&>(y)); }
template <typename X, typename Y, typename = typename std::enable_if<
detail::orderable_operators<typename hana::tag_of<X>::type>::value ||
detail::orderable_operators<typename hana::tag_of<Y>::type>::value
>::type>
constexpr auto operator<=(X&& x, Y&& y)
{ return hana::less_equal(static_cast<X&&>(x), static_cast<Y&&>(y)); }
template <typename X, typename Y, typename = typename std::enable_if<
detail::orderable_operators<typename hana::tag_of<X>::type>::value ||
detail::orderable_operators<typename hana::tag_of<Y>::type>::value
>::type>
constexpr auto operator>=(X&& x, Y&& y)
{ return hana::greater_equal(static_cast<X&&>(x), static_cast<Y&&>(y)); }
} // end namespace operators
} }} // end namespace boost::hana
#endif // !BOOST_HANA_DETAIL_OPERATORS_ORDERABLE_HPP
+40
View File
@@ -0,0 +1,40 @@
/*!
@file
Defines operators for Searchables.
Copyright Louis Dionne 2013-2022
Distributed under the Boost Software License, Version 1.0.
(See accompanying file LICENSE.md or copy at http://boost.org/LICENSE_1_0.txt)
*/
#ifndef BOOST_HANA_DETAIL_OPERATORS_SEARCHABLE_HPP
#define BOOST_HANA_DETAIL_OPERATORS_SEARCHABLE_HPP
#include <boost/hana/config.hpp>
#include <boost/hana/fwd/at_key.hpp>
namespace boost { namespace hana { namespace detail {
template <typename Derived>
struct searchable_operators {
template <typename Key>
constexpr decltype(auto) operator[](Key&& key) & {
return hana::at_key(static_cast<Derived&>(*this),
static_cast<Key&&>(key));
}
template <typename Key>
constexpr decltype(auto) operator[](Key&& key) && {
return hana::at_key(static_cast<Derived&&>(*this),
static_cast<Key&&>(key));
}
template <typename Key>
constexpr decltype(auto) operator[](Key&& key) const& {
return hana::at_key(static_cast<Derived const&>(*this),
static_cast<Key&&>(key));
}
};
} }} // end namespace boost::hana
#endif // !BOOST_HANA_DETAIL_OPERATORS_SEARCHABLE_HPP