/usr/include/boost/asio/execution
Edit: /usr/include/boost/asio/execution/allocator.hpp (7823B)
//
// execution/allocator.hpp
// ~~~~~~~~~~~~~~~~~~~~~~~
//
// Copyright (c) 2003-2020 Christopher M. Kohlhoff (chris at kohlhoff dot com)
//
// 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)
//
#ifndef BOOST_ASIO_EXECUTION_ALLOCATOR_HPP
#define BOOST_ASIO_EXECUTION_ALLOCATOR_HPP
#if defined(_MSC_VER) && (_MSC_VER >= 1200)
# pragma once
#endif // defined(_MSC_VER) && (_MSC_VER >= 1200)
#include
#include
#include
#include
#include
#include
#include
#include
#include
namespace boost {
namespace asio {
#if defined(GENERATING_DOCUMENTATION)
namespace execution {
/// A property to describe which allocator an executor will use to allocate the
/// memory required to store a submitted function object.
template
struct allocator_t
{
/// The allocator_t property applies to executors, senders, and schedulers.
template
static constexpr bool is_applicable_property_v =
is_executor_v || is_sender_v || is_scheduler_v;
/// The allocator_t property can be required.
static constexpr bool is_requirable = true;
/// The allocator_t property can be preferred.
static constexpr bool is_preferable = true;
/// Default constructor.
constexpr allocator_t();
/// Obtain the allocator stored in the allocator_t property object.
/**
* Present only if @c ProtoAllocator is non-void.
*/
constexpr ProtoAllocator value() const;
/// Create an allocator_t object with a different allocator.
/**
* Present only if @c ProtoAllocator is void.
*/
template
allocator_t allocator;
} // namespace execution
#else // defined(GENERATING_DOCUMENTATION)
namespace execution {
template
struct allocator_t
{
#if defined(BOOST_ASIO_HAS_VARIABLE_TEMPLATES)
template
BOOST_ASIO_STATIC_CONSTEXPR(bool,
is_applicable_property_v = is_executor::value
|| is_sender::value || is_scheduler::value);
#endif // defined(BOOST_ASIO_HAS_VARIABLE_TEMPLATES)
BOOST_ASIO_STATIC_CONSTEXPR(bool, is_requirable = true);
BOOST_ASIO_STATIC_CONSTEXPR(bool, is_preferable = true);
#if defined(BOOST_ASIO_HAS_DEDUCED_STATIC_QUERY_TRAIT) \
&& defined(BOOST_ASIO_HAS_SFINAE_VARIABLE_TEMPLATES)
template
static BOOST_ASIO_CONSTEXPR
typename traits::query_static_constexpr_member::result_type
static_query()
BOOST_ASIO_NOEXCEPT_IF((
traits::query_static_constexpr_member::is_noexcept))
{
return traits::query_static_constexpr_member::value();
}
template ())>
static BOOST_ASIO_CONSTEXPR const T static_query_v
= allocator_t::static_query();
#endif // defined(BOOST_ASIO_HAS_DEDUCED_STATIC_QUERY_TRAIT)
// && defined(BOOST_ASIO_HAS_SFINAE_VARIABLE_TEMPLATES)
BOOST_ASIO_CONSTEXPR ProtoAllocator value() const
{
return a_;
}
private:
friend struct allocator_t;
explicit BOOST_ASIO_CONSTEXPR allocator_t(const ProtoAllocator& a)
: a_(a)
{
}
ProtoAllocator a_;
};
#if defined(BOOST_ASIO_HAS_DEDUCED_STATIC_QUERY_TRAIT) \
&& defined(BOOST_ASIO_HAS_SFINAE_VARIABLE_TEMPLATES)
template template
const T allocator_t::static_query_v;
#endif // defined(BOOST_ASIO_HAS_DEDUCED_STATIC_QUERY_TRAIT)
// && defined(BOOST_ASIO_HAS_SFINAE_VARIABLE_TEMPLATES)
template <>
struct allocator_t
{
#if defined(BOOST_ASIO_HAS_VARIABLE_TEMPLATES)
template
BOOST_ASIO_STATIC_CONSTEXPR(bool,
is_applicable_property_v = is_executor::value
|| is_sender::value || is_scheduler::value);
#endif // defined(BOOST_ASIO_HAS_VARIABLE_TEMPLATES)
BOOST_ASIO_STATIC_CONSTEXPR(bool, is_requirable = true);
BOOST_ASIO_STATIC_CONSTEXPR(bool, is_preferable = true);
BOOST_ASIO_CONSTEXPR allocator_t()
{
}
#if defined(BOOST_ASIO_HAS_DEDUCED_STATIC_QUERY_TRAIT) \
&& defined(BOOST_ASIO_HAS_SFINAE_VARIABLE_TEMPLATES)
template
static BOOST_ASIO_CONSTEXPR
typename traits::query_static_constexpr_member::result_type
static_query()
BOOST_ASIO_NOEXCEPT_IF((
traits::query_static_constexpr_member::is_noexcept))
{
return traits::query_static_constexpr_member::value();
}
template ())>
static BOOST_ASIO_CONSTEXPR const T static_query_v
= allocator_t::static_query();
#endif // defined(BOOST_ASIO_HAS_DEDUCED_STATIC_QUERY_TRAIT)
// && defined(BOOST_ASIO_HAS_SFINAE_VARIABLE_TEMPLATES)
template
BOOST_ASIO_CONSTEXPR allocator_t operator()(
const OtherProtoAllocator& a) const
{
return allocator_t(a);
}
};
#if defined(BOOST_ASIO_HAS_DEDUCED_STATIC_QUERY_TRAIT) \
&& defined(BOOST_ASIO_HAS_SFINAE_VARIABLE_TEMPLATES)
template
const T allocator_t::static_query_v;
#endif // defined(BOOST_ASIO_HAS_DEDUCED_STATIC_QUERY_TRAIT)
// && defined(BOOST_ASIO_HAS_SFINAE_VARIABLE_TEMPLATES)
#if defined(BOOST_ASIO_HAS_CONSTEXPR) || defined(GENERATING_DOCUMENTATION)
constexpr allocator_t allocator;
#else // defined(BOOST_ASIO_HAS_CONSTEXPR) || defined(GENERATING_DOCUMENTATION)
template
struct allocator_instance
{
static allocator_t instance;
};
template
allocator_t allocator_instance::instance;
namespace {
static const allocator_t& allocator = allocator_instance::instance;
} // namespace
#endif
} // namespace execution
#if !defined(BOOST_ASIO_HAS_VARIABLE_TEMPLATES)
template
struct is_applicable_property >
: integral_constant::value
|| execution::is_sender::value
|| execution::is_scheduler::value>
{
};
#endif // !defined(BOOST_ASIO_HAS_VARIABLE_TEMPLATES)
namespace traits {
#if !defined(BOOST_ASIO_HAS_DEDUCED_STATIC_QUERY_TRAIT) \
|| !defined(BOOST_ASIO_HAS_SFINAE_VARIABLE_TEMPLATES)
template
struct static_query,
typename enable_if<
traits::query_static_constexpr_member >::is_valid
>::type>
{
BOOST_ASIO_STATIC_CONSTEXPR(bool, is_valid = true);
BOOST_ASIO_STATIC_CONSTEXPR(bool, is_noexcept = true);
typedef typename traits::query_static_constexpr_member >::result_type result_type;
static BOOST_ASIO_CONSTEXPR result_type value()
{
return traits::query_static_constexpr_member >::value();
}
};
#endif // !defined(BOOST_ASIO_HAS_DEDUCED_STATIC_QUERY_TRAIT)
// || !defined(BOOST_ASIO_HAS_SFINAE_VARIABLE_TEMPLATES)
} // namespace traits
#endif // defined(GENERATING_DOCUMENTATION)
} // namespace asio
} // namespace boost
#include
#endif // BOOST_ASIO_EXECUTION_ALLOCATOR_HPP