Add properties implementation.
This commit is contained in:
parent
62102ebb59
commit
7bdae05db9
@ -385,6 +385,7 @@ sub copy_include_files
|
||||
"include/asio/ssl/impl",
|
||||
"include/asio/ssl/old",
|
||||
"include/asio/ssl/old/detail",
|
||||
"include/asio/traits",
|
||||
"include/asio/ts",
|
||||
"include/asio/windows");
|
||||
|
||||
@ -474,6 +475,27 @@ sub copy_latency_tests
|
||||
}
|
||||
}
|
||||
|
||||
sub copy_properties_tests
|
||||
{
|
||||
my @dirs = (
|
||||
"src/tests/properties/cpp03",
|
||||
"src/tests/properties/cpp11",
|
||||
"src/tests/properties/cpp14");
|
||||
|
||||
our $boost_dir;
|
||||
foreach my $dir (@dirs)
|
||||
{
|
||||
my @files = ( glob("$dir/*.*pp"), glob("$dir/Jamfile*") );
|
||||
foreach my $file (@files)
|
||||
{
|
||||
my $from = $file;
|
||||
my $to = $file;
|
||||
$to =~ s/^src\/tests\/properties\//$boost_dir\/libs\/asio\/test\/properties\//;
|
||||
copy_source_file($from, $to);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
sub copy_examples
|
||||
{
|
||||
my @dirs = (
|
||||
@ -598,6 +620,7 @@ copy_include_files();
|
||||
create_lib_directory();
|
||||
copy_unit_tests();
|
||||
copy_latency_tests();
|
||||
copy_properties_tests();
|
||||
copy_examples();
|
||||
copy_doc();
|
||||
copy_tools();
|
||||
|
@ -223,6 +223,7 @@ AC_OUTPUT([
|
||||
include/Makefile
|
||||
src/Makefile
|
||||
src/tests/Makefile
|
||||
src/tests/properties/Makefile
|
||||
src/examples/cpp03/Makefile
|
||||
src/examples/cpp11/Makefile
|
||||
src/examples/cpp14/Makefile
|
||||
|
@ -386,6 +386,7 @@ nobase_include_HEADERS = \
|
||||
asio/ip/udp.hpp \
|
||||
asio/ip/unicast.hpp \
|
||||
asio/ip/v6_only.hpp \
|
||||
asio/is_applicable_property.hpp \
|
||||
asio/is_executor.hpp \
|
||||
asio/is_read_buffered.hpp \
|
||||
asio/is_write_buffered.hpp \
|
||||
@ -403,10 +404,14 @@ nobase_include_HEADERS = \
|
||||
asio/posix/descriptor.hpp \
|
||||
asio/posix/stream_descriptor.hpp \
|
||||
asio/post.hpp \
|
||||
asio/prefer.hpp \
|
||||
asio/query.hpp \
|
||||
asio/read_at.hpp \
|
||||
asio/read.hpp \
|
||||
asio/read_until.hpp \
|
||||
asio/redirect_error.hpp \
|
||||
asio/require.hpp \
|
||||
asio/require_concept.hpp \
|
||||
asio/serial_port_base.hpp \
|
||||
asio/serial_port.hpp \
|
||||
asio/signal_set.hpp \
|
||||
@ -453,6 +458,21 @@ nobase_include_HEADERS = \
|
||||
asio/thread.hpp \
|
||||
asio/thread_pool.hpp \
|
||||
asio/time_traits.hpp \
|
||||
asio/traits/equality_comparable.hpp \
|
||||
asio/traits/execute_free.hpp \
|
||||
asio/traits/execute_member.hpp \
|
||||
asio/traits/prefer_free.hpp \
|
||||
asio/traits/prefer_member.hpp \
|
||||
asio/traits/query_free.hpp \
|
||||
asio/traits/query_member.hpp \
|
||||
asio/traits/query_static_constexpr_member.hpp \
|
||||
asio/traits/require_concept_free.hpp \
|
||||
asio/traits/require_concept_member.hpp \
|
||||
asio/traits/require_free.hpp \
|
||||
asio/traits/require_member.hpp \
|
||||
asio/traits/static_query.hpp \
|
||||
asio/traits/static_require.hpp \
|
||||
asio/traits/static_require_concept.hpp \
|
||||
asio/ts/buffer.hpp \
|
||||
asio/ts/executor.hpp \
|
||||
asio/ts/internet.hpp \
|
||||
|
@ -93,6 +93,7 @@
|
||||
#include "asio/ip/udp.hpp"
|
||||
#include "asio/ip/unicast.hpp"
|
||||
#include "asio/ip/v6_only.hpp"
|
||||
#include "asio/is_applicable_property.hpp"
|
||||
#include "asio/is_executor.hpp"
|
||||
#include "asio/is_read_buffered.hpp"
|
||||
#include "asio/is_write_buffered.hpp"
|
||||
@ -108,10 +109,14 @@
|
||||
#include "asio/posix/descriptor_base.hpp"
|
||||
#include "asio/posix/stream_descriptor.hpp"
|
||||
#include "asio/post.hpp"
|
||||
#include "asio/prefer.hpp"
|
||||
#include "asio/query.hpp"
|
||||
#include "asio/read.hpp"
|
||||
#include "asio/read_at.hpp"
|
||||
#include "asio/read_until.hpp"
|
||||
#include "asio/redirect_error.hpp"
|
||||
#include "asio/require.hpp"
|
||||
#include "asio/require_concept.hpp"
|
||||
#include "asio/serial_port.hpp"
|
||||
#include "asio/serial_port_base.hpp"
|
||||
#include "asio/signal_set.hpp"
|
||||
|
@ -194,6 +194,13 @@
|
||||
# endif // defined(ASIO_MSVC)
|
||||
# endif // !defined(ASIO_DISABLE_VARIADIC_TEMPLATES)
|
||||
#endif // !defined(ASIO_HAS_VARIADIC_TEMPLATES)
|
||||
#if !defined(ASIO_ELLIPSIS)
|
||||
# if defined(ASIO_HAS_VARIADIC_TEMPLATES)
|
||||
# define ASIO_ELLIPSIS ...
|
||||
# else // defined(ASIO_HAS_VARIADIC_TEMPLATES)
|
||||
# define ASIO_ELLIPSIS
|
||||
# endif // defined(ASIO_HAS_VARIADIC_TEMPLATES)
|
||||
#endif // !defined(ASIO_ELLIPSIS)
|
||||
|
||||
// Support deleted functions on compilers known to allow it.
|
||||
#if !defined(ASIO_DELETED)
|
||||
@ -248,39 +255,68 @@
|
||||
# define ASIO_CONSTEXPR
|
||||
# endif // defined(ASIO_HAS_CONSTEXPR)
|
||||
#endif // !defined(ASIO_CONSTEXPR)
|
||||
#if !defined(ASIO_STATIC_CONSTEXPR)
|
||||
# if defined(ASIO_HAS_CONSTEXPR)
|
||||
# define ASIO_STATIC_CONSTEXPR(type, assignment) \
|
||||
static constexpr type assignment
|
||||
# else // defined(ASIO_HAS_CONSTEXPR)
|
||||
# define ASIO_STATIC_CONSTEXPR(type, assignment) \
|
||||
static const type assignment
|
||||
# endif // defined(ASIO_HAS_CONSTEXPR)
|
||||
#endif // !defined(ASIO_STATIC_CONSTEXPR)
|
||||
|
||||
// Support noexcept on compilers known to allow it.
|
||||
#if !defined(ASIO_NOEXCEPT)
|
||||
#if !defined(ASIO_HAS_NOEXCEPT)
|
||||
# if !defined(ASIO_DISABLE_NOEXCEPT)
|
||||
# if defined(ASIO_HAS_BOOST_CONFIG) && (BOOST_VERSION >= 105300)
|
||||
# if !defined(BOOST_NO_NOEXCEPT)
|
||||
# define ASIO_HAS_NOEXCEPT 1
|
||||
# endif // !defined(BOOST_NO_NOEXCEPT)
|
||||
# define ASIO_NOEXCEPT BOOST_NOEXCEPT
|
||||
# define ASIO_NOEXCEPT_OR_NOTHROW BOOST_NOEXCEPT_OR_NOTHROW
|
||||
# define ASIO_NOEXCEPT_IF(c) BOOST_NOEXCEPT_IF(c)
|
||||
# elif defined(__clang__)
|
||||
# if __has_feature(__cxx_noexcept__)
|
||||
# define ASIO_NOEXCEPT noexcept(true)
|
||||
# define ASIO_NOEXCEPT_OR_NOTHROW noexcept(true)
|
||||
# define ASIO_HAS_NOEXCEPT 1
|
||||
# endif // __has_feature(__cxx_noexcept__)
|
||||
# elif defined(__GNUC__)
|
||||
# if ((__GNUC__ == 4) && (__GNUC_MINOR__ >= 7)) || (__GNUC__ > 4)
|
||||
# if (__cplusplus >= 201103) || defined(__GXX_EXPERIMENTAL_CXX0X__)
|
||||
# define ASIO_NOEXCEPT noexcept(true)
|
||||
# define ASIO_NOEXCEPT_OR_NOTHROW noexcept(true)
|
||||
# define ASIO_HAS_NOEXCEPT 1
|
||||
# endif // (__cplusplus >= 201103) || defined(__GXX_EXPERIMENTAL_CXX0X__)
|
||||
# endif // ((__GNUC__ == 4) && (__GNUC_MINOR__ >= 7)) || (__GNUC__ > 4)
|
||||
# elif defined(ASIO_MSVC)
|
||||
# if (_MSC_VER >= 1900)
|
||||
# define ASIO_NOEXCEPT noexcept(true)
|
||||
# define ASIO_NOEXCEPT_OR_NOTHROW noexcept(true)
|
||||
# define ASIO_HAS_NOEXCEPT 1
|
||||
# endif // (_MSC_VER >= 1900)
|
||||
# endif // defined(ASIO_MSVC)
|
||||
# endif // !defined(ASIO_DISABLE_NOEXCEPT)
|
||||
# if !defined(ASIO_NOEXCEPT)
|
||||
# define ASIO_NOEXCEPT
|
||||
# endif // !defined(ASIO_NOEXCEPT)
|
||||
# if !defined(ASIO_NOEXCEPT_OR_NOTHROW)
|
||||
# define ASIO_NOEXCEPT_OR_NOTHROW throw()
|
||||
# endif // !defined(ASIO_NOEXCEPT_OR_NOTHROW)
|
||||
#endif // !defined(ASIO_HAS_NOEXCEPT)
|
||||
#if !defined(ASIO_NOEXCEPT)
|
||||
# if defined(ASIO_HAS_NOEXCEPT)
|
||||
# define ASIO_NOEXCEPT noexcept(true)
|
||||
# else // defined(ASIO_HAS_NOEXCEPT)
|
||||
# define ASIO_NOEXCEPT
|
||||
# endif // defined(ASIO_HAS_NOEXCEPT)
|
||||
#endif // !defined(ASIO_NOEXCEPT)
|
||||
#if !defined(ASIO_NOEXCEPT_OR_NOTHROW)
|
||||
# if defined(ASIO_HAS_NOEXCEPT)
|
||||
# define ASIO_NOEXCEPT_OR_NOTHROW noexcept(true)
|
||||
# else // defined(ASIO_HAS_NOEXCEPT)
|
||||
# define ASIO_NOEXCEPT_OR_NOTHROW throw()
|
||||
# endif // defined(ASIO_HAS_NOEXCEPT)
|
||||
#endif // !defined(ASIO_NOEXCEPT_OR_NOTHROW)
|
||||
#if !defined(ASIO_NOEXCEPT_IF)
|
||||
# if defined(ASIO_HAS_NOEXCEPT)
|
||||
# define ASIO_NOEXCEPT_IF(c) noexcept(c)
|
||||
# else // defined(ASIO_HAS_NOEXCEPT)
|
||||
# define ASIO_NOEXCEPT_IF(c)
|
||||
# endif // defined(ASIO_HAS_NOEXCEPT)
|
||||
#endif // !defined(ASIO_NOEXCEPT_IF)
|
||||
|
||||
// Support automatic type deduction on compilers known to support it.
|
||||
#if !defined(ASIO_HAS_DECLTYPE)
|
||||
@ -368,6 +404,67 @@
|
||||
# endif // !defined(ASIO_DISABLE_CONCEPTS)
|
||||
#endif // !defined(ASIO_HAS_CONCEPTS)
|
||||
|
||||
// Support template variables on compilers known to allow it.
|
||||
#if !defined(ASIO_HAS_VARIABLE_TEMPLATES)
|
||||
# if !defined(ASIO_DISABLE_VARIABLE_TEMPLATES)
|
||||
# if defined(__clang__)
|
||||
# if (__cplusplus >= 201402)
|
||||
# if __has_feature(__cxx_variable_templates__)
|
||||
# define ASIO_HAS_VARIABLE_TEMPLATES 1
|
||||
# endif // __has_feature(__cxx_variable_templates__)
|
||||
# endif // (__cplusplus >= 201703)
|
||||
# endif // defined(__clang__)
|
||||
# if defined(__GNUC__)
|
||||
# if (__GNUC__ >= 5)
|
||||
# if (__cplusplus >= 201402)
|
||||
# define ASIO_HAS_VARIABLE_TEMPLATES 1
|
||||
# endif // (__cplusplus >= 201402)
|
||||
# endif // (__GNUC__ >= 5)
|
||||
# endif // defined(__GNUC__)
|
||||
# if defined(ASIO_MSVC)
|
||||
# if (_MSC_VER >= 1901)
|
||||
# define ASIO_HAS_VARIABLE_TEMPLATES 1
|
||||
# endif // (_MSC_VER >= 1901)
|
||||
# endif // defined(ASIO_MSVC)
|
||||
# endif // !defined(ASIO_DISABLE_VARIABLE_TEMPLATES)
|
||||
#endif // !defined(ASIO_HAS_VARIABLE_TEMPLATES)
|
||||
|
||||
// Support SFINAEd template variables on compilers known to allow it.
|
||||
#if !defined(ASIO_HAS_SFINAE_VARIABLE_TEMPLATES)
|
||||
# if !defined(ASIO_DISABLE_SFINAE_VARIABLE_TEMPLATES)
|
||||
# if defined(__clang__)
|
||||
# if (__cplusplus >= 201703)
|
||||
# if __has_feature(__cxx_variable_templates__)
|
||||
# define ASIO_HAS_SFINAE_VARIABLE_TEMPLATES 1
|
||||
# endif // __has_feature(__cxx_variable_templates__)
|
||||
# endif // (__cplusplus >= 201703)
|
||||
# endif // defined(__clang__)
|
||||
# if defined(__GNUC__)
|
||||
# if (__GNUC__ >= 7)
|
||||
# if (__cplusplus >= 201402)
|
||||
# define ASIO_HAS_SFINAE_VARIABLE_TEMPLATES 1
|
||||
# endif // (__cplusplus >= 201402)
|
||||
# endif // (__GNUC__ >= 7)
|
||||
# endif // defined(__GNUC__)
|
||||
# if defined(ASIO_MSVC)
|
||||
# if (_MSC_VER >= 1901)
|
||||
# define ASIO_HAS_SFINAE_VARIABLE_TEMPLATES 1
|
||||
# endif // (_MSC_VER >= 1901)
|
||||
# endif // defined(ASIO_MSVC)
|
||||
# endif // !defined(ASIO_DISABLE_SFINAE_VARIABLE_TEMPLATES)
|
||||
#endif // !defined(ASIO_HAS_SFINAE_VARIABLE_TEMPLATES)
|
||||
|
||||
// Enable workarounds for lack of working expression SFINAE.
|
||||
#if !defined(ASIO_HAS_WORKING_EXPRESSION_SFINAE)
|
||||
# if !defined(ASIO_DISABLE_WORKING_EXPRESSION_SFINAE)
|
||||
# if !defined(ASIO_MSVC)
|
||||
# if (__cplusplus >= 201103)
|
||||
# define ASIO_HAS_WORKING_EXPRESSION_SFINAE 1
|
||||
# endif // (__cplusplus >= 201103)
|
||||
# endif // defined(ASIO_MSVC)
|
||||
# endif // !defined(ASIO_DISABLE_WORKING_EXPRESSION_SFINAE)
|
||||
#endif // !defined(ASIO_HAS_WORKING_EXPRESSION_SFINAE)
|
||||
|
||||
// Standard library support for system errors.
|
||||
#if !defined(ASIO_HAS_STD_SYSTEM_ERROR)
|
||||
# if !defined(ASIO_DISABLE_STD_SYSTEM_ERROR)
|
||||
|
@ -84,6 +84,8 @@ using boost::result_of;
|
||||
using boost::true_type;
|
||||
#endif // defined(ASIO_HAS_STD_TYPE_TRAITS)
|
||||
|
||||
template <typename> struct void_type { typedef void type; };
|
||||
|
||||
} // namespace asio
|
||||
|
||||
#endif // ASIO_DETAIL_TYPE_TRAITS_HPP
|
||||
|
61
asio/include/asio/is_applicable_property.hpp
Normal file
61
asio/include/asio/is_applicable_property.hpp
Normal file
@ -0,0 +1,61 @@
|
||||
//
|
||||
// is_applicable_property.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 ASIO_IS_APPLICABLE_PROPERTY_HPP
|
||||
#define ASIO_IS_APPLICABLE_PROPERTY_HPP
|
||||
|
||||
#if defined(_MSC_VER) && (_MSC_VER >= 1200)
|
||||
# pragma once
|
||||
#endif // defined(_MSC_VER) && (_MSC_VER >= 1200)
|
||||
|
||||
#include "asio/detail/config.hpp"
|
||||
#include "asio/detail/type_traits.hpp"
|
||||
|
||||
namespace asio {
|
||||
namespace detail {
|
||||
|
||||
template <typename T, typename Property, typename = void>
|
||||
struct is_applicable_property_trait : false_type
|
||||
{
|
||||
};
|
||||
|
||||
#if defined(ASIO_HAS_VARIABLE_TEMPLATES)
|
||||
|
||||
template <typename T, typename Property>
|
||||
struct is_applicable_property_trait<T, Property,
|
||||
typename void_type<
|
||||
typename enable_if<
|
||||
!!Property::template is_applicable_property_v<T>
|
||||
>::type
|
||||
>::type> : true_type
|
||||
{
|
||||
};
|
||||
|
||||
#endif // defined(ASIO_HAS_VARIABLE_TEMPLATES)
|
||||
|
||||
} // namespace detail
|
||||
|
||||
template <typename T, typename Property, typename = void>
|
||||
struct is_applicable_property :
|
||||
detail::is_applicable_property_trait<T, Property>
|
||||
{
|
||||
};
|
||||
|
||||
#if defined(ASIO_HAS_VARIABLE_TEMPLATES)
|
||||
|
||||
template <typename T, typename Property>
|
||||
ASIO_CONSTEXPR const bool is_applicable_property_v
|
||||
= is_applicable_property<T, Property>::value;
|
||||
|
||||
#endif // defined(ASIO_HAS_VARIABLE_TEMPLATES)
|
||||
|
||||
} // namespace asio
|
||||
|
||||
#endif // ASIO_IS_APPLICABLE_PROPERTY_HPP
|
656
asio/include/asio/prefer.hpp
Normal file
656
asio/include/asio/prefer.hpp
Normal file
@ -0,0 +1,656 @@
|
||||
//
|
||||
// prefer.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 ASIO_PREFER_HPP
|
||||
#define ASIO_PREFER_HPP
|
||||
|
||||
#if defined(_MSC_VER) && (_MSC_VER >= 1200)
|
||||
# pragma once
|
||||
#endif // defined(_MSC_VER) && (_MSC_VER >= 1200)
|
||||
|
||||
#include "asio/detail/config.hpp"
|
||||
#include "asio/detail/type_traits.hpp"
|
||||
#include "asio/is_applicable_property.hpp"
|
||||
#include "asio/traits/prefer_free.hpp"
|
||||
#include "asio/traits/prefer_member.hpp"
|
||||
#include "asio/traits/require_free.hpp"
|
||||
#include "asio/traits/require_member.hpp"
|
||||
#include "asio/traits/static_require.hpp"
|
||||
|
||||
#include "asio/detail/push_options.hpp"
|
||||
|
||||
#if defined(GENERATING_DOCUMENTATION)
|
||||
|
||||
namespace asio {
|
||||
|
||||
/// A customisation point that attempts to apply a property to an object.
|
||||
/**
|
||||
* The name <tt>prefer</tt> denotes a customisation point object. The
|
||||
* expression <tt>asio::prefer(E, P0, Pn...)</tt> for some subexpressions
|
||||
* <tt>E</tt> and <tt>P0</tt>, and where <tt>Pn...</tt> represents <tt>N</tt>
|
||||
* subexpressions (where <tt>N</tt> is 0 or more, and with types <tt>T =
|
||||
* decay_t<decltype(E)></tt> and <tt>Prop0 = decay_t<decltype(P0)></tt>) is
|
||||
* expression-equivalent to:
|
||||
*
|
||||
* @li If <tt>is_applicable_property_v<T, Prop0> && Prop0::is_preferable</tt> is
|
||||
* not a well-formed constant expression with value <tt>true</tt>,
|
||||
* <tt>asio::prefer(E, P0, Pn...)</tt> is ill-formed.
|
||||
*
|
||||
* @li Otherwise, <tt>E</tt> if <tt>N == 0</tt> and the expression
|
||||
* <tt>Prop0::template static_query_v<T> == Prop0::value()</tt> is a
|
||||
* well-formed constant expression with value <tt>true</tt>.
|
||||
*
|
||||
* @li Otherwise, <tt>(E).require(P0)</tt> if <tt>N == 0</tt> and the expression
|
||||
* <tt>(E).require(P0)</tt> is a valid expression.
|
||||
*
|
||||
* @li Otherwise, <tt>require(E, P0)</tt> if <tt>N == 0</tt> and the expression
|
||||
* <tt>require(E, P0)</tt> is a valid expression with overload resolution
|
||||
* performed in a context that does not include the declaration of the
|
||||
* <tt>require</tt> customization point object.
|
||||
*
|
||||
* @li Otherwise, <tt>(E).prefer(P0)</tt> if <tt>N == 0</tt> and the expression
|
||||
* <tt>(E).prefer(P0)</tt> is a valid expression.
|
||||
*
|
||||
* @li Otherwise, <tt>prefer(E, P0)</tt> if <tt>N == 0</tt> and the expression
|
||||
* <tt>prefer(E, P0)</tt> is a valid expression with overload resolution
|
||||
* performed in a context that does not include the declaration of the
|
||||
* <tt>prefer</tt> customization point object.
|
||||
*
|
||||
* @li Otherwise, <tt>E</tt> if <tt>N == 0</tt>.
|
||||
*
|
||||
* @li Otherwise,
|
||||
* <tt>asio::prefer(asio::prefer(E, P0), Pn...)</tt>
|
||||
* if <tt>N > 0</tt> and the expression
|
||||
* <tt>asio::prefer(asio::prefer(E, P0), Pn...)</tt>
|
||||
* is a valid expression.
|
||||
*
|
||||
* @li Otherwise, <tt>asio::prefer(E, P0, Pn...)</tt> is ill-formed.
|
||||
*/
|
||||
inline constexpr unspecified prefer = unspecified;
|
||||
|
||||
/// A type trait that determines whether a @c prefer expression is well-formed.
|
||||
/**
|
||||
* Class template @c can_prefer is a trait that is derived from
|
||||
* @c true_type if the expression <tt>asio::prefer(std::declval<T>(),
|
||||
* std::declval<Properties>()...)</tt> is well formed; otherwise @c false_type.
|
||||
*/
|
||||
template <typename T, typename... Properties>
|
||||
struct can_prefer :
|
||||
integral_constant<bool, automatically_determined>
|
||||
{
|
||||
};
|
||||
|
||||
/// A type trait that determines whether a @c prefer expression will not throw.
|
||||
/**
|
||||
* Class template @c is_nothrow_prefer is a trait that is derived from
|
||||
* @c true_type if the expression <tt>asio::prefer(std::declval<T>(),
|
||||
* std::declval<Properties>()...)</tt> is @c noexcept; otherwise @c false_type.
|
||||
*/
|
||||
template <typename T, typename... Properties>
|
||||
struct is_nothrow_prefer :
|
||||
integral_constant<bool, automatically_determined>
|
||||
{
|
||||
};
|
||||
|
||||
/// A type trait that determines the result type of a @c prefer expression.
|
||||
/**
|
||||
* Class template @c prefer_result_type is a trait that determines the result
|
||||
* type of the expression <tt>asio::prefer(std::declval<T>(),
|
||||
* std::declval<Properties>()...)</tt>.
|
||||
*/
|
||||
template <typename T, typename... Properties>
|
||||
struct prefer_result_type
|
||||
{
|
||||
/// The result of the @c prefer expression.
|
||||
typedef automatically_determined type;
|
||||
};
|
||||
|
||||
} // namespace asio
|
||||
|
||||
#else // defined(GENERATING_DOCUMENTATION)
|
||||
|
||||
namespace asio_prefer_fn {
|
||||
|
||||
using asio::decay;
|
||||
using asio::declval;
|
||||
using asio::enable_if;
|
||||
using asio::is_applicable_property;
|
||||
using asio::traits::prefer_free;
|
||||
using asio::traits::prefer_member;
|
||||
using asio::traits::require_free;
|
||||
using asio::traits::require_member;
|
||||
using asio::traits::static_require;
|
||||
|
||||
void prefer();
|
||||
void require();
|
||||
|
||||
enum overload_type
|
||||
{
|
||||
identity,
|
||||
call_require_member,
|
||||
call_require_free,
|
||||
call_prefer_member,
|
||||
call_prefer_free,
|
||||
two_props,
|
||||
n_props,
|
||||
ill_formed
|
||||
};
|
||||
|
||||
template <typename T, typename Properties, typename = void>
|
||||
struct call_traits
|
||||
{
|
||||
ASIO_STATIC_CONSTEXPR(overload_type, overload = ill_formed);
|
||||
ASIO_STATIC_CONSTEXPR(bool, is_noexcept = false);
|
||||
typedef void result_type;
|
||||
};
|
||||
|
||||
template <typename T, typename Property>
|
||||
struct call_traits<T, void(Property),
|
||||
typename enable_if<
|
||||
(
|
||||
is_applicable_property<
|
||||
typename decay<T>::type,
|
||||
typename decay<Property>::type
|
||||
>::value
|
||||
&&
|
||||
decay<Property>::type::is_preferable
|
||||
&&
|
||||
static_require<T, Property>::is_valid
|
||||
)
|
||||
>::type>
|
||||
{
|
||||
ASIO_STATIC_CONSTEXPR(overload_type, overload = identity);
|
||||
ASIO_STATIC_CONSTEXPR(bool, is_noexcept = true);
|
||||
|
||||
#if defined(ASIO_HAS_MOVE)
|
||||
typedef ASIO_MOVE_ARG(T) result_type;
|
||||
#else // defined(ASIO_HAS_MOVE)
|
||||
typedef ASIO_MOVE_ARG(typename decay<T>::type) result_type;
|
||||
#endif // defined(ASIO_HAS_MOVE)
|
||||
};
|
||||
|
||||
template <typename T, typename Property>
|
||||
struct call_traits<T, void(Property),
|
||||
typename enable_if<
|
||||
(
|
||||
is_applicable_property<
|
||||
typename decay<T>::type,
|
||||
typename decay<Property>::type
|
||||
>::value
|
||||
&&
|
||||
decay<Property>::type::is_preferable
|
||||
&&
|
||||
!static_require<T, Property>::is_valid
|
||||
&&
|
||||
require_member<T, Property>::is_valid
|
||||
)
|
||||
>::type> :
|
||||
require_member<T, Property>
|
||||
{
|
||||
ASIO_STATIC_CONSTEXPR(overload_type, overload = call_require_member);
|
||||
};
|
||||
|
||||
template <typename T, typename Property>
|
||||
struct call_traits<T, void(Property),
|
||||
typename enable_if<
|
||||
(
|
||||
is_applicable_property<
|
||||
typename decay<T>::type,
|
||||
typename decay<Property>::type
|
||||
>::value
|
||||
&&
|
||||
decay<Property>::type::is_preferable
|
||||
&&
|
||||
!static_require<T, Property>::is_valid
|
||||
&&
|
||||
!require_member<T, Property>::is_valid
|
||||
&&
|
||||
require_free<T, Property>::is_valid
|
||||
)
|
||||
>::type> :
|
||||
require_free<T, Property>
|
||||
{
|
||||
ASIO_STATIC_CONSTEXPR(overload_type, overload = call_require_free);
|
||||
};
|
||||
|
||||
template <typename T, typename Property>
|
||||
struct call_traits<T, void(Property),
|
||||
typename enable_if<
|
||||
(
|
||||
is_applicable_property<
|
||||
typename decay<T>::type,
|
||||
typename decay<Property>::type
|
||||
>::value
|
||||
&&
|
||||
decay<Property>::type::is_preferable
|
||||
&&
|
||||
!static_require<T, Property>::is_valid
|
||||
&&
|
||||
!require_member<T, Property>::is_valid
|
||||
&&
|
||||
!require_free<T, Property>::is_valid
|
||||
&&
|
||||
prefer_member<T, Property>::is_valid
|
||||
)
|
||||
>::type> :
|
||||
prefer_member<T, Property>
|
||||
{
|
||||
ASIO_STATIC_CONSTEXPR(overload_type, overload = call_prefer_member);
|
||||
};
|
||||
|
||||
template <typename T, typename Property>
|
||||
struct call_traits<T, void(Property),
|
||||
typename enable_if<
|
||||
(
|
||||
is_applicable_property<
|
||||
typename decay<T>::type,
|
||||
typename decay<Property>::type
|
||||
>::value
|
||||
&&
|
||||
decay<Property>::type::is_preferable
|
||||
&&
|
||||
!static_require<T, Property>::is_valid
|
||||
&&
|
||||
!require_member<T, Property>::is_valid
|
||||
&&
|
||||
!require_free<T, Property>::is_valid
|
||||
&&
|
||||
!prefer_member<T, Property>::is_valid
|
||||
&&
|
||||
prefer_free<T, Property>::is_valid
|
||||
)
|
||||
>::type> :
|
||||
prefer_free<T, Property>
|
||||
{
|
||||
ASIO_STATIC_CONSTEXPR(overload_type, overload = call_prefer_free);
|
||||
};
|
||||
|
||||
template <typename T, typename Property>
|
||||
struct call_traits<T, void(Property),
|
||||
typename enable_if<
|
||||
(
|
||||
is_applicable_property<
|
||||
typename decay<T>::type,
|
||||
typename decay<Property>::type
|
||||
>::value
|
||||
&&
|
||||
decay<Property>::type::is_preferable
|
||||
&&
|
||||
!static_require<T, Property>::is_valid
|
||||
&&
|
||||
!require_member<T, Property>::is_valid
|
||||
&&
|
||||
!require_free<T, Property>::is_valid
|
||||
&&
|
||||
!prefer_member<T, Property>::is_valid
|
||||
&&
|
||||
!prefer_free<T, Property>::is_valid
|
||||
)
|
||||
>::type>
|
||||
{
|
||||
ASIO_STATIC_CONSTEXPR(overload_type, overload = identity);
|
||||
ASIO_STATIC_CONSTEXPR(bool, is_noexcept = true);
|
||||
|
||||
#if defined(ASIO_HAS_MOVE)
|
||||
typedef ASIO_MOVE_ARG(T) result_type;
|
||||
#else // defined(ASIO_HAS_MOVE)
|
||||
typedef ASIO_MOVE_ARG(typename decay<T>::type) result_type;
|
||||
#endif // defined(ASIO_HAS_MOVE)
|
||||
};
|
||||
|
||||
template <typename T, typename P0, typename P1>
|
||||
struct call_traits<T, void(P0, P1),
|
||||
typename enable_if<
|
||||
call_traits<T, void(P0)>::overload != ill_formed
|
||||
&&
|
||||
call_traits<
|
||||
typename call_traits<T, void(P0)>::result_type,
|
||||
void(P1)
|
||||
>::overload != ill_formed
|
||||
>::type>
|
||||
{
|
||||
ASIO_STATIC_CONSTEXPR(overload_type, overload = two_props);
|
||||
|
||||
ASIO_STATIC_CONSTEXPR(bool, is_noexcept =
|
||||
(
|
||||
call_traits<T, void(P0)>::is_noexcept
|
||||
&&
|
||||
call_traits<
|
||||
typename call_traits<T, void(P0)>::result_type,
|
||||
void(P1)
|
||||
>::is_noexcept
|
||||
));
|
||||
|
||||
typedef typename decay<
|
||||
typename call_traits<
|
||||
typename call_traits<T, void(P0)>::result_type,
|
||||
void(P1)
|
||||
>::result_type
|
||||
>::type result_type;
|
||||
};
|
||||
|
||||
template <typename T, typename P0, typename P1, typename ASIO_ELLIPSIS PN>
|
||||
struct call_traits<T, void(P0, P1, PN ASIO_ELLIPSIS),
|
||||
typename enable_if<
|
||||
call_traits<T, void(P0)>::overload != ill_formed
|
||||
&&
|
||||
call_traits<
|
||||
typename call_traits<T, void(P0)>::result_type,
|
||||
void(P1, PN ASIO_ELLIPSIS)
|
||||
>::overload != ill_formed
|
||||
>::type>
|
||||
{
|
||||
ASIO_STATIC_CONSTEXPR(overload_type, overload = n_props);
|
||||
|
||||
ASIO_STATIC_CONSTEXPR(bool, is_noexcept =
|
||||
(
|
||||
call_traits<T, void(P0)>::is_noexcept
|
||||
&&
|
||||
call_traits<
|
||||
typename call_traits<T, void(P0)>::result_type,
|
||||
void(P1, PN ASIO_ELLIPSIS)
|
||||
>::is_noexcept
|
||||
));
|
||||
|
||||
typedef typename decay<
|
||||
typename call_traits<
|
||||
typename call_traits<T, void(P0)>::result_type,
|
||||
void(P1, PN ASIO_ELLIPSIS)
|
||||
>::result_type
|
||||
>::type result_type;
|
||||
};
|
||||
|
||||
struct impl
|
||||
{
|
||||
template <typename T, typename Property>
|
||||
ASIO_CONSTEXPR typename enable_if<
|
||||
call_traits<T, void(Property)>::overload == identity,
|
||||
typename call_traits<T, void(Property)>::result_type
|
||||
>::type
|
||||
operator()(
|
||||
ASIO_MOVE_ARG(T) t,
|
||||
ASIO_MOVE_ARG(Property)) const
|
||||
ASIO_NOEXCEPT_IF((
|
||||
call_traits<T, void(Property)>::is_noexcept))
|
||||
{
|
||||
return ASIO_MOVE_CAST(T)(t);
|
||||
}
|
||||
|
||||
template <typename T, typename Property>
|
||||
ASIO_CONSTEXPR typename enable_if<
|
||||
call_traits<T, void(Property)>::overload == call_require_member,
|
||||
typename call_traits<T, void(Property)>::result_type
|
||||
>::type
|
||||
operator()(
|
||||
ASIO_MOVE_ARG(T) t,
|
||||
ASIO_MOVE_ARG(Property) p) const
|
||||
ASIO_NOEXCEPT_IF((
|
||||
call_traits<T, void(Property)>::is_noexcept))
|
||||
{
|
||||
return ASIO_MOVE_CAST(T)(t).require(
|
||||
ASIO_MOVE_CAST(Property)(p));
|
||||
}
|
||||
|
||||
template <typename T, typename Property>
|
||||
ASIO_CONSTEXPR typename enable_if<
|
||||
call_traits<T, void(Property)>::overload == call_require_free,
|
||||
typename call_traits<T, void(Property)>::result_type
|
||||
>::type
|
||||
operator()(
|
||||
ASIO_MOVE_ARG(T) t,
|
||||
ASIO_MOVE_ARG(Property) p) const
|
||||
ASIO_NOEXCEPT_IF((
|
||||
call_traits<T, void(Property)>::is_noexcept))
|
||||
{
|
||||
return require(
|
||||
ASIO_MOVE_CAST(T)(t),
|
||||
ASIO_MOVE_CAST(Property)(p));
|
||||
}
|
||||
|
||||
template <typename T, typename Property>
|
||||
ASIO_CONSTEXPR typename enable_if<
|
||||
call_traits<T, void(Property)>::overload == call_prefer_member,
|
||||
typename call_traits<T, void(Property)>::result_type
|
||||
>::type
|
||||
operator()(
|
||||
ASIO_MOVE_ARG(T) t,
|
||||
ASIO_MOVE_ARG(Property) p) const
|
||||
ASIO_NOEXCEPT_IF((
|
||||
call_traits<T, void(Property)>::is_noexcept))
|
||||
{
|
||||
return ASIO_MOVE_CAST(T)(t).prefer(
|
||||
ASIO_MOVE_CAST(Property)(p));
|
||||
}
|
||||
|
||||
template <typename T, typename Property>
|
||||
ASIO_CONSTEXPR typename enable_if<
|
||||
call_traits<T, void(Property)>::overload == call_prefer_free,
|
||||
typename call_traits<T, void(Property)>::result_type
|
||||
>::type
|
||||
operator()(
|
||||
ASIO_MOVE_ARG(T) t,
|
||||
ASIO_MOVE_ARG(Property) p) const
|
||||
ASIO_NOEXCEPT_IF((
|
||||
call_traits<T, void(Property)>::is_noexcept))
|
||||
{
|
||||
return prefer(
|
||||
ASIO_MOVE_CAST(T)(t),
|
||||
ASIO_MOVE_CAST(Property)(p));
|
||||
}
|
||||
|
||||
template <typename T, typename P0, typename P1>
|
||||
ASIO_CONSTEXPR typename enable_if<
|
||||
call_traits<T, void(P0, P1)>::overload == two_props,
|
||||
typename call_traits<T, void(P0, P1)>::result_type
|
||||
>::type
|
||||
operator()(
|
||||
ASIO_MOVE_ARG(T) t,
|
||||
ASIO_MOVE_ARG(P0) p0,
|
||||
ASIO_MOVE_ARG(P1) p1) const
|
||||
ASIO_NOEXCEPT_IF((
|
||||
call_traits<T, void(P0, P1)>::is_noexcept))
|
||||
{
|
||||
return (*this)(
|
||||
(*this)(
|
||||
ASIO_MOVE_CAST(T)(t),
|
||||
ASIO_MOVE_CAST(P0)(p0)),
|
||||
ASIO_MOVE_CAST(P1)(p1));
|
||||
}
|
||||
|
||||
template <typename T, typename P0, typename P1,
|
||||
typename ASIO_ELLIPSIS PN>
|
||||
ASIO_CONSTEXPR typename enable_if<
|
||||
call_traits<T, void(P0, P1, PN ASIO_ELLIPSIS)>::overload == n_props,
|
||||
typename call_traits<T, void(P0, P1, PN ASIO_ELLIPSIS)>::result_type
|
||||
>::type
|
||||
operator()(
|
||||
ASIO_MOVE_ARG(T) t,
|
||||
ASIO_MOVE_ARG(P0) p0,
|
||||
ASIO_MOVE_ARG(P1) p1,
|
||||
ASIO_MOVE_ARG(PN) ASIO_ELLIPSIS pn) const
|
||||
ASIO_NOEXCEPT_IF((
|
||||
call_traits<T, void(P0, P1, PN ASIO_ELLIPSIS)>::is_noexcept))
|
||||
{
|
||||
return (*this)(
|
||||
(*this)(
|
||||
ASIO_MOVE_CAST(T)(t),
|
||||
ASIO_MOVE_CAST(P0)(p0)),
|
||||
ASIO_MOVE_CAST(P1)(p1),
|
||||
ASIO_MOVE_CAST(PN)(pn) ASIO_ELLIPSIS);
|
||||
}
|
||||
};
|
||||
|
||||
template <typename T = impl>
|
||||
struct static_instance
|
||||
{
|
||||
static const T instance;
|
||||
};
|
||||
|
||||
template <typename T>
|
||||
const T static_instance<T>::instance = {};
|
||||
|
||||
} // namespace asio_prefer_fn
|
||||
namespace asio {
|
||||
namespace {
|
||||
|
||||
static ASIO_CONSTEXPR const asio_prefer_fn::impl&
|
||||
prefer = asio_prefer_fn::static_instance<>::instance;
|
||||
|
||||
} // namespace
|
||||
|
||||
#if defined(ASIO_HAS_VARIADIC_TEMPLATES)
|
||||
|
||||
template <typename T, typename... Properties>
|
||||
struct can_prefer :
|
||||
integral_constant<bool,
|
||||
asio_prefer_fn::call_traits<T, void(Properties...)>::overload
|
||||
!= asio_prefer_fn::ill_formed>
|
||||
{
|
||||
};
|
||||
|
||||
#else // defined(ASIO_HAS_VARIADIC_TEMPLATES)
|
||||
|
||||
template <typename T, typename P0 = void,
|
||||
typename P1 = void, typename P2 = void>
|
||||
struct can_prefer :
|
||||
integral_constant<bool,
|
||||
asio_prefer_fn::call_traits<T, void(P0, P1, P2)>::overload
|
||||
!= asio_prefer_fn::ill_formed>
|
||||
{
|
||||
};
|
||||
|
||||
template <typename T, typename P0, typename P1>
|
||||
struct can_prefer<T, P0, P1> :
|
||||
integral_constant<bool,
|
||||
asio_prefer_fn::call_traits<T, void(P0, P1)>::overload
|
||||
!= asio_prefer_fn::ill_formed>
|
||||
{
|
||||
};
|
||||
|
||||
template <typename T, typename P0>
|
||||
struct can_prefer<T, P0> :
|
||||
integral_constant<bool,
|
||||
asio_prefer_fn::call_traits<T, void(P0)>::overload
|
||||
!= asio_prefer_fn::ill_formed>
|
||||
{
|
||||
};
|
||||
|
||||
template <typename T>
|
||||
struct can_prefer<T> :
|
||||
false_type
|
||||
{
|
||||
};
|
||||
|
||||
#endif // defined(ASIO_HAS_VARIADIC_TEMPLATES)
|
||||
|
||||
#if defined(ASIO_HAS_VARIABLE_TEMPLATES)
|
||||
|
||||
template <typename T, typename ASIO_ELLIPSIS Properties>
|
||||
constexpr bool can_prefer_v
|
||||
= can_prefer<T, Properties ASIO_ELLIPSIS>::value;
|
||||
|
||||
#endif // defined(ASIO_HAS_VARIABLE_TEMPLATES)
|
||||
|
||||
#if defined(ASIO_HAS_VARIADIC_TEMPLATES)
|
||||
|
||||
template <typename T, typename... Properties>
|
||||
struct is_nothrow_prefer :
|
||||
integral_constant<bool,
|
||||
asio_prefer_fn::call_traits<T, void(Properties...)>::is_noexcept>
|
||||
{
|
||||
};
|
||||
|
||||
#else // defined(ASIO_HAS_VARIADIC_TEMPLATES)
|
||||
|
||||
template <typename T, typename P0 = void,
|
||||
typename P1 = void, typename P2 = void>
|
||||
struct is_nothrow_prefer :
|
||||
integral_constant<bool,
|
||||
asio_prefer_fn::call_traits<T, void(P0, P1, P2)>::is_noexcept>
|
||||
{
|
||||
};
|
||||
|
||||
template <typename T, typename P0, typename P1>
|
||||
struct is_nothrow_prefer<T, P0, P1> :
|
||||
integral_constant<bool,
|
||||
asio_prefer_fn::call_traits<T, void(P0, P1)>::is_noexcept>
|
||||
{
|
||||
};
|
||||
|
||||
template <typename T, typename P0>
|
||||
struct is_nothrow_prefer<T, P0> :
|
||||
integral_constant<bool,
|
||||
asio_prefer_fn::call_traits<T, void(P0)>::is_noexcept>
|
||||
{
|
||||
};
|
||||
|
||||
template <typename T>
|
||||
struct is_nothrow_prefer<T> :
|
||||
false_type
|
||||
{
|
||||
};
|
||||
|
||||
#endif // defined(ASIO_HAS_VARIADIC_TEMPLATES)
|
||||
|
||||
#if defined(ASIO_HAS_VARIABLE_TEMPLATES)
|
||||
|
||||
template <typename T, typename ASIO_ELLIPSIS Properties>
|
||||
constexpr bool is_nothrow_prefer_v
|
||||
= is_nothrow_prefer<T, Properties ASIO_ELLIPSIS>::value;
|
||||
|
||||
#endif // defined(ASIO_HAS_VARIABLE_TEMPLATES)
|
||||
|
||||
#if defined(ASIO_HAS_VARIADIC_TEMPLATES)
|
||||
|
||||
template <typename T, typename... Properties>
|
||||
struct prefer_result_type
|
||||
{
|
||||
typedef typename asio_prefer_fn::call_traits<
|
||||
T, void(Properties...)>::result_type type;
|
||||
};
|
||||
|
||||
#else // defined(ASIO_HAS_VARIADIC_TEMPLATES)
|
||||
|
||||
template <typename T, typename P0 = void,
|
||||
typename P1 = void, typename P2 = void>
|
||||
struct prefer_result_type
|
||||
{
|
||||
typedef typename asio_prefer_fn::call_traits<
|
||||
T, void(P0, P1, P2)>::result_type type;
|
||||
};
|
||||
|
||||
template <typename T, typename P0, typename P1>
|
||||
struct prefer_result_type<T, P0, P1>
|
||||
{
|
||||
typedef typename asio_prefer_fn::call_traits<
|
||||
T, void(P0, P1)>::result_type type;
|
||||
};
|
||||
|
||||
template <typename T, typename P0>
|
||||
struct prefer_result_type<T, P0>
|
||||
{
|
||||
typedef typename asio_prefer_fn::call_traits<
|
||||
T, void(P0)>::result_type type;
|
||||
};
|
||||
|
||||
template <typename T>
|
||||
struct prefer_result_type<T>
|
||||
{
|
||||
};
|
||||
|
||||
#endif // defined(ASIO_HAS_VARIADIC_TEMPLATES)
|
||||
|
||||
} // namespace asio
|
||||
|
||||
#endif // defined(GENERATING_DOCUMENTATION)
|
||||
|
||||
#include "asio/detail/pop_options.hpp"
|
||||
|
||||
#endif // ASIO_PREFER_HPP
|
296
asio/include/asio/query.hpp
Normal file
296
asio/include/asio/query.hpp
Normal file
@ -0,0 +1,296 @@
|
||||
//
|
||||
// query.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 ASIO_QUERY_HPP
|
||||
#define ASIO_QUERY_HPP
|
||||
|
||||
#if defined(_MSC_VER) && (_MSC_VER >= 1200)
|
||||
# pragma once
|
||||
#endif // defined(_MSC_VER) && (_MSC_VER >= 1200)
|
||||
|
||||
#include "asio/detail/config.hpp"
|
||||
#include "asio/detail/type_traits.hpp"
|
||||
#include "asio/is_applicable_property.hpp"
|
||||
#include "asio/traits/query_member.hpp"
|
||||
#include "asio/traits/query_free.hpp"
|
||||
#include "asio/traits/static_query.hpp"
|
||||
|
||||
#include "asio/detail/push_options.hpp"
|
||||
|
||||
#if defined(GENERATING_DOCUMENTATION)
|
||||
|
||||
namespace asio {
|
||||
|
||||
/// A customisation point that queries the value of a property.
|
||||
/**
|
||||
* The name <tt>query</tt> denotes a customization point object. The
|
||||
* expression <tt>asio::query(E, P)</tt> for some
|
||||
* subexpressions <tt>E</tt> and <tt>P</tt> (with types <tt>T =
|
||||
* decay_t<decltype(E)></tt> and <tt>Prop = decay_t<decltype(P)></tt>) is
|
||||
* expression-equivalent to:
|
||||
*
|
||||
* @li If <tt>is_applicable_property_v<T, Prop></tt> is not a well-formed
|
||||
* constant expression with value <tt>true</tt>, <tt>asio::query(E,
|
||||
* P)</tt> is ill-formed.
|
||||
*
|
||||
* @li Otherwise, <tt>Prop::template static_query_v<T></tt> if the expression
|
||||
* <tt>Prop::template static_query_v<T></tt> is a well-formed constant
|
||||
* expression.
|
||||
*
|
||||
* @li Otherwise, <tt>(E).query(P)</tt> if the expression
|
||||
* <tt>(E).query(P)</tt> is well-formed.
|
||||
*
|
||||
* @li Otherwise, <tt>query(E, P)</tt> if the expression
|
||||
* <tt>query(E, P)</tt> is a valid expression with overload
|
||||
* resolution performed in a context that does not include the declaration
|
||||
* of the <tt>query</tt> customization point object.
|
||||
*
|
||||
* @li Otherwise, <tt>asio::query(E, P)</tt> is ill-formed.
|
||||
*/
|
||||
inline constexpr unspecified query = unspecified;
|
||||
|
||||
/// A type trait that determines whether a @c query expression is well-formed.
|
||||
/**
|
||||
* Class template @c can_query is a trait that is derived from
|
||||
* @c true_type if the expression <tt>asio::query(std::declval<T>(),
|
||||
* std::declval<Property>())</tt> is well formed; otherwise @c false_type.
|
||||
*/
|
||||
template <typename T, typename Property>
|
||||
struct can_query :
|
||||
integral_constant<bool, automatically_determined>
|
||||
{
|
||||
};
|
||||
|
||||
/// A type trait that determines whether a @c query expression will
|
||||
/// not throw.
|
||||
/**
|
||||
* Class template @c is_nothrow_query is a trait that is derived from
|
||||
* @c true_type if the expression <tt>asio::query(std::declval<T>(),
|
||||
* std::declval<Property>())</tt> is @c noexcept; otherwise @c false_type.
|
||||
*/
|
||||
template <typename T, typename Property>
|
||||
struct is_nothrow_query :
|
||||
integral_constant<bool, automatically_determined>
|
||||
{
|
||||
};
|
||||
|
||||
/// A type trait that determines the result type of a @c query expression.
|
||||
/**
|
||||
* Class template @c query_result_type is a trait that determines the
|
||||
* result type of the expression <tt>asio::query(std::declval<T>(),
|
||||
* std::declval<Property>())</tt>.
|
||||
*/
|
||||
template <typename T, typename Property>
|
||||
struct query_result_type
|
||||
{
|
||||
/// The result of the @c query expression.
|
||||
typedef automatically_determined type;
|
||||
};
|
||||
|
||||
} // namespace asio
|
||||
|
||||
#else // defined(GENERATING_DOCUMENTATION)
|
||||
|
||||
namespace asio_query_fn {
|
||||
|
||||
using asio::decay;
|
||||
using asio::declval;
|
||||
using asio::enable_if;
|
||||
using asio::is_applicable_property;
|
||||
using asio::traits::query_free;
|
||||
using asio::traits::query_member;
|
||||
using asio::traits::static_query;
|
||||
|
||||
void query();
|
||||
|
||||
enum overload_type
|
||||
{
|
||||
static_value,
|
||||
call_member,
|
||||
call_free,
|
||||
ill_formed
|
||||
};
|
||||
|
||||
template <typename T, typename Properties, typename = void>
|
||||
struct call_traits
|
||||
{
|
||||
ASIO_STATIC_CONSTEXPR(overload_type, overload = ill_formed);
|
||||
ASIO_STATIC_CONSTEXPR(bool, is_noexcept = false);
|
||||
typedef void result_type;
|
||||
};
|
||||
|
||||
template <typename T, typename Property>
|
||||
struct call_traits<T, void(Property),
|
||||
typename enable_if<
|
||||
(
|
||||
is_applicable_property<
|
||||
typename decay<T>::type,
|
||||
typename decay<Property>::type
|
||||
>::value
|
||||
&&
|
||||
static_query<T, Property>::is_valid
|
||||
)
|
||||
>::type> :
|
||||
static_query<T, Property>
|
||||
{
|
||||
ASIO_STATIC_CONSTEXPR(overload_type, overload = static_value);
|
||||
};
|
||||
|
||||
template <typename T, typename Property>
|
||||
struct call_traits<T, void(Property),
|
||||
typename enable_if<
|
||||
(
|
||||
is_applicable_property<
|
||||
typename decay<T>::type,
|
||||
typename decay<Property>::type
|
||||
>::value
|
||||
&&
|
||||
!static_query<T, Property>::is_valid
|
||||
&&
|
||||
query_member<T, Property>::is_valid
|
||||
)
|
||||
>::type> :
|
||||
query_member<T, Property>
|
||||
{
|
||||
ASIO_STATIC_CONSTEXPR(overload_type, overload = call_member);
|
||||
};
|
||||
|
||||
template <typename T, typename Property>
|
||||
struct call_traits<T, void(Property),
|
||||
typename enable_if<
|
||||
(
|
||||
is_applicable_property<
|
||||
typename decay<T>::type,
|
||||
typename decay<Property>::type
|
||||
>::value
|
||||
&&
|
||||
!static_query<T, Property>::is_valid
|
||||
&&
|
||||
!query_member<T, Property>::is_valid
|
||||
&&
|
||||
query_free<T, Property>::is_valid
|
||||
)
|
||||
>::type> :
|
||||
query_free<T, Property>
|
||||
{
|
||||
ASIO_STATIC_CONSTEXPR(overload_type, overload = call_free);
|
||||
};
|
||||
|
||||
struct impl
|
||||
{
|
||||
template <typename T, typename Property>
|
||||
ASIO_CONSTEXPR typename enable_if<
|
||||
call_traits<T, void(Property)>::overload == static_value,
|
||||
typename call_traits<T, void(Property)>::result_type
|
||||
>::type
|
||||
operator()(
|
||||
ASIO_MOVE_ARG(T),
|
||||
ASIO_MOVE_ARG(Property)) const
|
||||
ASIO_NOEXCEPT_IF((
|
||||
call_traits<T, void(Property)>::is_noexcept))
|
||||
{
|
||||
return static_query<
|
||||
typename decay<T>::type,
|
||||
typename decay<Property>::type
|
||||
>::value();
|
||||
}
|
||||
|
||||
template <typename T, typename Property>
|
||||
ASIO_CONSTEXPR typename enable_if<
|
||||
call_traits<T, void(Property)>::overload == call_member,
|
||||
typename call_traits<T, void(Property)>::result_type
|
||||
>::type
|
||||
operator()(
|
||||
ASIO_MOVE_ARG(T) t,
|
||||
ASIO_MOVE_ARG(Property) p) const
|
||||
ASIO_NOEXCEPT_IF((
|
||||
call_traits<T, void(Property)>::is_noexcept))
|
||||
{
|
||||
return ASIO_MOVE_CAST(T)(t).query(ASIO_MOVE_CAST(Property)(p));
|
||||
}
|
||||
|
||||
template <typename T, typename Property>
|
||||
ASIO_CONSTEXPR typename enable_if<
|
||||
call_traits<T, void(Property)>::overload == call_free,
|
||||
typename call_traits<T, void(Property)>::result_type
|
||||
>::type
|
||||
operator()(
|
||||
ASIO_MOVE_ARG(T) t,
|
||||
ASIO_MOVE_ARG(Property) p) const
|
||||
ASIO_NOEXCEPT_IF((
|
||||
call_traits<T, void(Property)>::is_noexcept))
|
||||
{
|
||||
return query(ASIO_MOVE_CAST(T)(t), ASIO_MOVE_CAST(Property)(p));
|
||||
}
|
||||
};
|
||||
|
||||
template <typename T = impl>
|
||||
struct static_instance
|
||||
{
|
||||
static const T instance;
|
||||
};
|
||||
|
||||
template <typename T>
|
||||
const T static_instance<T>::instance = {};
|
||||
|
||||
} // namespace asio_query_fn
|
||||
namespace asio {
|
||||
namespace {
|
||||
|
||||
static ASIO_CONSTEXPR const asio_query_fn::impl&
|
||||
query = asio_query_fn::static_instance<>::instance;
|
||||
|
||||
} // namespace
|
||||
|
||||
template <typename T, typename Property>
|
||||
struct can_query :
|
||||
integral_constant<bool,
|
||||
asio_query_fn::call_traits<T, void(Property)>::overload !=
|
||||
asio_query_fn::ill_formed>
|
||||
{
|
||||
};
|
||||
|
||||
#if defined(ASIO_HAS_VARIABLE_TEMPLATES)
|
||||
|
||||
template <typename T, typename Property>
|
||||
constexpr bool can_query_v
|
||||
= can_query<T, Property>::value;
|
||||
|
||||
#endif // defined(ASIO_HAS_VARIABLE_TEMPLATES)
|
||||
|
||||
template <typename T, typename Property>
|
||||
struct is_nothrow_query :
|
||||
integral_constant<bool,
|
||||
asio_query_fn::call_traits<T, void(Property)>::is_noexcept>
|
||||
{
|
||||
};
|
||||
|
||||
#if defined(ASIO_HAS_VARIABLE_TEMPLATES)
|
||||
|
||||
template <typename T, typename Property>
|
||||
constexpr bool is_nothrow_query_v
|
||||
= is_nothrow_query<T, Property>::value;
|
||||
|
||||
#endif // defined(ASIO_HAS_VARIABLE_TEMPLATES)
|
||||
|
||||
template <typename T, typename Property>
|
||||
struct query_result_type
|
||||
{
|
||||
typedef typename asio_query_fn::call_traits<
|
||||
T, void(Property)>::result_type type;
|
||||
};
|
||||
|
||||
} // namespace asio
|
||||
|
||||
#endif // defined(GENERATING_DOCUMENTATION)
|
||||
|
||||
#include "asio/detail/pop_options.hpp"
|
||||
|
||||
#endif // ASIO_QUERY_HPP
|
524
asio/include/asio/require.hpp
Normal file
524
asio/include/asio/require.hpp
Normal file
@ -0,0 +1,524 @@
|
||||
//
|
||||
// require.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 ASIO_REQUIRE_HPP
|
||||
#define ASIO_REQUIRE_HPP
|
||||
|
||||
#if defined(_MSC_VER) && (_MSC_VER >= 1200)
|
||||
# pragma once
|
||||
#endif // defined(_MSC_VER) && (_MSC_VER >= 1200)
|
||||
|
||||
#include "asio/detail/config.hpp"
|
||||
#include "asio/detail/type_traits.hpp"
|
||||
#include "asio/is_applicable_property.hpp"
|
||||
#include "asio/traits/require_member.hpp"
|
||||
#include "asio/traits/require_free.hpp"
|
||||
#include "asio/traits/static_require.hpp"
|
||||
|
||||
#include "asio/detail/push_options.hpp"
|
||||
|
||||
#if defined(GENERATING_DOCUMENTATION)
|
||||
|
||||
namespace asio {
|
||||
|
||||
/// A customisation point that applies a concept-preserving property to an
|
||||
/// object.
|
||||
/**
|
||||
* The name <tt>require</tt> denotes a customisation point object. The
|
||||
* expression <tt>asio::require(E, P0, Pn...)</tt> for some
|
||||
* subexpressions <tt>E</tt> and <tt>P0</tt>, and where <tt>Pn...</tt>
|
||||
* represents <tt>N</tt> subexpressions (where <tt>N</tt> is 0 or more, and with
|
||||
* types <tt>T = decay_t<decltype(E)></tt> and <tt>Prop0 =
|
||||
* decay_t<decltype(P0)></tt>) is expression-equivalent to:
|
||||
*
|
||||
* @li If <tt>is_applicable_property_v<T, Prop0> && Prop0::is_requirable</tt> is
|
||||
* not a well-formed constant expression with value <tt>true</tt>,
|
||||
* <tt>asio::require(E, P0, Pn...)</tt> is ill-formed.
|
||||
*
|
||||
* @li Otherwise, <tt>E</tt> if <tt>N == 0</tt> and the expression
|
||||
* <tt>Prop0::template static_query_v<T> == Prop0::value()</tt> is a
|
||||
* well-formed constant expression with value <tt>true</tt>.
|
||||
*
|
||||
* @li Otherwise, <tt>(E).require(P0)</tt> if <tt>N == 0</tt> and the expression
|
||||
* <tt>(E).require(P0)</tt> is a valid expression.
|
||||
*
|
||||
* @li Otherwise, <tt>require(E, P0)</tt> if <tt>N == 0</tt> and the expression
|
||||
* <tt>require(E, P0)</tt> is a valid expression with overload resolution
|
||||
* performed in a context that does not include the declaration of the
|
||||
* <tt>require</tt> customization point object.
|
||||
*
|
||||
* @li Otherwise,
|
||||
* <tt>asio::require(asio::require(E, P0), Pn...)</tt>
|
||||
* if <tt>N > 0</tt> and the expression
|
||||
* <tt>asio::require(asio::require(E, P0), Pn...)</tt>
|
||||
* is a valid expression.
|
||||
*
|
||||
* @li Otherwise, <tt>asio::require(E, P0, Pn...)</tt> is ill-formed.
|
||||
*/
|
||||
inline constexpr unspecified require = unspecified;
|
||||
|
||||
/// A type trait that determines whether a @c require expression is well-formed.
|
||||
/**
|
||||
* Class template @c can_require is a trait that is derived from
|
||||
* @c true_type if the expression <tt>asio::require(std::declval<T>(),
|
||||
* std::declval<Properties>()...)</tt> is well formed; otherwise @c false_type.
|
||||
*/
|
||||
template <typename T, typename... Properties>
|
||||
struct can_require :
|
||||
integral_constant<bool, automatically_determined>
|
||||
{
|
||||
};
|
||||
|
||||
/// A type trait that determines whether a @c require expression will not throw.
|
||||
/**
|
||||
* Class template @c is_nothrow_require is a trait that is derived from
|
||||
* @c true_type if the expression <tt>asio::require(std::declval<T>(),
|
||||
* std::declval<Properties>()...)</tt> is @c noexcept; otherwise @c false_type.
|
||||
*/
|
||||
template <typename T, typename... Properties>
|
||||
struct is_nothrow_require :
|
||||
integral_constant<bool, automatically_determined>
|
||||
{
|
||||
};
|
||||
|
||||
/// A type trait that determines the result type of a @c require expression.
|
||||
/**
|
||||
* Class template @c require_result_type is a trait that determines the result
|
||||
* type of the expression <tt>asio::require(std::declval<T>(),
|
||||
* std::declval<Properties>()...)</tt>.
|
||||
*/
|
||||
template <typename T, typename... Properties>
|
||||
struct require_result_type
|
||||
{
|
||||
/// The result of the @c require expression.
|
||||
typedef automatically_determined type;
|
||||
};
|
||||
|
||||
} // namespace asio
|
||||
|
||||
#else // defined(GENERATING_DOCUMENTATION)
|
||||
|
||||
namespace asio_require_fn {
|
||||
|
||||
using asio::decay;
|
||||
using asio::declval;
|
||||
using asio::enable_if;
|
||||
using asio::is_applicable_property;
|
||||
using asio::traits::require_free;
|
||||
using asio::traits::require_member;
|
||||
using asio::traits::static_require;
|
||||
|
||||
void require();
|
||||
|
||||
enum overload_type
|
||||
{
|
||||
identity,
|
||||
call_member,
|
||||
call_free,
|
||||
two_props,
|
||||
n_props,
|
||||
ill_formed
|
||||
};
|
||||
|
||||
template <typename T, typename Properties, typename = void>
|
||||
struct call_traits
|
||||
{
|
||||
ASIO_STATIC_CONSTEXPR(overload_type, overload = ill_formed);
|
||||
ASIO_STATIC_CONSTEXPR(bool, is_noexcept = false);
|
||||
typedef void result_type;
|
||||
};
|
||||
|
||||
template <typename T, typename Property>
|
||||
struct call_traits<T, void(Property),
|
||||
typename enable_if<
|
||||
(
|
||||
is_applicable_property<
|
||||
typename decay<T>::type,
|
||||
typename decay<Property>::type
|
||||
>::value
|
||||
&&
|
||||
decay<Property>::type::is_requirable
|
||||
&&
|
||||
static_require<T, Property>::is_valid
|
||||
)
|
||||
>::type>
|
||||
{
|
||||
ASIO_STATIC_CONSTEXPR(overload_type, overload = identity);
|
||||
ASIO_STATIC_CONSTEXPR(bool, is_noexcept = true);
|
||||
|
||||
#if defined(ASIO_HAS_MOVE)
|
||||
typedef ASIO_MOVE_ARG(T) result_type;
|
||||
#else // defined(ASIO_HAS_MOVE)
|
||||
typedef ASIO_MOVE_ARG(typename decay<T>::type) result_type;
|
||||
#endif // defined(ASIO_HAS_MOVE)
|
||||
};
|
||||
|
||||
template <typename T, typename Property>
|
||||
struct call_traits<T, void(Property),
|
||||
typename enable_if<
|
||||
(
|
||||
is_applicable_property<
|
||||
typename decay<T>::type,
|
||||
typename decay<Property>::type
|
||||
>::value
|
||||
&&
|
||||
decay<Property>::type::is_requirable
|
||||
&&
|
||||
!static_require<T, Property>::is_valid
|
||||
&&
|
||||
require_member<T, Property>::is_valid
|
||||
)
|
||||
>::type> :
|
||||
require_member<T, Property>
|
||||
{
|
||||
ASIO_STATIC_CONSTEXPR(overload_type, overload = call_member);
|
||||
};
|
||||
|
||||
template <typename T, typename Property>
|
||||
struct call_traits<T, void(Property),
|
||||
typename enable_if<
|
||||
(
|
||||
is_applicable_property<
|
||||
typename decay<T>::type,
|
||||
typename decay<Property>::type
|
||||
>::value
|
||||
&&
|
||||
decay<Property>::type::is_requirable
|
||||
&&
|
||||
!static_require<T, Property>::is_valid
|
||||
&&
|
||||
!require_member<T, Property>::is_valid
|
||||
&&
|
||||
require_free<T, Property>::is_valid
|
||||
)
|
||||
>::type> :
|
||||
require_free<T, Property>
|
||||
{
|
||||
ASIO_STATIC_CONSTEXPR(overload_type, overload = call_free);
|
||||
};
|
||||
|
||||
template <typename T, typename P0, typename P1>
|
||||
struct call_traits<T, void(P0, P1),
|
||||
typename enable_if<
|
||||
call_traits<T, void(P0)>::overload != ill_formed
|
||||
&&
|
||||
call_traits<
|
||||
typename call_traits<T, void(P0)>::result_type,
|
||||
void(P1)
|
||||
>::overload != ill_formed
|
||||
>::type>
|
||||
{
|
||||
ASIO_STATIC_CONSTEXPR(overload_type, overload = two_props);
|
||||
|
||||
ASIO_STATIC_CONSTEXPR(bool, is_noexcept =
|
||||
(
|
||||
call_traits<T, void(P0)>::is_noexcept
|
||||
&&
|
||||
call_traits<
|
||||
typename call_traits<T, void(P0)>::result_type,
|
||||
void(P1)
|
||||
>::is_noexcept
|
||||
));
|
||||
|
||||
typedef typename decay<
|
||||
typename call_traits<
|
||||
typename call_traits<T, void(P0)>::result_type,
|
||||
void(P1)
|
||||
>::result_type
|
||||
>::type result_type;
|
||||
};
|
||||
|
||||
template <typename T, typename P0, typename P1, typename ASIO_ELLIPSIS PN>
|
||||
struct call_traits<T, void(P0, P1, PN ASIO_ELLIPSIS),
|
||||
typename enable_if<
|
||||
call_traits<T, void(P0)>::overload != ill_formed
|
||||
&&
|
||||
call_traits<
|
||||
typename call_traits<T, void(P0)>::result_type,
|
||||
void(P1, PN ASIO_ELLIPSIS)
|
||||
>::overload != ill_formed
|
||||
>::type>
|
||||
{
|
||||
ASIO_STATIC_CONSTEXPR(overload_type, overload = n_props);
|
||||
|
||||
ASIO_STATIC_CONSTEXPR(bool, is_noexcept =
|
||||
(
|
||||
call_traits<T, void(P0)>::is_noexcept
|
||||
&&
|
||||
call_traits<
|
||||
typename call_traits<T, void(P0)>::result_type,
|
||||
void(P1, PN ASIO_ELLIPSIS)
|
||||
>::is_noexcept
|
||||
));
|
||||
|
||||
typedef typename decay<
|
||||
typename call_traits<
|
||||
typename call_traits<T, void(P0)>::result_type,
|
||||
void(P1, PN ASIO_ELLIPSIS)
|
||||
>::result_type
|
||||
>::type result_type;
|
||||
};
|
||||
|
||||
struct impl
|
||||
{
|
||||
template <typename T, typename Property>
|
||||
ASIO_CONSTEXPR typename enable_if<
|
||||
call_traits<T, void(Property)>::overload == identity,
|
||||
typename call_traits<T, void(Property)>::result_type
|
||||
>::type
|
||||
operator()(
|
||||
ASIO_MOVE_ARG(T) t,
|
||||
ASIO_MOVE_ARG(Property)) const
|
||||
ASIO_NOEXCEPT_IF((
|
||||
call_traits<T, void(Property)>::is_noexcept))
|
||||
{
|
||||
return ASIO_MOVE_CAST(T)(t);
|
||||
}
|
||||
|
||||
template <typename T, typename Property>
|
||||
ASIO_CONSTEXPR typename enable_if<
|
||||
call_traits<T, void(Property)>::overload == call_member,
|
||||
typename call_traits<T, void(Property)>::result_type
|
||||
>::type
|
||||
operator()(
|
||||
ASIO_MOVE_ARG(T) t,
|
||||
ASIO_MOVE_ARG(Property) p) const
|
||||
ASIO_NOEXCEPT_IF((
|
||||
call_traits<T, void(Property)>::is_noexcept))
|
||||
{
|
||||
return ASIO_MOVE_CAST(T)(t).require(
|
||||
ASIO_MOVE_CAST(Property)(p));
|
||||
}
|
||||
|
||||
template <typename T, typename Property>
|
||||
ASIO_CONSTEXPR typename enable_if<
|
||||
call_traits<T, void(Property)>::overload == call_free,
|
||||
typename call_traits<T, void(Property)>::result_type
|
||||
>::type
|
||||
operator()(
|
||||
ASIO_MOVE_ARG(T) t,
|
||||
ASIO_MOVE_ARG(Property) p) const
|
||||
ASIO_NOEXCEPT_IF((
|
||||
call_traits<T, void(Property)>::is_noexcept))
|
||||
{
|
||||
return require(
|
||||
ASIO_MOVE_CAST(T)(t),
|
||||
ASIO_MOVE_CAST(Property)(p));
|
||||
}
|
||||
|
||||
template <typename T, typename P0, typename P1>
|
||||
ASIO_CONSTEXPR typename enable_if<
|
||||
call_traits<T, void(P0, P1)>::overload == two_props,
|
||||
typename call_traits<T, void(P0, P1)>::result_type
|
||||
>::type
|
||||
operator()(
|
||||
ASIO_MOVE_ARG(T) t,
|
||||
ASIO_MOVE_ARG(P0) p0,
|
||||
ASIO_MOVE_ARG(P1) p1) const
|
||||
ASIO_NOEXCEPT_IF((
|
||||
call_traits<T, void(P0, P1)>::is_noexcept))
|
||||
{
|
||||
return (*this)(
|
||||
(*this)(
|
||||
ASIO_MOVE_CAST(T)(t),
|
||||
ASIO_MOVE_CAST(P0)(p0)),
|
||||
ASIO_MOVE_CAST(P1)(p1));
|
||||
}
|
||||
|
||||
template <typename T, typename P0, typename P1,
|
||||
typename ASIO_ELLIPSIS PN>
|
||||
ASIO_CONSTEXPR typename enable_if<
|
||||
call_traits<T, void(P0, P1, PN ASIO_ELLIPSIS)>::overload == n_props,
|
||||
typename call_traits<T, void(P0, P1, PN ASIO_ELLIPSIS)>::result_type
|
||||
>::type
|
||||
operator()(
|
||||
ASIO_MOVE_ARG(T) t,
|
||||
ASIO_MOVE_ARG(P0) p0,
|
||||
ASIO_MOVE_ARG(P1) p1,
|
||||
ASIO_MOVE_ARG(PN) ASIO_ELLIPSIS pn) const
|
||||
ASIO_NOEXCEPT_IF((
|
||||
call_traits<T, void(P0, P1, PN ASIO_ELLIPSIS)>::is_noexcept))
|
||||
{
|
||||
return (*this)(
|
||||
(*this)(
|
||||
ASIO_MOVE_CAST(T)(t),
|
||||
ASIO_MOVE_CAST(P0)(p0)),
|
||||
ASIO_MOVE_CAST(P1)(p1),
|
||||
ASIO_MOVE_CAST(PN)(pn) ASIO_ELLIPSIS);
|
||||
}
|
||||
};
|
||||
|
||||
template <typename T = impl>
|
||||
struct static_instance
|
||||
{
|
||||
static const T instance;
|
||||
};
|
||||
|
||||
template <typename T>
|
||||
const T static_instance<T>::instance = {};
|
||||
|
||||
} // namespace asio_require_fn
|
||||
namespace asio {
|
||||
namespace {
|
||||
|
||||
static ASIO_CONSTEXPR const asio_require_fn::impl&
|
||||
require = asio_require_fn::static_instance<>::instance;
|
||||
|
||||
} // namespace
|
||||
|
||||
#if defined(ASIO_HAS_VARIADIC_TEMPLATES)
|
||||
|
||||
template <typename T, typename... Properties>
|
||||
struct can_require :
|
||||
integral_constant<bool,
|
||||
asio_require_fn::call_traits<T, void(Properties...)>::overload
|
||||
!= asio_require_fn::ill_formed>
|
||||
{
|
||||
};
|
||||
|
||||
#else // defined(ASIO_HAS_VARIADIC_TEMPLATES)
|
||||
|
||||
template <typename T, typename P0 = void,
|
||||
typename P1 = void, typename P2 = void>
|
||||
struct can_require :
|
||||
integral_constant<bool,
|
||||
asio_require_fn::call_traits<T, void(P0, P1, P2)>::overload
|
||||
!= asio_require_fn::ill_formed>
|
||||
{
|
||||
};
|
||||
|
||||
template <typename T, typename P0, typename P1>
|
||||
struct can_require<T, P0, P1> :
|
||||
integral_constant<bool,
|
||||
asio_require_fn::call_traits<T, void(P0, P1)>::overload
|
||||
!= asio_require_fn::ill_formed>
|
||||
{
|
||||
};
|
||||
|
||||
template <typename T, typename P0>
|
||||
struct can_require<T, P0> :
|
||||
integral_constant<bool,
|
||||
asio_require_fn::call_traits<T, void(P0)>::overload
|
||||
!= asio_require_fn::ill_formed>
|
||||
{
|
||||
};
|
||||
|
||||
template <typename T>
|
||||
struct can_require<T> :
|
||||
false_type
|
||||
{
|
||||
};
|
||||
|
||||
#endif // defined(ASIO_HAS_VARIADIC_TEMPLATES)
|
||||
|
||||
#if defined(ASIO_HAS_VARIABLE_TEMPLATES)
|
||||
|
||||
template <typename T, typename ASIO_ELLIPSIS Properties>
|
||||
constexpr bool can_require_v
|
||||
= can_require<T, Properties ASIO_ELLIPSIS>::value;
|
||||
|
||||
#endif // defined(ASIO_HAS_VARIABLE_TEMPLATES)
|
||||
|
||||
#if defined(ASIO_HAS_VARIADIC_TEMPLATES)
|
||||
|
||||
template <typename T, typename... Properties>
|
||||
struct is_nothrow_require :
|
||||
integral_constant<bool,
|
||||
asio_require_fn::call_traits<T, void(Properties...)>::is_noexcept>
|
||||
{
|
||||
};
|
||||
|
||||
#else // defined(ASIO_HAS_VARIADIC_TEMPLATES)
|
||||
|
||||
template <typename T, typename P0 = void,
|
||||
typename P1 = void, typename P2 = void>
|
||||
struct is_nothrow_require :
|
||||
integral_constant<bool,
|
||||
asio_require_fn::call_traits<T, void(P0, P1, P2)>::is_noexcept>
|
||||
{
|
||||
};
|
||||
|
||||
template <typename T, typename P0, typename P1>
|
||||
struct is_nothrow_require<T, P0, P1> :
|
||||
integral_constant<bool,
|
||||
asio_require_fn::call_traits<T, void(P0, P1)>::is_noexcept>
|
||||
{
|
||||
};
|
||||
|
||||
template <typename T, typename P0>
|
||||
struct is_nothrow_require<T, P0> :
|
||||
integral_constant<bool,
|
||||
asio_require_fn::call_traits<T, void(P0)>::is_noexcept>
|
||||
{
|
||||
};
|
||||
|
||||
template <typename T>
|
||||
struct is_nothrow_require<T> :
|
||||
false_type
|
||||
{
|
||||
};
|
||||
|
||||
#endif // defined(ASIO_HAS_VARIADIC_TEMPLATES)
|
||||
|
||||
#if defined(ASIO_HAS_VARIABLE_TEMPLATES)
|
||||
|
||||
template <typename T, typename ASIO_ELLIPSIS Properties>
|
||||
constexpr bool is_nothrow_require_v
|
||||
= is_nothrow_require<T, Properties ASIO_ELLIPSIS>::value;
|
||||
|
||||
#endif // defined(ASIO_HAS_VARIABLE_TEMPLATES)
|
||||
|
||||
#if defined(ASIO_HAS_VARIADIC_TEMPLATES)
|
||||
|
||||
template <typename T, typename... Properties>
|
||||
struct require_result_type
|
||||
{
|
||||
typedef typename asio_require_fn::call_traits<
|
||||
T, void(Properties...)>::result_type type;
|
||||
};
|
||||
|
||||
#else // defined(ASIO_HAS_VARIADIC_TEMPLATES)
|
||||
|
||||
template <typename T, typename P0 = void,
|
||||
typename P1 = void, typename P2 = void>
|
||||
struct require_result_type
|
||||
{
|
||||
typedef typename asio_require_fn::call_traits<
|
||||
T, void(P0, P1, P2)>::result_type type;
|
||||
};
|
||||
|
||||
template <typename T, typename P0, typename P1>
|
||||
struct require_result_type<T, P0, P1>
|
||||
{
|
||||
typedef typename asio_require_fn::call_traits<
|
||||
T, void(P0, P1)>::result_type type;
|
||||
};
|
||||
|
||||
template <typename T, typename P0>
|
||||
struct require_result_type<T, P0>
|
||||
{
|
||||
typedef typename asio_require_fn::call_traits<
|
||||
T, void(P0)>::result_type type;
|
||||
};
|
||||
|
||||
template <typename T>
|
||||
struct require_result_type<T>
|
||||
{
|
||||
};
|
||||
|
||||
#endif // defined(ASIO_HAS_VARIADIC_TEMPLATES)
|
||||
|
||||
} // namespace asio
|
||||
|
||||
#endif // defined(GENERATING_DOCUMENTATION)
|
||||
|
||||
#include "asio/detail/pop_options.hpp"
|
||||
|
||||
#endif // ASIO_REQUIRE_HPP
|
310
asio/include/asio/require_concept.hpp
Normal file
310
asio/include/asio/require_concept.hpp
Normal file
@ -0,0 +1,310 @@
|
||||
//
|
||||
// require_concept.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 ASIO_REQUIRE_CONCEPT_HPP
|
||||
#define ASIO_REQUIRE_CONCEPT_HPP
|
||||
|
||||
#if defined(_MSC_VER) && (_MSC_VER >= 1200)
|
||||
# pragma once
|
||||
#endif // defined(_MSC_VER) && (_MSC_VER >= 1200)
|
||||
|
||||
#include "asio/detail/config.hpp"
|
||||
#include "asio/detail/type_traits.hpp"
|
||||
#include "asio/is_applicable_property.hpp"
|
||||
#include "asio/traits/require_concept_member.hpp"
|
||||
#include "asio/traits/require_concept_free.hpp"
|
||||
#include "asio/traits/static_require_concept.hpp"
|
||||
|
||||
#include "asio/detail/push_options.hpp"
|
||||
|
||||
#if defined(GENERATING_DOCUMENTATION)
|
||||
|
||||
namespace asio {
|
||||
|
||||
/// A customisation point that applies a concept-enforcing property to an
|
||||
/// object.
|
||||
/**
|
||||
* The name <tt>require_concept</tt> denotes a customization point object. The
|
||||
* expression <tt>asio::require_concept(E, P)</tt> for some
|
||||
* subexpressions <tt>E</tt> and <tt>P</tt> (with types <tt>T =
|
||||
* decay_t<decltype(E)></tt> and <tt>Prop = decay_t<decltype(P)></tt>) is
|
||||
* expression-equivalent to:
|
||||
*
|
||||
* @li If <tt>is_applicable_property_v<T, Prop> &&
|
||||
* Prop::is_requirable_concept</tt> is not a well-formed constant expression
|
||||
* with value <tt>true</tt>, <tt>asio::require_concept(E, P)</tt> is
|
||||
* ill-formed.
|
||||
*
|
||||
* @li Otherwise, <tt>E</tt> if the expression <tt>Prop::template
|
||||
* static_query_v<T> == Prop::value()</tt> is a well-formed constant
|
||||
* expression with value <tt>true</tt>.
|
||||
*
|
||||
* @li Otherwise, <tt>(E).require_concept(P)</tt> if the expression
|
||||
* <tt>(E).require_concept(P)</tt> is well-formed.
|
||||
*
|
||||
* @li Otherwise, <tt>require_concept(E, P)</tt> if the expression
|
||||
* <tt>require_concept(E, P)</tt> is a valid expression with overload
|
||||
* resolution performed in a context that does not include the declaration
|
||||
* of the <tt>require_concept</tt> customization point object.
|
||||
*
|
||||
* @li Otherwise, <tt>asio::require_concept(E, P)</tt> is ill-formed.
|
||||
*/
|
||||
inline constexpr unspecified require_concept = unspecified;
|
||||
|
||||
/// A type trait that determines whether a @c require_concept expression is
|
||||
/// well-formed.
|
||||
/**
|
||||
* Class template @c can_require_concept is a trait that is derived from
|
||||
* @c true_type if the expression
|
||||
* <tt>asio::require_concept(std::declval<T>(),
|
||||
* std::declval<Property>())</tt> is well formed; otherwise @c false_type.
|
||||
*/
|
||||
template <typename T, typename Property>
|
||||
struct can_require_concept :
|
||||
integral_constant<bool, automatically_determined>
|
||||
{
|
||||
};
|
||||
|
||||
/// A type trait that determines whether a @c require_concept expression will
|
||||
/// not throw.
|
||||
/**
|
||||
* Class template @c is_nothrow_require_concept is a trait that is derived from
|
||||
* @c true_type if the expression
|
||||
* <tt>asio::require_concept(std::declval<T>(),
|
||||
* std::declval<Property>())</tt> is @c noexcept; otherwise @c false_type.
|
||||
*/
|
||||
template <typename T, typename Property>
|
||||
struct is_nothrow_require_concept :
|
||||
integral_constant<bool, automatically_determined>
|
||||
{
|
||||
};
|
||||
|
||||
/// A type trait that determines the result type of a @c require_concept
|
||||
/// expression.
|
||||
/**
|
||||
* Class template @c require_concept_result_type is a trait that determines the
|
||||
* result type of the expression
|
||||
* <tt>asio::require_concept(std::declval<T>(),
|
||||
* std::declval<Property>())</tt>.
|
||||
*/
|
||||
template <typename T, typename Property>
|
||||
struct require_concept_result_type
|
||||
{
|
||||
/// The result of the @c require_concept expression.
|
||||
typedef automatically_determined type;
|
||||
};
|
||||
|
||||
} // namespace asio
|
||||
|
||||
#else // defined(GENERATING_DOCUMENTATION)
|
||||
|
||||
namespace asio_require_concept_fn {
|
||||
|
||||
using asio::decay;
|
||||
using asio::declval;
|
||||
using asio::enable_if;
|
||||
using asio::is_applicable_property;
|
||||
using asio::traits::require_concept_free;
|
||||
using asio::traits::require_concept_member;
|
||||
using asio::traits::static_require_concept;
|
||||
|
||||
void require_concept();
|
||||
|
||||
enum overload_type
|
||||
{
|
||||
identity,
|
||||
call_member,
|
||||
call_free,
|
||||
ill_formed
|
||||
};
|
||||
|
||||
template <typename T, typename Properties, typename = void>
|
||||
struct call_traits
|
||||
{
|
||||
ASIO_STATIC_CONSTEXPR(overload_type, overload = ill_formed);
|
||||
ASIO_STATIC_CONSTEXPR(bool, is_noexcept = false);
|
||||
typedef void result_type;
|
||||
};
|
||||
|
||||
template <typename T, typename Property>
|
||||
struct call_traits<T, void(Property),
|
||||
typename enable_if<
|
||||
(
|
||||
is_applicable_property<
|
||||
typename decay<T>::type,
|
||||
typename decay<Property>::type
|
||||
>::value
|
||||
&&
|
||||
decay<Property>::type::is_requirable_concept
|
||||
&&
|
||||
static_require_concept<T, Property>::is_valid
|
||||
)
|
||||
>::type>
|
||||
{
|
||||
ASIO_STATIC_CONSTEXPR(overload_type, overload = identity);
|
||||
ASIO_STATIC_CONSTEXPR(bool, is_noexcept = true);
|
||||
typedef ASIO_MOVE_ARG(T) result_type;
|
||||
};
|
||||
|
||||
template <typename T, typename Property>
|
||||
struct call_traits<T, void(Property),
|
||||
typename enable_if<
|
||||
(
|
||||
is_applicable_property<
|
||||
typename decay<T>::type,
|
||||
typename decay<Property>::type
|
||||
>::value
|
||||
&&
|
||||
decay<Property>::type::is_requirable_concept
|
||||
&&
|
||||
!static_require_concept<T, Property>::is_valid
|
||||
&&
|
||||
require_concept_member<T, Property>::is_valid
|
||||
)
|
||||
>::type> :
|
||||
require_concept_member<T, Property>
|
||||
{
|
||||
ASIO_STATIC_CONSTEXPR(overload_type, overload = call_member);
|
||||
};
|
||||
|
||||
template <typename T, typename Property>
|
||||
struct call_traits<T, void(Property),
|
||||
typename enable_if<
|
||||
(
|
||||
is_applicable_property<
|
||||
typename decay<T>::type,
|
||||
typename decay<Property>::type
|
||||
>::value
|
||||
&&
|
||||
decay<Property>::type::is_requirable_concept
|
||||
&&
|
||||
!static_require_concept<T, Property>::is_valid
|
||||
&&
|
||||
!require_concept_member<T, Property>::is_valid
|
||||
&&
|
||||
require_concept_free<T, Property>::is_valid
|
||||
)
|
||||
>::type> :
|
||||
require_concept_free<T, Property>
|
||||
{
|
||||
ASIO_STATIC_CONSTEXPR(overload_type, overload = call_free);
|
||||
};
|
||||
|
||||
struct impl
|
||||
{
|
||||
template <typename T, typename Property>
|
||||
ASIO_CONSTEXPR typename enable_if<
|
||||
call_traits<T, void(Property)>::overload == identity,
|
||||
typename call_traits<T, void(Property)>::result_type
|
||||
>::type
|
||||
operator()(
|
||||
ASIO_MOVE_ARG(T) t,
|
||||
ASIO_MOVE_ARG(Property)) const
|
||||
ASIO_NOEXCEPT_IF((
|
||||
call_traits<T, void(Property)>::is_noexcept))
|
||||
{
|
||||
return ASIO_MOVE_CAST(T)(t);
|
||||
}
|
||||
|
||||
template <typename T, typename Property>
|
||||
ASIO_CONSTEXPR typename enable_if<
|
||||
call_traits<T, void(Property)>::overload == call_member,
|
||||
typename call_traits<T, void(Property)>::result_type
|
||||
>::type
|
||||
operator()(
|
||||
ASIO_MOVE_ARG(T) t,
|
||||
ASIO_MOVE_ARG(Property) p) const
|
||||
ASIO_NOEXCEPT_IF((
|
||||
call_traits<T, void(Property)>::is_noexcept))
|
||||
{
|
||||
return ASIO_MOVE_CAST(T)(t).require_concept(
|
||||
ASIO_MOVE_CAST(Property)(p));
|
||||
}
|
||||
|
||||
template <typename T, typename Property>
|
||||
ASIO_CONSTEXPR typename enable_if<
|
||||
call_traits<T, void(Property)>::overload == call_free,
|
||||
typename call_traits<T, void(Property)>::result_type
|
||||
>::type
|
||||
operator()(
|
||||
ASIO_MOVE_ARG(T) t,
|
||||
ASIO_MOVE_ARG(Property) p) const
|
||||
ASIO_NOEXCEPT_IF((
|
||||
call_traits<T, void(Property)>::is_noexcept))
|
||||
{
|
||||
return require_concept(
|
||||
ASIO_MOVE_CAST(T)(t),
|
||||
ASIO_MOVE_CAST(Property)(p));
|
||||
}
|
||||
};
|
||||
|
||||
template <typename T = impl>
|
||||
struct static_instance
|
||||
{
|
||||
static const T instance;
|
||||
};
|
||||
|
||||
template <typename T>
|
||||
const T static_instance<T>::instance = {};
|
||||
|
||||
} // namespace asio_require_concept_fn
|
||||
namespace asio {
|
||||
namespace {
|
||||
|
||||
static ASIO_CONSTEXPR const asio_require_concept_fn::impl&
|
||||
require_concept = asio_require_concept_fn::static_instance<>::instance;
|
||||
|
||||
} // namespace
|
||||
|
||||
template <typename T, typename Property>
|
||||
struct can_require_concept :
|
||||
integral_constant<bool,
|
||||
asio_require_concept_fn::call_traits<T, void(Property)>::overload !=
|
||||
asio_require_concept_fn::ill_formed>
|
||||
{
|
||||
};
|
||||
|
||||
#if defined(ASIO_HAS_VARIABLE_TEMPLATES)
|
||||
|
||||
template <typename T, typename Property>
|
||||
constexpr bool can_require_concept_v
|
||||
= can_require_concept<T, Property>::value;
|
||||
|
||||
#endif // defined(ASIO_HAS_VARIABLE_TEMPLATES)
|
||||
|
||||
template <typename T, typename Property>
|
||||
struct is_nothrow_require_concept :
|
||||
integral_constant<bool,
|
||||
asio_require_concept_fn::call_traits<T, void(Property)>::is_noexcept>
|
||||
{
|
||||
};
|
||||
|
||||
#if defined(ASIO_HAS_VARIABLE_TEMPLATES)
|
||||
|
||||
template <typename T, typename Property>
|
||||
constexpr bool is_nothrow_require_concept_v
|
||||
= is_nothrow_require_concept<T, Property>::value;
|
||||
|
||||
#endif // defined(ASIO_HAS_VARIABLE_TEMPLATES)
|
||||
|
||||
template <typename T, typename Property>
|
||||
struct require_concept_result_type
|
||||
{
|
||||
typedef typename asio_require_concept_fn::call_traits<
|
||||
T, void(Property)>::result_type type;
|
||||
};
|
||||
|
||||
} // namespace asio
|
||||
|
||||
#endif // defined(GENERATING_DOCUMENTATION)
|
||||
|
||||
#include "asio/detail/pop_options.hpp"
|
||||
|
||||
#endif // ASIO_REQUIRE_CONCEPT_HPP
|
108
asio/include/asio/traits/prefer_free.hpp
Normal file
108
asio/include/asio/traits/prefer_free.hpp
Normal file
@ -0,0 +1,108 @@
|
||||
//
|
||||
// traits/prefer_free.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 ASIO_TRAITS_PREFER_FREE_HPP
|
||||
#define ASIO_TRAITS_PREFER_FREE_HPP
|
||||
|
||||
#if defined(_MSC_VER) && (_MSC_VER >= 1200)
|
||||
# pragma once
|
||||
#endif // defined(_MSC_VER) && (_MSC_VER >= 1200)
|
||||
|
||||
#include "asio/detail/config.hpp"
|
||||
#include "asio/detail/type_traits.hpp"
|
||||
|
||||
#if defined(ASIO_HAS_DECLTYPE) \
|
||||
&& defined(ASIO_HAS_NOEXCEPT) \
|
||||
&& defined(ASIO_HAS_WORKING_EXPRESSION_SFINAE)
|
||||
# define ASIO_HAS_DEDUCED_PREFER_FREE_TRAIT 1
|
||||
#endif // defined(ASIO_HAS_DECLTYPE)
|
||||
// && defined(ASIO_HAS_NOEXCEPT)
|
||||
// && defined(ASIO_HAS_WORKING_EXPRESSION_SFINAE)
|
||||
|
||||
#include "asio/detail/push_options.hpp"
|
||||
|
||||
namespace asio {
|
||||
namespace traits {
|
||||
|
||||
template <typename T, typename Property, typename = void>
|
||||
struct prefer_free_default;
|
||||
|
||||
template <typename T, typename Property, typename = void>
|
||||
struct prefer_free;
|
||||
|
||||
} // namespace traits
|
||||
namespace detail {
|
||||
|
||||
struct no_prefer_free
|
||||
{
|
||||
ASIO_STATIC_CONSTEXPR(bool, is_valid = false);
|
||||
ASIO_STATIC_CONSTEXPR(bool, is_noexcept = false);
|
||||
};
|
||||
|
||||
#if defined(ASIO_HAS_DEDUCED_PREFER_FREE_TRAIT)
|
||||
|
||||
template <typename T, typename Property, typename = void>
|
||||
struct prefer_free_trait : no_prefer_free
|
||||
{
|
||||
};
|
||||
|
||||
template <typename T, typename Property>
|
||||
struct prefer_free_trait<T, Property,
|
||||
typename void_type<
|
||||
decltype(prefer(declval<T>(), declval<Property>()))
|
||||
>::type>
|
||||
{
|
||||
ASIO_STATIC_CONSTEXPR(bool, is_valid = true);
|
||||
|
||||
using result_type = decltype(
|
||||
prefer(declval<T>(), declval<Property>()));
|
||||
|
||||
ASIO_STATIC_CONSTEXPR(bool, is_noexcept = noexcept(
|
||||
prefer(declval<T>(), declval<Property>())));
|
||||
};
|
||||
|
||||
#else // defined(ASIO_HAS_DEDUCED_PREFER_FREE_TRAIT)
|
||||
|
||||
template <typename T, typename Property, typename = void>
|
||||
struct prefer_free_trait :
|
||||
conditional<
|
||||
is_same<T, typename decay<T>::type>::value
|
||||
&& is_same<Property, typename decay<Property>::type>::value,
|
||||
no_prefer_free,
|
||||
traits::prefer_free<
|
||||
typename decay<T>::type,
|
||||
typename decay<Property>::type>
|
||||
>::type
|
||||
{
|
||||
};
|
||||
|
||||
#endif // defined(ASIO_HAS_DEDUCED_PREFER_FREE_TRAIT)
|
||||
|
||||
} // namespace detail
|
||||
namespace traits {
|
||||
|
||||
template <typename T, typename Property, typename>
|
||||
struct prefer_free_default :
|
||||
detail::prefer_free_trait<T, Property>
|
||||
{
|
||||
};
|
||||
|
||||
template <typename T, typename Property, typename>
|
||||
struct prefer_free :
|
||||
prefer_free_default<T, Property>
|
||||
{
|
||||
};
|
||||
|
||||
} // namespace traits
|
||||
} // namespace asio
|
||||
|
||||
#include "asio/detail/pop_options.hpp"
|
||||
|
||||
#endif // ASIO_TRAITS_PREFER_FREE_HPP
|
108
asio/include/asio/traits/prefer_member.hpp
Normal file
108
asio/include/asio/traits/prefer_member.hpp
Normal file
@ -0,0 +1,108 @@
|
||||
//
|
||||
// traits/prefer_member.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 ASIO_TRAITS_PREFER_MEMBER_HPP
|
||||
#define ASIO_TRAITS_PREFER_MEMBER_HPP
|
||||
|
||||
#if defined(_MSC_VER) && (_MSC_VER >= 1200)
|
||||
# pragma once
|
||||
#endif // defined(_MSC_VER) && (_MSC_VER >= 1200)
|
||||
|
||||
#include "asio/detail/config.hpp"
|
||||
#include "asio/detail/type_traits.hpp"
|
||||
|
||||
#if defined(ASIO_HAS_DECLTYPE) \
|
||||
&& defined(ASIO_HAS_NOEXCEPT) \
|
||||
&& defined(ASIO_HAS_WORKING_EXPRESSION_SFINAE)
|
||||
# define ASIO_HAS_DEDUCED_PREFER_MEMBER_TRAIT 1
|
||||
#endif // defined(ASIO_HAS_DECLTYPE)
|
||||
// && defined(ASIO_HAS_NOEXCEPT)
|
||||
// && defined(ASIO_HAS_WORKING_EXPRESSION_SFINAE)
|
||||
|
||||
#include "asio/detail/push_options.hpp"
|
||||
|
||||
namespace asio {
|
||||
namespace traits {
|
||||
|
||||
template <typename T, typename Property, typename = void>
|
||||
struct prefer_member_default;
|
||||
|
||||
template <typename T, typename Property, typename = void>
|
||||
struct prefer_member;
|
||||
|
||||
} // namespace traits
|
||||
namespace detail {
|
||||
|
||||
struct no_prefer_member
|
||||
{
|
||||
ASIO_STATIC_CONSTEXPR(bool, is_valid = false);
|
||||
ASIO_STATIC_CONSTEXPR(bool, is_noexcept = false);
|
||||
};
|
||||
|
||||
#if defined(ASIO_HAS_DEDUCED_PREFER_MEMBER_TRAIT)
|
||||
|
||||
template <typename T, typename Property, typename = void>
|
||||
struct prefer_member_trait : no_prefer_member
|
||||
{
|
||||
};
|
||||
|
||||
template <typename T, typename Property>
|
||||
struct prefer_member_trait<T, Property,
|
||||
typename void_type<
|
||||
decltype(declval<T>().prefer(declval<Property>()))
|
||||
>::type>
|
||||
{
|
||||
ASIO_STATIC_CONSTEXPR(bool, is_valid = true);
|
||||
|
||||
using result_type = decltype(
|
||||
declval<T>().prefer(declval<Property>()));
|
||||
|
||||
ASIO_STATIC_CONSTEXPR(bool, is_noexcept = noexcept(
|
||||
declval<T>().prefer(declval<Property>())));
|
||||
};
|
||||
|
||||
#else // defined(ASIO_HAS_DEDUCED_PREFER_MEMBER_TRAIT)
|
||||
|
||||
template <typename T, typename Property, typename = void>
|
||||
struct prefer_member_trait :
|
||||
conditional<
|
||||
is_same<T, typename decay<T>::type>::value
|
||||
&& is_same<Property, typename decay<Property>::type>::value,
|
||||
no_prefer_member,
|
||||
traits::prefer_member<
|
||||
typename decay<T>::type,
|
||||
typename decay<Property>::type>
|
||||
>::type
|
||||
{
|
||||
};
|
||||
|
||||
#endif // defined(ASIO_HAS_DEDUCED_PREFER_MEMBER_TRAIT)
|
||||
|
||||
} // namespace detail
|
||||
namespace traits {
|
||||
|
||||
template <typename T, typename Property, typename>
|
||||
struct prefer_member_default :
|
||||
detail::prefer_member_trait<T, Property>
|
||||
{
|
||||
};
|
||||
|
||||
template <typename T, typename Property, typename>
|
||||
struct prefer_member :
|
||||
prefer_member_default<T, Property>
|
||||
{
|
||||
};
|
||||
|
||||
} // namespace traits
|
||||
} // namespace asio
|
||||
|
||||
#include "asio/detail/pop_options.hpp"
|
||||
|
||||
#endif // ASIO_TRAITS_PREFER_MEMBER_HPP
|
108
asio/include/asio/traits/query_free.hpp
Normal file
108
asio/include/asio/traits/query_free.hpp
Normal file
@ -0,0 +1,108 @@
|
||||
//
|
||||
// traits/query_free.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 ASIO_TRAITS_QUERY_FREE_HPP
|
||||
#define ASIO_TRAITS_QUERY_FREE_HPP
|
||||
|
||||
#if defined(_MSC_VER) && (_MSC_VER >= 1200)
|
||||
# pragma once
|
||||
#endif // defined(_MSC_VER) && (_MSC_VER >= 1200)
|
||||
|
||||
#include "asio/detail/config.hpp"
|
||||
#include "asio/detail/type_traits.hpp"
|
||||
|
||||
#if defined(ASIO_HAS_DECLTYPE) \
|
||||
&& defined(ASIO_HAS_NOEXCEPT) \
|
||||
&& defined(ASIO_HAS_WORKING_EXPRESSION_SFINAE)
|
||||
# define ASIO_HAS_DEDUCED_QUERY_FREE_TRAIT 1
|
||||
#endif // defined(ASIO_HAS_DECLTYPE)
|
||||
// && defined(ASIO_HAS_NOEXCEPT)
|
||||
// && defined(ASIO_HAS_WORKING_EXPRESSION_SFINAE)
|
||||
|
||||
#include "asio/detail/push_options.hpp"
|
||||
|
||||
namespace asio {
|
||||
namespace traits {
|
||||
|
||||
template <typename T, typename Property, typename = void>
|
||||
struct query_free_default;
|
||||
|
||||
template <typename T, typename Property, typename = void>
|
||||
struct query_free;
|
||||
|
||||
} // namespace traits
|
||||
namespace detail {
|
||||
|
||||
struct no_query_free
|
||||
{
|
||||
ASIO_STATIC_CONSTEXPR(bool, is_valid = false);
|
||||
ASIO_STATIC_CONSTEXPR(bool, is_noexcept = false);
|
||||
};
|
||||
|
||||
#if defined(ASIO_HAS_DEDUCED_QUERY_FREE_TRAIT)
|
||||
|
||||
template <typename T, typename Property, typename = void>
|
||||
struct query_free_trait : no_query_free
|
||||
{
|
||||
};
|
||||
|
||||
template <typename T, typename Property>
|
||||
struct query_free_trait<T, Property,
|
||||
typename void_type<
|
||||
decltype(query(declval<T>(), declval<Property>()))
|
||||
>::type>
|
||||
{
|
||||
ASIO_STATIC_CONSTEXPR(bool, is_valid = true);
|
||||
|
||||
using result_type = decltype(
|
||||
query(declval<T>(), declval<Property>()));
|
||||
|
||||
ASIO_STATIC_CONSTEXPR(bool, is_noexcept = noexcept(
|
||||
query(declval<T>(), declval<Property>())));
|
||||
};
|
||||
|
||||
#else // defined(ASIO_HAS_DEDUCED_QUERY_FREE_TRAIT)
|
||||
|
||||
template <typename T, typename Property, typename = void>
|
||||
struct query_free_trait :
|
||||
conditional<
|
||||
is_same<T, typename decay<T>::type>::value
|
||||
&& is_same<Property, typename decay<Property>::type>::value,
|
||||
no_query_free,
|
||||
traits::query_free<
|
||||
typename decay<T>::type,
|
||||
typename decay<Property>::type>
|
||||
>::type
|
||||
{
|
||||
};
|
||||
|
||||
#endif // defined(ASIO_HAS_DEDUCED_QUERY_FREE_TRAIT)
|
||||
|
||||
} // namespace detail
|
||||
namespace traits {
|
||||
|
||||
template <typename T, typename Property, typename>
|
||||
struct query_free_default :
|
||||
detail::query_free_trait<T, Property>
|
||||
{
|
||||
};
|
||||
|
||||
template <typename T, typename Property, typename>
|
||||
struct query_free :
|
||||
query_free_default<T, Property>
|
||||
{
|
||||
};
|
||||
|
||||
} // namespace traits
|
||||
} // namespace asio
|
||||
|
||||
#include "asio/detail/pop_options.hpp"
|
||||
|
||||
#endif // ASIO_TRAITS_QUERY_FREE_HPP
|
108
asio/include/asio/traits/query_member.hpp
Normal file
108
asio/include/asio/traits/query_member.hpp
Normal file
@ -0,0 +1,108 @@
|
||||
//
|
||||
// traits/query_member.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 ASIO_TRAITS_QUERY_MEMBER_HPP
|
||||
#define ASIO_TRAITS_QUERY_MEMBER_HPP
|
||||
|
||||
#if defined(_MSC_VER) && (_MSC_VER >= 1200)
|
||||
# pragma once
|
||||
#endif // defined(_MSC_VER) && (_MSC_VER >= 1200)
|
||||
|
||||
#include "asio/detail/config.hpp"
|
||||
#include "asio/detail/type_traits.hpp"
|
||||
|
||||
#if defined(ASIO_HAS_DECLTYPE) \
|
||||
&& defined(ASIO_HAS_NOEXCEPT) \
|
||||
&& defined(ASIO_HAS_WORKING_EXPRESSION_SFINAE)
|
||||
# define ASIO_HAS_DEDUCED_QUERY_MEMBER_TRAIT 1
|
||||
#endif // defined(ASIO_HAS_DECLTYPE)
|
||||
// && defined(ASIO_HAS_NOEXCEPT)
|
||||
// && defined(ASIO_HAS_WORKING_EXPRESSION_SFINAE)
|
||||
|
||||
#include "asio/detail/push_options.hpp"
|
||||
|
||||
namespace asio {
|
||||
namespace traits {
|
||||
|
||||
template <typename T, typename Property, typename = void>
|
||||
struct query_member_default;
|
||||
|
||||
template <typename T, typename Property, typename = void>
|
||||
struct query_member;
|
||||
|
||||
} // namespace traits
|
||||
namespace detail {
|
||||
|
||||
struct no_query_member
|
||||
{
|
||||
ASIO_STATIC_CONSTEXPR(bool, is_valid = false);
|
||||
ASIO_STATIC_CONSTEXPR(bool, is_noexcept = false);
|
||||
};
|
||||
|
||||
#if defined(ASIO_HAS_DEDUCED_QUERY_MEMBER_TRAIT)
|
||||
|
||||
template <typename T, typename Property, typename = void>
|
||||
struct query_member_trait : no_query_member
|
||||
{
|
||||
};
|
||||
|
||||
template <typename T, typename Property>
|
||||
struct query_member_trait<T, Property,
|
||||
typename void_type<
|
||||
decltype(declval<T>().query(declval<Property>()))
|
||||
>::type>
|
||||
{
|
||||
ASIO_STATIC_CONSTEXPR(bool, is_valid = true);
|
||||
|
||||
using result_type = decltype(
|
||||
declval<T>().query(declval<Property>()));
|
||||
|
||||
ASIO_STATIC_CONSTEXPR(bool, is_noexcept = noexcept(
|
||||
declval<T>().query(declval<Property>())));
|
||||
};
|
||||
|
||||
#else // defined(ASIO_HAS_DEDUCED_QUERY_MEMBER_TRAIT)
|
||||
|
||||
template <typename T, typename Property, typename = void>
|
||||
struct query_member_trait :
|
||||
conditional<
|
||||
is_same<T, typename decay<T>::type>::value
|
||||
&& is_same<Property, typename decay<Property>::type>::value,
|
||||
no_query_member,
|
||||
traits::query_member<
|
||||
typename decay<T>::type,
|
||||
typename decay<Property>::type>
|
||||
>::type
|
||||
{
|
||||
};
|
||||
|
||||
#endif // defined(ASIO_HAS_DEDUCED_QUERY_MEMBER_TRAIT)
|
||||
|
||||
} // namespace detail
|
||||
namespace traits {
|
||||
|
||||
template <typename T, typename Property, typename>
|
||||
struct query_member_default :
|
||||
detail::query_member_trait<T, Property>
|
||||
{
|
||||
};
|
||||
|
||||
template <typename T, typename Property, typename>
|
||||
struct query_member :
|
||||
query_member_default<T, Property>
|
||||
{
|
||||
};
|
||||
|
||||
} // namespace traits
|
||||
} // namespace asio
|
||||
|
||||
#include "asio/detail/pop_options.hpp"
|
||||
|
||||
#endif // ASIO_TRAITS_QUERY_MEMBER_HPP
|
108
asio/include/asio/traits/require_concept_free.hpp
Normal file
108
asio/include/asio/traits/require_concept_free.hpp
Normal file
@ -0,0 +1,108 @@
|
||||
//
|
||||
// traits/require_concept_free.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 ASIO_TRAITS_REQUIRE_CONCEPT_FREE_HPP
|
||||
#define ASIO_TRAITS_REQUIRE_CONCEPT_FREE_HPP
|
||||
|
||||
#if defined(_MSC_VER) && (_MSC_VER >= 1200)
|
||||
# pragma once
|
||||
#endif // defined(_MSC_VER) && (_MSC_VER >= 1200)
|
||||
|
||||
#include "asio/detail/config.hpp"
|
||||
#include "asio/detail/type_traits.hpp"
|
||||
|
||||
#if defined(ASIO_HAS_DECLTYPE) \
|
||||
&& defined(ASIO_HAS_NOEXCEPT) \
|
||||
&& defined(ASIO_HAS_WORKING_EXPRESSION_SFINAE)
|
||||
# define ASIO_HAS_DEDUCED_REQUIRE_CONCEPT_FREE_TRAIT 1
|
||||
#endif // defined(ASIO_HAS_DECLTYPE)
|
||||
// && defined(ASIO_HAS_NOEXCEPT)
|
||||
// && defined(ASIO_HAS_WORKING_EXPRESSION_SFINAE)
|
||||
|
||||
#include "asio/detail/push_options.hpp"
|
||||
|
||||
namespace asio {
|
||||
namespace traits {
|
||||
|
||||
template <typename T, typename Property, typename = void>
|
||||
struct require_concept_free_default;
|
||||
|
||||
template <typename T, typename Property, typename = void>
|
||||
struct require_concept_free;
|
||||
|
||||
} // namespace traits
|
||||
namespace detail {
|
||||
|
||||
struct no_require_concept_free
|
||||
{
|
||||
ASIO_STATIC_CONSTEXPR(bool, is_valid = false);
|
||||
ASIO_STATIC_CONSTEXPR(bool, is_noexcept = false);
|
||||
};
|
||||
|
||||
#if defined(ASIO_HAS_DEDUCED_REQUIRE_CONCEPT_FREE_TRAIT)
|
||||
|
||||
template <typename T, typename Property, typename = void>
|
||||
struct require_concept_free_trait : no_require_concept_free
|
||||
{
|
||||
};
|
||||
|
||||
template <typename T, typename Property>
|
||||
struct require_concept_free_trait<T, Property,
|
||||
typename void_type<
|
||||
decltype(require_concept(declval<T>(), declval<Property>()))
|
||||
>::type>
|
||||
{
|
||||
ASIO_STATIC_CONSTEXPR(bool, is_valid = true);
|
||||
|
||||
using result_type = decltype(
|
||||
require_concept(declval<T>(), declval<Property>()));
|
||||
|
||||
ASIO_STATIC_CONSTEXPR(bool, is_noexcept = noexcept(
|
||||
require_concept(declval<T>(), declval<Property>())));
|
||||
};
|
||||
|
||||
#else // defined(ASIO_HAS_DEDUCED_REQUIRE_CONCEPT_FREE_TRAIT)
|
||||
|
||||
template <typename T, typename Property, typename = void>
|
||||
struct require_concept_free_trait :
|
||||
conditional<
|
||||
is_same<T, typename decay<T>::type>::value
|
||||
&& is_same<Property, typename decay<Property>::type>::value,
|
||||
no_require_concept_free,
|
||||
traits::require_concept_free<
|
||||
typename decay<T>::type,
|
||||
typename decay<Property>::type>
|
||||
>::type
|
||||
{
|
||||
};
|
||||
|
||||
#endif // defined(ASIO_HAS_DEDUCED_REQUIRE_CONCEPT_FREE_TRAIT)
|
||||
|
||||
} // namespace detail
|
||||
namespace traits {
|
||||
|
||||
template <typename T, typename Property, typename>
|
||||
struct require_concept_free_default :
|
||||
detail::require_concept_free_trait<T, Property>
|
||||
{
|
||||
};
|
||||
|
||||
template <typename T, typename Property, typename>
|
||||
struct require_concept_free :
|
||||
require_concept_free_default<T, Property>
|
||||
{
|
||||
};
|
||||
|
||||
} // namespace traits
|
||||
} // namespace asio
|
||||
|
||||
#include "asio/detail/pop_options.hpp"
|
||||
|
||||
#endif // ASIO_TRAITS_REQUIRE_CONCEPT_FREE_HPP
|
108
asio/include/asio/traits/require_concept_member.hpp
Normal file
108
asio/include/asio/traits/require_concept_member.hpp
Normal file
@ -0,0 +1,108 @@
|
||||
//
|
||||
// traits/require_concept_member.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 ASIO_TRAITS_REQUIRE_CONCEPT_MEMBER_HPP
|
||||
#define ASIO_TRAITS_REQUIRE_CONCEPT_MEMBER_HPP
|
||||
|
||||
#if defined(_MSC_VER) && (_MSC_VER >= 1200)
|
||||
# pragma once
|
||||
#endif // defined(_MSC_VER) && (_MSC_VER >= 1200)
|
||||
|
||||
#include "asio/detail/config.hpp"
|
||||
#include "asio/detail/type_traits.hpp"
|
||||
|
||||
#if defined(ASIO_HAS_DECLTYPE) \
|
||||
&& defined(ASIO_HAS_NOEXCEPT) \
|
||||
&& defined(ASIO_HAS_WORKING_EXPRESSION_SFINAE)
|
||||
# define ASIO_HAS_DEDUCED_REQUIRE_CONCEPT_MEMBER_TRAIT 1
|
||||
#endif // defined(ASIO_HAS_DECLTYPE)
|
||||
// && defined(ASIO_HAS_NOEXCEPT)
|
||||
// && defined(ASIO_HAS_WORKING_EXPRESSION_SFINAE)
|
||||
|
||||
#include "asio/detail/push_options.hpp"
|
||||
|
||||
namespace asio {
|
||||
namespace traits {
|
||||
|
||||
template <typename T, typename Property, typename = void>
|
||||
struct require_concept_member_default;
|
||||
|
||||
template <typename T, typename Property, typename = void>
|
||||
struct require_concept_member;
|
||||
|
||||
} // namespace traits
|
||||
namespace detail {
|
||||
|
||||
struct no_require_concept_member
|
||||
{
|
||||
ASIO_STATIC_CONSTEXPR(bool, is_valid = false);
|
||||
ASIO_STATIC_CONSTEXPR(bool, is_noexcept = false);
|
||||
};
|
||||
|
||||
#if defined(ASIO_HAS_DEDUCED_REQUIRE_CONCEPT_MEMBER_TRAIT)
|
||||
|
||||
template <typename T, typename Property, typename = void>
|
||||
struct require_concept_member_trait : no_require_concept_member
|
||||
{
|
||||
};
|
||||
|
||||
template <typename T, typename Property>
|
||||
struct require_concept_member_trait<T, Property,
|
||||
typename void_type<
|
||||
decltype(declval<T>().require_concept(declval<Property>()))
|
||||
>::type>
|
||||
{
|
||||
ASIO_STATIC_CONSTEXPR(bool, is_valid = true);
|
||||
|
||||
using result_type = decltype(
|
||||
declval<T>().require_concept(declval<Property>()));
|
||||
|
||||
ASIO_STATIC_CONSTEXPR(bool, is_noexcept = noexcept(
|
||||
declval<T>().require_concept(declval<Property>())));
|
||||
};
|
||||
|
||||
#else // defined(ASIO_HAS_DEDUCED_REQUIRE_CONCEPT_MEMBER_TRAIT)
|
||||
|
||||
template <typename T, typename Property, typename = void>
|
||||
struct require_concept_member_trait :
|
||||
conditional<
|
||||
is_same<T, typename decay<T>::type>::value
|
||||
&& is_same<Property, typename decay<Property>::type>::value,
|
||||
no_require_concept_member,
|
||||
traits::require_concept_member<
|
||||
typename decay<T>::type,
|
||||
typename decay<Property>::type>
|
||||
>::type
|
||||
{
|
||||
};
|
||||
|
||||
#endif // defined(ASIO_HAS_DEDUCED_REQUIRE_CONCEPT_MEMBER_TRAIT)
|
||||
|
||||
} // namespace detail
|
||||
namespace traits {
|
||||
|
||||
template <typename T, typename Property, typename>
|
||||
struct require_concept_member_default :
|
||||
detail::require_concept_member_trait<T, Property>
|
||||
{
|
||||
};
|
||||
|
||||
template <typename T, typename Property, typename>
|
||||
struct require_concept_member :
|
||||
require_concept_member_default<T, Property>
|
||||
{
|
||||
};
|
||||
|
||||
} // namespace traits
|
||||
} // namespace asio
|
||||
|
||||
#include "asio/detail/pop_options.hpp"
|
||||
|
||||
#endif // ASIO_TRAITS_REQUIRE_CONCEPT_MEMBER_HPP
|
108
asio/include/asio/traits/require_free.hpp
Normal file
108
asio/include/asio/traits/require_free.hpp
Normal file
@ -0,0 +1,108 @@
|
||||
//
|
||||
// traits/require_free.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 ASIO_TRAITS_REQUIRE_FREE_HPP
|
||||
#define ASIO_TRAITS_REQUIRE_FREE_HPP
|
||||
|
||||
#if defined(_MSC_VER) && (_MSC_VER >= 1200)
|
||||
# pragma once
|
||||
#endif // defined(_MSC_VER) && (_MSC_VER >= 1200)
|
||||
|
||||
#include "asio/detail/config.hpp"
|
||||
#include "asio/detail/type_traits.hpp"
|
||||
|
||||
#if defined(ASIO_HAS_DECLTYPE) \
|
||||
&& defined(ASIO_HAS_NOEXCEPT) \
|
||||
&& defined(ASIO_HAS_WORKING_EXPRESSION_SFINAE)
|
||||
# define ASIO_HAS_DEDUCED_REQUIRE_FREE_TRAIT 1
|
||||
#endif // defined(ASIO_HAS_DECLTYPE)
|
||||
// && defined(ASIO_HAS_NOEXCEPT)
|
||||
// && defined(ASIO_HAS_WORKING_EXPRESSION_SFINAE)
|
||||
|
||||
#include "asio/detail/push_options.hpp"
|
||||
|
||||
namespace asio {
|
||||
namespace traits {
|
||||
|
||||
template <typename T, typename Property, typename = void>
|
||||
struct require_free_default;
|
||||
|
||||
template <typename T, typename Property, typename = void>
|
||||
struct require_free;
|
||||
|
||||
} // namespace traits
|
||||
namespace detail {
|
||||
|
||||
struct no_require_free
|
||||
{
|
||||
ASIO_STATIC_CONSTEXPR(bool, is_valid = false);
|
||||
ASIO_STATIC_CONSTEXPR(bool, is_noexcept = false);
|
||||
};
|
||||
|
||||
#if defined(ASIO_HAS_DEDUCED_REQUIRE_FREE_TRAIT)
|
||||
|
||||
template <typename T, typename Property, typename = void>
|
||||
struct require_free_trait : no_require_free
|
||||
{
|
||||
};
|
||||
|
||||
template <typename T, typename Property>
|
||||
struct require_free_trait<T, Property,
|
||||
typename void_type<
|
||||
decltype(require(declval<T>(), declval<Property>()))
|
||||
>::type>
|
||||
{
|
||||
ASIO_STATIC_CONSTEXPR(bool, is_valid = true);
|
||||
|
||||
using result_type = decltype(
|
||||
require(declval<T>(), declval<Property>()));
|
||||
|
||||
ASIO_STATIC_CONSTEXPR(bool, is_noexcept = noexcept(
|
||||
require(declval<T>(), declval<Property>())));
|
||||
};
|
||||
|
||||
#else // defined(ASIO_HAS_DEDUCED_REQUIRE_FREE_TRAIT)
|
||||
|
||||
template <typename T, typename Property, typename = void>
|
||||
struct require_free_trait :
|
||||
conditional<
|
||||
is_same<T, typename decay<T>::type>::value
|
||||
&& is_same<Property, typename decay<Property>::type>::value,
|
||||
no_require_free,
|
||||
traits::require_free<
|
||||
typename decay<T>::type,
|
||||
typename decay<Property>::type>
|
||||
>::type
|
||||
{
|
||||
};
|
||||
|
||||
#endif // defined(ASIO_HAS_DEDUCED_REQUIRE_FREE_TRAIT)
|
||||
|
||||
} // namespace detail
|
||||
namespace traits {
|
||||
|
||||
template <typename T, typename Property, typename>
|
||||
struct require_free_default :
|
||||
detail::require_free_trait<T, Property>
|
||||
{
|
||||
};
|
||||
|
||||
template <typename T, typename Property, typename>
|
||||
struct require_free :
|
||||
require_free_default<T, Property>
|
||||
{
|
||||
};
|
||||
|
||||
} // namespace traits
|
||||
} // namespace asio
|
||||
|
||||
#include "asio/detail/pop_options.hpp"
|
||||
|
||||
#endif // ASIO_TRAITS_REQUIRE_FREE_HPP
|
108
asio/include/asio/traits/require_member.hpp
Normal file
108
asio/include/asio/traits/require_member.hpp
Normal file
@ -0,0 +1,108 @@
|
||||
//
|
||||
// traits/require_member.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 ASIO_TRAITS_REQUIRE_MEMBER_HPP
|
||||
#define ASIO_TRAITS_REQUIRE_MEMBER_HPP
|
||||
|
||||
#if defined(_MSC_VER) && (_MSC_VER >= 1200)
|
||||
# pragma once
|
||||
#endif // defined(_MSC_VER) && (_MSC_VER >= 1200)
|
||||
|
||||
#include "asio/detail/config.hpp"
|
||||
#include "asio/detail/type_traits.hpp"
|
||||
|
||||
#if defined(ASIO_HAS_DECLTYPE) \
|
||||
&& defined(ASIO_HAS_NOEXCEPT) \
|
||||
&& defined(ASIO_HAS_WORKING_EXPRESSION_SFINAE)
|
||||
# define ASIO_HAS_DEDUCED_REQUIRE_MEMBER_TRAIT 1
|
||||
#endif // defined(ASIO_HAS_DECLTYPE)
|
||||
// && defined(ASIO_HAS_NOEXCEPT)
|
||||
// && defined(ASIO_HAS_WORKING_EXPRESSION_SFINAE)
|
||||
|
||||
#include "asio/detail/push_options.hpp"
|
||||
|
||||
namespace asio {
|
||||
namespace traits {
|
||||
|
||||
template <typename T, typename Property, typename = void>
|
||||
struct require_member_default;
|
||||
|
||||
template <typename T, typename Property, typename = void>
|
||||
struct require_member;
|
||||
|
||||
} // namespace traits
|
||||
namespace detail {
|
||||
|
||||
struct no_require_member
|
||||
{
|
||||
ASIO_STATIC_CONSTEXPR(bool, is_valid = false);
|
||||
ASIO_STATIC_CONSTEXPR(bool, is_noexcept = false);
|
||||
};
|
||||
|
||||
#if defined(ASIO_HAS_DEDUCED_REQUIRE_MEMBER_TRAIT)
|
||||
|
||||
template <typename T, typename Property, typename = void>
|
||||
struct require_member_trait : no_require_member
|
||||
{
|
||||
};
|
||||
|
||||
template <typename T, typename Property>
|
||||
struct require_member_trait<T, Property,
|
||||
typename void_type<
|
||||
decltype(declval<T>().require(declval<Property>()))
|
||||
>::type>
|
||||
{
|
||||
ASIO_STATIC_CONSTEXPR(bool, is_valid = true);
|
||||
|
||||
using result_type = decltype(
|
||||
declval<T>().require(declval<Property>()));
|
||||
|
||||
ASIO_STATIC_CONSTEXPR(bool, is_noexcept = noexcept(
|
||||
declval<T>().require(declval<Property>())));
|
||||
};
|
||||
|
||||
#else // defined(ASIO_HAS_DEDUCED_REQUIRE_MEMBER_TRAIT)
|
||||
|
||||
template <typename T, typename Property, typename = void>
|
||||
struct require_member_trait :
|
||||
conditional<
|
||||
is_same<T, typename decay<T>::type>::value
|
||||
&& is_same<Property, typename decay<Property>::type>::value,
|
||||
no_require_member,
|
||||
traits::require_member<
|
||||
typename decay<T>::type,
|
||||
typename decay<Property>::type>
|
||||
>::type
|
||||
{
|
||||
};
|
||||
|
||||
#endif // defined(ASIO_HAS_DEDUCED_REQUIRE_MEMBER_TRAIT)
|
||||
|
||||
} // namespace detail
|
||||
namespace traits {
|
||||
|
||||
template <typename T, typename Property, typename>
|
||||
struct require_member_default :
|
||||
detail::require_member_trait<T, Property>
|
||||
{
|
||||
};
|
||||
|
||||
template <typename T, typename Property, typename>
|
||||
struct require_member :
|
||||
require_member_default<T, Property>
|
||||
{
|
||||
};
|
||||
|
||||
} // namespace traits
|
||||
} // namespace asio
|
||||
|
||||
#include "asio/detail/pop_options.hpp"
|
||||
|
||||
#endif // ASIO_TRAITS_REQUIRE_MEMBER_HPP
|
108
asio/include/asio/traits/static_query.hpp
Normal file
108
asio/include/asio/traits/static_query.hpp
Normal file
@ -0,0 +1,108 @@
|
||||
//
|
||||
// traits/static_query.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 ASIO_TRAITS_STATIC_QUERY_HPP
|
||||
#define ASIO_TRAITS_STATIC_QUERY_HPP
|
||||
|
||||
#if defined(_MSC_VER) && (_MSC_VER >= 1200)
|
||||
# pragma once
|
||||
#endif // defined(_MSC_VER) && (_MSC_VER >= 1200)
|
||||
|
||||
#include "asio/detail/config.hpp"
|
||||
#include "asio/detail/type_traits.hpp"
|
||||
|
||||
#if defined(ASIO_HAS_DECLTYPE) \
|
||||
&& defined(ASIO_HAS_NOEXCEPT) \
|
||||
&& defined(ASIO_HAS_CONSTEXPR) \
|
||||
&& defined(ASIO_HAS_VARIABLE_TEMPLATES) \
|
||||
&& defined(ASIO_HAS_WORKING_EXPRESSION_SFINAE)
|
||||
# define ASIO_HAS_DEDUCED_STATIC_QUERY_TRAIT 1
|
||||
#endif // defined(ASIO_HAS_DECLTYPE)
|
||||
// && defined(ASIO_HAS_NOEXCEPT)
|
||||
// && defined(ASIO_HAS_CONSTEXPR)
|
||||
// && defined(ASIO_HAS_VARIABLE_TEMPLATES)
|
||||
// && defined(ASIO_HAS_WORKING_EXPRESSION_SFINAE)
|
||||
|
||||
#include "asio/detail/push_options.hpp"
|
||||
|
||||
namespace asio {
|
||||
namespace traits {
|
||||
|
||||
template <typename T, typename Property, typename = void>
|
||||
struct static_query_default;
|
||||
|
||||
template <typename T, typename Property, typename = void>
|
||||
struct static_query;
|
||||
|
||||
} // namespace traits
|
||||
namespace detail {
|
||||
|
||||
struct no_static_query
|
||||
{
|
||||
ASIO_STATIC_CONSTEXPR(bool, is_valid = false);
|
||||
ASIO_STATIC_CONSTEXPR(bool, is_noexcept = false);
|
||||
};
|
||||
|
||||
template <typename T, typename Property, typename = void>
|
||||
struct static_query_trait :
|
||||
conditional<
|
||||
is_same<T, typename decay<T>::type>::value
|
||||
&& is_same<Property, typename decay<Property>::type>::value,
|
||||
no_static_query,
|
||||
traits::static_query<
|
||||
typename decay<T>::type,
|
||||
typename decay<Property>::type>
|
||||
>::type
|
||||
{
|
||||
};
|
||||
|
||||
#if defined(ASIO_HAS_DEDUCED_STATIC_QUERY_TRAIT)
|
||||
|
||||
template <typename T, typename Property>
|
||||
struct static_query_trait<T, Property,
|
||||
typename void_type<
|
||||
decltype(decay<Property>::type::template static_query_v<T>)
|
||||
>::type>
|
||||
{
|
||||
ASIO_STATIC_CONSTEXPR(bool, is_valid = true);
|
||||
|
||||
using result_type = decltype(
|
||||
decay<Property>::type::template static_query_v<T>);
|
||||
|
||||
ASIO_STATIC_CONSTEXPR(bool, is_noexcept =
|
||||
noexcept(decay<Property>::type::template static_query_v<T>));
|
||||
|
||||
static ASIO_CONSTEXPR result_type value() noexcept(is_noexcept)
|
||||
{
|
||||
return decay<Property>::type::template static_query_v<T>;
|
||||
}
|
||||
};
|
||||
|
||||
#endif // defined(ASIO_HAS_DEDUCED_STATIC_QUERY_TRAIT)
|
||||
|
||||
} // namespace detail
|
||||
namespace traits {
|
||||
|
||||
template <typename T, typename Property, typename>
|
||||
struct static_query_default : detail::static_query_trait<T, Property>
|
||||
{
|
||||
};
|
||||
|
||||
template <typename T, typename Property, typename>
|
||||
struct static_query : static_query_default<T, Property>
|
||||
{
|
||||
};
|
||||
|
||||
} // namespace traits
|
||||
} // namespace asio
|
||||
|
||||
#include "asio/detail/pop_options.hpp"
|
||||
|
||||
#endif // ASIO_TRAITS_STATIC_QUERY_HPP
|
123
asio/include/asio/traits/static_require.hpp
Normal file
123
asio/include/asio/traits/static_require.hpp
Normal file
@ -0,0 +1,123 @@
|
||||
//
|
||||
// traits/static_require.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 ASIO_TRAITS_STATIC_REQUIRE_HPP
|
||||
#define ASIO_TRAITS_STATIC_REQUIRE_HPP
|
||||
|
||||
#if defined(_MSC_VER) && (_MSC_VER >= 1200)
|
||||
# pragma once
|
||||
#endif // defined(_MSC_VER) && (_MSC_VER >= 1200)
|
||||
|
||||
#include "asio/detail/config.hpp"
|
||||
#include "asio/detail/type_traits.hpp"
|
||||
#include "asio/traits/static_query.hpp"
|
||||
|
||||
#if defined(ASIO_HAS_DECLTYPE) \
|
||||
&& defined(ASIO_HAS_NOEXCEPT)
|
||||
# define ASIO_HAS_DEDUCED_STATIC_REQUIRE_TRAIT 1
|
||||
#endif // defined(ASIO_HAS_DECLTYPE)
|
||||
// && defined(ASIO_HAS_NOEXCEPT)
|
||||
|
||||
#include "asio/detail/push_options.hpp"
|
||||
|
||||
namespace asio {
|
||||
namespace traits {
|
||||
|
||||
template <typename T, typename Property, typename = void>
|
||||
struct static_require_default;
|
||||
|
||||
template <typename T, typename Property, typename = void>
|
||||
struct static_require;
|
||||
|
||||
} // namespace traits
|
||||
namespace detail {
|
||||
|
||||
struct no_static_require
|
||||
{
|
||||
ASIO_STATIC_CONSTEXPR(bool, is_valid = false);
|
||||
};
|
||||
|
||||
template <typename T, typename Property, typename = void>
|
||||
struct static_require_trait :
|
||||
conditional<
|
||||
is_same<T, typename decay<T>::type>::value
|
||||
&& is_same<Property, typename decay<Property>::type>::value,
|
||||
no_static_require,
|
||||
traits::static_require<
|
||||
typename decay<T>::type,
|
||||
typename decay<Property>::type>
|
||||
>::type
|
||||
{
|
||||
};
|
||||
|
||||
#if defined(ASIO_HAS_DEDUCED_STATIC_REQUIRE_TRAIT)
|
||||
|
||||
#if defined(ASIO_HAS_WORKING_EXPRESSION_SFINAE)
|
||||
|
||||
template <typename T, typename Property>
|
||||
struct static_require_trait<T, Property,
|
||||
typename enable_if<
|
||||
decay<Property>::type::value() == traits::static_query<T, Property>::value()
|
||||
>::type>
|
||||
{
|
||||
ASIO_STATIC_CONSTEXPR(bool, is_valid = true);
|
||||
};
|
||||
|
||||
#else // defined(ASIO_HAS_WORKING_EXPRESSION_SFINAE)
|
||||
|
||||
false_type static_require_test(...);
|
||||
|
||||
template <typename T, typename Property>
|
||||
true_type static_require_test(T*, Property*,
|
||||
typename enable_if<
|
||||
Property::value() == traits::static_query<T, Property>::value()
|
||||
>::type* = 0);
|
||||
|
||||
template <typename T, typename Property>
|
||||
struct has_static_require
|
||||
{
|
||||
ASIO_STATIC_CONSTEXPR(bool, value =
|
||||
decltype((static_require_test)(
|
||||
static_cast<T*>(0), static_cast<Property*>(0)))::value);
|
||||
};
|
||||
|
||||
template <typename T, typename Property>
|
||||
struct static_require_trait<T, Property,
|
||||
typename enable_if<
|
||||
has_static_require<typename decay<T>::type,
|
||||
typename decay<Property>::type>::value
|
||||
>::type>
|
||||
{
|
||||
ASIO_STATIC_CONSTEXPR(bool, is_valid = true);
|
||||
};
|
||||
|
||||
#endif // defined(ASIO_HAS_WORKING_EXPRESSION_SFINAE)
|
||||
|
||||
#endif // defined(ASIO_HAS_DEDUCED_STATIC_REQUIRE_TRAIT)
|
||||
|
||||
} // namespace detail
|
||||
namespace traits {
|
||||
|
||||
template <typename T, typename Property, typename>
|
||||
struct static_require_default : detail::static_require_trait<T, Property>
|
||||
{
|
||||
};
|
||||
|
||||
template <typename T, typename Property, typename>
|
||||
struct static_require : static_require_default<T, Property>
|
||||
{
|
||||
};
|
||||
|
||||
} // namespace traits
|
||||
} // namespace asio
|
||||
|
||||
#include "asio/detail/pop_options.hpp"
|
||||
|
||||
#endif // ASIO_TRAITS_STATIC_REQUIRE_HPP
|
123
asio/include/asio/traits/static_require_concept.hpp
Normal file
123
asio/include/asio/traits/static_require_concept.hpp
Normal file
@ -0,0 +1,123 @@
|
||||
//
|
||||
// traits/static_require_concept.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 ASIO_TRAITS_STATIC_REQUIRE_CONCEPT_HPP
|
||||
#define ASIO_TRAITS_STATIC_REQUIRE_CONCEPT_HPP
|
||||
|
||||
#if defined(_MSC_VER) && (_MSC_VER >= 1200)
|
||||
# pragma once
|
||||
#endif // defined(_MSC_VER) && (_MSC_VER >= 1200)
|
||||
|
||||
#include "asio/detail/config.hpp"
|
||||
#include "asio/detail/type_traits.hpp"
|
||||
#include "asio/traits/static_query.hpp"
|
||||
|
||||
#if defined(ASIO_HAS_DECLTYPE) \
|
||||
&& defined(ASIO_HAS_NOEXCEPT)
|
||||
# define ASIO_HAS_DEDUCED_STATIC_REQUIRE_CONCEPT_TRAIT 1
|
||||
#endif // defined(ASIO_HAS_DECLTYPE)
|
||||
// && defined(ASIO_HAS_NOEXCEPT)
|
||||
|
||||
#include "asio/detail/push_options.hpp"
|
||||
|
||||
namespace asio {
|
||||
namespace traits {
|
||||
|
||||
template <typename T, typename Property, typename = void>
|
||||
struct static_require_concept_default;
|
||||
|
||||
template <typename T, typename Property, typename = void>
|
||||
struct static_require_concept;
|
||||
|
||||
} // namespace traits
|
||||
namespace detail {
|
||||
|
||||
struct no_static_require_concept
|
||||
{
|
||||
ASIO_STATIC_CONSTEXPR(bool, is_valid = false);
|
||||
};
|
||||
|
||||
template <typename T, typename Property, typename = void>
|
||||
struct static_require_concept_trait :
|
||||
conditional<
|
||||
is_same<T, typename decay<T>::type>::value
|
||||
&& is_same<Property, typename decay<Property>::type>::value,
|
||||
no_static_require_concept,
|
||||
traits::static_require_concept<
|
||||
typename decay<T>::type,
|
||||
typename decay<Property>::type>
|
||||
>::type
|
||||
{
|
||||
};
|
||||
|
||||
#if defined(ASIO_HAS_DEDUCED_STATIC_REQUIRE_CONCEPT_TRAIT)
|
||||
|
||||
#if defined(ASIO_HAS_WORKING_EXPRESSION_SFINAE)
|
||||
|
||||
template <typename T, typename Property>
|
||||
struct static_require_concept_trait<T, Property,
|
||||
typename enable_if<
|
||||
decay<Property>::type::value() == traits::static_query<T, Property>::value()
|
||||
>::type>
|
||||
{
|
||||
ASIO_STATIC_CONSTEXPR(bool, is_valid = true);
|
||||
};
|
||||
|
||||
#else // defined(ASIO_HAS_WORKING_EXPRESSION_SFINAE)
|
||||
|
||||
false_type static_require_concept_test(...);
|
||||
|
||||
template <typename T, typename Property>
|
||||
true_type static_require_concept_test(T*, Property*,
|
||||
typename enable_if<
|
||||
Property::value() == traits::static_query<T, Property>::value()
|
||||
>::type* = 0);
|
||||
|
||||
template <typename T, typename Property>
|
||||
struct has_static_require_concept
|
||||
{
|
||||
ASIO_STATIC_CONSTEXPR(bool, value =
|
||||
decltype((static_require_concept_test)(
|
||||
static_cast<T*>(0), static_cast<Property*>(0)))::value);
|
||||
};
|
||||
|
||||
template <typename T, typename Property>
|
||||
struct static_require_concept_trait<T, Property,
|
||||
typename enable_if<
|
||||
has_static_require_concept<T, typename decay<Property>::type>::value
|
||||
>::type>
|
||||
{
|
||||
ASIO_STATIC_CONSTEXPR(bool, is_valid = true);
|
||||
};
|
||||
|
||||
#endif // defined(ASIO_HAS_WORKING_EXPRESSION_SFINAE)
|
||||
|
||||
#endif // defined(ASIO_HAS_DEDUCED_STATIC_REQUIRE_CONCEPT_TRAIT)
|
||||
|
||||
} // namespace detail
|
||||
namespace traits {
|
||||
|
||||
template <typename T, typename Property, typename>
|
||||
struct static_require_concept_default :
|
||||
detail::static_require_concept_trait<T, Property>
|
||||
{
|
||||
};
|
||||
|
||||
template <typename T, typename Property, typename>
|
||||
struct static_require_concept : static_require_concept_default<T, Property>
|
||||
{
|
||||
};
|
||||
|
||||
} // namespace traits
|
||||
} // namespace asio
|
||||
|
||||
#include "asio/detail/pop_options.hpp"
|
||||
|
||||
#endif // ASIO_TRAITS_STATIC_REQUIRE_CONCEPT_HPP
|
@ -9,6 +9,56 @@
|
||||
-->
|
||||
|
||||
<informaltable frame="all">
|
||||
<tgroup cols="4">
|
||||
<colspec colname="a"/>
|
||||
<colspec colname="b"/>
|
||||
<colspec colname="c"/>
|
||||
<colspec colname="d"/>
|
||||
<thead>
|
||||
<row>
|
||||
<entry valign="center" namest="a" nameend="a">
|
||||
<bridgehead renderas="sect2">Properties</bridgehead>
|
||||
</entry>
|
||||
<entry valign="center" namest="b" nameend="d">
|
||||
<bridgehead renderas="sect2"></bridgehead>
|
||||
</entry>
|
||||
</row>
|
||||
</thead>
|
||||
<tbody>
|
||||
<row>
|
||||
<entry valign="top">
|
||||
<bridgehead renderas="sect3">Customisation Points</bridgehead>
|
||||
<simplelist type="vert" columns="1">
|
||||
<member><link linkend="asio.reference.prefer">prefer</link></member>
|
||||
<member><link linkend="asio.reference.query">query</link></member>
|
||||
<member><link linkend="asio.reference.require">require</link></member>
|
||||
<member><link linkend="asio.reference.require_concept">require_concept</link></member>
|
||||
</simplelist>
|
||||
<bridgehead renderas="sect3">Traits</bridgehead>
|
||||
<simplelist type="vert" columns="1">
|
||||
<member><link linkend="asio.reference.can_prefer">can_prefer</link></member>
|
||||
<member><link linkend="asio.reference.can_query">can_query</link></member>
|
||||
<member><link linkend="asio.reference.can_require">can_require</link></member>
|
||||
<member><link linkend="asio.reference.can_require_concept">can_require_concept</link></member>
|
||||
<member><link linkend="asio.reference.is_nothrow_prefer">is_nothrow_prefer</link></member>
|
||||
<member><link linkend="asio.reference.is_nothrow_query">is_nothrow_query</link></member>
|
||||
<member><link linkend="asio.reference.is_nothrow_require">is_nothrow_require</link></member>
|
||||
<member><link linkend="asio.reference.is_nothrow_require_concept">is_nothrow_require_concept</link></member>
|
||||
<member><link linkend="asio.reference.prefer_result_type">prefer_result_type</link></member>
|
||||
<member><link linkend="asio.reference.query_result_type">query_result_type</link></member>
|
||||
<member><link linkend="asio.reference.require_result_type">require_result_type</link></member>
|
||||
<member><link linkend="asio.reference.require_concept_result_type">require_concept_result_type</link></member>
|
||||
</simplelist>
|
||||
</entry>
|
||||
<entry valign="top">
|
||||
</entry>
|
||||
<entry valign="top">
|
||||
</entry>
|
||||
<entry valign="top">
|
||||
</entry>
|
||||
</row>
|
||||
</tbody>
|
||||
</tgroup>
|
||||
<tgroup cols="4">
|
||||
<colspec colname="a"/>
|
||||
<colspec colname="b"/>
|
||||
|
@ -9,6 +9,8 @@ endif
|
||||
LDADD = libasio.a
|
||||
endif
|
||||
|
||||
SUBDIRS = properties
|
||||
|
||||
check_PROGRAMS = \
|
||||
unit/associated_allocator \
|
||||
unit/associated_executor \
|
||||
|
8
asio/src/tests/properties/.gitignore
vendored
Normal file
8
asio/src/tests/properties/.gitignore
vendored
Normal file
@ -0,0 +1,8 @@
|
||||
*_free
|
||||
*_free_prefer
|
||||
*_free_require
|
||||
*_member
|
||||
*_member_prefer
|
||||
*_member_require
|
||||
*_static
|
||||
*_unsupported
|
367
asio/src/tests/properties/Makefile.am
Normal file
367
asio/src/tests/properties/Makefile.am
Normal file
@ -0,0 +1,367 @@
|
||||
AUTOMAKE_OPTIONS = subdir-objects
|
||||
|
||||
check_PROGRAMS = \
|
||||
cpp03/query_free \
|
||||
cpp03/query_member \
|
||||
cpp03/query_static \
|
||||
cpp03/can_query_free \
|
||||
cpp03/can_query_member \
|
||||
cpp03/can_query_static \
|
||||
cpp03/can_query_unsupported \
|
||||
cpp03/can_query_not_applicable_free \
|
||||
cpp03/can_query_not_applicable_member \
|
||||
cpp03/can_query_not_applicable_static \
|
||||
cpp03/can_query_not_applicable_unsupported \
|
||||
cpp03/require_concept_free \
|
||||
cpp03/require_concept_member \
|
||||
cpp03/require_concept_static \
|
||||
cpp03/can_require_concept_free \
|
||||
cpp03/can_require_concept_member \
|
||||
cpp03/can_require_concept_static \
|
||||
cpp03/can_require_concept_unsupported \
|
||||
cpp03/can_require_concept_not_applicable_free \
|
||||
cpp03/can_require_concept_not_applicable_member \
|
||||
cpp03/can_require_concept_not_applicable_static \
|
||||
cpp03/can_require_concept_not_applicable_unsupported \
|
||||
cpp03/require_free \
|
||||
cpp03/require_member \
|
||||
cpp03/require_static \
|
||||
cpp03/can_require_free \
|
||||
cpp03/can_require_member \
|
||||
cpp03/can_require_static \
|
||||
cpp03/can_require_unsupported \
|
||||
cpp03/can_require_not_applicable_free \
|
||||
cpp03/can_require_not_applicable_member \
|
||||
cpp03/can_require_not_applicable_static \
|
||||
cpp03/can_require_not_applicable_unsupported \
|
||||
cpp03/prefer_free_prefer \
|
||||
cpp03/prefer_member_prefer \
|
||||
cpp03/prefer_free_require \
|
||||
cpp03/prefer_member_require \
|
||||
cpp03/prefer_static \
|
||||
cpp03/prefer_unsupported \
|
||||
cpp03/can_prefer_free_prefer \
|
||||
cpp03/can_prefer_free_require \
|
||||
cpp03/can_prefer_member_prefer \
|
||||
cpp03/can_prefer_member_require \
|
||||
cpp03/can_prefer_static \
|
||||
cpp03/can_prefer_unsupported \
|
||||
cpp03/can_prefer_not_applicable_free_prefer \
|
||||
cpp03/can_prefer_not_applicable_free_require \
|
||||
cpp03/can_prefer_not_applicable_member_prefer \
|
||||
cpp03/can_prefer_not_applicable_member_require \
|
||||
cpp03/can_prefer_not_applicable_static \
|
||||
cpp03/can_prefer_not_applicable_unsupported \
|
||||
cpp03/can_prefer_not_preferable_free_prefer \
|
||||
cpp03/can_prefer_not_preferable_free_require \
|
||||
cpp03/can_prefer_not_preferable_member_prefer \
|
||||
cpp03/can_prefer_not_preferable_member_require \
|
||||
cpp03/can_prefer_not_preferable_static \
|
||||
cpp03/can_prefer_not_preferable_unsupported
|
||||
|
||||
cpp03_query_free_SOURCES = cpp03/query_free.cpp
|
||||
cpp03_query_member_SOURCES = cpp03/query_member.cpp
|
||||
cpp03_query_static_SOURCES = cpp03/query_static.cpp
|
||||
cpp03_can_query_free_SOURCES = cpp03/can_query_free.cpp
|
||||
cpp03_can_query_member_SOURCES = cpp03/can_query_member.cpp
|
||||
cpp03_can_query_static_SOURCES = cpp03/can_query_static.cpp
|
||||
cpp03_can_query_unsupported_SOURCES = cpp03/can_query_unsupported.cpp
|
||||
cpp03_can_query_not_applicable_free_SOURCES = cpp03/can_query_not_applicable_free.cpp
|
||||
cpp03_can_query_not_applicable_member_SOURCES = cpp03/can_query_not_applicable_member.cpp
|
||||
cpp03_can_query_not_applicable_static_SOURCES = cpp03/can_query_not_applicable_static.cpp
|
||||
cpp03_can_query_not_applicable_unsupported_SOURCES = cpp03/can_query_not_applicable_unsupported.cpp
|
||||
cpp03_require_concept_free_SOURCES = cpp03/require_concept_free.cpp
|
||||
cpp03_require_concept_member_SOURCES = cpp03/require_concept_member.cpp
|
||||
cpp03_require_concept_static_SOURCES = cpp03/require_concept_static.cpp
|
||||
cpp03_can_require_concept_free_SOURCES = cpp03/can_require_concept_free.cpp
|
||||
cpp03_can_require_concept_member_SOURCES = cpp03/can_require_concept_member.cpp
|
||||
cpp03_can_require_concept_static_SOURCES = cpp03/can_require_concept_static.cpp
|
||||
cpp03_can_require_concept_unsupported_SOURCES = cpp03/can_require_concept_unsupported.cpp
|
||||
cpp03_can_require_concept_not_applicable_free_SOURCES = cpp03/can_require_concept_not_applicable_free.cpp
|
||||
cpp03_can_require_concept_not_applicable_member_SOURCES = cpp03/can_require_concept_not_applicable_member.cpp
|
||||
cpp03_can_require_concept_not_applicable_static_SOURCES = cpp03/can_require_concept_not_applicable_static.cpp
|
||||
cpp03_can_require_concept_not_applicable_unsupported_SOURCES = cpp03/can_require_concept_not_applicable_unsupported.cpp
|
||||
cpp03_require_free_SOURCES = cpp03/require_free.cpp
|
||||
cpp03_require_member_SOURCES = cpp03/require_member.cpp
|
||||
cpp03_require_static_SOURCES = cpp03/require_static.cpp
|
||||
cpp03_can_require_free_SOURCES = cpp03/can_require_free.cpp
|
||||
cpp03_can_require_member_SOURCES = cpp03/can_require_member.cpp
|
||||
cpp03_can_require_static_SOURCES = cpp03/can_require_static.cpp
|
||||
cpp03_can_require_unsupported_SOURCES = cpp03/can_require_unsupported.cpp
|
||||
cpp03_can_require_not_applicable_free_SOURCES = cpp03/can_require_not_applicable_free.cpp
|
||||
cpp03_can_require_not_applicable_member_SOURCES = cpp03/can_require_not_applicable_member.cpp
|
||||
cpp03_can_require_not_applicable_static_SOURCES = cpp03/can_require_not_applicable_static.cpp
|
||||
cpp03_can_require_not_applicable_unsupported_SOURCES = cpp03/can_require_not_applicable_unsupported.cpp
|
||||
cpp03_prefer_free_prefer_SOURCES = cpp03/prefer_free_prefer.cpp
|
||||
cpp03_prefer_free_require_SOURCES = cpp03/prefer_free_require.cpp
|
||||
cpp03_prefer_member_prefer_SOURCES = cpp03/prefer_member_prefer.cpp
|
||||
cpp03_prefer_member_require_SOURCES = cpp03/prefer_member_require.cpp
|
||||
cpp03_prefer_static_SOURCES = cpp03/prefer_static.cpp
|
||||
cpp03_prefer_unsupported_SOURCES = cpp03/prefer_unsupported.cpp
|
||||
cpp03_can_prefer_free_prefer_SOURCES = cpp03/can_prefer_free_prefer.cpp
|
||||
cpp03_can_prefer_free_require_SOURCES = cpp03/can_prefer_free_require.cpp
|
||||
cpp03_can_prefer_member_prefer_SOURCES = cpp03/can_prefer_member_prefer.cpp
|
||||
cpp03_can_prefer_member_require_SOURCES = cpp03/can_prefer_member_require.cpp
|
||||
cpp03_can_prefer_static_SOURCES = cpp03/can_prefer_static.cpp
|
||||
cpp03_can_prefer_unsupported_SOURCES = cpp03/can_prefer_unsupported.cpp
|
||||
cpp03_can_prefer_not_applicable_free_prefer_SOURCES = cpp03/can_prefer_not_applicable_free_prefer.cpp
|
||||
cpp03_can_prefer_not_applicable_free_require_SOURCES = cpp03/can_prefer_not_applicable_free_require.cpp
|
||||
cpp03_can_prefer_not_applicable_member_prefer_SOURCES = cpp03/can_prefer_not_applicable_member_prefer.cpp
|
||||
cpp03_can_prefer_not_applicable_member_require_SOURCES = cpp03/can_prefer_not_applicable_member_require.cpp
|
||||
cpp03_can_prefer_not_applicable_static_SOURCES = cpp03/can_prefer_not_applicable_static.cpp
|
||||
cpp03_can_prefer_not_applicable_unsupported_SOURCES = cpp03/can_prefer_not_applicable_unsupported.cpp
|
||||
cpp03_can_prefer_not_preferable_free_prefer_SOURCES = cpp03/can_prefer_not_preferable_free_prefer.cpp
|
||||
cpp03_can_prefer_not_preferable_free_require_SOURCES = cpp03/can_prefer_not_preferable_free_require.cpp
|
||||
cpp03_can_prefer_not_preferable_member_prefer_SOURCES = cpp03/can_prefer_not_preferable_member_prefer.cpp
|
||||
cpp03_can_prefer_not_preferable_member_require_SOURCES = cpp03/can_prefer_not_preferable_member_require.cpp
|
||||
cpp03_can_prefer_not_preferable_static_SOURCES = cpp03/can_prefer_not_preferable_static.cpp
|
||||
cpp03_can_prefer_not_preferable_unsupported_SOURCES = cpp03/can_prefer_not_preferable_unsupported.cpp
|
||||
|
||||
if HAVE_CXX11
|
||||
|
||||
check_PROGRAMS += \
|
||||
cpp11/query_free \
|
||||
cpp11/query_member \
|
||||
cpp11/query_static \
|
||||
cpp11/can_query_free \
|
||||
cpp11/can_query_member \
|
||||
cpp11/can_query_static \
|
||||
cpp11/can_query_unsupported \
|
||||
cpp11/can_query_not_applicable_free \
|
||||
cpp11/can_query_not_applicable_member \
|
||||
cpp11/can_query_not_applicable_static \
|
||||
cpp11/can_query_not_applicable_unsupported \
|
||||
cpp11/require_concept_free \
|
||||
cpp11/require_concept_member \
|
||||
cpp11/require_concept_static \
|
||||
cpp11/can_require_concept_free \
|
||||
cpp11/can_require_concept_member \
|
||||
cpp11/can_require_concept_static \
|
||||
cpp11/can_require_concept_unsupported \
|
||||
cpp11/can_require_concept_not_applicable_free \
|
||||
cpp11/can_require_concept_not_applicable_member \
|
||||
cpp11/can_require_concept_not_applicable_static \
|
||||
cpp11/can_require_concept_not_applicable_unsupported \
|
||||
cpp11/require_free \
|
||||
cpp11/require_member \
|
||||
cpp11/require_static \
|
||||
cpp11/can_require_free \
|
||||
cpp11/can_require_member \
|
||||
cpp11/can_require_static \
|
||||
cpp11/can_require_unsupported \
|
||||
cpp11/can_require_not_applicable_free \
|
||||
cpp11/can_require_not_applicable_member \
|
||||
cpp11/can_require_not_applicable_static \
|
||||
cpp11/can_require_not_applicable_unsupported \
|
||||
cpp11/prefer_free_prefer \
|
||||
cpp11/prefer_member_prefer \
|
||||
cpp11/prefer_free_require \
|
||||
cpp11/prefer_member_require \
|
||||
cpp11/prefer_static \
|
||||
cpp11/prefer_unsupported \
|
||||
cpp11/can_prefer_free_prefer \
|
||||
cpp11/can_prefer_free_require \
|
||||
cpp11/can_prefer_member_prefer \
|
||||
cpp11/can_prefer_member_require \
|
||||
cpp11/can_prefer_static \
|
||||
cpp11/can_prefer_unsupported \
|
||||
cpp11/can_prefer_not_applicable_free_prefer \
|
||||
cpp11/can_prefer_not_applicable_free_require \
|
||||
cpp11/can_prefer_not_applicable_member_prefer \
|
||||
cpp11/can_prefer_not_applicable_member_require \
|
||||
cpp11/can_prefer_not_applicable_static \
|
||||
cpp11/can_prefer_not_applicable_unsupported \
|
||||
cpp11/can_prefer_not_preferable_free_prefer \
|
||||
cpp11/can_prefer_not_preferable_free_require \
|
||||
cpp11/can_prefer_not_preferable_member_prefer \
|
||||
cpp11/can_prefer_not_preferable_member_require \
|
||||
cpp11/can_prefer_not_preferable_static \
|
||||
cpp11/can_prefer_not_preferable_unsupported
|
||||
|
||||
cpp11_query_free_SOURCES = cpp11/query_free.cpp
|
||||
cpp11_query_member_SOURCES = cpp11/query_member.cpp
|
||||
cpp11_query_static_SOURCES = cpp11/query_static.cpp
|
||||
cpp11_can_query_free_SOURCES = cpp11/can_query_free.cpp
|
||||
cpp11_can_query_member_SOURCES = cpp11/can_query_member.cpp
|
||||
cpp11_can_query_static_SOURCES = cpp11/can_query_static.cpp
|
||||
cpp11_can_query_unsupported_SOURCES = cpp11/can_query_unsupported.cpp
|
||||
cpp11_can_query_not_applicable_free_SOURCES = cpp11/can_query_not_applicable_free.cpp
|
||||
cpp11_can_query_not_applicable_member_SOURCES = cpp11/can_query_not_applicable_member.cpp
|
||||
cpp11_can_query_not_applicable_static_SOURCES = cpp11/can_query_not_applicable_static.cpp
|
||||
cpp11_can_query_not_applicable_unsupported_SOURCES = cpp11/can_query_not_applicable_unsupported.cpp
|
||||
cpp11_require_concept_free_SOURCES = cpp11/require_concept_free.cpp
|
||||
cpp11_require_concept_member_SOURCES = cpp11/require_concept_member.cpp
|
||||
cpp11_require_concept_static_SOURCES = cpp11/require_concept_static.cpp
|
||||
cpp11_can_require_concept_free_SOURCES = cpp11/can_require_concept_free.cpp
|
||||
cpp11_can_require_concept_member_SOURCES = cpp11/can_require_concept_member.cpp
|
||||
cpp11_can_require_concept_static_SOURCES = cpp11/can_require_concept_static.cpp
|
||||
cpp11_can_require_concept_unsupported_SOURCES = cpp11/can_require_concept_unsupported.cpp
|
||||
cpp11_can_require_concept_not_applicable_free_SOURCES = cpp11/can_require_concept_not_applicable_free.cpp
|
||||
cpp11_can_require_concept_not_applicable_member_SOURCES = cpp11/can_require_concept_not_applicable_member.cpp
|
||||
cpp11_can_require_concept_not_applicable_static_SOURCES = cpp11/can_require_concept_not_applicable_static.cpp
|
||||
cpp11_can_require_concept_not_applicable_unsupported_SOURCES = cpp11/can_require_concept_not_applicable_unsupported.cpp
|
||||
cpp11_require_free_SOURCES = cpp11/require_free.cpp
|
||||
cpp11_require_member_SOURCES = cpp11/require_member.cpp
|
||||
cpp11_require_static_SOURCES = cpp11/require_static.cpp
|
||||
cpp11_can_require_free_SOURCES = cpp11/can_require_free.cpp
|
||||
cpp11_can_require_member_SOURCES = cpp11/can_require_member.cpp
|
||||
cpp11_can_require_static_SOURCES = cpp11/can_require_static.cpp
|
||||
cpp11_can_require_unsupported_SOURCES = cpp11/can_require_unsupported.cpp
|
||||
cpp11_can_require_not_applicable_free_SOURCES = cpp11/can_require_not_applicable_free.cpp
|
||||
cpp11_can_require_not_applicable_member_SOURCES = cpp11/can_require_not_applicable_member.cpp
|
||||
cpp11_can_require_not_applicable_static_SOURCES = cpp11/can_require_not_applicable_static.cpp
|
||||
cpp11_can_require_not_applicable_unsupported_SOURCES = cpp11/can_require_not_applicable_unsupported.cpp
|
||||
cpp11_prefer_free_prefer_SOURCES = cpp11/prefer_free_prefer.cpp
|
||||
cpp11_prefer_free_require_SOURCES = cpp11/prefer_free_require.cpp
|
||||
cpp11_prefer_member_prefer_SOURCES = cpp11/prefer_member_prefer.cpp
|
||||
cpp11_prefer_member_require_SOURCES = cpp11/prefer_member_require.cpp
|
||||
cpp11_prefer_static_SOURCES = cpp11/prefer_static.cpp
|
||||
cpp11_prefer_unsupported_SOURCES = cpp11/prefer_unsupported.cpp
|
||||
cpp11_can_prefer_free_prefer_SOURCES = cpp11/can_prefer_free_prefer.cpp
|
||||
cpp11_can_prefer_free_require_SOURCES = cpp11/can_prefer_free_require.cpp
|
||||
cpp11_can_prefer_member_prefer_SOURCES = cpp11/can_prefer_member_prefer.cpp
|
||||
cpp11_can_prefer_member_require_SOURCES = cpp11/can_prefer_member_require.cpp
|
||||
cpp11_can_prefer_static_SOURCES = cpp11/can_prefer_static.cpp
|
||||
cpp11_can_prefer_unsupported_SOURCES = cpp11/can_prefer_unsupported.cpp
|
||||
cpp11_can_prefer_not_applicable_free_prefer_SOURCES = cpp11/can_prefer_not_applicable_free_prefer.cpp
|
||||
cpp11_can_prefer_not_applicable_free_require_SOURCES = cpp11/can_prefer_not_applicable_free_require.cpp
|
||||
cpp11_can_prefer_not_applicable_member_prefer_SOURCES = cpp11/can_prefer_not_applicable_member_prefer.cpp
|
||||
cpp11_can_prefer_not_applicable_member_require_SOURCES = cpp11/can_prefer_not_applicable_member_require.cpp
|
||||
cpp11_can_prefer_not_applicable_static_SOURCES = cpp11/can_prefer_not_applicable_static.cpp
|
||||
cpp11_can_prefer_not_applicable_unsupported_SOURCES = cpp11/can_prefer_not_applicable_unsupported.cpp
|
||||
cpp11_can_prefer_not_preferable_free_prefer_SOURCES = cpp11/can_prefer_not_preferable_free_prefer.cpp
|
||||
cpp11_can_prefer_not_preferable_free_require_SOURCES = cpp11/can_prefer_not_preferable_free_require.cpp
|
||||
cpp11_can_prefer_not_preferable_member_prefer_SOURCES = cpp11/can_prefer_not_preferable_member_prefer.cpp
|
||||
cpp11_can_prefer_not_preferable_member_require_SOURCES = cpp11/can_prefer_not_preferable_member_require.cpp
|
||||
cpp11_can_prefer_not_preferable_static_SOURCES = cpp11/can_prefer_not_preferable_static.cpp
|
||||
cpp11_can_prefer_not_preferable_unsupported_SOURCES = cpp11/can_prefer_not_preferable_unsupported.cpp
|
||||
|
||||
endif
|
||||
|
||||
if HAVE_CXX14
|
||||
|
||||
check_PROGRAMS += \
|
||||
cpp14/query_free \
|
||||
cpp14/query_member \
|
||||
cpp14/query_static \
|
||||
cpp14/can_query_free \
|
||||
cpp14/can_query_member \
|
||||
cpp14/can_query_static \
|
||||
cpp14/can_query_unsupported \
|
||||
cpp14/can_query_not_applicable_free \
|
||||
cpp14/can_query_not_applicable_member \
|
||||
cpp14/can_query_not_applicable_static \
|
||||
cpp14/can_query_not_applicable_unsupported \
|
||||
cpp14/require_concept_free \
|
||||
cpp14/require_concept_member \
|
||||
cpp14/require_concept_static \
|
||||
cpp14/can_require_concept_free \
|
||||
cpp14/can_require_concept_member \
|
||||
cpp14/can_require_concept_static \
|
||||
cpp14/can_require_concept_unsupported \
|
||||
cpp14/can_require_concept_not_applicable_free \
|
||||
cpp14/can_require_concept_not_applicable_member \
|
||||
cpp14/can_require_concept_not_applicable_static \
|
||||
cpp14/can_require_concept_not_applicable_unsupported \
|
||||
cpp14/require_free \
|
||||
cpp14/require_member \
|
||||
cpp14/require_static \
|
||||
cpp14/can_require_free \
|
||||
cpp14/can_require_member \
|
||||
cpp14/can_require_static \
|
||||
cpp14/can_require_unsupported \
|
||||
cpp14/can_require_not_applicable_free \
|
||||
cpp14/can_require_not_applicable_member \
|
||||
cpp14/can_require_not_applicable_static \
|
||||
cpp14/can_require_not_applicable_unsupported \
|
||||
cpp14/prefer_free_prefer \
|
||||
cpp14/prefer_member_prefer \
|
||||
cpp14/prefer_free_require \
|
||||
cpp14/prefer_member_require \
|
||||
cpp14/prefer_static \
|
||||
cpp14/prefer_unsupported \
|
||||
cpp14/can_prefer_free_prefer \
|
||||
cpp14/can_prefer_free_require \
|
||||
cpp14/can_prefer_member_prefer \
|
||||
cpp14/can_prefer_member_require \
|
||||
cpp14/can_prefer_static \
|
||||
cpp14/can_prefer_unsupported \
|
||||
cpp14/can_prefer_not_applicable_free_prefer \
|
||||
cpp14/can_prefer_not_applicable_free_require \
|
||||
cpp14/can_prefer_not_applicable_member_prefer \
|
||||
cpp14/can_prefer_not_applicable_member_require \
|
||||
cpp14/can_prefer_not_applicable_static \
|
||||
cpp14/can_prefer_not_applicable_unsupported \
|
||||
cpp14/can_prefer_not_preferable_free_prefer \
|
||||
cpp14/can_prefer_not_preferable_free_require \
|
||||
cpp14/can_prefer_not_preferable_member_prefer \
|
||||
cpp14/can_prefer_not_preferable_member_require \
|
||||
cpp14/can_prefer_not_preferable_static \
|
||||
cpp14/can_prefer_not_preferable_unsupported
|
||||
|
||||
cpp14_query_free_SOURCES = cpp14/query_free.cpp
|
||||
cpp14_query_member_SOURCES = cpp14/query_member.cpp
|
||||
cpp14_query_static_SOURCES = cpp14/query_static.cpp
|
||||
cpp14_can_query_free_SOURCES = cpp14/can_query_free.cpp
|
||||
cpp14_can_query_member_SOURCES = cpp14/can_query_member.cpp
|
||||
cpp14_can_query_static_SOURCES = cpp14/can_query_static.cpp
|
||||
cpp14_can_query_unsupported_SOURCES = cpp14/can_query_unsupported.cpp
|
||||
cpp14_can_query_not_applicable_free_SOURCES = cpp14/can_query_not_applicable_free.cpp
|
||||
cpp14_can_query_not_applicable_member_SOURCES = cpp14/can_query_not_applicable_member.cpp
|
||||
cpp14_can_query_not_applicable_static_SOURCES = cpp14/can_query_not_applicable_static.cpp
|
||||
cpp14_can_query_not_applicable_unsupported_SOURCES = cpp14/can_query_not_applicable_unsupported.cpp
|
||||
cpp14_require_concept_free_SOURCES = cpp14/require_concept_free.cpp
|
||||
cpp14_require_concept_member_SOURCES = cpp14/require_concept_member.cpp
|
||||
cpp14_require_concept_static_SOURCES = cpp14/require_concept_static.cpp
|
||||
cpp14_can_require_concept_free_SOURCES = cpp14/can_require_concept_free.cpp
|
||||
cpp14_can_require_concept_member_SOURCES = cpp14/can_require_concept_member.cpp
|
||||
cpp14_can_require_concept_static_SOURCES = cpp14/can_require_concept_static.cpp
|
||||
cpp14_can_require_concept_unsupported_SOURCES = cpp14/can_require_concept_unsupported.cpp
|
||||
cpp14_can_require_concept_not_applicable_free_SOURCES = cpp14/can_require_concept_not_applicable_free.cpp
|
||||
cpp14_can_require_concept_not_applicable_member_SOURCES = cpp14/can_require_concept_not_applicable_member.cpp
|
||||
cpp14_can_require_concept_not_applicable_static_SOURCES = cpp14/can_require_concept_not_applicable_static.cpp
|
||||
cpp14_can_require_concept_not_applicable_unsupported_SOURCES = cpp14/can_require_concept_not_applicable_unsupported.cpp
|
||||
cpp14_require_free_SOURCES = cpp14/require_free.cpp
|
||||
cpp14_require_member_SOURCES = cpp14/require_member.cpp
|
||||
cpp14_require_static_SOURCES = cpp14/require_static.cpp
|
||||
cpp14_can_require_free_SOURCES = cpp14/can_require_free.cpp
|
||||
cpp14_can_require_member_SOURCES = cpp14/can_require_member.cpp
|
||||
cpp14_can_require_static_SOURCES = cpp14/can_require_static.cpp
|
||||
cpp14_can_require_unsupported_SOURCES = cpp14/can_require_unsupported.cpp
|
||||
cpp14_can_require_not_applicable_free_SOURCES = cpp14/can_require_not_applicable_free.cpp
|
||||
cpp14_can_require_not_applicable_member_SOURCES = cpp14/can_require_not_applicable_member.cpp
|
||||
cpp14_can_require_not_applicable_static_SOURCES = cpp14/can_require_not_applicable_static.cpp
|
||||
cpp14_can_require_not_applicable_unsupported_SOURCES = cpp14/can_require_not_applicable_unsupported.cpp
|
||||
cpp14_prefer_free_prefer_SOURCES = cpp14/prefer_free_prefer.cpp
|
||||
cpp14_prefer_free_require_SOURCES = cpp14/prefer_free_require.cpp
|
||||
cpp14_prefer_member_prefer_SOURCES = cpp14/prefer_member_prefer.cpp
|
||||
cpp14_prefer_member_require_SOURCES = cpp14/prefer_member_require.cpp
|
||||
cpp14_prefer_static_SOURCES = cpp14/prefer_static.cpp
|
||||
cpp14_prefer_unsupported_SOURCES = cpp14/prefer_unsupported.cpp
|
||||
cpp14_can_prefer_free_prefer_SOURCES = cpp14/can_prefer_free_prefer.cpp
|
||||
cpp14_can_prefer_free_require_SOURCES = cpp14/can_prefer_free_require.cpp
|
||||
cpp14_can_prefer_member_prefer_SOURCES = cpp14/can_prefer_member_prefer.cpp
|
||||
cpp14_can_prefer_member_require_SOURCES = cpp14/can_prefer_member_require.cpp
|
||||
cpp14_can_prefer_static_SOURCES = cpp14/can_prefer_static.cpp
|
||||
cpp14_can_prefer_unsupported_SOURCES = cpp14/can_prefer_unsupported.cpp
|
||||
cpp14_can_prefer_not_applicable_free_prefer_SOURCES = cpp14/can_prefer_not_applicable_free_prefer.cpp
|
||||
cpp14_can_prefer_not_applicable_free_require_SOURCES = cpp14/can_prefer_not_applicable_free_require.cpp
|
||||
cpp14_can_prefer_not_applicable_member_prefer_SOURCES = cpp14/can_prefer_not_applicable_member_prefer.cpp
|
||||
cpp14_can_prefer_not_applicable_member_require_SOURCES = cpp14/can_prefer_not_applicable_member_require.cpp
|
||||
cpp14_can_prefer_not_applicable_static_SOURCES = cpp14/can_prefer_not_applicable_static.cpp
|
||||
cpp14_can_prefer_not_applicable_unsupported_SOURCES = cpp14/can_prefer_not_applicable_unsupported.cpp
|
||||
cpp14_can_prefer_not_preferable_free_prefer_SOURCES = cpp14/can_prefer_not_preferable_free_prefer.cpp
|
||||
cpp14_can_prefer_not_preferable_free_require_SOURCES = cpp14/can_prefer_not_preferable_free_require.cpp
|
||||
cpp14_can_prefer_not_preferable_member_prefer_SOURCES = cpp14/can_prefer_not_preferable_member_prefer.cpp
|
||||
cpp14_can_prefer_not_preferable_member_require_SOURCES = cpp14/can_prefer_not_preferable_member_require.cpp
|
||||
cpp14_can_prefer_not_preferable_static_SOURCES = cpp14/can_prefer_not_preferable_static.cpp
|
||||
cpp14_can_prefer_not_preferable_unsupported_SOURCES = cpp14/can_prefer_not_preferable_unsupported.cpp
|
||||
|
||||
endif
|
||||
|
||||
TESTS = $(check_PROGRAMS)
|
||||
|
||||
AM_CXXFLAGS = -I$(srcdir)/../../../include
|
||||
|
||||
MAINTAINERCLEANFILES = \
|
||||
$(srcdir)/Makefile.in
|
308
asio/src/tests/properties/Makefile.msc
Normal file
308
asio/src/tests/properties/Makefile.msc
Normal file
@ -0,0 +1,308 @@
|
||||
COMMON_CXXFLAGS = -nologo -GR -EHsc -I. -I../../../include
|
||||
|
||||
!ifdef CXXLATEST
|
||||
STD_CXXFLAGS = -std:c++latest
|
||||
!endif
|
||||
|
||||
!ifdef WARNINGS
|
||||
WARNINGS_CXXFLAGS = -W4 -wd4512 -wd4447
|
||||
!endif
|
||||
|
||||
!ifdef STATICRTL
|
||||
! ifdef DEBUG
|
||||
DEBUG_CXXFLAGS = -Zi -MTd
|
||||
! else
|
||||
DEBUG_CXXFLAGS = -O2 -MT
|
||||
! endif
|
||||
!else
|
||||
! ifdef DEBUG
|
||||
DEBUG_CXXFLAGS = -Zi -MDd
|
||||
! else
|
||||
DEBUG_CXXFLAGS = -O2 -MD
|
||||
! endif
|
||||
!endif
|
||||
|
||||
!ifdef UNICODE
|
||||
UNICODE_CXXFLAGS = -DUNICODE -D_UNICODE
|
||||
!endif
|
||||
|
||||
!ifdef TRACKING
|
||||
TRACKING_CXXFLAGS = -DASIO_ENABLE_HANDLER_TRACKING
|
||||
!endif
|
||||
|
||||
!ifndef _WIN32_WINNT
|
||||
! ifdef STORE
|
||||
_WIN32_WINNT=0x0603
|
||||
! else
|
||||
_WIN32_WINNT=0x0601
|
||||
! endif
|
||||
!endif
|
||||
|
||||
!ifdef WIN9X
|
||||
DEFINES = \
|
||||
-DASIO_DISABLE_IOCP \
|
||||
-D_WIN32_WINNT=$(_WIN32_WINNT) \
|
||||
-DBOOST_ALL_NO_LIB \
|
||||
-DBOOST_CHRONO_DONT_PROVIDE_HYBRID_ERROR_HANDLING
|
||||
!else
|
||||
! ifdef STORE
|
||||
DEFINES = \
|
||||
-DWINAPI_FAMILY=WINAPI_FAMILY_PC_APP \
|
||||
-DBOOST_ALL_NO_LIB -D_WIN32_WINNT=$(_WIN32_WINNT) \
|
||||
-DUNICODE -D_UNICODE \
|
||||
-DBOOST_CHRONO_DONT_PROVIDE_HYBRID_ERROR_HANDLING
|
||||
! else
|
||||
! ifdef WINRT
|
||||
DEFINES = \
|
||||
-ZW -FI SDKDDKVer.h -FI winapifamily.h -DWINAPI_FAMILY=WINAPI_PARTITION_APP \
|
||||
-DBOOST_ALL_NO_LIB \
|
||||
-DBOOST_CHRONO_DONT_PROVIDE_HYBRID_ERROR_HANDLING
|
||||
! else
|
||||
DEFINES = \
|
||||
-D_WIN32_WINNT=$(_WIN32_WINNT) \
|
||||
-DBOOST_ALL_NO_LIB \
|
||||
-DBOOST_CHRONO_DONT_PROVIDE_HYBRID_ERROR_HANDLING
|
||||
! endif
|
||||
! endif
|
||||
!endif
|
||||
|
||||
!ifdef STANDALONE
|
||||
STANDALONE_CXXFLAGS = -DASIO_STANDALONE
|
||||
!else
|
||||
STANDALONE_CXXFLAGS = -I$(BOOSTDIR) -DASIO_ENABLE_BOOST
|
||||
!endif
|
||||
|
||||
CXXFLAGS = \
|
||||
$(COMMON_CXXFLAGS) \
|
||||
$(STD_CXXFLAGS) \
|
||||
$(WARNINGS_CXXFLAGS) \
|
||||
$(DEBUG_CXXFLAGS) \
|
||||
$(UNICODE_CXXFLAGS) \
|
||||
$(TRACKING_CXXFLAGS) \
|
||||
$(STANDALONE_CXXFLAGS)
|
||||
|
||||
CPP03_TEST_EXES = \
|
||||
cpp03\query_free.exe \
|
||||
cpp03\query_member.exe \
|
||||
cpp03\query_static.exe \
|
||||
cpp03\can_query_free.exe \
|
||||
cpp03\can_query_member.exe \
|
||||
cpp03\can_query_static.exe \
|
||||
cpp03\can_query_unsupported.exe \
|
||||
cpp03\can_query_not_applicable_free.exe \
|
||||
cpp03\can_query_not_applicable_member.exe \
|
||||
cpp03\can_query_not_applicable_static.exe \
|
||||
cpp03\can_query_not_applicable_unsupported.exe \
|
||||
cpp03\require_concept_free.exe \
|
||||
cpp03\require_concept_member.exe \
|
||||
cpp03\require_concept_static.exe \
|
||||
cpp03\can_require_concept_free.exe \
|
||||
cpp03\can_require_concept_member.exe \
|
||||
cpp03\can_require_concept_static.exe \
|
||||
cpp03\can_require_concept_unsupported.exe \
|
||||
cpp03\can_require_concept_not_applicable_free.exe \
|
||||
cpp03\can_require_concept_not_applicable_member.exe \
|
||||
cpp03\can_require_concept_not_applicable_static.exe \
|
||||
cpp03\can_require_concept_not_applicable_unsupported.exe \
|
||||
cpp03\require_free.exe \
|
||||
cpp03\require_member.exe \
|
||||
cpp03\require_static.exe \
|
||||
cpp03\can_require_free.exe \
|
||||
cpp03\can_require_member.exe \
|
||||
cpp03\can_require_static.exe \
|
||||
cpp03\can_require_unsupported.exe \
|
||||
cpp03\can_require_not_applicable_free.exe \
|
||||
cpp03\can_require_not_applicable_member.exe \
|
||||
cpp03\can_require_not_applicable_static.exe \
|
||||
cpp03\can_require_not_applicable_unsupported.exe \
|
||||
cpp03\prefer_free_prefer.exe \
|
||||
cpp03\prefer_member_prefer.exe \
|
||||
cpp03\prefer_free_require.exe \
|
||||
cpp03\prefer_member_require.exe \
|
||||
cpp03\prefer_static.exe \
|
||||
cpp03\prefer_unsupported.exe \
|
||||
cpp03\can_prefer_free_prefer.exe \
|
||||
cpp03\can_prefer_free_require.exe \
|
||||
cpp03\can_prefer_member_prefer.exe \
|
||||
cpp03\can_prefer_member_require.exe \
|
||||
cpp03\can_prefer_static.exe \
|
||||
cpp03\can_prefer_unsupported.exe \
|
||||
cpp03\can_prefer_not_applicable_free_prefer.exe \
|
||||
cpp03\can_prefer_not_applicable_free_require.exe \
|
||||
cpp03\can_prefer_not_applicable_member_prefer.exe \
|
||||
cpp03\can_prefer_not_applicable_member_require.exe \
|
||||
cpp03\can_prefer_not_applicable_static.exe \
|
||||
cpp03\can_prefer_not_applicable_unsupported.exe \
|
||||
cpp03\can_prefer_not_preferable_free_prefer.exe \
|
||||
cpp03\can_prefer_not_preferable_free_require.exe \
|
||||
cpp03\can_prefer_not_preferable_member_prefer.exe \
|
||||
cpp03\can_prefer_not_preferable_member_require.exe \
|
||||
cpp03\can_prefer_not_preferable_static.exe \
|
||||
cpp03\can_prefer_not_preferable_unsupported.exe
|
||||
|
||||
!ifdef CPP11
|
||||
|
||||
CPP11_TEST_EXES = \
|
||||
cpp11\query_free.exe \
|
||||
cpp11\query_member.exe \
|
||||
cpp11\query_static.exe \
|
||||
cpp11\can_query_free.exe \
|
||||
cpp11\can_query_member.exe \
|
||||
cpp11\can_query_static.exe \
|
||||
cpp11\can_query_unsupported.exe \
|
||||
cpp11\can_query_not_applicable_free.exe \
|
||||
cpp11\can_query_not_applicable_member.exe \
|
||||
cpp11\can_query_not_applicable_static.exe \
|
||||
cpp11\can_query_not_applicable_unsupported.exe \
|
||||
cpp11\require_concept_free.exe \
|
||||
cpp11\require_concept_member.exe \
|
||||
cpp11\require_concept_static.exe \
|
||||
cpp11\can_require_concept_free.exe \
|
||||
cpp11\can_require_concept_member.exe \
|
||||
cpp11\can_require_concept_static.exe \
|
||||
cpp11\can_require_concept_unsupported.exe \
|
||||
cpp11\can_require_concept_not_applicable_free.exe \
|
||||
cpp11\can_require_concept_not_applicable_member.exe \
|
||||
cpp11\can_require_concept_not_applicable_static.exe \
|
||||
cpp11\can_require_concept_not_applicable_unsupported.exe \
|
||||
cpp11\require_free.exe \
|
||||
cpp11\require_member.exe \
|
||||
cpp11\require_static.exe \
|
||||
cpp11\can_require_free.exe \
|
||||
cpp11\can_require_member.exe \
|
||||
cpp11\can_require_static.exe \
|
||||
cpp11\can_require_unsupported.exe \
|
||||
cpp11\can_require_not_applicable_free.exe \
|
||||
cpp11\can_require_not_applicable_member.exe \
|
||||
cpp11\can_require_not_applicable_static.exe \
|
||||
cpp11\can_require_not_applicable_unsupported.exe \
|
||||
cpp11\prefer_free_prefer.exe \
|
||||
cpp11\prefer_member_prefer.exe \
|
||||
cpp11\prefer_free_require.exe \
|
||||
cpp11\prefer_member_require.exe \
|
||||
cpp11\prefer_static.exe \
|
||||
cpp11\prefer_unsupported.exe \
|
||||
cpp11\can_prefer_free_prefer.exe \
|
||||
cpp11\can_prefer_free_require.exe \
|
||||
cpp11\can_prefer_member_prefer.exe \
|
||||
cpp11\can_prefer_member_require.exe \
|
||||
cpp11\can_prefer_static.exe \
|
||||
cpp11\can_prefer_unsupported.exe \
|
||||
cpp11\can_prefer_not_applicable_free_prefer.exe \
|
||||
cpp11\can_prefer_not_applicable_free_require.exe \
|
||||
cpp11\can_prefer_not_applicable_member_prefer.exe \
|
||||
cpp11\can_prefer_not_applicable_member_require.exe \
|
||||
cpp11\can_prefer_not_applicable_static.exe \
|
||||
cpp11\can_prefer_not_applicable_unsupported.exe \
|
||||
cpp11\can_prefer_not_preferable_free_prefer.exe \
|
||||
cpp11\can_prefer_not_preferable_free_require.exe \
|
||||
cpp11\can_prefer_not_preferable_member_prefer.exe \
|
||||
cpp11\can_prefer_not_preferable_member_require.exe \
|
||||
cpp11\can_prefer_not_preferable_static.exe \
|
||||
cpp11\can_prefer_not_preferable_unsupported.exe
|
||||
|
||||
!endif
|
||||
|
||||
!ifdef CPP14
|
||||
|
||||
CPP14_TEST_EXES = \
|
||||
cpp14\query_free.exe \
|
||||
cpp14\query_member.exe \
|
||||
cpp14\query_static.exe \
|
||||
cpp14\can_query_free.exe \
|
||||
cpp14\can_query_member.exe \
|
||||
cpp14\can_query_static.exe \
|
||||
cpp14\can_query_unsupported.exe \
|
||||
cpp14\can_query_not_applicable_free.exe \
|
||||
cpp14\can_query_not_applicable_member.exe \
|
||||
cpp14\can_query_not_applicable_static.exe \
|
||||
cpp14\can_query_not_applicable_unsupported.exe \
|
||||
cpp14\require_concept_free.exe \
|
||||
cpp14\require_concept_member.exe \
|
||||
cpp14\require_concept_static.exe \
|
||||
cpp14\can_require_concept_free.exe \
|
||||
cpp14\can_require_concept_member.exe \
|
||||
cpp14\can_require_concept_static.exe \
|
||||
cpp14\can_require_concept_unsupported.exe \
|
||||
cpp14\can_require_concept_not_applicable_free.exe \
|
||||
cpp14\can_require_concept_not_applicable_member.exe \
|
||||
cpp14\can_require_concept_not_applicable_static.exe \
|
||||
cpp14\can_require_concept_not_applicable_unsupported.exe \
|
||||
cpp14\require_free.exe \
|
||||
cpp14\require_member.exe \
|
||||
cpp14\require_static.exe \
|
||||
cpp14\can_require_free.exe \
|
||||
cpp14\can_require_member.exe \
|
||||
cpp14\can_require_static.exe \
|
||||
cpp14\can_require_unsupported.exe \
|
||||
cpp14\can_require_not_applicable_free.exe \
|
||||
cpp14\can_require_not_applicable_member.exe \
|
||||
cpp14\can_require_not_applicable_static.exe \
|
||||
cpp14\can_require_not_applicable_unsupported.exe \
|
||||
cpp14\prefer_free_prefer.exe \
|
||||
cpp14\prefer_member_prefer.exe \
|
||||
cpp14\prefer_free_require.exe \
|
||||
cpp14\prefer_member_require.exe \
|
||||
cpp14\prefer_static.exe \
|
||||
cpp14\prefer_unsupported.exe \
|
||||
cpp14\can_prefer_free_prefer.exe \
|
||||
cpp14\can_prefer_free_require.exe \
|
||||
cpp14\can_prefer_member_prefer.exe \
|
||||
cpp14\can_prefer_member_require.exe \
|
||||
cpp14\can_prefer_static.exe \
|
||||
cpp14\can_prefer_unsupported.exe \
|
||||
cpp14\can_prefer_not_applicable_free_prefer.exe \
|
||||
cpp14\can_prefer_not_applicable_free_require.exe \
|
||||
cpp14\can_prefer_not_applicable_member_prefer.exe \
|
||||
cpp14\can_prefer_not_applicable_member_require.exe \
|
||||
cpp14\can_prefer_not_applicable_static.exe \
|
||||
cpp14\can_prefer_not_applicable_unsupported.exe \
|
||||
cpp14\can_prefer_not_preferable_free_prefer.exe \
|
||||
cpp14\can_prefer_not_preferable_free_require.exe \
|
||||
cpp14\can_prefer_not_preferable_member_prefer.exe \
|
||||
cpp14\can_prefer_not_preferable_member_require.exe \
|
||||
cpp14\can_prefer_not_preferable_static.exe \
|
||||
cpp14\can_prefer_not_preferable_unsupported.exe
|
||||
|
||||
!endif
|
||||
|
||||
TEST_EXES = \
|
||||
$(CPP03_TEST_EXES) \
|
||||
$(CPP11_TEST_EXES) \
|
||||
$(CPP14_TEST_EXES)
|
||||
|
||||
all: \
|
||||
$(TEST_EXES)
|
||||
|
||||
check: $(TEST_EXES)
|
||||
!@echo === Running $** === && $** && echo.
|
||||
|
||||
{cpp03}.cpp{cpp03}.exe:
|
||||
cl -Fe$@ -Fo$(<:.cpp=.obj) $(CXXFLAGS) $(DEFINES) $< $(LIBS) -link -opt:ref
|
||||
|
||||
{cpp11}.cpp{cpp11}.exe:
|
||||
cl -Fe$@ -Fo$(<:.cpp=.obj) $(CXXFLAGS) $(DEFINES) $< $(LIBS) -link -opt:ref
|
||||
|
||||
{cpp14}.cpp{cpp14}.exe:
|
||||
cl -Fe$@ -Fo$(<:.cpp=.obj) $(CXXFLAGS) $(DEFINES) $< $(LIBS) -link -opt:ref
|
||||
|
||||
clean:
|
||||
-del /q /s cpp03\*.exe
|
||||
-del /q /s cpp03\*.exe.manifest
|
||||
-del /q /s cpp03\*.exp
|
||||
-del /q /s cpp03\*.ilk
|
||||
-del /q /s cpp03\*.pdb
|
||||
-del /q /s cpp03\*.obj
|
||||
-del /q /s cpp11\*.exe
|
||||
-del /q /s cpp11\*.exe.manifest
|
||||
-del /q /s cpp11\*.exp
|
||||
-del /q /s cpp11\*.ilk
|
||||
-del /q /s cpp11\*.pdb
|
||||
-del /q /s cpp11\*.obj
|
||||
-del /q /s cpp14\*.exe
|
||||
-del /q /s cpp14\*.exe.manifest
|
||||
-del /q /s cpp14\*.exp
|
||||
-del /q /s cpp14\*.ilk
|
||||
-del /q /s cpp14\*.pdb
|
||||
-del /q /s cpp14\*.obj
|
||||
-del /q /s *.pdb
|
59
asio/src/tests/properties/cpp03/can_prefer_free_prefer.cpp
Normal file
59
asio/src/tests/properties/cpp03/can_prefer_free_prefer.cpp
Normal file
@ -0,0 +1,59 @@
|
||||
//
|
||||
// cpp03/can_prefer_free_prefer.cpp
|
||||
// ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||
//
|
||||
// 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)
|
||||
//
|
||||
|
||||
#include "asio/prefer.hpp"
|
||||
#include <cassert>
|
||||
|
||||
template <int>
|
||||
struct prop
|
||||
{
|
||||
static const bool is_preferable = true;
|
||||
};
|
||||
|
||||
template <int>
|
||||
struct object
|
||||
{
|
||||
template <int N>
|
||||
friend object<N> prefer(const object&, prop<N>)
|
||||
{
|
||||
return object<N>();
|
||||
}
|
||||
};
|
||||
|
||||
namespace asio {
|
||||
|
||||
template<int N, int M>
|
||||
struct is_applicable_property<object<N>, prop<M> >
|
||||
{
|
||||
static const bool value = true;
|
||||
};
|
||||
|
||||
namespace traits {
|
||||
|
||||
template<int N, int M>
|
||||
struct prefer_free<object<N>, prop<M> >
|
||||
{
|
||||
static const bool is_valid = true;
|
||||
static const bool is_noexcept = true;
|
||||
typedef object<M> result_type;
|
||||
};
|
||||
|
||||
} // namespace traits
|
||||
} // namespace asio
|
||||
|
||||
int main()
|
||||
{
|
||||
assert((asio::can_prefer<object<1>, prop<2> >::value));
|
||||
assert((asio::can_prefer<object<1>, prop<2>, prop<3> >::value));
|
||||
assert((asio::can_prefer<object<1>, prop<2>, prop<3>, prop<4> >::value));
|
||||
assert((asio::can_prefer<const object<1>, prop<2> >::value));
|
||||
assert((asio::can_prefer<const object<1>, prop<2>, prop<3> >::value));
|
||||
assert((asio::can_prefer<const object<1>, prop<2>, prop<3>, prop<4> >::value));
|
||||
}
|
59
asio/src/tests/properties/cpp03/can_prefer_free_require.cpp
Normal file
59
asio/src/tests/properties/cpp03/can_prefer_free_require.cpp
Normal file
@ -0,0 +1,59 @@
|
||||
//
|
||||
// cpp03/can_prefer_free_require.cpp
|
||||
// ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||
//
|
||||
// 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)
|
||||
//
|
||||
|
||||
#include "asio/prefer.hpp"
|
||||
#include <cassert>
|
||||
|
||||
template <int>
|
||||
struct prop
|
||||
{
|
||||
static const bool is_preferable = true;
|
||||
};
|
||||
|
||||
template <int>
|
||||
struct object
|
||||
{
|
||||
template <int N>
|
||||
friend object<N> require(const object&, prop<N>)
|
||||
{
|
||||
return object<N>();
|
||||
}
|
||||
};
|
||||
|
||||
namespace asio {
|
||||
|
||||
template<int N, int M>
|
||||
struct is_applicable_property<object<N>, prop<M> >
|
||||
{
|
||||
static const bool value = true;
|
||||
};
|
||||
|
||||
namespace traits {
|
||||
|
||||
template<int N, int M>
|
||||
struct require_free<object<N>, prop<M> >
|
||||
{
|
||||
static const bool is_valid = true;
|
||||
static const bool is_noexcept = true;
|
||||
typedef object<M> result_type;
|
||||
};
|
||||
|
||||
} // namespace traits
|
||||
} // namespace asio
|
||||
|
||||
int main()
|
||||
{
|
||||
assert((asio::can_prefer<object<1>, prop<2> >::value));
|
||||
assert((asio::can_prefer<object<1>, prop<2>, prop<3> >::value));
|
||||
assert((asio::can_prefer<object<1>, prop<2>, prop<3>, prop<4> >::value));
|
||||
assert((asio::can_prefer<const object<1>, prop<2> >::value));
|
||||
assert((asio::can_prefer<const object<1>, prop<2>, prop<3> >::value));
|
||||
assert((asio::can_prefer<const object<1>, prop<2>, prop<3>, prop<4> >::value));
|
||||
}
|
59
asio/src/tests/properties/cpp03/can_prefer_member_prefer.cpp
Normal file
59
asio/src/tests/properties/cpp03/can_prefer_member_prefer.cpp
Normal file
@ -0,0 +1,59 @@
|
||||
//
|
||||
// cpp03/can_prefer_member_prefer.cpp
|
||||
// ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||
//
|
||||
// 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)
|
||||
//
|
||||
|
||||
#include "asio/prefer.hpp"
|
||||
#include <cassert>
|
||||
|
||||
template <int>
|
||||
struct prop
|
||||
{
|
||||
static const bool is_preferable = true;
|
||||
};
|
||||
|
||||
template <int>
|
||||
struct object
|
||||
{
|
||||
template <int N>
|
||||
object<N> prefer(prop<N>) const
|
||||
{
|
||||
return object<N>();
|
||||
}
|
||||
};
|
||||
|
||||
namespace asio {
|
||||
|
||||
template<int N, int M>
|
||||
struct is_applicable_property<object<N>, prop<M> >
|
||||
{
|
||||
static const bool value = true;
|
||||
};
|
||||
|
||||
namespace traits {
|
||||
|
||||
template<int N, int M>
|
||||
struct prefer_member<object<N>, prop<M> >
|
||||
{
|
||||
static const bool is_valid = true;
|
||||
static const bool is_noexcept = true;
|
||||
typedef object<M> result_type;
|
||||
};
|
||||
|
||||
} // namespace traits
|
||||
} // namespace asio
|
||||
|
||||
int main()
|
||||
{
|
||||
assert((asio::can_prefer<object<1>, prop<2> >::value));
|
||||
assert((asio::can_prefer<object<1>, prop<2>, prop<3> >::value));
|
||||
assert((asio::can_prefer<object<1>, prop<2>, prop<3>, prop<4> >::value));
|
||||
assert((asio::can_prefer<const object<1>, prop<2> >::value));
|
||||
assert((asio::can_prefer<const object<1>, prop<2>, prop<3> >::value));
|
||||
assert((asio::can_prefer<const object<1>, prop<2>, prop<3>, prop<4> >::value));
|
||||
}
|
@ -0,0 +1,59 @@
|
||||
//
|
||||
// cpp03/can_prefer_member_require.cpp
|
||||
// ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||
//
|
||||
// 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)
|
||||
//
|
||||
|
||||
#include "asio/prefer.hpp"
|
||||
#include <cassert>
|
||||
|
||||
template <int>
|
||||
struct prop
|
||||
{
|
||||
static const bool is_preferable = true;
|
||||
};
|
||||
|
||||
template <int>
|
||||
struct object
|
||||
{
|
||||
template <int N>
|
||||
object<N> require(prop<N>) const
|
||||
{
|
||||
return object<N>();
|
||||
}
|
||||
};
|
||||
|
||||
namespace asio {
|
||||
|
||||
template<int N, int M>
|
||||
struct is_applicable_property<object<N>, prop<M> >
|
||||
{
|
||||
static const bool value = true;
|
||||
};
|
||||
|
||||
namespace traits {
|
||||
|
||||
template<int N, int M>
|
||||
struct require_member<object<N>, prop<M> >
|
||||
{
|
||||
static const bool is_valid = true;
|
||||
static const bool is_noexcept = true;
|
||||
typedef object<M> result_type;
|
||||
};
|
||||
|
||||
} // namespace traits
|
||||
} // namespace asio
|
||||
|
||||
int main()
|
||||
{
|
||||
assert((asio::can_prefer<object<1>, prop<2> >::value));
|
||||
assert((asio::can_prefer<object<1>, prop<2>, prop<3> >::value));
|
||||
assert((asio::can_prefer<object<1>, prop<2>, prop<3>, prop<4> >::value));
|
||||
assert((asio::can_prefer<const object<1>, prop<2> >::value));
|
||||
assert((asio::can_prefer<const object<1>, prop<2>, prop<3> >::value));
|
||||
assert((asio::can_prefer<const object<1>, prop<2>, prop<3>, prop<4> >::value));
|
||||
}
|
@ -0,0 +1,52 @@
|
||||
//
|
||||
// cpp03/can_prefer_not_applicable_free_prefer.cpp
|
||||
// ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||
//
|
||||
// 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)
|
||||
//
|
||||
|
||||
#include "asio/prefer.hpp"
|
||||
#include <cassert>
|
||||
|
||||
template <int>
|
||||
struct prop
|
||||
{
|
||||
static const bool is_preferable = true;
|
||||
};
|
||||
|
||||
template <int>
|
||||
struct object
|
||||
{
|
||||
template <int N>
|
||||
friend object<N> prefer(const object&, prop<N>)
|
||||
{
|
||||
return object<N>();
|
||||
}
|
||||
};
|
||||
|
||||
namespace asio {
|
||||
namespace traits {
|
||||
|
||||
template<int N, int M>
|
||||
struct prefer_free<object<N>, prop<M> >
|
||||
{
|
||||
static const bool is_valid = true;
|
||||
static const bool is_noexcept = true;
|
||||
typedef object<M> result_type;
|
||||
};
|
||||
|
||||
} // namespace traits
|
||||
} // namespace asio
|
||||
|
||||
int main()
|
||||
{
|
||||
assert((!asio::can_prefer<object<1>, prop<2> >::value));
|
||||
assert((!asio::can_prefer<object<1>, prop<2>, prop<3> >::value));
|
||||
assert((!asio::can_prefer<object<1>, prop<2>, prop<3>, prop<4> >::value));
|
||||
assert((!asio::can_prefer<const object<1>, prop<2> >::value));
|
||||
assert((!asio::can_prefer<const object<1>, prop<2>, prop<3> >::value));
|
||||
assert((!asio::can_prefer<const object<1>, prop<2>, prop<3>, prop<4> >::value));
|
||||
}
|
@ -0,0 +1,52 @@
|
||||
//
|
||||
// cpp03/can_prefer_not_applicable_free_require.cpp
|
||||
// ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||
//
|
||||
// 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)
|
||||
//
|
||||
|
||||
#include "asio/prefer.hpp"
|
||||
#include <cassert>
|
||||
|
||||
template <int>
|
||||
struct prop
|
||||
{
|
||||
static const bool is_preferable = true;
|
||||
};
|
||||
|
||||
template <int>
|
||||
struct object
|
||||
{
|
||||
template <int N>
|
||||
friend object<N> require(const object&, prop<N>)
|
||||
{
|
||||
return object<N>();
|
||||
}
|
||||
};
|
||||
|
||||
namespace asio {
|
||||
namespace traits {
|
||||
|
||||
template<int N, int M>
|
||||
struct require_free<object<N>, prop<M> >
|
||||
{
|
||||
static const bool is_valid = true;
|
||||
static const bool is_noexcept = true;
|
||||
typedef object<M> result_type;
|
||||
};
|
||||
|
||||
} // namespace traits
|
||||
} // namespace asio
|
||||
|
||||
int main()
|
||||
{
|
||||
assert((!asio::can_prefer<object<1>, prop<2> >::value));
|
||||
assert((!asio::can_prefer<object<1>, prop<2>, prop<3> >::value));
|
||||
assert((!asio::can_prefer<object<1>, prop<2>, prop<3>, prop<4> >::value));
|
||||
assert((!asio::can_prefer<const object<1>, prop<2> >::value));
|
||||
assert((!asio::can_prefer<const object<1>, prop<2>, prop<3> >::value));
|
||||
assert((!asio::can_prefer<const object<1>, prop<2>, prop<3>, prop<4> >::value));
|
||||
}
|
@ -0,0 +1,52 @@
|
||||
//
|
||||
// cpp03/can_prefer_not_applicable_member_prefer.cpp
|
||||
// ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||
//
|
||||
// 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)
|
||||
//
|
||||
|
||||
#include "asio/prefer.hpp"
|
||||
#include <cassert>
|
||||
|
||||
template <int>
|
||||
struct prop
|
||||
{
|
||||
static const bool is_preferable = true;
|
||||
};
|
||||
|
||||
template <int>
|
||||
struct object
|
||||
{
|
||||
template <int N>
|
||||
object<N> prefer(prop<N>) const
|
||||
{
|
||||
return object<N>();
|
||||
}
|
||||
};
|
||||
|
||||
namespace asio {
|
||||
namespace traits {
|
||||
|
||||
template<int N, int M>
|
||||
struct prefer_member<object<N>, prop<M> >
|
||||
{
|
||||
static const bool is_valid = true;
|
||||
static const bool is_noexcept = true;
|
||||
typedef object<M> result_type;
|
||||
};
|
||||
|
||||
} // namespace traits
|
||||
} // namespace asio
|
||||
|
||||
int main()
|
||||
{
|
||||
assert((!asio::can_prefer<object<1>, prop<2> >::value));
|
||||
assert((!asio::can_prefer<object<1>, prop<2>, prop<3> >::value));
|
||||
assert((!asio::can_prefer<object<1>, prop<2>, prop<3>, prop<4> >::value));
|
||||
assert((!asio::can_prefer<const object<1>, prop<2> >::value));
|
||||
assert((!asio::can_prefer<const object<1>, prop<2>, prop<3> >::value));
|
||||
assert((!asio::can_prefer<const object<1>, prop<2>, prop<3>, prop<4> >::value));
|
||||
}
|
@ -0,0 +1,52 @@
|
||||
//
|
||||
// cpp03/can_prefer_not_applicable_member_require.cpp
|
||||
// ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||
//
|
||||
// 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)
|
||||
//
|
||||
|
||||
#include "asio/prefer.hpp"
|
||||
#include <cassert>
|
||||
|
||||
template <int>
|
||||
struct prop
|
||||
{
|
||||
static const bool is_preferable = true;
|
||||
};
|
||||
|
||||
template <int>
|
||||
struct object
|
||||
{
|
||||
template <int N>
|
||||
object<N> require(prop<N>) const
|
||||
{
|
||||
return object<N>();
|
||||
}
|
||||
};
|
||||
|
||||
namespace asio {
|
||||
namespace traits {
|
||||
|
||||
template<int N, int M>
|
||||
struct require_member<object<N>, prop<M> >
|
||||
{
|
||||
static const bool is_valid = true;
|
||||
static const bool is_noexcept = true;
|
||||
typedef object<M> result_type;
|
||||
};
|
||||
|
||||
} // namespace traits
|
||||
} // namespace asio
|
||||
|
||||
int main()
|
||||
{
|
||||
assert((!asio::can_prefer<object<1>, prop<2> >::value));
|
||||
assert((!asio::can_prefer<object<1>, prop<2>, prop<3> >::value));
|
||||
assert((!asio::can_prefer<object<1>, prop<2>, prop<3>, prop<4> >::value));
|
||||
assert((!asio::can_prefer<const object<1>, prop<2> >::value));
|
||||
assert((!asio::can_prefer<const object<1>, prop<2>, prop<3> >::value));
|
||||
assert((!asio::can_prefer<const object<1>, prop<2>, prop<3>, prop<4> >::value));
|
||||
}
|
@ -0,0 +1,45 @@
|
||||
//
|
||||
// cpp03/can_prefer_not_applicable_static.cpp
|
||||
// ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||
//
|
||||
// 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)
|
||||
//
|
||||
|
||||
#include "asio/prefer.hpp"
|
||||
#include <cassert>
|
||||
|
||||
template <int>
|
||||
struct prop
|
||||
{
|
||||
static const bool is_preferable = true;
|
||||
};
|
||||
|
||||
template <int>
|
||||
struct object
|
||||
{
|
||||
};
|
||||
|
||||
namespace asio {
|
||||
namespace traits {
|
||||
|
||||
template<int N>
|
||||
struct static_require<object<N>, prop<N> >
|
||||
{
|
||||
static const bool is_valid = true;
|
||||
};
|
||||
|
||||
} // namespace traits
|
||||
} // namespace asio
|
||||
|
||||
int main()
|
||||
{
|
||||
assert((!asio::can_prefer<object<1>, prop<1> >::value));
|
||||
assert((!asio::can_prefer<object<1>, prop<1>, prop<1> >::value));
|
||||
assert((!asio::can_prefer<object<1>, prop<1>, prop<1>, prop<1> >::value));
|
||||
assert((!asio::can_prefer<const object<1>, prop<1> >::value));
|
||||
assert((!asio::can_prefer<const object<1>, prop<1>, prop<1> >::value));
|
||||
assert((!asio::can_prefer<const object<1>, prop<1>, prop<1>, prop<1> >::value));
|
||||
}
|
@ -0,0 +1,33 @@
|
||||
//
|
||||
// cpp03/can_prefer_not_applicable_unsupported.cpp
|
||||
// ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||
//
|
||||
// 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)
|
||||
//
|
||||
|
||||
#include "asio/prefer.hpp"
|
||||
#include <cassert>
|
||||
|
||||
template <int>
|
||||
struct prop
|
||||
{
|
||||
static const bool is_preferable = true;
|
||||
};
|
||||
|
||||
template <int>
|
||||
struct object
|
||||
{
|
||||
};
|
||||
|
||||
int main()
|
||||
{
|
||||
assert((!asio::can_prefer<object<1>, prop<2> >::value));
|
||||
assert((!asio::can_prefer<object<1>, prop<2>, prop<3> >::value));
|
||||
assert((!asio::can_prefer<object<1>, prop<2>, prop<3>, prop<4> >::value));
|
||||
assert((!asio::can_prefer<const object<1>, prop<2> >::value));
|
||||
assert((!asio::can_prefer<const object<1>, prop<2>, prop<3> >::value));
|
||||
assert((!asio::can_prefer<const object<1>, prop<2>, prop<3>, prop<4> >::value));
|
||||
}
|
@ -0,0 +1,59 @@
|
||||
//
|
||||
// cpp03/can_prefer_not_preferable_free_prefer.cpp
|
||||
// ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||
//
|
||||
// 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)
|
||||
//
|
||||
|
||||
#include "asio/prefer.hpp"
|
||||
#include <cassert>
|
||||
|
||||
template <int>
|
||||
struct prop
|
||||
{
|
||||
static const bool is_preferable = false;
|
||||
};
|
||||
|
||||
template <int>
|
||||
struct object
|
||||
{
|
||||
template <int N>
|
||||
friend object<N> prefer(const object&, prop<N>)
|
||||
{
|
||||
return object<N>();
|
||||
}
|
||||
};
|
||||
|
||||
namespace asio {
|
||||
|
||||
template<int N, int M>
|
||||
struct is_applicable_property<object<N>, prop<M> >
|
||||
{
|
||||
static const bool value = true;
|
||||
};
|
||||
|
||||
namespace traits {
|
||||
|
||||
template<int N, int M>
|
||||
struct prefer_free<object<N>, prop<M> >
|
||||
{
|
||||
static const bool is_valid = true;
|
||||
static const bool is_noexcept = true;
|
||||
typedef object<M> result_type;
|
||||
};
|
||||
|
||||
} // namespace traits
|
||||
} // namespace asio
|
||||
|
||||
int main()
|
||||
{
|
||||
assert((!asio::can_prefer<object<1>, prop<2> >::value));
|
||||
assert((!asio::can_prefer<object<1>, prop<2>, prop<3> >::value));
|
||||
assert((!asio::can_prefer<object<1>, prop<2>, prop<3>, prop<4> >::value));
|
||||
assert((!asio::can_prefer<const object<1>, prop<2> >::value));
|
||||
assert((!asio::can_prefer<const object<1>, prop<2>, prop<3> >::value));
|
||||
assert((!asio::can_prefer<const object<1>, prop<2>, prop<3>, prop<4> >::value));
|
||||
}
|
@ -0,0 +1,59 @@
|
||||
//
|
||||
// cpp03/can_prefer_not_preferable_free_require.cpp
|
||||
// ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||
//
|
||||
// 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)
|
||||
//
|
||||
|
||||
#include "asio/prefer.hpp"
|
||||
#include <cassert>
|
||||
|
||||
template <int>
|
||||
struct prop
|
||||
{
|
||||
static const bool is_preferable = false;
|
||||
};
|
||||
|
||||
template <int>
|
||||
struct object
|
||||
{
|
||||
template <int N>
|
||||
friend object<N> require(const object&, prop<N>)
|
||||
{
|
||||
return object<N>();
|
||||
}
|
||||
};
|
||||
|
||||
namespace asio {
|
||||
|
||||
template<int N, int M>
|
||||
struct is_applicable_property<object<N>, prop<M> >
|
||||
{
|
||||
static const bool value = true;
|
||||
};
|
||||
|
||||
namespace traits {
|
||||
|
||||
template<int N, int M>
|
||||
struct require_free<object<N>, prop<M> >
|
||||
{
|
||||
static const bool is_valid = true;
|
||||
static const bool is_noexcept = true;
|
||||
typedef object<M> result_type;
|
||||
};
|
||||
|
||||
} // namespace traits
|
||||
} // namespace asio
|
||||
|
||||
int main()
|
||||
{
|
||||
assert((!asio::can_prefer<object<1>, prop<2> >::value));
|
||||
assert((!asio::can_prefer<object<1>, prop<2>, prop<3> >::value));
|
||||
assert((!asio::can_prefer<object<1>, prop<2>, prop<3>, prop<4> >::value));
|
||||
assert((!asio::can_prefer<const object<1>, prop<2> >::value));
|
||||
assert((!asio::can_prefer<const object<1>, prop<2>, prop<3> >::value));
|
||||
assert((!asio::can_prefer<const object<1>, prop<2>, prop<3>, prop<4> >::value));
|
||||
}
|
@ -0,0 +1,59 @@
|
||||
//
|
||||
// cpp03/can_prefer_not_preferable_member_prefer.cpp
|
||||
// ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||
//
|
||||
// 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)
|
||||
//
|
||||
|
||||
#include "asio/prefer.hpp"
|
||||
#include <cassert>
|
||||
|
||||
template <int>
|
||||
struct prop
|
||||
{
|
||||
static const bool is_preferable = false;
|
||||
};
|
||||
|
||||
template <int>
|
||||
struct object
|
||||
{
|
||||
template <int N>
|
||||
object<N> prefer(prop<N>) const
|
||||
{
|
||||
return object<N>();
|
||||
}
|
||||
};
|
||||
|
||||
namespace asio {
|
||||
|
||||
template<int N, int M>
|
||||
struct is_applicable_property<object<N>, prop<M> >
|
||||
{
|
||||
static const bool value = true;
|
||||
};
|
||||
|
||||
namespace traits {
|
||||
|
||||
template<int N, int M>
|
||||
struct prefer_member<object<N>, prop<M> >
|
||||
{
|
||||
static const bool is_valid = true;
|
||||
static const bool is_noexcept = true;
|
||||
typedef object<M> result_type;
|
||||
};
|
||||
|
||||
} // namespace traits
|
||||
} // namespace asio
|
||||
|
||||
int main()
|
||||
{
|
||||
assert((!asio::can_prefer<object<1>, prop<2> >::value));
|
||||
assert((!asio::can_prefer<object<1>, prop<2>, prop<3> >::value));
|
||||
assert((!asio::can_prefer<object<1>, prop<2>, prop<3>, prop<4> >::value));
|
||||
assert((!asio::can_prefer<const object<1>, prop<2> >::value));
|
||||
assert((!asio::can_prefer<const object<1>, prop<2>, prop<3> >::value));
|
||||
assert((!asio::can_prefer<const object<1>, prop<2>, prop<3>, prop<4> >::value));
|
||||
}
|
@ -0,0 +1,59 @@
|
||||
//
|
||||
// cpp03/can_prefer_not_preferable_member_require.cpp
|
||||
// ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||
//
|
||||
// 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)
|
||||
//
|
||||
|
||||
#include "asio/prefer.hpp"
|
||||
#include <cassert>
|
||||
|
||||
template <int>
|
||||
struct prop
|
||||
{
|
||||
static const bool is_preferable = false;
|
||||
};
|
||||
|
||||
template <int>
|
||||
struct object
|
||||
{
|
||||
template <int N>
|
||||
object<N> require(prop<N>) const
|
||||
{
|
||||
return object<N>();
|
||||
}
|
||||
};
|
||||
|
||||
namespace asio {
|
||||
|
||||
template<int N, int M>
|
||||
struct is_applicable_property<object<N>, prop<M> >
|
||||
{
|
||||
static const bool value = true;
|
||||
};
|
||||
|
||||
namespace traits {
|
||||
|
||||
template<int N, int M>
|
||||
struct require_member<object<N>, prop<M> >
|
||||
{
|
||||
static const bool is_valid = true;
|
||||
static const bool is_noexcept = true;
|
||||
typedef object<M> result_type;
|
||||
};
|
||||
|
||||
} // namespace traits
|
||||
} // namespace asio
|
||||
|
||||
int main()
|
||||
{
|
||||
assert((!asio::can_prefer<object<1>, prop<2> >::value));
|
||||
assert((!asio::can_prefer<object<1>, prop<2>, prop<3> >::value));
|
||||
assert((!asio::can_prefer<object<1>, prop<2>, prop<3>, prop<4> >::value));
|
||||
assert((!asio::can_prefer<const object<1>, prop<2> >::value));
|
||||
assert((!asio::can_prefer<const object<1>, prop<2>, prop<3> >::value));
|
||||
assert((!asio::can_prefer<const object<1>, prop<2>, prop<3>, prop<4> >::value));
|
||||
}
|
@ -0,0 +1,52 @@
|
||||
//
|
||||
// cpp03/can_prefer_not_preferable_static.cpp
|
||||
// ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||
//
|
||||
// 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)
|
||||
//
|
||||
|
||||
#include "asio/prefer.hpp"
|
||||
#include <cassert>
|
||||
|
||||
template <int>
|
||||
struct prop
|
||||
{
|
||||
static const bool is_preferable = false;
|
||||
};
|
||||
|
||||
template <int>
|
||||
struct object
|
||||
{
|
||||
};
|
||||
|
||||
namespace asio {
|
||||
|
||||
template<int N, int M>
|
||||
struct is_applicable_property<object<N>, prop<M> >
|
||||
{
|
||||
static const bool value = true;
|
||||
};
|
||||
|
||||
namespace traits {
|
||||
|
||||
template<int N>
|
||||
struct static_require<object<N>, prop<N> >
|
||||
{
|
||||
static const bool is_valid = true;
|
||||
};
|
||||
|
||||
} // namespace traits
|
||||
} // namespace asio
|
||||
|
||||
int main()
|
||||
{
|
||||
assert((!asio::can_prefer<object<1>, prop<1> >::value));
|
||||
assert((!asio::can_prefer<object<1>, prop<1>, prop<1> >::value));
|
||||
assert((!asio::can_prefer<object<1>, prop<1>, prop<1>, prop<1> >::value));
|
||||
assert((!asio::can_prefer<const object<1>, prop<1> >::value));
|
||||
assert((!asio::can_prefer<const object<1>, prop<1>, prop<1> >::value));
|
||||
assert((!asio::can_prefer<const object<1>, prop<1>, prop<1>, prop<1> >::value));
|
||||
}
|
@ -0,0 +1,43 @@
|
||||
//
|
||||
// cpp03/can_prefer_not_preferable_unsupported.cpp
|
||||
// ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||
//
|
||||
// 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)
|
||||
//
|
||||
|
||||
#include "asio/prefer.hpp"
|
||||
#include <cassert>
|
||||
|
||||
template <int>
|
||||
struct prop
|
||||
{
|
||||
static const bool is_preferable = false;
|
||||
};
|
||||
|
||||
template <int>
|
||||
struct object
|
||||
{
|
||||
};
|
||||
|
||||
namespace asio {
|
||||
|
||||
template<int N, int M>
|
||||
struct is_applicable_property<object<N>, prop<M> >
|
||||
{
|
||||
static const bool value = true;
|
||||
};
|
||||
|
||||
} // namespace asio
|
||||
|
||||
int main()
|
||||
{
|
||||
assert((!asio::can_prefer<object<1>, prop<2> >::value));
|
||||
assert((!asio::can_prefer<object<1>, prop<2>, prop<3> >::value));
|
||||
assert((!asio::can_prefer<object<1>, prop<2>, prop<3>, prop<4> >::value));
|
||||
assert((!asio::can_prefer<const object<1>, prop<2> >::value));
|
||||
assert((!asio::can_prefer<const object<1>, prop<2>, prop<3> >::value));
|
||||
assert((!asio::can_prefer<const object<1>, prop<2>, prop<3>, prop<4> >::value));
|
||||
}
|
52
asio/src/tests/properties/cpp03/can_prefer_static.cpp
Normal file
52
asio/src/tests/properties/cpp03/can_prefer_static.cpp
Normal file
@ -0,0 +1,52 @@
|
||||
//
|
||||
// cpp03/can_prefer_static.cpp
|
||||
// ~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||
//
|
||||
// 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)
|
||||
//
|
||||
|
||||
#include "asio/prefer.hpp"
|
||||
#include <cassert>
|
||||
|
||||
template <int>
|
||||
struct prop
|
||||
{
|
||||
static const bool is_preferable = true;
|
||||
};
|
||||
|
||||
template <int>
|
||||
struct object
|
||||
{
|
||||
};
|
||||
|
||||
namespace asio {
|
||||
|
||||
template<int N, int M>
|
||||
struct is_applicable_property<object<N>, prop<M> >
|
||||
{
|
||||
static const bool value = true;
|
||||
};
|
||||
|
||||
namespace traits {
|
||||
|
||||
template<int N>
|
||||
struct static_require<object<N>, prop<N> >
|
||||
{
|
||||
static const bool is_valid = true;
|
||||
};
|
||||
|
||||
} // namespace traits
|
||||
} // namespace asio
|
||||
|
||||
int main()
|
||||
{
|
||||
assert((asio::can_prefer<object<1>, prop<1> >::value));
|
||||
assert((asio::can_prefer<object<1>, prop<1>, prop<1> >::value));
|
||||
assert((asio::can_prefer<object<1>, prop<1>, prop<1>, prop<1> >::value));
|
||||
assert((asio::can_prefer<const object<1>, prop<1> >::value));
|
||||
assert((asio::can_prefer<const object<1>, prop<1>, prop<1> >::value));
|
||||
assert((asio::can_prefer<const object<1>, prop<1>, prop<1>, prop<1> >::value));
|
||||
}
|
43
asio/src/tests/properties/cpp03/can_prefer_unsupported.cpp
Normal file
43
asio/src/tests/properties/cpp03/can_prefer_unsupported.cpp
Normal file
@ -0,0 +1,43 @@
|
||||
//
|
||||
// cpp03/can_prefer_unsupported.cpp
|
||||
// ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||
//
|
||||
// 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)
|
||||
//
|
||||
|
||||
#include "asio/prefer.hpp"
|
||||
#include <cassert>
|
||||
|
||||
template <int>
|
||||
struct prop
|
||||
{
|
||||
static const bool is_preferable = true;
|
||||
};
|
||||
|
||||
template <int>
|
||||
struct object
|
||||
{
|
||||
};
|
||||
|
||||
namespace asio {
|
||||
|
||||
template<int N, int M>
|
||||
struct is_applicable_property<object<N>, prop<M> >
|
||||
{
|
||||
static const bool value = true;
|
||||
};
|
||||
|
||||
} // namespace asio
|
||||
|
||||
int main()
|
||||
{
|
||||
assert((asio::can_prefer<object<1>, prop<2> >::value));
|
||||
assert((asio::can_prefer<object<1>, prop<2>, prop<3> >::value));
|
||||
assert((asio::can_prefer<object<1>, prop<2>, prop<3>, prop<4> >::value));
|
||||
assert((asio::can_prefer<const object<1>, prop<2> >::value));
|
||||
assert((asio::can_prefer<const object<1>, prop<2>, prop<3> >::value));
|
||||
assert((asio::can_prefer<const object<1>, prop<2>, prop<3>, prop<4> >::value));
|
||||
}
|
48
asio/src/tests/properties/cpp03/can_query_free.cpp
Normal file
48
asio/src/tests/properties/cpp03/can_query_free.cpp
Normal file
@ -0,0 +1,48 @@
|
||||
//
|
||||
// cpp03/can_query_free.cpp
|
||||
// ~~~~~~~~~~~~~~~~~~~~~~~~
|
||||
//
|
||||
// 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)
|
||||
//
|
||||
|
||||
#include "asio/query.hpp"
|
||||
#include <cassert>
|
||||
|
||||
struct prop
|
||||
{
|
||||
};
|
||||
|
||||
struct object
|
||||
{
|
||||
friend int query(const object&, prop) { return 123; }
|
||||
};
|
||||
|
||||
namespace asio {
|
||||
|
||||
template<>
|
||||
struct is_applicable_property<object, prop>
|
||||
{
|
||||
static const bool value = true;
|
||||
};
|
||||
|
||||
namespace traits {
|
||||
|
||||
template<>
|
||||
struct query_free<object, prop>
|
||||
{
|
||||
static const bool is_valid = true;
|
||||
static const bool is_noexcept = true;
|
||||
typedef int result_type;
|
||||
};
|
||||
|
||||
} // namespace traits
|
||||
} // namespace asio
|
||||
|
||||
int main()
|
||||
{
|
||||
assert((asio::can_query<object, prop>::value));
|
||||
assert((asio::can_query<const object, prop>::value));
|
||||
}
|
48
asio/src/tests/properties/cpp03/can_query_member.cpp
Normal file
48
asio/src/tests/properties/cpp03/can_query_member.cpp
Normal file
@ -0,0 +1,48 @@
|
||||
//
|
||||
// cpp03/can_query_member.cpp
|
||||
// ~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||
//
|
||||
// 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)
|
||||
//
|
||||
|
||||
#include "asio/query.hpp"
|
||||
#include <cassert>
|
||||
|
||||
struct prop
|
||||
{
|
||||
};
|
||||
|
||||
struct object
|
||||
{
|
||||
int query(prop) const { return 123; }
|
||||
};
|
||||
|
||||
namespace asio {
|
||||
|
||||
template<>
|
||||
struct is_applicable_property<object, prop>
|
||||
{
|
||||
static const bool value = true;
|
||||
};
|
||||
|
||||
namespace traits {
|
||||
|
||||
template<>
|
||||
struct query_member<object, prop>
|
||||
{
|
||||
static const bool is_valid = true;
|
||||
static const bool is_noexcept = true;
|
||||
typedef int result_type;
|
||||
};
|
||||
|
||||
} // namespace traits
|
||||
} // namespace asio
|
||||
|
||||
int main()
|
||||
{
|
||||
assert((asio::can_query<object, prop>::value));
|
||||
assert((asio::can_query<const object, prop>::value));
|
||||
}
|
@ -0,0 +1,41 @@
|
||||
//
|
||||
// cpp03/can_query_not_applicable_free.cpp
|
||||
// ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||
//
|
||||
// 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)
|
||||
//
|
||||
|
||||
#include "asio/query.hpp"
|
||||
#include <cassert>
|
||||
|
||||
struct prop
|
||||
{
|
||||
};
|
||||
|
||||
struct object
|
||||
{
|
||||
friend int query(const object&, prop) { return 123; }
|
||||
};
|
||||
|
||||
namespace asio {
|
||||
namespace traits {
|
||||
|
||||
template<>
|
||||
struct query_free<object, prop>
|
||||
{
|
||||
static const bool is_valid = true;
|
||||
static const bool is_noexcept = true;
|
||||
typedef int result_type;
|
||||
};
|
||||
|
||||
} // namespace traits
|
||||
} // namespace asio
|
||||
|
||||
int main()
|
||||
{
|
||||
assert((!asio::can_query<object, prop>::value));
|
||||
assert((!asio::can_query<const object, prop>::value));
|
||||
}
|
@ -0,0 +1,41 @@
|
||||
//
|
||||
// cpp03/can_query_not_applicable_member.cpp
|
||||
// ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||
//
|
||||
// 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)
|
||||
//
|
||||
|
||||
#include "asio/query.hpp"
|
||||
#include <cassert>
|
||||
|
||||
struct prop
|
||||
{
|
||||
};
|
||||
|
||||
struct object
|
||||
{
|
||||
int query(prop) const { return 123; }
|
||||
};
|
||||
|
||||
namespace asio {
|
||||
namespace traits {
|
||||
|
||||
template<>
|
||||
struct query_member<object, prop>
|
||||
{
|
||||
static const bool is_valid = true;
|
||||
static const bool is_noexcept = true;
|
||||
typedef int result_type;
|
||||
};
|
||||
|
||||
} // namespace traits
|
||||
} // namespace asio
|
||||
|
||||
int main()
|
||||
{
|
||||
assert((!asio::can_query<object, prop>::value));
|
||||
assert((!asio::can_query<const object, prop>::value));
|
||||
}
|
@ -0,0 +1,41 @@
|
||||
//
|
||||
// cpp03/can_query_not_applicable_static.cpp
|
||||
// ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||
//
|
||||
// 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)
|
||||
//
|
||||
|
||||
#include "asio/query.hpp"
|
||||
#include <cassert>
|
||||
|
||||
struct prop
|
||||
{
|
||||
};
|
||||
|
||||
struct object
|
||||
{
|
||||
};
|
||||
|
||||
namespace asio {
|
||||
namespace traits {
|
||||
|
||||
template<>
|
||||
struct static_query<object, prop>
|
||||
{
|
||||
static const bool is_valid = true;
|
||||
static const bool is_noexcept = true;
|
||||
typedef int result_type;
|
||||
static int value() { return 123; }
|
||||
};
|
||||
|
||||
} // namespace traits
|
||||
} // namespace asio
|
||||
|
||||
int main()
|
||||
{
|
||||
assert((!asio::can_query<object, prop>::value));
|
||||
assert((!asio::can_query<const object, prop>::value));
|
||||
}
|
@ -0,0 +1,26 @@
|
||||
//
|
||||
// cpp03/can_query_not_applicable_unsupported.cpp
|
||||
// ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||
//
|
||||
// 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)
|
||||
//
|
||||
|
||||
#include "asio/query.hpp"
|
||||
#include <cassert>
|
||||
|
||||
struct prop
|
||||
{
|
||||
};
|
||||
|
||||
struct object
|
||||
{
|
||||
};
|
||||
|
||||
int main()
|
||||
{
|
||||
assert((!asio::can_query<object, prop>::value));
|
||||
assert((!asio::can_query<const object, prop>::value));
|
||||
}
|
48
asio/src/tests/properties/cpp03/can_query_static.cpp
Normal file
48
asio/src/tests/properties/cpp03/can_query_static.cpp
Normal file
@ -0,0 +1,48 @@
|
||||
//
|
||||
// cpp03/can_query_static.cpp
|
||||
// ~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||
//
|
||||
// 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)
|
||||
//
|
||||
|
||||
#include "asio/query.hpp"
|
||||
#include <cassert>
|
||||
|
||||
struct prop
|
||||
{
|
||||
};
|
||||
|
||||
struct object
|
||||
{
|
||||
};
|
||||
|
||||
namespace asio {
|
||||
|
||||
template<>
|
||||
struct is_applicable_property<object, prop>
|
||||
{
|
||||
static const bool value = true;
|
||||
};
|
||||
|
||||
namespace traits {
|
||||
|
||||
template<>
|
||||
struct static_query<object, prop>
|
||||
{
|
||||
static const bool is_valid = true;
|
||||
static const bool is_noexcept = true;
|
||||
typedef int result_type;
|
||||
static int value() { return 123; }
|
||||
};
|
||||
|
||||
} // namespace traits
|
||||
} // namespace asio
|
||||
|
||||
int main()
|
||||
{
|
||||
assert((asio::can_query<object, prop>::value));
|
||||
assert((asio::can_query<const object, prop>::value));
|
||||
}
|
36
asio/src/tests/properties/cpp03/can_query_unsupported.cpp
Normal file
36
asio/src/tests/properties/cpp03/can_query_unsupported.cpp
Normal file
@ -0,0 +1,36 @@
|
||||
//
|
||||
// cpp03/can_query_unsupported.cpp
|
||||
// ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||
//
|
||||
// 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)
|
||||
//
|
||||
|
||||
#include "asio/query.hpp"
|
||||
#include <cassert>
|
||||
|
||||
struct prop
|
||||
{
|
||||
};
|
||||
|
||||
struct object
|
||||
{
|
||||
};
|
||||
|
||||
namespace asio {
|
||||
|
||||
template <>
|
||||
struct is_applicable_property<object, prop>
|
||||
{
|
||||
static const bool value = true;
|
||||
};
|
||||
|
||||
} // namespace asio
|
||||
|
||||
int main()
|
||||
{
|
||||
assert((!asio::can_query<object, prop>::value));
|
||||
assert((!asio::can_query<const object, prop>::value));
|
||||
}
|
55
asio/src/tests/properties/cpp03/can_require_concept_free.cpp
Normal file
55
asio/src/tests/properties/cpp03/can_require_concept_free.cpp
Normal file
@ -0,0 +1,55 @@
|
||||
//
|
||||
// cpp03/can_require_concept_free.cpp
|
||||
// ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||
//
|
||||
// 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)
|
||||
//
|
||||
|
||||
#include "asio/require_concept.hpp"
|
||||
#include <cassert>
|
||||
|
||||
template <int>
|
||||
struct prop
|
||||
{
|
||||
static const bool is_requirable_concept = true;
|
||||
};
|
||||
|
||||
template <int>
|
||||
struct object
|
||||
{
|
||||
template <int N>
|
||||
friend object<N> require_concept(const object&, prop<N>)
|
||||
{
|
||||
return object<N>();
|
||||
}
|
||||
};
|
||||
|
||||
namespace asio {
|
||||
|
||||
template<int N, int M>
|
||||
struct is_applicable_property<object<N>, prop<M> >
|
||||
{
|
||||
static const bool value = true;
|
||||
};
|
||||
|
||||
namespace traits {
|
||||
|
||||
template<int N, int M>
|
||||
struct require_concept_free<object<N>, prop<M> >
|
||||
{
|
||||
static const bool is_valid = true;
|
||||
static const bool is_noexcept = true;
|
||||
typedef object<M> result_type;
|
||||
};
|
||||
|
||||
} // namespace traits
|
||||
} // namespace asio
|
||||
|
||||
int main()
|
||||
{
|
||||
assert((asio::can_require_concept<object<1>, prop<2> >::value));
|
||||
assert((asio::can_require_concept<const object<1>, prop<2> >::value));
|
||||
}
|
@ -0,0 +1,55 @@
|
||||
//
|
||||
// cpp03/can_require_concept_member.cpp
|
||||
// ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||
//
|
||||
// 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)
|
||||
//
|
||||
|
||||
#include "asio/require_concept.hpp"
|
||||
#include <cassert>
|
||||
|
||||
template <int>
|
||||
struct prop
|
||||
{
|
||||
static const bool is_requirable_concept = true;
|
||||
};
|
||||
|
||||
template <int>
|
||||
struct object
|
||||
{
|
||||
template <int N>
|
||||
object<N> require_concept(prop<N>) const
|
||||
{
|
||||
return object<N>();
|
||||
}
|
||||
};
|
||||
|
||||
namespace asio {
|
||||
|
||||
template<int N, int M>
|
||||
struct is_applicable_property<object<N>, prop<M> >
|
||||
{
|
||||
static const bool value = true;
|
||||
};
|
||||
|
||||
namespace traits {
|
||||
|
||||
template<int N, int M>
|
||||
struct require_concept_member<object<N>, prop<M> >
|
||||
{
|
||||
static const bool is_valid = true;
|
||||
static const bool is_noexcept = true;
|
||||
typedef object<M> result_type;
|
||||
};
|
||||
|
||||
} // namespace traits
|
||||
} // namespace asio
|
||||
|
||||
int main()
|
||||
{
|
||||
assert((asio::can_require_concept<object<1>, prop<2> >::value));
|
||||
assert((asio::can_require_concept<const object<1>, prop<2> >::value));
|
||||
}
|
@ -0,0 +1,48 @@
|
||||
//
|
||||
// cpp03/can_require_concept_not_applicable_free.cpp
|
||||
// ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||
//
|
||||
// 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)
|
||||
//
|
||||
|
||||
#include "asio/require_concept.hpp"
|
||||
#include <cassert>
|
||||
|
||||
template <int>
|
||||
struct prop
|
||||
{
|
||||
static const bool is_requirable_concept = true;
|
||||
};
|
||||
|
||||
template <int>
|
||||
struct object
|
||||
{
|
||||
template <int N>
|
||||
friend object<N> require_concept(const object&, prop<N>)
|
||||
{
|
||||
return object<N>();
|
||||
}
|
||||
};
|
||||
|
||||
namespace asio {
|
||||
namespace traits {
|
||||
|
||||
template<int N, int M>
|
||||
struct require_concept_free<object<N>, prop<M> >
|
||||
{
|
||||
static const bool is_valid = true;
|
||||
static const bool is_noexcept = true;
|
||||
typedef object<M> result_type;
|
||||
};
|
||||
|
||||
} // namespace traits
|
||||
} // namespace asio
|
||||
|
||||
int main()
|
||||
{
|
||||
assert((!asio::can_require_concept<object<1>, prop<2> >::value));
|
||||
assert((!asio::can_require_concept<const object<1>, prop<2> >::value));
|
||||
}
|
@ -0,0 +1,48 @@
|
||||
//
|
||||
// cpp03/can_require_concept_not_applicable_member.cpp
|
||||
// ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||
//
|
||||
// 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)
|
||||
//
|
||||
|
||||
#include "asio/require_concept.hpp"
|
||||
#include <cassert>
|
||||
|
||||
template <int>
|
||||
struct prop
|
||||
{
|
||||
static const bool is_requirable_concept = true;
|
||||
};
|
||||
|
||||
template <int>
|
||||
struct object
|
||||
{
|
||||
template <int N>
|
||||
object<N> require_concept(prop<N>) const
|
||||
{
|
||||
return object<N>();
|
||||
}
|
||||
};
|
||||
|
||||
namespace asio {
|
||||
namespace traits {
|
||||
|
||||
template<int N, int M>
|
||||
struct require_concept_member<object<N>, prop<M> >
|
||||
{
|
||||
static const bool is_valid = true;
|
||||
static const bool is_noexcept = true;
|
||||
typedef object<M> result_type;
|
||||
};
|
||||
|
||||
} // namespace traits
|
||||
} // namespace asio
|
||||
|
||||
int main()
|
||||
{
|
||||
assert((!asio::can_require_concept<object<1>, prop<2> >::value));
|
||||
assert((!asio::can_require_concept<const object<1>, prop<2> >::value));
|
||||
}
|
@ -0,0 +1,41 @@
|
||||
//
|
||||
// cpp03/can_require_concept_not_applicable_static.cpp
|
||||
// ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||
//
|
||||
// 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)
|
||||
//
|
||||
|
||||
#include "asio/require_concept.hpp"
|
||||
#include <cassert>
|
||||
|
||||
template <int>
|
||||
struct prop
|
||||
{
|
||||
static const bool is_requirable_concept = true;
|
||||
};
|
||||
|
||||
template <int>
|
||||
struct object
|
||||
{
|
||||
};
|
||||
|
||||
namespace asio {
|
||||
namespace traits {
|
||||
|
||||
template<int N>
|
||||
struct static_require_concept<object<N>, prop<N> >
|
||||
{
|
||||
static const bool is_valid = true;
|
||||
};
|
||||
|
||||
} // namespace traits
|
||||
} // namespace asio
|
||||
|
||||
int main()
|
||||
{
|
||||
assert((!asio::can_require_concept<object<1>, prop<2> >::value));
|
||||
assert((!asio::can_require_concept<const object<1>, prop<2> >::value));
|
||||
}
|
@ -0,0 +1,28 @@
|
||||
//
|
||||
// cpp03/can_require_concept_not_applicable_unsupported.cpp
|
||||
// ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||
//
|
||||
// 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)
|
||||
//
|
||||
|
||||
#include "asio/require_concept.hpp"
|
||||
#include <cassert>
|
||||
|
||||
template <int>
|
||||
struct prop
|
||||
{
|
||||
};
|
||||
|
||||
template <int>
|
||||
struct object
|
||||
{
|
||||
};
|
||||
|
||||
int main()
|
||||
{
|
||||
assert((!asio::can_require_concept<object<1>, prop<2> >::value));
|
||||
assert((!asio::can_require_concept<const object<1>, prop<2> >::value));
|
||||
}
|
@ -0,0 +1,48 @@
|
||||
//
|
||||
// cpp03/can_require_concept_static.cpp
|
||||
// ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||
//
|
||||
// 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)
|
||||
//
|
||||
|
||||
#include "asio/require_concept.hpp"
|
||||
#include <cassert>
|
||||
|
||||
template <int>
|
||||
struct prop
|
||||
{
|
||||
static const bool is_requirable_concept = true;
|
||||
};
|
||||
|
||||
template <int>
|
||||
struct object
|
||||
{
|
||||
};
|
||||
|
||||
namespace asio {
|
||||
|
||||
template<int N, int M>
|
||||
struct is_applicable_property<object<N>, prop<M> >
|
||||
{
|
||||
static const bool value = true;
|
||||
};
|
||||
|
||||
namespace traits {
|
||||
|
||||
template<int N>
|
||||
struct static_require_concept<object<N>, prop<N> >
|
||||
{
|
||||
static const bool is_valid = true;
|
||||
};
|
||||
|
||||
} // namespace traits
|
||||
} // namespace asio
|
||||
|
||||
int main()
|
||||
{
|
||||
assert((asio::can_require_concept<object<1>, prop<1> >::value));
|
||||
assert((asio::can_require_concept<const object<1>, prop<1> >::value));
|
||||
}
|
@ -0,0 +1,38 @@
|
||||
//
|
||||
// cpp03/can_require_concept_unsupported.cpp
|
||||
// ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||
//
|
||||
// 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)
|
||||
//
|
||||
|
||||
#include "asio/require_concept.hpp"
|
||||
#include <cassert>
|
||||
|
||||
template <int>
|
||||
struct prop
|
||||
{
|
||||
};
|
||||
|
||||
template <int>
|
||||
struct object
|
||||
{
|
||||
};
|
||||
|
||||
namespace asio {
|
||||
|
||||
template<int N, int M>
|
||||
struct is_applicable_property<object<N>, prop<M> >
|
||||
{
|
||||
static const bool value = true;
|
||||
};
|
||||
|
||||
} // namespace asio
|
||||
|
||||
int main()
|
||||
{
|
||||
assert((!asio::can_require_concept<object<1>, prop<2> >::value));
|
||||
assert((!asio::can_require_concept<const object<1>, prop<2> >::value));
|
||||
}
|
59
asio/src/tests/properties/cpp03/can_require_free.cpp
Normal file
59
asio/src/tests/properties/cpp03/can_require_free.cpp
Normal file
@ -0,0 +1,59 @@
|
||||
//
|
||||
// cpp03/can_require_free.cpp
|
||||
// ~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||
//
|
||||
// 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)
|
||||
//
|
||||
|
||||
#include "asio/require.hpp"
|
||||
#include <cassert>
|
||||
|
||||
template <int>
|
||||
struct prop
|
||||
{
|
||||
static const bool is_requirable = true;
|
||||
};
|
||||
|
||||
template <int>
|
||||
struct object
|
||||
{
|
||||
template <int N>
|
||||
friend object<N> require(const object&, prop<N>)
|
||||
{
|
||||
return object<N>();
|
||||
}
|
||||
};
|
||||
|
||||
namespace asio {
|
||||
|
||||
template<int N, int M>
|
||||
struct is_applicable_property<object<N>, prop<M> >
|
||||
{
|
||||
static const bool value = true;
|
||||
};
|
||||
|
||||
namespace traits {
|
||||
|
||||
template<int N, int M>
|
||||
struct require_free<object<N>, prop<M> >
|
||||
{
|
||||
static const bool is_valid = true;
|
||||
static const bool is_noexcept = true;
|
||||
typedef object<M> result_type;
|
||||
};
|
||||
|
||||
} // namespace traits
|
||||
} // namespace asio
|
||||
|
||||
int main()
|
||||
{
|
||||
assert((asio::can_require<object<1>, prop<2> >::value));
|
||||
assert((asio::can_require<object<1>, prop<2>, prop<3> >::value));
|
||||
assert((asio::can_require<object<1>, prop<2>, prop<3>, prop<4> >::value));
|
||||
assert((asio::can_require<const object<1>, prop<2> >::value));
|
||||
assert((asio::can_require<const object<1>, prop<2>, prop<3> >::value));
|
||||
assert((asio::can_require<const object<1>, prop<2>, prop<3>, prop<4> >::value));
|
||||
}
|
59
asio/src/tests/properties/cpp03/can_require_member.cpp
Normal file
59
asio/src/tests/properties/cpp03/can_require_member.cpp
Normal file
@ -0,0 +1,59 @@
|
||||
//
|
||||
// cpp03/can_require_member.cpp
|
||||
// ~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||
//
|
||||
// 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)
|
||||
//
|
||||
|
||||
#include "asio/require.hpp"
|
||||
#include <cassert>
|
||||
|
||||
template <int>
|
||||
struct prop
|
||||
{
|
||||
static const bool is_requirable = true;
|
||||
};
|
||||
|
||||
template <int>
|
||||
struct object
|
||||
{
|
||||
template <int N>
|
||||
object<N> require(prop<N>) const
|
||||
{
|
||||
return object<N>();
|
||||
}
|
||||
};
|
||||
|
||||
namespace asio {
|
||||
|
||||
template<int N, int M>
|
||||
struct is_applicable_property<object<N>, prop<M> >
|
||||
{
|
||||
static const bool value = true;
|
||||
};
|
||||
|
||||
namespace traits {
|
||||
|
||||
template<int N, int M>
|
||||
struct require_member<object<N>, prop<M> >
|
||||
{
|
||||
static const bool is_valid = true;
|
||||
static const bool is_noexcept = true;
|
||||
typedef object<M> result_type;
|
||||
};
|
||||
|
||||
} // namespace traits
|
||||
} // namespace asio
|
||||
|
||||
int main()
|
||||
{
|
||||
assert((asio::can_require<object<1>, prop<2> >::value));
|
||||
assert((asio::can_require<object<1>, prop<2>, prop<3> >::value));
|
||||
assert((asio::can_require<object<1>, prop<2>, prop<3>, prop<4> >::value));
|
||||
assert((asio::can_require<const object<1>, prop<2> >::value));
|
||||
assert((asio::can_require<const object<1>, prop<2>, prop<3> >::value));
|
||||
assert((asio::can_require<const object<1>, prop<2>, prop<3>, prop<4> >::value));
|
||||
}
|
@ -0,0 +1,52 @@
|
||||
//
|
||||
// cpp03/can_require_not_applicable_free.cpp
|
||||
// ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||
//
|
||||
// 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)
|
||||
//
|
||||
|
||||
#include "asio/require.hpp"
|
||||
#include <cassert>
|
||||
|
||||
template <int>
|
||||
struct prop
|
||||
{
|
||||
static const bool is_requirable = true;
|
||||
};
|
||||
|
||||
template <int>
|
||||
struct object
|
||||
{
|
||||
template <int N>
|
||||
friend object<N> require(const object&, prop<N>)
|
||||
{
|
||||
return object<N>();
|
||||
}
|
||||
};
|
||||
|
||||
namespace asio {
|
||||
namespace traits {
|
||||
|
||||
template<int N, int M>
|
||||
struct require_free<object<N>, prop<M> >
|
||||
{
|
||||
static const bool is_valid = true;
|
||||
static const bool is_noexcept = true;
|
||||
typedef object<M> result_type;
|
||||
};
|
||||
|
||||
} // namespace traits
|
||||
} // namespace asio
|
||||
|
||||
int main()
|
||||
{
|
||||
assert((!asio::can_require<object<1>, prop<2> >::value));
|
||||
assert((!asio::can_require<object<1>, prop<2>, prop<3> >::value));
|
||||
assert((!asio::can_require<object<1>, prop<2>, prop<3>, prop<4> >::value));
|
||||
assert((!asio::can_require<const object<1>, prop<2> >::value));
|
||||
assert((!asio::can_require<const object<1>, prop<2>, prop<3> >::value));
|
||||
assert((!asio::can_require<const object<1>, prop<2>, prop<3>, prop<4> >::value));
|
||||
}
|
@ -0,0 +1,52 @@
|
||||
//
|
||||
// cpp03/can_require_not_applicable_member.cpp
|
||||
// ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||
//
|
||||
// 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)
|
||||
//
|
||||
|
||||
#include "asio/require.hpp"
|
||||
#include <cassert>
|
||||
|
||||
template <int>
|
||||
struct prop
|
||||
{
|
||||
static const bool is_requirable = true;
|
||||
};
|
||||
|
||||
template <int>
|
||||
struct object
|
||||
{
|
||||
template <int N>
|
||||
object<N> require(prop<N>) const
|
||||
{
|
||||
return object<N>();
|
||||
}
|
||||
};
|
||||
|
||||
namespace asio {
|
||||
namespace traits {
|
||||
|
||||
template<int N, int M>
|
||||
struct require_member<object<N>, prop<M> >
|
||||
{
|
||||
static const bool is_valid = true;
|
||||
static const bool is_noexcept = true;
|
||||
typedef object<M> result_type;
|
||||
};
|
||||
|
||||
} // namespace traits
|
||||
} // namespace asio
|
||||
|
||||
int main()
|
||||
{
|
||||
assert((!asio::can_require<object<1>, prop<2> >::value));
|
||||
assert((!asio::can_require<object<1>, prop<2>, prop<3> >::value));
|
||||
assert((!asio::can_require<object<1>, prop<2>, prop<3>, prop<4> >::value));
|
||||
assert((!asio::can_require<const object<1>, prop<2> >::value));
|
||||
assert((!asio::can_require<const object<1>, prop<2>, prop<3> >::value));
|
||||
assert((!asio::can_require<const object<1>, prop<2>, prop<3>, prop<4> >::value));
|
||||
}
|
@ -0,0 +1,45 @@
|
||||
//
|
||||
// cpp03/can_require_not_applicable_static.cpp
|
||||
// ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||
//
|
||||
// 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)
|
||||
//
|
||||
|
||||
#include "asio/require.hpp"
|
||||
#include <cassert>
|
||||
|
||||
template <int>
|
||||
struct prop
|
||||
{
|
||||
static const bool is_requirable = true;
|
||||
};
|
||||
|
||||
template <int>
|
||||
struct object
|
||||
{
|
||||
};
|
||||
|
||||
namespace asio {
|
||||
namespace traits {
|
||||
|
||||
template<int N>
|
||||
struct static_require<object<N>, prop<N> >
|
||||
{
|
||||
static const bool is_valid = true;
|
||||
};
|
||||
|
||||
} // namespace traits
|
||||
} // namespace asio
|
||||
|
||||
int main()
|
||||
{
|
||||
assert((!asio::can_require<object<1>, prop<1> >::value));
|
||||
assert((!asio::can_require<object<1>, prop<1>, prop<1> >::value));
|
||||
assert((!asio::can_require<object<1>, prop<1>, prop<1>, prop<1> >::value));
|
||||
assert((!asio::can_require<const object<1>, prop<1> >::value));
|
||||
assert((!asio::can_require<const object<1>, prop<1>, prop<1> >::value));
|
||||
assert((!asio::can_require<const object<1>, prop<1>, prop<1>, prop<1> >::value));
|
||||
}
|
@ -0,0 +1,32 @@
|
||||
//
|
||||
// cpp03/can_require_not_applicable_unsupported.cpp
|
||||
// ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||
//
|
||||
// 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)
|
||||
//
|
||||
|
||||
#include "asio/require.hpp"
|
||||
#include <cassert>
|
||||
|
||||
template <int>
|
||||
struct prop
|
||||
{
|
||||
};
|
||||
|
||||
template <int>
|
||||
struct object
|
||||
{
|
||||
};
|
||||
|
||||
int main()
|
||||
{
|
||||
assert((!asio::can_require<object<1>, prop<2> >::value));
|
||||
assert((!asio::can_require<object<1>, prop<2>, prop<3> >::value));
|
||||
assert((!asio::can_require<object<1>, prop<2>, prop<3>, prop<4> >::value));
|
||||
assert((!asio::can_require<const object<1>, prop<2> >::value));
|
||||
assert((!asio::can_require<const object<1>, prop<2>, prop<3> >::value));
|
||||
assert((!asio::can_require<const object<1>, prop<2>, prop<3>, prop<4> >::value));
|
||||
}
|
52
asio/src/tests/properties/cpp03/can_require_static.cpp
Normal file
52
asio/src/tests/properties/cpp03/can_require_static.cpp
Normal file
@ -0,0 +1,52 @@
|
||||
//
|
||||
// cpp03/can_require_static.cpp
|
||||
// ~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||
//
|
||||
// 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)
|
||||
//
|
||||
|
||||
#include "asio/require.hpp"
|
||||
#include <cassert>
|
||||
|
||||
template <int>
|
||||
struct prop
|
||||
{
|
||||
static const bool is_requirable = true;
|
||||
};
|
||||
|
||||
template <int>
|
||||
struct object
|
||||
{
|
||||
};
|
||||
|
||||
namespace asio {
|
||||
|
||||
template<int N, int M>
|
||||
struct is_applicable_property<object<N>, prop<M> >
|
||||
{
|
||||
static const bool value = true;
|
||||
};
|
||||
|
||||
namespace traits {
|
||||
|
||||
template<int N>
|
||||
struct static_require<object<N>, prop<N> >
|
||||
{
|
||||
static const bool is_valid = true;
|
||||
};
|
||||
|
||||
} // namespace traits
|
||||
} // namespace asio
|
||||
|
||||
int main()
|
||||
{
|
||||
assert((asio::can_require<object<1>, prop<1> >::value));
|
||||
assert((asio::can_require<object<1>, prop<1>, prop<1> >::value));
|
||||
assert((asio::can_require<object<1>, prop<1>, prop<1>, prop<1> >::value));
|
||||
assert((asio::can_require<const object<1>, prop<1> >::value));
|
||||
assert((asio::can_require<const object<1>, prop<1>, prop<1> >::value));
|
||||
assert((asio::can_require<const object<1>, prop<1>, prop<1>, prop<1> >::value));
|
||||
}
|
42
asio/src/tests/properties/cpp03/can_require_unsupported.cpp
Normal file
42
asio/src/tests/properties/cpp03/can_require_unsupported.cpp
Normal file
@ -0,0 +1,42 @@
|
||||
//
|
||||
// cpp03/can_require_unsupported.cpp
|
||||
// ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||
//
|
||||
// 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)
|
||||
//
|
||||
|
||||
#include "asio/require.hpp"
|
||||
#include <cassert>
|
||||
|
||||
template <int>
|
||||
struct prop
|
||||
{
|
||||
};
|
||||
|
||||
template <int>
|
||||
struct object
|
||||
{
|
||||
};
|
||||
|
||||
namespace asio {
|
||||
|
||||
template<int N, int M>
|
||||
struct is_applicable_property<object<N>, prop<M> >
|
||||
{
|
||||
static const bool value = true;
|
||||
};
|
||||
|
||||
} // namespace asio
|
||||
|
||||
int main()
|
||||
{
|
||||
assert((!asio::can_require<object<1>, prop<2> >::value));
|
||||
assert((!asio::can_require<object<1>, prop<2>, prop<3> >::value));
|
||||
assert((!asio::can_require<object<1>, prop<2>, prop<3>, prop<4> >::value));
|
||||
assert((!asio::can_require<const object<1>, prop<2> >::value));
|
||||
assert((!asio::can_require<const object<1>, prop<2>, prop<3> >::value));
|
||||
assert((!asio::can_require<const object<1>, prop<2>, prop<3>, prop<4> >::value));
|
||||
}
|
68
asio/src/tests/properties/cpp03/prefer_free_prefer.cpp
Normal file
68
asio/src/tests/properties/cpp03/prefer_free_prefer.cpp
Normal file
@ -0,0 +1,68 @@
|
||||
//
|
||||
// cpp03/prefer_free_prefer.cpp
|
||||
// ~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||
//
|
||||
// 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)
|
||||
//
|
||||
|
||||
#include "asio/prefer.hpp"
|
||||
#include <cassert>
|
||||
|
||||
template <int>
|
||||
struct prop
|
||||
{
|
||||
static const bool is_preferable = true;
|
||||
};
|
||||
|
||||
template <int>
|
||||
struct object
|
||||
{
|
||||
template <int N>
|
||||
friend object<N> prefer(const object&, prop<N>)
|
||||
{
|
||||
return object<N>();
|
||||
}
|
||||
};
|
||||
|
||||
namespace asio {
|
||||
|
||||
template<int N, int M>
|
||||
struct is_applicable_property<object<N>, prop<M> >
|
||||
{
|
||||
static const bool value = true;
|
||||
};
|
||||
|
||||
namespace traits {
|
||||
|
||||
template<int N, int M>
|
||||
struct prefer_free<object<N>, prop<M> >
|
||||
{
|
||||
static const bool is_valid = true;
|
||||
static const bool is_noexcept = true;
|
||||
typedef object<M> result_type;
|
||||
};
|
||||
|
||||
} // namespace traits
|
||||
} // namespace asio
|
||||
|
||||
int main()
|
||||
{
|
||||
object<1> o1 = {};
|
||||
object<2> o2 = asio::prefer(o1, prop<2>());
|
||||
object<3> o3 = asio::prefer(o1, prop<2>(), prop<3>());
|
||||
object<4> o4 = asio::prefer(o1, prop<2>(), prop<3>(), prop<4>());
|
||||
(void)o2;
|
||||
(void)o3;
|
||||
(void)o4;
|
||||
|
||||
const object<1> o5 = {};
|
||||
object<2> o6 = asio::prefer(o5, prop<2>());
|
||||
object<3> o7 = asio::prefer(o5, prop<2>(), prop<3>());
|
||||
object<4> o8 = asio::prefer(o5, prop<2>(), prop<3>(), prop<4>());
|
||||
(void)o6;
|
||||
(void)o7;
|
||||
(void)o8;
|
||||
}
|
68
asio/src/tests/properties/cpp03/prefer_free_require.cpp
Normal file
68
asio/src/tests/properties/cpp03/prefer_free_require.cpp
Normal file
@ -0,0 +1,68 @@
|
||||
//
|
||||
// cpp03/prefer_free_require.cpp
|
||||
// ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||
//
|
||||
// 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)
|
||||
//
|
||||
|
||||
#include "asio/prefer.hpp"
|
||||
#include <cassert>
|
||||
|
||||
template <int>
|
||||
struct prop
|
||||
{
|
||||
static const bool is_preferable = true;
|
||||
};
|
||||
|
||||
template <int>
|
||||
struct object
|
||||
{
|
||||
template <int N>
|
||||
friend object<N> require(const object&, prop<N>)
|
||||
{
|
||||
return object<N>();
|
||||
}
|
||||
};
|
||||
|
||||
namespace asio {
|
||||
|
||||
template<int N, int M>
|
||||
struct is_applicable_property<object<N>, prop<M> >
|
||||
{
|
||||
static const bool value = true;
|
||||
};
|
||||
|
||||
namespace traits {
|
||||
|
||||
template<int N, int M>
|
||||
struct require_free<object<N>, prop<M> >
|
||||
{
|
||||
static const bool is_valid = true;
|
||||
static const bool is_noexcept = true;
|
||||
typedef object<M> result_type;
|
||||
};
|
||||
|
||||
} // namespace traits
|
||||
} // namespace asio
|
||||
|
||||
int main()
|
||||
{
|
||||
object<1> o1 = {};
|
||||
object<2> o2 = asio::prefer(o1, prop<2>());
|
||||
object<3> o3 = asio::prefer(o1, prop<2>(), prop<3>());
|
||||
object<4> o4 = asio::prefer(o1, prop<2>(), prop<3>(), prop<4>());
|
||||
(void)o2;
|
||||
(void)o3;
|
||||
(void)o4;
|
||||
|
||||
const object<1> o5 = {};
|
||||
object<2> o6 = asio::prefer(o5, prop<2>());
|
||||
object<3> o7 = asio::prefer(o5, prop<2>(), prop<3>());
|
||||
object<4> o8 = asio::prefer(o5, prop<2>(), prop<3>(), prop<4>());
|
||||
(void)o6;
|
||||
(void)o7;
|
||||
(void)o8;
|
||||
}
|
68
asio/src/tests/properties/cpp03/prefer_member_prefer.cpp
Normal file
68
asio/src/tests/properties/cpp03/prefer_member_prefer.cpp
Normal file
@ -0,0 +1,68 @@
|
||||
//
|
||||
// cpp03/prefer_member_prefer.cpp
|
||||
// ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||
//
|
||||
// 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)
|
||||
//
|
||||
|
||||
#include "asio/prefer.hpp"
|
||||
#include <cassert>
|
||||
|
||||
template <int>
|
||||
struct prop
|
||||
{
|
||||
static const bool is_preferable = true;
|
||||
};
|
||||
|
||||
template <int>
|
||||
struct object
|
||||
{
|
||||
template <int N>
|
||||
object<N> prefer(prop<N>) const
|
||||
{
|
||||
return object<N>();
|
||||
}
|
||||
};
|
||||
|
||||
namespace asio {
|
||||
|
||||
template<int N, int M>
|
||||
struct is_applicable_property<object<N>, prop<M> >
|
||||
{
|
||||
static const bool value = true;
|
||||
};
|
||||
|
||||
namespace traits {
|
||||
|
||||
template<int N, int M>
|
||||
struct prefer_member<object<N>, prop<M> >
|
||||
{
|
||||
static const bool is_valid = true;
|
||||
static const bool is_noexcept = true;
|
||||
typedef object<M> result_type;
|
||||
};
|
||||
|
||||
} // namespace traits
|
||||
} // namespace asio
|
||||
|
||||
int main()
|
||||
{
|
||||
object<1> o1 = {};
|
||||
object<2> o2 = asio::prefer(o1, prop<2>());
|
||||
object<3> o3 = asio::prefer(o1, prop<2>(), prop<3>());
|
||||
object<4> o4 = asio::prefer(o1, prop<2>(), prop<3>(), prop<4>());
|
||||
(void)o2;
|
||||
(void)o3;
|
||||
(void)o4;
|
||||
|
||||
const object<1> o5 = {};
|
||||
object<2> o6 = asio::prefer(o5, prop<2>());
|
||||
object<3> o7 = asio::prefer(o5, prop<2>(), prop<3>());
|
||||
object<4> o8 = asio::prefer(o5, prop<2>(), prop<3>(), prop<4>());
|
||||
(void)o6;
|
||||
(void)o7;
|
||||
(void)o8;
|
||||
}
|
68
asio/src/tests/properties/cpp03/prefer_member_require.cpp
Normal file
68
asio/src/tests/properties/cpp03/prefer_member_require.cpp
Normal file
@ -0,0 +1,68 @@
|
||||
//
|
||||
// cpp03/prefer_member_require.cpp
|
||||
// ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||
//
|
||||
// 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)
|
||||
//
|
||||
|
||||
#include "asio/prefer.hpp"
|
||||
#include <cassert>
|
||||
|
||||
template <int>
|
||||
struct prop
|
||||
{
|
||||
static const bool is_preferable = true;
|
||||
};
|
||||
|
||||
template <int>
|
||||
struct object
|
||||
{
|
||||
template <int N>
|
||||
object<N> require(prop<N>) const
|
||||
{
|
||||
return object<N>();
|
||||
}
|
||||
};
|
||||
|
||||
namespace asio {
|
||||
|
||||
template<int N, int M>
|
||||
struct is_applicable_property<object<N>, prop<M> >
|
||||
{
|
||||
static const bool value = true;
|
||||
};
|
||||
|
||||
namespace traits {
|
||||
|
||||
template<int N, int M>
|
||||
struct require_member<object<N>, prop<M> >
|
||||
{
|
||||
static const bool is_valid = true;
|
||||
static const bool is_noexcept = true;
|
||||
typedef object<M> result_type;
|
||||
};
|
||||
|
||||
} // namespace traits
|
||||
} // namespace asio
|
||||
|
||||
int main()
|
||||
{
|
||||
object<1> o1 = {};
|
||||
object<2> o2 = asio::prefer(o1, prop<2>());
|
||||
object<3> o3 = asio::prefer(o1, prop<2>(), prop<3>());
|
||||
object<4> o4 = asio::prefer(o1, prop<2>(), prop<3>(), prop<4>());
|
||||
(void)o2;
|
||||
(void)o3;
|
||||
(void)o4;
|
||||
|
||||
const object<1> o5 = {};
|
||||
object<2> o6 = asio::prefer(o5, prop<2>());
|
||||
object<3> o7 = asio::prefer(o5, prop<2>(), prop<3>());
|
||||
object<4> o8 = asio::prefer(o5, prop<2>(), prop<3>(), prop<4>());
|
||||
(void)o6;
|
||||
(void)o7;
|
||||
(void)o8;
|
||||
}
|
61
asio/src/tests/properties/cpp03/prefer_static.cpp
Normal file
61
asio/src/tests/properties/cpp03/prefer_static.cpp
Normal file
@ -0,0 +1,61 @@
|
||||
//
|
||||
// cpp03/prefer_static.cpp
|
||||
// ~~~~~~~~~~~~~~~~~~~~~~~
|
||||
//
|
||||
// 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)
|
||||
//
|
||||
|
||||
#include "asio/prefer.hpp"
|
||||
#include <cassert>
|
||||
|
||||
template <int>
|
||||
struct prop
|
||||
{
|
||||
static const bool is_preferable = true;
|
||||
};
|
||||
|
||||
template <int>
|
||||
struct object
|
||||
{
|
||||
};
|
||||
|
||||
namespace asio {
|
||||
|
||||
template<int N, int M>
|
||||
struct is_applicable_property<object<N>, prop<M> >
|
||||
{
|
||||
static const bool value = true;
|
||||
};
|
||||
|
||||
namespace traits {
|
||||
|
||||
template<int N>
|
||||
struct static_require<object<N>, prop<N> >
|
||||
{
|
||||
static const bool is_valid = true;
|
||||
};
|
||||
|
||||
} // namespace traits
|
||||
} // namespace asio
|
||||
|
||||
int main()
|
||||
{
|
||||
object<1> o1 = {};
|
||||
object<1> o2 = asio::prefer(o1, prop<1>());
|
||||
object<1> o3 = asio::prefer(o1, prop<1>(), prop<1>());
|
||||
object<1> o4 = asio::prefer(o1, prop<1>(), prop<1>(), prop<1>());
|
||||
(void)o2;
|
||||
(void)o3;
|
||||
(void)o4;
|
||||
|
||||
const object<1> o5 = {};
|
||||
object<1> o6 = asio::prefer(o5, prop<1>());
|
||||
object<1> o7 = asio::prefer(o5, prop<1>(), prop<1>());
|
||||
object<1> o8 = asio::prefer(o5, prop<1>(), prop<1>(), prop<1>());
|
||||
(void)o6;
|
||||
(void)o7;
|
||||
(void)o8;
|
||||
}
|
46
asio/src/tests/properties/cpp03/prefer_unsupported.cpp
Normal file
46
asio/src/tests/properties/cpp03/prefer_unsupported.cpp
Normal file
@ -0,0 +1,46 @@
|
||||
//
|
||||
// cpp03/prefer_unsupported.cpp
|
||||
// ~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||
//
|
||||
// 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)
|
||||
//
|
||||
|
||||
#include "asio/prefer.hpp"
|
||||
#include <cassert>
|
||||
|
||||
template <int>
|
||||
struct prop
|
||||
{
|
||||
static const bool is_preferable = true;
|
||||
};
|
||||
|
||||
template <int>
|
||||
struct object
|
||||
{
|
||||
};
|
||||
|
||||
namespace asio {
|
||||
|
||||
template<int N, int M>
|
||||
struct is_applicable_property<object<N>, prop<M> >
|
||||
{
|
||||
static const bool value = true;
|
||||
};
|
||||
|
||||
} // namespace asio
|
||||
|
||||
int main()
|
||||
{
|
||||
object<1> o1 = {};
|
||||
const object<1>& o2 = asio::prefer(o1, prop<1>());
|
||||
assert(&o1 == &o2);
|
||||
(void)o2;
|
||||
|
||||
const object<1> o3 = {};
|
||||
const object<1>& o4 = asio::prefer(o3, prop<1>());
|
||||
assert(&o3 == &o4);
|
||||
(void)o4;
|
||||
}
|
55
asio/src/tests/properties/cpp03/query_free.cpp
Normal file
55
asio/src/tests/properties/cpp03/query_free.cpp
Normal file
@ -0,0 +1,55 @@
|
||||
//
|
||||
// cpp03/query_free.cpp
|
||||
// ~~~~~~~~~~~~~~~~~~~~
|
||||
//
|
||||
// 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)
|
||||
//
|
||||
|
||||
#include "asio/query.hpp"
|
||||
#include <cassert>
|
||||
|
||||
struct prop
|
||||
{
|
||||
};
|
||||
|
||||
struct object
|
||||
{
|
||||
friend int query(const object&, prop) { return 123; }
|
||||
};
|
||||
|
||||
namespace asio {
|
||||
|
||||
template<>
|
||||
struct is_applicable_property<object, prop>
|
||||
{
|
||||
static const bool value = true;
|
||||
};
|
||||
|
||||
namespace traits {
|
||||
|
||||
template<>
|
||||
struct query_free<object, prop>
|
||||
{
|
||||
static const bool is_valid = true;
|
||||
static const bool is_noexcept = true;
|
||||
typedef int result_type;
|
||||
};
|
||||
|
||||
} // namespace traits
|
||||
} // namespace asio
|
||||
|
||||
int main()
|
||||
{
|
||||
object o1 = {};
|
||||
int result1 = asio::query(o1, prop());
|
||||
assert(result1 == 123);
|
||||
(void)result1;
|
||||
|
||||
const object o2 = {};
|
||||
int result2 = asio::query(o2, prop());
|
||||
assert(result2 == 123);
|
||||
(void)result2;
|
||||
}
|
55
asio/src/tests/properties/cpp03/query_member.cpp
Normal file
55
asio/src/tests/properties/cpp03/query_member.cpp
Normal file
@ -0,0 +1,55 @@
|
||||
//
|
||||
// cpp03/query_member.cpp
|
||||
// ~~~~~~~~~~~~~~~~~~~~~~
|
||||
//
|
||||
// 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)
|
||||
//
|
||||
|
||||
#include "asio/query.hpp"
|
||||
#include <cassert>
|
||||
|
||||
struct prop
|
||||
{
|
||||
};
|
||||
|
||||
struct object
|
||||
{
|
||||
int query(prop) const { return 123; }
|
||||
};
|
||||
|
||||
namespace asio {
|
||||
|
||||
template<>
|
||||
struct is_applicable_property<object, prop>
|
||||
{
|
||||
static const bool value = true;
|
||||
};
|
||||
|
||||
namespace traits {
|
||||
|
||||
template<>
|
||||
struct query_member<object, prop>
|
||||
{
|
||||
static const bool is_valid = true;
|
||||
static const bool is_noexcept = true;
|
||||
typedef int result_type;
|
||||
};
|
||||
|
||||
} // namespace traits
|
||||
} // namespace asio
|
||||
|
||||
int main()
|
||||
{
|
||||
object o1 = {};
|
||||
int result1 = asio::query(o1, prop());
|
||||
assert(result1 == 123);
|
||||
(void)result1;
|
||||
|
||||
const object o2 = {};
|
||||
int result2 = asio::query(o2, prop());
|
||||
assert(result2 == 123);
|
||||
(void)result2;
|
||||
}
|
55
asio/src/tests/properties/cpp03/query_static.cpp
Normal file
55
asio/src/tests/properties/cpp03/query_static.cpp
Normal file
@ -0,0 +1,55 @@
|
||||
//
|
||||
// cpp03/query_static.cpp
|
||||
// ~~~~~~~~~~~~~~~~~~~~~~
|
||||
//
|
||||
// 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)
|
||||
//
|
||||
|
||||
#include "asio/query.hpp"
|
||||
#include <cassert>
|
||||
|
||||
struct prop
|
||||
{
|
||||
};
|
||||
|
||||
struct object
|
||||
{
|
||||
};
|
||||
|
||||
namespace asio {
|
||||
|
||||
template<>
|
||||
struct is_applicable_property<object, prop>
|
||||
{
|
||||
static const bool value = true;
|
||||
};
|
||||
|
||||
namespace traits {
|
||||
|
||||
template<>
|
||||
struct static_query<object, prop>
|
||||
{
|
||||
static const bool is_valid = true;
|
||||
static const bool is_noexcept = true;
|
||||
typedef int result_type;
|
||||
static int value() { return 123; }
|
||||
};
|
||||
|
||||
} // namespace traits
|
||||
} // namespace asio
|
||||
|
||||
int main()
|
||||
{
|
||||
object o1 = {};
|
||||
int result1 = asio::query(o1, prop());
|
||||
assert(result1 == 123);
|
||||
(void)result1;
|
||||
|
||||
const object o2 = {};
|
||||
int result2 = asio::query(o2, prop());
|
||||
assert(result2 == 123);
|
||||
(void)result2;
|
||||
}
|
60
asio/src/tests/properties/cpp03/require_concept_free.cpp
Normal file
60
asio/src/tests/properties/cpp03/require_concept_free.cpp
Normal file
@ -0,0 +1,60 @@
|
||||
//
|
||||
// cpp03/require_concept_free.cpp
|
||||
// ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||
//
|
||||
// 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)
|
||||
//
|
||||
|
||||
#include "asio/require_concept.hpp"
|
||||
#include <cassert>
|
||||
|
||||
template <int>
|
||||
struct prop
|
||||
{
|
||||
static const bool is_requirable_concept = true;
|
||||
};
|
||||
|
||||
template <int>
|
||||
struct object
|
||||
{
|
||||
template <int N>
|
||||
friend object<N> require_concept(const object&, prop<N>)
|
||||
{
|
||||
return object<N>();
|
||||
}
|
||||
};
|
||||
|
||||
namespace asio {
|
||||
|
||||
template<int N, int M>
|
||||
struct is_applicable_property<object<N>, prop<M> >
|
||||
{
|
||||
static const bool value = true;
|
||||
};
|
||||
|
||||
namespace traits {
|
||||
|
||||
template<int N, int M>
|
||||
struct require_concept_free<object<N>, prop<M> >
|
||||
{
|
||||
static const bool is_valid = true;
|
||||
static const bool is_noexcept = true;
|
||||
typedef object<M> result_type;
|
||||
};
|
||||
|
||||
} // namespace traits
|
||||
} // namespace asio
|
||||
|
||||
int main()
|
||||
{
|
||||
object<1> o1 = {};
|
||||
object<2> o2 = asio::require_concept(o1, prop<2>());
|
||||
(void)o2;
|
||||
|
||||
const object<1> o3 = {};
|
||||
object<2> o4 = asio::require_concept(o3, prop<2>());
|
||||
(void)o4;
|
||||
}
|
60
asio/src/tests/properties/cpp03/require_concept_member.cpp
Normal file
60
asio/src/tests/properties/cpp03/require_concept_member.cpp
Normal file
@ -0,0 +1,60 @@
|
||||
//
|
||||
// cpp03/require_concept_member.cpp
|
||||
// ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||
//
|
||||
// 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)
|
||||
//
|
||||
|
||||
#include "asio/require_concept.hpp"
|
||||
#include <cassert>
|
||||
|
||||
template <int>
|
||||
struct prop
|
||||
{
|
||||
static const bool is_requirable_concept = true;
|
||||
};
|
||||
|
||||
template <int>
|
||||
struct object
|
||||
{
|
||||
template <int N>
|
||||
object<N> require_concept(prop<N>) const
|
||||
{
|
||||
return object<N>();
|
||||
}
|
||||
};
|
||||
|
||||
namespace asio {
|
||||
|
||||
template<int N, int M>
|
||||
struct is_applicable_property<object<N>, prop<M> >
|
||||
{
|
||||
static const bool value = true;
|
||||
};
|
||||
|
||||
namespace traits {
|
||||
|
||||
template<int N, int M>
|
||||
struct require_concept_member<object<N>, prop<M> >
|
||||
{
|
||||
static const bool is_valid = true;
|
||||
static const bool is_noexcept = true;
|
||||
typedef object<M> result_type;
|
||||
};
|
||||
|
||||
} // namespace traits
|
||||
} // namespace asio
|
||||
|
||||
int main()
|
||||
{
|
||||
object<1> o1 = {};
|
||||
object<2> o2 = asio::require_concept(o1, prop<2>());
|
||||
(void)o2;
|
||||
|
||||
const object<1> o3 = {};
|
||||
object<2> o4 = asio::require_concept(o3, prop<2>());
|
||||
(void)o4;
|
||||
}
|
55
asio/src/tests/properties/cpp03/require_concept_static.cpp
Normal file
55
asio/src/tests/properties/cpp03/require_concept_static.cpp
Normal file
@ -0,0 +1,55 @@
|
||||
//
|
||||
// cpp03/require_concept_static.cpp
|
||||
// ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||
//
|
||||
// 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)
|
||||
//
|
||||
|
||||
#include "asio/require_concept.hpp"
|
||||
#include <cassert>
|
||||
|
||||
template <int>
|
||||
struct prop
|
||||
{
|
||||
static const bool is_requirable_concept = true;
|
||||
};
|
||||
|
||||
template <int>
|
||||
struct object
|
||||
{
|
||||
};
|
||||
|
||||
namespace asio {
|
||||
|
||||
template<int N, int M>
|
||||
struct is_applicable_property<object<N>, prop<M> >
|
||||
{
|
||||
static const bool value = true;
|
||||
};
|
||||
|
||||
namespace traits {
|
||||
|
||||
template<int N>
|
||||
struct static_require_concept<object<N>, prop<N> >
|
||||
{
|
||||
static const bool is_valid = true;
|
||||
};
|
||||
|
||||
} // namespace traits
|
||||
} // namespace asio
|
||||
|
||||
int main()
|
||||
{
|
||||
object<1> o1 = {};
|
||||
const object<1>& o2 = asio::require_concept(o1, prop<1>());
|
||||
assert(&o1 == &o2);
|
||||
(void)o2;
|
||||
|
||||
const object<1> o3 = {};
|
||||
const object<1>& o4 = asio::require_concept(o3, prop<1>());
|
||||
assert(&o3 == &o4);
|
||||
(void)o4;
|
||||
}
|
68
asio/src/tests/properties/cpp03/require_free.cpp
Normal file
68
asio/src/tests/properties/cpp03/require_free.cpp
Normal file
@ -0,0 +1,68 @@
|
||||
//
|
||||
// cpp03/require_free.cpp
|
||||
// ~~~~~~~~~~~~~~~~~~~~~~
|
||||
//
|
||||
// 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)
|
||||
//
|
||||
|
||||
#include "asio/require.hpp"
|
||||
#include <cassert>
|
||||
|
||||
template <int>
|
||||
struct prop
|
||||
{
|
||||
static const bool is_requirable = true;
|
||||
};
|
||||
|
||||
template <int>
|
||||
struct object
|
||||
{
|
||||
template <int N>
|
||||
friend object<N> require(const object&, prop<N>)
|
||||
{
|
||||
return object<N>();
|
||||
}
|
||||
};
|
||||
|
||||
namespace asio {
|
||||
|
||||
template<int N, int M>
|
||||
struct is_applicable_property<object<N>, prop<M> >
|
||||
{
|
||||
static const bool value = true;
|
||||
};
|
||||
|
||||
namespace traits {
|
||||
|
||||
template<int N, int M>
|
||||
struct require_free<object<N>, prop<M> >
|
||||
{
|
||||
static const bool is_valid = true;
|
||||
static const bool is_noexcept = true;
|
||||
typedef object<M> result_type;
|
||||
};
|
||||
|
||||
} // namespace traits
|
||||
} // namespace asio
|
||||
|
||||
int main()
|
||||
{
|
||||
object<1> o1 = {};
|
||||
object<2> o2 = asio::require(o1, prop<2>());
|
||||
object<3> o3 = asio::require(o1, prop<2>(), prop<3>());
|
||||
object<4> o4 = asio::require(o1, prop<2>(), prop<3>(), prop<4>());
|
||||
(void)o2;
|
||||
(void)o3;
|
||||
(void)o4;
|
||||
|
||||
const object<1> o5 = {};
|
||||
object<2> o6 = asio::require(o5, prop<2>());
|
||||
object<3> o7 = asio::require(o5, prop<2>(), prop<3>());
|
||||
object<4> o8 = asio::require(o5, prop<2>(), prop<3>(), prop<4>());
|
||||
(void)o6;
|
||||
(void)o7;
|
||||
(void)o8;
|
||||
}
|
68
asio/src/tests/properties/cpp03/require_member.cpp
Normal file
68
asio/src/tests/properties/cpp03/require_member.cpp
Normal file
@ -0,0 +1,68 @@
|
||||
//
|
||||
// cpp03/require_member.cpp
|
||||
// ~~~~~~~~~~~~~~~~~~~~~~~~
|
||||
//
|
||||
// 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)
|
||||
//
|
||||
|
||||
#include "asio/require.hpp"
|
||||
#include <cassert>
|
||||
|
||||
template <int>
|
||||
struct prop
|
||||
{
|
||||
static const bool is_requirable = true;
|
||||
};
|
||||
|
||||
template <int>
|
||||
struct object
|
||||
{
|
||||
template <int N>
|
||||
object<N> require(prop<N>) const
|
||||
{
|
||||
return object<N>();
|
||||
}
|
||||
};
|
||||
|
||||
namespace asio {
|
||||
|
||||
template<int N, int M>
|
||||
struct is_applicable_property<object<N>, prop<M> >
|
||||
{
|
||||
static const bool value = true;
|
||||
};
|
||||
|
||||
namespace traits {
|
||||
|
||||
template<int N, int M>
|
||||
struct require_member<object<N>, prop<M> >
|
||||
{
|
||||
static const bool is_valid = true;
|
||||
static const bool is_noexcept = true;
|
||||
typedef object<M> result_type;
|
||||
};
|
||||
|
||||
} // namespace traits
|
||||
} // namespace asio
|
||||
|
||||
int main()
|
||||
{
|
||||
object<1> o1 = {};
|
||||
object<2> o2 = asio::require(o1, prop<2>());
|
||||
object<3> o3 = asio::require(o1, prop<2>(), prop<3>());
|
||||
object<4> o4 = asio::require(o1, prop<2>(), prop<3>(), prop<4>());
|
||||
(void)o2;
|
||||
(void)o3;
|
||||
(void)o4;
|
||||
|
||||
const object<1> o5 = {};
|
||||
object<2> o6 = asio::require(o5, prop<2>());
|
||||
object<3> o7 = asio::require(o5, prop<2>(), prop<3>());
|
||||
object<4> o8 = asio::require(o5, prop<2>(), prop<3>(), prop<4>());
|
||||
(void)o6;
|
||||
(void)o7;
|
||||
(void)o8;
|
||||
}
|
61
asio/src/tests/properties/cpp03/require_static.cpp
Normal file
61
asio/src/tests/properties/cpp03/require_static.cpp
Normal file
@ -0,0 +1,61 @@
|
||||
//
|
||||
// cpp03/require_static.cpp
|
||||
// ~~~~~~~~~~~~~~~~~~~~~~~~
|
||||
//
|
||||
// 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)
|
||||
//
|
||||
|
||||
#include "asio/require.hpp"
|
||||
#include <cassert>
|
||||
|
||||
template <int>
|
||||
struct prop
|
||||
{
|
||||
static const bool is_requirable = true;
|
||||
};
|
||||
|
||||
template <int>
|
||||
struct object
|
||||
{
|
||||
};
|
||||
|
||||
namespace asio {
|
||||
|
||||
template<int N, int M>
|
||||
struct is_applicable_property<object<N>, prop<M> >
|
||||
{
|
||||
static const bool value = true;
|
||||
};
|
||||
|
||||
namespace traits {
|
||||
|
||||
template<int N>
|
||||
struct static_require<object<N>, prop<N> >
|
||||
{
|
||||
static const bool is_valid = true;
|
||||
};
|
||||
|
||||
} // namespace traits
|
||||
} // namespace asio
|
||||
|
||||
int main()
|
||||
{
|
||||
object<1> o1 = {};
|
||||
object<1> o2 = asio::require(o1, prop<1>());
|
||||
object<1> o3 = asio::require(o1, prop<1>(), prop<1>());
|
||||
object<1> o4 = asio::require(o1, prop<1>(), prop<1>(), prop<1>());
|
||||
(void)o2;
|
||||
(void)o3;
|
||||
(void)o4;
|
||||
|
||||
const object<1> o5 = {};
|
||||
object<1> o6 = asio::require(o5, prop<1>());
|
||||
object<1> o7 = asio::require(o5, prop<1>(), prop<1>());
|
||||
object<1> o8 = asio::require(o5, prop<1>(), prop<1>(), prop<1>());
|
||||
(void)o6;
|
||||
(void)o7;
|
||||
(void)o8;
|
||||
}
|
48
asio/src/tests/properties/cpp11/can_prefer_free_prefer.cpp
Normal file
48
asio/src/tests/properties/cpp11/can_prefer_free_prefer.cpp
Normal file
@ -0,0 +1,48 @@
|
||||
//
|
||||
// cpp11/can_prefer_free_prefer.cpp
|
||||
// ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||
//
|
||||
// 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)
|
||||
//
|
||||
|
||||
#include "asio/prefer.hpp"
|
||||
#include <cassert>
|
||||
|
||||
template <int>
|
||||
struct prop
|
||||
{
|
||||
static constexpr bool is_preferable = true;
|
||||
};
|
||||
|
||||
template <int>
|
||||
struct object
|
||||
{
|
||||
template <int N>
|
||||
friend constexpr object<N> prefer(const object&, prop<N>)
|
||||
{
|
||||
return object<N>();
|
||||
}
|
||||
};
|
||||
|
||||
namespace asio {
|
||||
|
||||
template<int N, int M>
|
||||
struct is_applicable_property<object<N>, prop<M> >
|
||||
{
|
||||
static constexpr bool value = true;
|
||||
};
|
||||
|
||||
} // namespace asio
|
||||
|
||||
int main()
|
||||
{
|
||||
static_assert(asio::can_prefer<object<1>, prop<2>>::value, "");
|
||||
static_assert(asio::can_prefer<object<1>, prop<2>, prop<3>>::value, "");
|
||||
static_assert(asio::can_prefer<object<1>, prop<2>, prop<3>, prop<4>>::value, "");
|
||||
static_assert(asio::can_prefer<const object<1>, prop<2>>::value, "");
|
||||
static_assert(asio::can_prefer<const object<1>, prop<2>, prop<3>>::value, "");
|
||||
static_assert(asio::can_prefer<const object<1>, prop<2>, prop<3>, prop<4>>::value, "");
|
||||
}
|
48
asio/src/tests/properties/cpp11/can_prefer_free_require.cpp
Normal file
48
asio/src/tests/properties/cpp11/can_prefer_free_require.cpp
Normal file
@ -0,0 +1,48 @@
|
||||
//
|
||||
// cpp11/can_prefer_free_require.cpp
|
||||
// ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||
//
|
||||
// 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)
|
||||
//
|
||||
|
||||
#include "asio/prefer.hpp"
|
||||
#include <cassert>
|
||||
|
||||
template <int>
|
||||
struct prop
|
||||
{
|
||||
static constexpr bool is_preferable = true;
|
||||
};
|
||||
|
||||
template <int>
|
||||
struct object
|
||||
{
|
||||
template <int N>
|
||||
friend constexpr object<N> require(const object&, prop<N>)
|
||||
{
|
||||
return object<N>();
|
||||
}
|
||||
};
|
||||
|
||||
namespace asio {
|
||||
|
||||
template<int N, int M>
|
||||
struct is_applicable_property<object<N>, prop<M> >
|
||||
{
|
||||
static constexpr bool value = true;
|
||||
};
|
||||
|
||||
} // namespace asio
|
||||
|
||||
int main()
|
||||
{
|
||||
static_assert(asio::can_prefer<object<1>, prop<2>>::value, "");
|
||||
static_assert(asio::can_prefer<object<1>, prop<2>, prop<3>>::value, "");
|
||||
static_assert(asio::can_prefer<object<1>, prop<2>, prop<3>, prop<4>>::value, "");
|
||||
static_assert(asio::can_prefer<const object<1>, prop<2>>::value, "");
|
||||
static_assert(asio::can_prefer<const object<1>, prop<2>, prop<3>>::value, "");
|
||||
static_assert(asio::can_prefer<const object<1>, prop<2>, prop<3>, prop<4>>::value, "");
|
||||
}
|
48
asio/src/tests/properties/cpp11/can_prefer_member_prefer.cpp
Normal file
48
asio/src/tests/properties/cpp11/can_prefer_member_prefer.cpp
Normal file
@ -0,0 +1,48 @@
|
||||
//
|
||||
// cpp11/can_prefer_member_prefer.cpp
|
||||
// ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||
//
|
||||
// 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)
|
||||
//
|
||||
|
||||
#include "asio/prefer.hpp"
|
||||
#include <cassert>
|
||||
|
||||
template <int>
|
||||
struct prop
|
||||
{
|
||||
static constexpr bool is_preferable = true;
|
||||
};
|
||||
|
||||
template <int>
|
||||
struct object
|
||||
{
|
||||
template <int N>
|
||||
constexpr object<N> prefer(prop<N>) const
|
||||
{
|
||||
return object<N>();
|
||||
}
|
||||
};
|
||||
|
||||
namespace asio {
|
||||
|
||||
template<int N, int M>
|
||||
struct is_applicable_property<object<N>, prop<M> >
|
||||
{
|
||||
static constexpr bool value = true;
|
||||
};
|
||||
|
||||
} // namespace asio
|
||||
|
||||
int main()
|
||||
{
|
||||
static_assert(asio::can_prefer<object<1>, prop<2>>::value, "");
|
||||
static_assert(asio::can_prefer<object<1>, prop<2>, prop<3>>::value, "");
|
||||
static_assert(asio::can_prefer<object<1>, prop<2>, prop<3>, prop<4>>::value, "");
|
||||
static_assert(asio::can_prefer<const object<1>, prop<2>>::value, "");
|
||||
static_assert(asio::can_prefer<const object<1>, prop<2>, prop<3>>::value, "");
|
||||
static_assert(asio::can_prefer<const object<1>, prop<2>, prop<3>, prop<4>>::value, "");
|
||||
}
|
@ -0,0 +1,48 @@
|
||||
//
|
||||
// cpp11/can_prefer_member_require.cpp
|
||||
// ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||
//
|
||||
// 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)
|
||||
//
|
||||
|
||||
#include "asio/prefer.hpp"
|
||||
#include <cassert>
|
||||
|
||||
template <int>
|
||||
struct prop
|
||||
{
|
||||
static constexpr bool is_preferable = true;
|
||||
};
|
||||
|
||||
template <int>
|
||||
struct object
|
||||
{
|
||||
template <int N>
|
||||
constexpr object<N> require(prop<N>) const
|
||||
{
|
||||
return object<N>();
|
||||
}
|
||||
};
|
||||
|
||||
namespace asio {
|
||||
|
||||
template<int N, int M>
|
||||
struct is_applicable_property<object<N>, prop<M> >
|
||||
{
|
||||
static constexpr bool value = true;
|
||||
};
|
||||
|
||||
} // namespace asio
|
||||
|
||||
int main()
|
||||
{
|
||||
static_assert(asio::can_prefer<object<1>, prop<2>>::value, "");
|
||||
static_assert(asio::can_prefer<object<1>, prop<2>, prop<3>>::value, "");
|
||||
static_assert(asio::can_prefer<object<1>, prop<2>, prop<3>, prop<4>>::value, "");
|
||||
static_assert(asio::can_prefer<const object<1>, prop<2>>::value, "");
|
||||
static_assert(asio::can_prefer<const object<1>, prop<2>, prop<3>>::value, "");
|
||||
static_assert(asio::can_prefer<const object<1>, prop<2>, prop<3>, prop<4>>::value, "");
|
||||
}
|
@ -0,0 +1,38 @@
|
||||
//
|
||||
// cpp11/can_prefer_not_applicable_free_prefer.cpp
|
||||
// ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||
//
|
||||
// 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)
|
||||
//
|
||||
|
||||
#include "asio/prefer.hpp"
|
||||
#include <cassert>
|
||||
|
||||
template <int>
|
||||
struct prop
|
||||
{
|
||||
static constexpr bool is_preferable = true;
|
||||
};
|
||||
|
||||
template <int>
|
||||
struct object
|
||||
{
|
||||
template <int N>
|
||||
friend constexpr object<N> prefer(const object&, prop<N>)
|
||||
{
|
||||
return object<N>();
|
||||
}
|
||||
};
|
||||
|
||||
int main()
|
||||
{
|
||||
static_assert(!asio::can_prefer<object<1>, prop<2>>::value, "");
|
||||
static_assert(!asio::can_prefer<object<1>, prop<2>, prop<3>>::value, "");
|
||||
static_assert(!asio::can_prefer<object<1>, prop<2>, prop<3>, prop<4>>::value, "");
|
||||
static_assert(!asio::can_prefer<const object<1>, prop<2>>::value, "");
|
||||
static_assert(!asio::can_prefer<const object<1>, prop<2>, prop<3>>::value, "");
|
||||
static_assert(!asio::can_prefer<const object<1>, prop<2>, prop<3>, prop<4>>::value, "");
|
||||
}
|
@ -0,0 +1,38 @@
|
||||
//
|
||||
// cpp11/can_prefer_not_applicable_free_require.cpp
|
||||
// ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||
//
|
||||
// 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)
|
||||
//
|
||||
|
||||
#include "asio/prefer.hpp"
|
||||
#include <cassert>
|
||||
|
||||
template <int>
|
||||
struct prop
|
||||
{
|
||||
static constexpr bool is_preferable = true;
|
||||
};
|
||||
|
||||
template <int>
|
||||
struct object
|
||||
{
|
||||
template <int N>
|
||||
friend constexpr object<N> require(const object&, prop<N>)
|
||||
{
|
||||
return object<N>();
|
||||
}
|
||||
};
|
||||
|
||||
int main()
|
||||
{
|
||||
static_assert(!asio::can_prefer<object<1>, prop<2>>::value, "");
|
||||
static_assert(!asio::can_prefer<object<1>, prop<2>, prop<3>>::value, "");
|
||||
static_assert(!asio::can_prefer<object<1>, prop<2>, prop<3>, prop<4>>::value, "");
|
||||
static_assert(!asio::can_prefer<const object<1>, prop<2>>::value, "");
|
||||
static_assert(!asio::can_prefer<const object<1>, prop<2>, prop<3>>::value, "");
|
||||
static_assert(!asio::can_prefer<const object<1>, prop<2>, prop<3>, prop<4>>::value, "");
|
||||
}
|
@ -0,0 +1,38 @@
|
||||
//
|
||||
// cpp11/can_prefer_not_applicable_member_prefer.cpp
|
||||
// ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||
//
|
||||
// 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)
|
||||
//
|
||||
|
||||
#include "asio/prefer.hpp"
|
||||
#include <cassert>
|
||||
|
||||
template <int>
|
||||
struct prop
|
||||
{
|
||||
static constexpr bool is_preferable = true;
|
||||
};
|
||||
|
||||
template <int>
|
||||
struct object
|
||||
{
|
||||
template <int N>
|
||||
constexpr object<N> prefer(prop<N>) const
|
||||
{
|
||||
return object<N>();
|
||||
}
|
||||
};
|
||||
|
||||
int main()
|
||||
{
|
||||
static_assert(!asio::can_prefer<object<1>, prop<2>>::value, "");
|
||||
static_assert(!asio::can_prefer<object<1>, prop<2>, prop<3>>::value, "");
|
||||
static_assert(!asio::can_prefer<object<1>, prop<2>, prop<3>, prop<4>>::value, "");
|
||||
static_assert(!asio::can_prefer<const object<1>, prop<2>>::value, "");
|
||||
static_assert(!asio::can_prefer<const object<1>, prop<2>, prop<3>>::value, "");
|
||||
static_assert(!asio::can_prefer<const object<1>, prop<2>, prop<3>, prop<4>>::value, "");
|
||||
}
|
@ -0,0 +1,38 @@
|
||||
//
|
||||
// cpp11/can_prefer_not_applicable_member_require.cpp
|
||||
// ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||
//
|
||||
// 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)
|
||||
//
|
||||
|
||||
#include "asio/prefer.hpp"
|
||||
#include <cassert>
|
||||
|
||||
template <int>
|
||||
struct prop
|
||||
{
|
||||
static constexpr bool is_preferable = true;
|
||||
};
|
||||
|
||||
template <int>
|
||||
struct object
|
||||
{
|
||||
template <int N>
|
||||
constexpr object<N> require(prop<N>) const
|
||||
{
|
||||
return object<N>();
|
||||
}
|
||||
};
|
||||
|
||||
int main()
|
||||
{
|
||||
static_assert(!asio::can_prefer<object<1>, prop<2>>::value, "");
|
||||
static_assert(!asio::can_prefer<object<1>, prop<2>, prop<3>>::value, "");
|
||||
static_assert(!asio::can_prefer<object<1>, prop<2>, prop<3>, prop<4>>::value, "");
|
||||
static_assert(!asio::can_prefer<const object<1>, prop<2>>::value, "");
|
||||
static_assert(!asio::can_prefer<const object<1>, prop<2>, prop<3>>::value, "");
|
||||
static_assert(!asio::can_prefer<const object<1>, prop<2>, prop<3>, prop<4>>::value, "");
|
||||
}
|
@ -0,0 +1,45 @@
|
||||
//
|
||||
// cpp11/can_prefer_not_applicable_static.cpp
|
||||
// ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||
//
|
||||
// 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)
|
||||
//
|
||||
|
||||
#include "asio/prefer.hpp"
|
||||
#include <cassert>
|
||||
|
||||
template <int>
|
||||
struct prop
|
||||
{
|
||||
static constexpr bool is_preferable = true;
|
||||
};
|
||||
|
||||
template <int>
|
||||
struct object
|
||||
{
|
||||
};
|
||||
|
||||
namespace asio {
|
||||
namespace traits {
|
||||
|
||||
template<int N>
|
||||
struct static_require<object<N>, prop<N> >
|
||||
{
|
||||
static constexpr bool is_valid = true;
|
||||
};
|
||||
|
||||
} // namespace traits
|
||||
} // namespace asio
|
||||
|
||||
int main()
|
||||
{
|
||||
static_assert(!asio::can_prefer<object<1>, prop<1>>::value, "");
|
||||
static_assert(!asio::can_prefer<object<1>, prop<1>, prop<1>>::value, "");
|
||||
static_assert(!asio::can_prefer<object<1>, prop<1>, prop<1>, prop<1>>::value, "");
|
||||
static_assert(!asio::can_prefer<const object<1>, prop<1>>::value, "");
|
||||
static_assert(!asio::can_prefer<const object<1>, prop<1>, prop<1>>::value, "");
|
||||
static_assert(!asio::can_prefer<const object<1>, prop<1>, prop<1>, prop<1>>::value, "");
|
||||
}
|
@ -0,0 +1,33 @@
|
||||
//
|
||||
// cpp11/can_prefer_not_applicable_unsupported.cpp
|
||||
// ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||
//
|
||||
// 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)
|
||||
//
|
||||
|
||||
#include "asio/prefer.hpp"
|
||||
#include <cassert>
|
||||
|
||||
template <int>
|
||||
struct prop
|
||||
{
|
||||
static constexpr bool is_preferable = true;
|
||||
};
|
||||
|
||||
template <int>
|
||||
struct object
|
||||
{
|
||||
};
|
||||
|
||||
int main()
|
||||
{
|
||||
static_assert(!asio::can_prefer<object<1>, prop<2>>::value, "");
|
||||
static_assert(!asio::can_prefer<object<1>, prop<2>, prop<3>>::value, "");
|
||||
static_assert(!asio::can_prefer<object<1>, prop<2>, prop<3>, prop<4>>::value, "");
|
||||
static_assert(!asio::can_prefer<const object<1>, prop<2>>::value, "");
|
||||
static_assert(!asio::can_prefer<const object<1>, prop<2>, prop<3>>::value, "");
|
||||
static_assert(!asio::can_prefer<const object<1>, prop<2>, prop<3>, prop<4>>::value, "");
|
||||
}
|
@ -0,0 +1,48 @@
|
||||
//
|
||||
// cpp11/can_prefer_not_preferable_free_prefer.cpp
|
||||
// ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||
//
|
||||
// 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)
|
||||
//
|
||||
|
||||
#include "asio/prefer.hpp"
|
||||
#include <cassert>
|
||||
|
||||
template <int>
|
||||
struct prop
|
||||
{
|
||||
static constexpr bool is_preferable = false;
|
||||
};
|
||||
|
||||
template <int>
|
||||
struct object
|
||||
{
|
||||
template <int N>
|
||||
friend constexpr object<N> prefer(const object&, prop<N>)
|
||||
{
|
||||
return object<N>();
|
||||
}
|
||||
};
|
||||
|
||||
namespace asio {
|
||||
|
||||
template<int N, int M>
|
||||
struct is_applicable_property<object<N>, prop<M> >
|
||||
{
|
||||
static constexpr bool value = true;
|
||||
};
|
||||
|
||||
} // namespace asio
|
||||
|
||||
int main()
|
||||
{
|
||||
static_assert(!asio::can_prefer<object<1>, prop<2>>::value, "");
|
||||
static_assert(!asio::can_prefer<object<1>, prop<2>, prop<3>>::value, "");
|
||||
static_assert(!asio::can_prefer<object<1>, prop<2>, prop<3>, prop<4>>::value, "");
|
||||
static_assert(!asio::can_prefer<const object<1>, prop<2>>::value, "");
|
||||
static_assert(!asio::can_prefer<const object<1>, prop<2>, prop<3>>::value, "");
|
||||
static_assert(!asio::can_prefer<const object<1>, prop<2>, prop<3>, prop<4>>::value, "");
|
||||
}
|
@ -0,0 +1,48 @@
|
||||
//
|
||||
// cpp11/can_prefer_not_preferable_free_require.cpp
|
||||
// ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||
//
|
||||
// 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)
|
||||
//
|
||||
|
||||
#include "asio/prefer.hpp"
|
||||
#include <cassert>
|
||||
|
||||
template <int>
|
||||
struct prop
|
||||
{
|
||||
static constexpr bool is_preferable = false;
|
||||
};
|
||||
|
||||
template <int>
|
||||
struct object
|
||||
{
|
||||
template <int N>
|
||||
friend constexpr object<N> require(const object&, prop<N>)
|
||||
{
|
||||
return object<N>();
|
||||
}
|
||||
};
|
||||
|
||||
namespace asio {
|
||||
|
||||
template<int N, int M>
|
||||
struct is_applicable_property<object<N>, prop<M> >
|
||||
{
|
||||
static constexpr bool value = true;
|
||||
};
|
||||
|
||||
} // namespace asio
|
||||
|
||||
int main()
|
||||
{
|
||||
static_assert(!asio::can_prefer<object<1>, prop<2>>::value, "");
|
||||
static_assert(!asio::can_prefer<object<1>, prop<2>, prop<3>>::value, "");
|
||||
static_assert(!asio::can_prefer<object<1>, prop<2>, prop<3>, prop<4>>::value, "");
|
||||
static_assert(!asio::can_prefer<const object<1>, prop<2>>::value, "");
|
||||
static_assert(!asio::can_prefer<const object<1>, prop<2>, prop<3>>::value, "");
|
||||
static_assert(!asio::can_prefer<const object<1>, prop<2>, prop<3>, prop<4>>::value, "");
|
||||
}
|
@ -0,0 +1,48 @@
|
||||
//
|
||||
// cpp11/can_prefer_not_preferable_member_prefer.cpp
|
||||
// ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||
//
|
||||
// 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)
|
||||
//
|
||||
|
||||
#include "asio/prefer.hpp"
|
||||
#include <cassert>
|
||||
|
||||
template <int>
|
||||
struct prop
|
||||
{
|
||||
static constexpr bool is_preferable = false;
|
||||
};
|
||||
|
||||
template <int>
|
||||
struct object
|
||||
{
|
||||
template <int N>
|
||||
constexpr object<N> prefer(prop<N>) const
|
||||
{
|
||||
return object<N>();
|
||||
}
|
||||
};
|
||||
|
||||
namespace asio {
|
||||
|
||||
template<int N, int M>
|
||||
struct is_applicable_property<object<N>, prop<M> >
|
||||
{
|
||||
static constexpr bool value = true;
|
||||
};
|
||||
|
||||
} // namespace asio
|
||||
|
||||
int main()
|
||||
{
|
||||
static_assert(!asio::can_prefer<object<1>, prop<2>>::value, "");
|
||||
static_assert(!asio::can_prefer<object<1>, prop<2>, prop<3>>::value, "");
|
||||
static_assert(!asio::can_prefer<object<1>, prop<2>, prop<3>, prop<4>>::value, "");
|
||||
static_assert(!asio::can_prefer<const object<1>, prop<2>>::value, "");
|
||||
static_assert(!asio::can_prefer<const object<1>, prop<2>, prop<3>>::value, "");
|
||||
static_assert(!asio::can_prefer<const object<1>, prop<2>, prop<3>, prop<4>>::value, "");
|
||||
}
|
@ -0,0 +1,48 @@
|
||||
//
|
||||
// cpp11/can_prefer_not_preferable_member_require.cpp
|
||||
// ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||
//
|
||||
// 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)
|
||||
//
|
||||
|
||||
#include "asio/prefer.hpp"
|
||||
#include <cassert>
|
||||
|
||||
template <int>
|
||||
struct prop
|
||||
{
|
||||
static constexpr bool is_preferable = false;
|
||||
};
|
||||
|
||||
template <int>
|
||||
struct object
|
||||
{
|
||||
template <int N>
|
||||
constexpr object<N> require(prop<N>) const
|
||||
{
|
||||
return object<N>();
|
||||
}
|
||||
};
|
||||
|
||||
namespace asio {
|
||||
|
||||
template<int N, int M>
|
||||
struct is_applicable_property<object<N>, prop<M> >
|
||||
{
|
||||
static constexpr bool value = true;
|
||||
};
|
||||
|
||||
} // namespace asio
|
||||
|
||||
int main()
|
||||
{
|
||||
static_assert(!asio::can_prefer<object<1>, prop<2>>::value, "");
|
||||
static_assert(!asio::can_prefer<object<1>, prop<2>, prop<3>>::value, "");
|
||||
static_assert(!asio::can_prefer<object<1>, prop<2>, prop<3>, prop<4>>::value, "");
|
||||
static_assert(!asio::can_prefer<const object<1>, prop<2>>::value, "");
|
||||
static_assert(!asio::can_prefer<const object<1>, prop<2>, prop<3>>::value, "");
|
||||
static_assert(!asio::can_prefer<const object<1>, prop<2>, prop<3>, prop<4>>::value, "");
|
||||
}
|
@ -0,0 +1,43 @@
|
||||
//
|
||||
// cpp11/can_prefer_not_preferable_static.cpp
|
||||
// ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||
//
|
||||
// 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)
|
||||
//
|
||||
|
||||
#include "asio/prefer.hpp"
|
||||
#include <cassert>
|
||||
|
||||
template <int>
|
||||
struct prop
|
||||
{
|
||||
static constexpr bool is_preferable = false;
|
||||
};
|
||||
|
||||
template <int>
|
||||
struct object
|
||||
{
|
||||
};
|
||||
|
||||
namespace asio {
|
||||
|
||||
template<int N, int M>
|
||||
struct is_applicable_property<object<N>, prop<M> >
|
||||
{
|
||||
static constexpr bool value = true;
|
||||
};
|
||||
|
||||
} // namespace asio
|
||||
|
||||
int main()
|
||||
{
|
||||
static_assert(!asio::can_prefer<object<1>, prop<1>>::value, "");
|
||||
static_assert(!asio::can_prefer<object<1>, prop<1>, prop<1>>::value, "");
|
||||
static_assert(!asio::can_prefer<object<1>, prop<1>, prop<1>, prop<1>>::value, "");
|
||||
static_assert(!asio::can_prefer<const object<1>, prop<1>>::value, "");
|
||||
static_assert(!asio::can_prefer<const object<1>, prop<1>, prop<1>>::value, "");
|
||||
static_assert(!asio::can_prefer<const object<1>, prop<1>, prop<1>, prop<1>>::value, "");
|
||||
}
|
@ -0,0 +1,43 @@
|
||||
//
|
||||
// cpp11/can_prefer_not_preferable_unsupported.cpp
|
||||
// ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||
//
|
||||
// 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)
|
||||
//
|
||||
|
||||
#include "asio/prefer.hpp"
|
||||
#include <cassert>
|
||||
|
||||
template <int>
|
||||
struct prop
|
||||
{
|
||||
static constexpr bool is_preferable = false;
|
||||
};
|
||||
|
||||
template <int>
|
||||
struct object
|
||||
{
|
||||
};
|
||||
|
||||
namespace asio {
|
||||
|
||||
template<int N, int M>
|
||||
struct is_applicable_property<object<N>, prop<M> >
|
||||
{
|
||||
static constexpr bool value = true;
|
||||
};
|
||||
|
||||
} // namespace asio
|
||||
|
||||
int main()
|
||||
{
|
||||
static_assert(!asio::can_prefer<object<1>, prop<2>>::value, "");
|
||||
static_assert(!asio::can_prefer<object<1>, prop<2>, prop<3>>::value, "");
|
||||
static_assert(!asio::can_prefer<object<1>, prop<2>, prop<3>, prop<4>>::value, "");
|
||||
static_assert(!asio::can_prefer<const object<1>, prop<2>>::value, "");
|
||||
static_assert(!asio::can_prefer<const object<1>, prop<2>, prop<3>>::value, "");
|
||||
static_assert(!asio::can_prefer<const object<1>, prop<2>, prop<3>, prop<4>>::value, "");
|
||||
}
|
Some files were not shown because too many files have changed in this diff Show More
Loading…
Reference in New Issue
Block a user