Lesson 35 - Get Compute Auth Token Working
This commit is contained in:
11
Plugins/GameLiftPlugin/Source/GameLiftServer/ThirdParty/asio/src/tests/.gitignore
vendored
Normal file
11
Plugins/GameLiftPlugin/Source/GameLiftServer/ThirdParty/asio/src/tests/.gitignore
vendored
Normal file
@@ -0,0 +1,11 @@
|
||||
.deps
|
||||
.dirstamp
|
||||
*.o
|
||||
*.obj
|
||||
*.exe
|
||||
*_test
|
||||
*.ilk
|
||||
*.manifest
|
||||
*.pdb
|
||||
*.tds
|
||||
*.winmd
|
||||
590
Plugins/GameLiftPlugin/Source/GameLiftServer/ThirdParty/asio/src/tests/Makefile.am
vendored
Normal file
590
Plugins/GameLiftPlugin/Source/GameLiftServer/ThirdParty/asio/src/tests/Makefile.am
vendored
Normal file
@@ -0,0 +1,590 @@
|
||||
AUTOMAKE_OPTIONS = subdir-objects
|
||||
|
||||
if SEPARATE_COMPILATION
|
||||
noinst_LIBRARIES = libasio.a
|
||||
libasio_a_SOURCES = ../asio.cpp
|
||||
if HAVE_OPENSSL
|
||||
libasio_a_SOURCES += ../asio_ssl.cpp
|
||||
endif
|
||||
LDADD = libasio.a
|
||||
endif
|
||||
|
||||
SUBDIRS = properties
|
||||
|
||||
check_PROGRAMS = \
|
||||
unit/associated_allocator \
|
||||
unit/associated_cancellation_slot \
|
||||
unit/associated_executor \
|
||||
unit/associator \
|
||||
unit/async_result \
|
||||
unit/awaitable \
|
||||
unit/basic_datagram_socket \
|
||||
unit/basic_deadline_timer \
|
||||
unit/basic_raw_socket \
|
||||
unit/basic_seq_packet_socket \
|
||||
unit/basic_serial_port \
|
||||
unit/basic_signal_set \
|
||||
unit/basic_socket \
|
||||
unit/basic_socket_acceptor \
|
||||
unit/basic_stream_socket \
|
||||
unit/basic_streambuf \
|
||||
unit/basic_waitable_timer \
|
||||
unit/bind_cancellation_slot \
|
||||
unit/bind_executor \
|
||||
unit/buffered_read_stream \
|
||||
unit/buffered_stream \
|
||||
unit/buffered_write_stream \
|
||||
unit/buffer \
|
||||
unit/buffers_iterator \
|
||||
unit/cancellation_signal \
|
||||
unit/cancellation_state \
|
||||
unit/cancellation_type \
|
||||
unit/co_spawn \
|
||||
unit/completion_condition \
|
||||
unit/compose \
|
||||
unit/connect \
|
||||
unit/coroutine \
|
||||
unit/deadline_timer \
|
||||
unit/defer \
|
||||
unit/detached \
|
||||
unit/dispatch \
|
||||
unit/error \
|
||||
unit/execution/any_executor \
|
||||
unit/execution/blocking \
|
||||
unit/execution/blocking_adaptation \
|
||||
unit/execution/bulk_execute \
|
||||
unit/execution/bulk_guarantee \
|
||||
unit/execution/connect \
|
||||
unit/execution/context_as \
|
||||
unit/execution/execute \
|
||||
unit/execution/executor \
|
||||
unit/execution/invocable_archetype \
|
||||
unit/execution/mapping \
|
||||
unit/execution/operation_state \
|
||||
unit/execution/outstanding_work \
|
||||
unit/execution/prefer_only \
|
||||
unit/execution/receiver \
|
||||
unit/execution/relationship \
|
||||
unit/execution/schedule \
|
||||
unit/execution/scheduler \
|
||||
unit/execution/sender \
|
||||
unit/execution/set_done \
|
||||
unit/execution/set_error \
|
||||
unit/execution/set_value \
|
||||
unit/execution/start \
|
||||
unit/execution/submit \
|
||||
unit/execution_context \
|
||||
unit/executor \
|
||||
unit/executor_work_guard \
|
||||
unit/generic/basic_endpoint \
|
||||
unit/generic/datagram_protocol \
|
||||
unit/generic/raw_protocol \
|
||||
unit/generic/seq_packet_protocol \
|
||||
unit/generic/stream_protocol \
|
||||
unit/high_resolution_timer \
|
||||
unit/io_context \
|
||||
unit/io_context_strand \
|
||||
unit/ip/address \
|
||||
unit/ip/address_v4 \
|
||||
unit/ip/address_v4_iterator \
|
||||
unit/ip/address_v4_range \
|
||||
unit/ip/address_v6 \
|
||||
unit/ip/address_v6_iterator \
|
||||
unit/ip/address_v6_range \
|
||||
unit/ip/basic_endpoint \
|
||||
unit/ip/basic_resolver \
|
||||
unit/ip/basic_resolver_entry \
|
||||
unit/ip/basic_resolver_iterator \
|
||||
unit/ip/basic_resolver_query \
|
||||
unit/ip/host_name \
|
||||
unit/ip/icmp \
|
||||
unit/ip/multicast \
|
||||
unit/ip/network_v4 \
|
||||
unit/ip/network_v6 \
|
||||
unit/ip/resolver_query_base \
|
||||
unit/ip/tcp \
|
||||
unit/ip/udp \
|
||||
unit/ip/unicast \
|
||||
unit/ip/v6_only \
|
||||
unit/is_read_buffered \
|
||||
unit/is_write_buffered \
|
||||
unit/local/basic_endpoint \
|
||||
unit/local/connect_pair \
|
||||
unit/local/datagram_protocol \
|
||||
unit/local/stream_protocol \
|
||||
unit/packaged_task \
|
||||
unit/placeholders \
|
||||
unit/posix/basic_descriptor \
|
||||
unit/posix/basic_stream_descriptor \
|
||||
unit/posix/descriptor \
|
||||
unit/posix/descriptor_base \
|
||||
unit/posix/stream_descriptor \
|
||||
unit/post \
|
||||
unit/read \
|
||||
unit/read_at \
|
||||
unit/read_until \
|
||||
unit/redirect_error \
|
||||
unit/serial_port \
|
||||
unit/serial_port_base \
|
||||
unit/signal_set \
|
||||
unit/socket_base \
|
||||
unit/static_thread_pool \
|
||||
unit/steady_timer \
|
||||
unit/strand \
|
||||
unit/streambuf \
|
||||
unit/system_context \
|
||||
unit/system_executor \
|
||||
unit/system_timer \
|
||||
unit/this_coro \
|
||||
unit/thread \
|
||||
unit/thread_pool \
|
||||
unit/time_traits \
|
||||
unit/ts/buffer \
|
||||
unit/ts/executor \
|
||||
unit/ts/internet \
|
||||
unit/ts/io_context \
|
||||
unit/ts/net \
|
||||
unit/ts/netfwd \
|
||||
unit/ts/socket \
|
||||
unit/ts/timer \
|
||||
unit/use_awaitable \
|
||||
unit/use_future \
|
||||
unit/uses_executor \
|
||||
unit/wait_traits \
|
||||
unit/windows/basic_object_handle \
|
||||
unit/windows/basic_overlapped_handle \
|
||||
unit/windows/basic_random_access_handle \
|
||||
unit/windows/basic_stream_handle \
|
||||
unit/windows/object_handle \
|
||||
unit/windows/overlapped_handle \
|
||||
unit/windows/overlapped_ptr \
|
||||
unit/windows/random_access_handle \
|
||||
unit/windows/stream_handle \
|
||||
unit/write \
|
||||
unit/write_at
|
||||
|
||||
if !STANDALONE
|
||||
noinst_PROGRAMS = \
|
||||
latency/tcp_client \
|
||||
latency/tcp_server \
|
||||
latency/udp_client \
|
||||
latency/udp_server \
|
||||
performance/client \
|
||||
performance/server
|
||||
endif
|
||||
|
||||
if HAVE_CXX14
|
||||
check_PROGRAMS += \
|
||||
unit/experimental/deferred
|
||||
endif
|
||||
|
||||
if HAVE_CXX20
|
||||
check_PROGRAMS += \
|
||||
unit/experimental/promise
|
||||
|
||||
if HAVE_COROUTINES
|
||||
check_PROGRAMS += \
|
||||
unit/experimental/awaitable_operators \
|
||||
unit/experimental/coro/cancel \
|
||||
unit/experimental/coro/exception \
|
||||
unit/experimental/coro/partial \
|
||||
unit/experimental/coro/simple_test \
|
||||
unit/experimental/coro/stack_test \
|
||||
unit/experimental/coro/use_coro
|
||||
endif
|
||||
endif
|
||||
|
||||
if HAVE_OPENSSL
|
||||
check_PROGRAMS += \
|
||||
unit/ssl/context_base \
|
||||
unit/ssl/context \
|
||||
unit/ssl/error \
|
||||
unit/ssl/host_name_verification \
|
||||
unit/ssl/rfc2818_verification \
|
||||
unit/ssl/stream_base \
|
||||
unit/ssl/stream
|
||||
endif
|
||||
|
||||
TESTS = \
|
||||
unit/associated_allocator \
|
||||
unit/associated_cancellation_slot \
|
||||
unit/associated_executor \
|
||||
unit/associator \
|
||||
unit/async_result \
|
||||
unit/awaitable \
|
||||
unit/basic_datagram_socket \
|
||||
unit/basic_deadline_timer \
|
||||
unit/basic_raw_socket \
|
||||
unit/basic_seq_packet_socket \
|
||||
unit/basic_serial_port \
|
||||
unit/basic_signal_set \
|
||||
unit/basic_socket \
|
||||
unit/basic_socket_acceptor \
|
||||
unit/basic_stream_socket \
|
||||
unit/basic_streambuf \
|
||||
unit/basic_waitable_timer \
|
||||
unit/bind_cancellation_slot \
|
||||
unit/bind_executor \
|
||||
unit/buffered_read_stream \
|
||||
unit/buffered_stream \
|
||||
unit/buffered_write_stream \
|
||||
unit/buffer \
|
||||
unit/buffers_iterator \
|
||||
unit/cancellation_signal \
|
||||
unit/cancellation_state \
|
||||
unit/cancellation_type \
|
||||
unit/co_spawn \
|
||||
unit/completion_condition \
|
||||
unit/compose \
|
||||
unit/connect \
|
||||
unit/deadline_timer \
|
||||
unit/defer \
|
||||
unit/detached \
|
||||
unit/dispatch \
|
||||
unit/error \
|
||||
unit/execution/any_executor \
|
||||
unit/execution/blocking \
|
||||
unit/execution/blocking_adaptation \
|
||||
unit/execution/bulk_execute \
|
||||
unit/execution/bulk_guarantee \
|
||||
unit/execution/connect \
|
||||
unit/execution/context_as \
|
||||
unit/execution/execute \
|
||||
unit/execution/executor \
|
||||
unit/execution/invocable_archetype \
|
||||
unit/execution/mapping \
|
||||
unit/execution/operation_state \
|
||||
unit/execution/outstanding_work \
|
||||
unit/execution/prefer_only \
|
||||
unit/execution/receiver \
|
||||
unit/execution/relationship \
|
||||
unit/execution/schedule \
|
||||
unit/execution/scheduler \
|
||||
unit/execution/sender \
|
||||
unit/execution/set_done \
|
||||
unit/execution/set_error \
|
||||
unit/execution/set_value \
|
||||
unit/execution/start \
|
||||
unit/execution/submit \
|
||||
unit/execution_context \
|
||||
unit/executor \
|
||||
unit/executor_work_guard \
|
||||
unit/high_resolution_timer \
|
||||
unit/io_context \
|
||||
unit/io_context_strand \
|
||||
unit/ip/address \
|
||||
unit/ip/address_v4 \
|
||||
unit/ip/address_v4_iterator \
|
||||
unit/ip/address_v4_range \
|
||||
unit/ip/address_v6 \
|
||||
unit/ip/address_v6_iterator \
|
||||
unit/ip/address_v6_range \
|
||||
unit/ip/basic_endpoint \
|
||||
unit/ip/basic_resolver \
|
||||
unit/ip/basic_resolver_entry \
|
||||
unit/ip/basic_resolver_iterator \
|
||||
unit/ip/basic_resolver_query \
|
||||
unit/ip/host_name \
|
||||
unit/ip/icmp \
|
||||
unit/ip/multicast \
|
||||
unit/ip/network_v4 \
|
||||
unit/ip/network_v6 \
|
||||
unit/ip/resolver_query_base \
|
||||
unit/ip/tcp \
|
||||
unit/ip/udp \
|
||||
unit/ip/unicast \
|
||||
unit/ip/v6_only \
|
||||
unit/is_read_buffered \
|
||||
unit/is_write_buffered \
|
||||
unit/local/basic_endpoint \
|
||||
unit/local/connect_pair \
|
||||
unit/local/datagram_protocol \
|
||||
unit/local/stream_protocol \
|
||||
unit/packaged_task \
|
||||
unit/placeholders \
|
||||
unit/posix/basic_descriptor\
|
||||
unit/posix/basic_stream_descriptor\
|
||||
unit/posix/descriptor\
|
||||
unit/posix/descriptor_base \
|
||||
unit/posix/stream_descriptor \
|
||||
unit/post \
|
||||
unit/read \
|
||||
unit/read_at \
|
||||
unit/read_until \
|
||||
unit/redirect_error \
|
||||
unit/serial_port \
|
||||
unit/serial_port_base \
|
||||
unit/signal_set \
|
||||
unit/socket_base \
|
||||
unit/static_thread_pool \
|
||||
unit/steady_timer \
|
||||
unit/strand \
|
||||
unit/streambuf \
|
||||
unit/system_context \
|
||||
unit/system_executor \
|
||||
unit/system_timer \
|
||||
unit/this_coro \
|
||||
unit/thread \
|
||||
unit/thread_pool \
|
||||
unit/time_traits \
|
||||
unit/ts/buffer \
|
||||
unit/ts/executor \
|
||||
unit/ts/internet \
|
||||
unit/ts/io_context \
|
||||
unit/ts/net \
|
||||
unit/ts/netfwd \
|
||||
unit/ts/socket \
|
||||
unit/ts/timer \
|
||||
unit/use_awaitable \
|
||||
unit/use_future \
|
||||
unit/uses_executor \
|
||||
unit/wait_traits \
|
||||
unit/windows/basic_object_handle \
|
||||
unit/windows/basic_overlapped_handle \
|
||||
unit/windows/basic_random_access_handle \
|
||||
unit/windows/basic_stream_handle \
|
||||
unit/windows/object_handle \
|
||||
unit/windows/overlapped_handle \
|
||||
unit/windows/overlapped_ptr \
|
||||
unit/windows/random_access_handle \
|
||||
unit/windows/stream_handle \
|
||||
unit/write \
|
||||
unit/write_at
|
||||
|
||||
if HAVE_CXX14
|
||||
TESTS += \
|
||||
unit/experimental/deferred
|
||||
endif
|
||||
|
||||
if HAVE_CXX20
|
||||
TESTS += \
|
||||
unit/experimental/promise
|
||||
|
||||
if HAVE_COROUTINES
|
||||
TESTS += \
|
||||
unit/experimental/awaitable_operators \
|
||||
unit/experimental/coro/cancel \
|
||||
unit/experimental/coro/exception \
|
||||
unit/experimental/coro/partial \
|
||||
unit/experimental/coro/simple_test \
|
||||
unit/experimental/coro/stack_test \
|
||||
unit/experimental/coro/use_coro
|
||||
endif
|
||||
endif
|
||||
|
||||
if HAVE_OPENSSL
|
||||
TESTS += \
|
||||
unit/ssl/context_base \
|
||||
unit/ssl/context \
|
||||
unit/ssl/error \
|
||||
unit/ssl/host_name_verification \
|
||||
unit/ssl/rfc2818_verification \
|
||||
unit/ssl/stream_base \
|
||||
unit/ssl/stream
|
||||
endif
|
||||
|
||||
noinst_HEADERS = \
|
||||
latency/high_res_clock.hpp \
|
||||
unit/unit_test.hpp
|
||||
|
||||
AM_CXXFLAGS = -I$(srcdir)/../../include
|
||||
|
||||
if !STANDALONE
|
||||
latency_tcp_client_SOURCES = latency/tcp_client.cpp
|
||||
latency_tcp_server_SOURCES = latency/tcp_server.cpp
|
||||
latency_udp_client_SOURCES = latency/udp_client.cpp
|
||||
latency_udp_server_SOURCES = latency/udp_server.cpp
|
||||
performance_client_SOURCES = performance/client.cpp
|
||||
performance_server_SOURCES = performance/server.cpp
|
||||
endif
|
||||
|
||||
unit_associated_allocator_SOURCES = unit/associated_allocator.cpp
|
||||
unit_associated_cancellation_slot_SOURCES = unit/associated_cancellation_slot.cpp
|
||||
unit_associated_executor_SOURCES = unit/associated_executor.cpp
|
||||
unit_associator_SOURCES = unit/associator.cpp
|
||||
unit_async_result_SOURCES = unit/async_result.cpp
|
||||
unit_awaitable_SOURCES = unit/awaitable.cpp
|
||||
unit_basic_datagram_socket_SOURCES = unit/basic_datagram_socket.cpp
|
||||
unit_basic_deadline_timer_SOURCES = unit/basic_deadline_timer.cpp
|
||||
unit_basic_raw_socket_SOURCES = unit/basic_raw_socket.cpp
|
||||
unit_basic_seq_packet_socket_SOURCES = unit/basic_seq_packet_socket.cpp
|
||||
unit_basic_serial_port_SOURCES = unit/basic_serial_port.cpp
|
||||
unit_basic_signal_set_SOURCES = unit/basic_signal_set.cpp
|
||||
unit_basic_socket_SOURCES = unit/basic_socket.cpp
|
||||
unit_basic_socket_acceptor_SOURCES = unit/basic_socket_acceptor.cpp
|
||||
unit_basic_stream_socket_SOURCES = unit/basic_stream_socket.cpp
|
||||
unit_basic_streambuf_SOURCES = unit/basic_streambuf.cpp
|
||||
unit_basic_waitable_timer_SOURCES = unit/basic_waitable_timer.cpp
|
||||
unit_bind_cancellation_slot_SOURCES = unit/bind_cancellation_slot.cpp
|
||||
unit_bind_executor_SOURCES = unit/bind_executor.cpp
|
||||
unit_buffer_SOURCES = unit/buffer.cpp
|
||||
unit_buffers_iterator_SOURCES = unit/buffers_iterator.cpp
|
||||
unit_buffered_read_stream_SOURCES = unit/buffered_read_stream.cpp
|
||||
unit_buffered_stream_SOURCES = unit/buffered_stream.cpp
|
||||
unit_buffered_write_stream_SOURCES = unit/buffered_write_stream.cpp
|
||||
unit_cancellation_signal_SOURCES = unit/cancellation_signal.cpp
|
||||
unit_cancellation_state_SOURCES = unit/cancellation_state.cpp
|
||||
unit_cancellation_type_SOURCES = unit/cancellation_type.cpp
|
||||
unit_co_spawn_SOURCES = unit/co_spawn.cpp
|
||||
unit_completion_condition_SOURCES = unit/completion_condition.cpp
|
||||
unit_compose_SOURCES = unit/compose.cpp
|
||||
unit_connect_SOURCES = unit/connect.cpp
|
||||
unit_coroutine_SOURCES = unit/coroutine.cpp
|
||||
unit_deadline_timer_SOURCES = unit/deadline_timer.cpp
|
||||
unit_defer_SOURCES = unit/defer.cpp
|
||||
unit_detached_SOURCES = unit/detached.cpp
|
||||
unit_dispatch_SOURCES = unit/dispatch.cpp
|
||||
unit_error_SOURCES = unit/error.cpp
|
||||
unit_execution_any_executor_SOURCES = unit/execution/any_executor.cpp
|
||||
unit_execution_blocking_SOURCES = unit/execution/blocking.cpp
|
||||
unit_execution_blocking_adaptation_SOURCES = unit/execution/blocking_adaptation.cpp
|
||||
unit_execution_bulk_execute_SOURCES = unit/execution/bulk_execute.cpp
|
||||
unit_execution_bulk_guarantee_SOURCES = unit/execution/bulk_guarantee.cpp
|
||||
unit_execution_connect_SOURCES = unit/execution/connect.cpp
|
||||
unit_execution_context_as_SOURCES = unit/execution/context_as.cpp
|
||||
unit_execution_execute_SOURCES = unit/execution/execute.cpp
|
||||
unit_execution_executor_SOURCES = unit/execution/executor.cpp
|
||||
unit_execution_invocable_archetype_SOURCES = unit/execution/invocable_archetype.cpp
|
||||
unit_execution_mapping_SOURCES = unit/execution/mapping.cpp
|
||||
unit_execution_outstanding_work_SOURCES = unit/execution/outstanding_work.cpp
|
||||
unit_execution_operation_state_SOURCES = unit/execution/operation_state.cpp
|
||||
unit_execution_prefer_only_SOURCES = unit/execution/prefer_only.cpp
|
||||
unit_execution_receiver_SOURCES = unit/execution/receiver.cpp
|
||||
unit_execution_relationship_SOURCES = unit/execution/relationship.cpp
|
||||
unit_execution_schedule_SOURCES = unit/execution/schedule.cpp
|
||||
unit_execution_scheduler_SOURCES = unit/execution/scheduler.cpp
|
||||
unit_execution_sender_SOURCES = unit/execution/sender.cpp
|
||||
unit_execution_set_done_SOURCES = unit/execution/set_done.cpp
|
||||
unit_execution_set_error_SOURCES = unit/execution/set_error.cpp
|
||||
unit_execution_set_value_SOURCES = unit/execution/set_value.cpp
|
||||
unit_execution_start_SOURCES = unit/execution/start.cpp
|
||||
unit_execution_submit_SOURCES = unit/execution/submit.cpp
|
||||
unit_execution_context_SOURCES = unit/execution_context.cpp
|
||||
unit_executor_SOURCES = unit/executor.cpp
|
||||
unit_executor_work_guard_SOURCES = unit/executor_work_guard.cpp
|
||||
unit_generic_basic_endpoint_SOURCES = unit/generic/basic_endpoint.cpp
|
||||
unit_generic_datagram_protocol_SOURCES = unit/generic/datagram_protocol.cpp
|
||||
unit_generic_raw_protocol_SOURCES = unit/generic/raw_protocol.cpp
|
||||
unit_generic_seq_packet_protocol_SOURCES = unit/generic/seq_packet_protocol.cpp
|
||||
unit_generic_stream_protocol_SOURCES = unit/generic/stream_protocol.cpp
|
||||
unit_high_resolution_timer_SOURCES = unit/high_resolution_timer.cpp
|
||||
unit_io_context_SOURCES = unit/io_context.cpp
|
||||
unit_io_context_strand_SOURCES = unit/io_context_strand.cpp
|
||||
unit_ip_address_SOURCES = unit/ip/address.cpp
|
||||
unit_ip_address_v4_SOURCES = unit/ip/address_v4.cpp
|
||||
unit_ip_address_v4_iterator_SOURCES = unit/ip/address_v4_iterator.cpp
|
||||
unit_ip_address_v4_range_SOURCES = unit/ip/address_v4_range.cpp
|
||||
unit_ip_address_v6_SOURCES = unit/ip/address_v6.cpp
|
||||
unit_ip_address_v6_iterator_SOURCES = unit/ip/address_v6_iterator.cpp
|
||||
unit_ip_address_v6_range_SOURCES = unit/ip/address_v6_range.cpp
|
||||
unit_ip_basic_endpoint_SOURCES = unit/ip/basic_endpoint.cpp
|
||||
unit_ip_basic_resolver_SOURCES = unit/ip/basic_resolver.cpp
|
||||
unit_ip_basic_resolver_entry_SOURCES = unit/ip/basic_resolver_entry.cpp
|
||||
unit_ip_basic_resolver_iterator_SOURCES = unit/ip/basic_resolver_iterator.cpp
|
||||
unit_ip_basic_resolver_query_SOURCES = unit/ip/basic_resolver_query.cpp
|
||||
unit_ip_host_name_SOURCES = unit/ip/host_name.cpp
|
||||
unit_ip_icmp_SOURCES = unit/ip/icmp.cpp
|
||||
unit_ip_multicast_SOURCES = unit/ip/multicast.cpp
|
||||
unit_ip_network_v4_SOURCES = unit/ip/network_v4.cpp
|
||||
unit_ip_network_v6_SOURCES = unit/ip/network_v6.cpp
|
||||
unit_ip_resolver_query_base_SOURCES = unit/ip/resolver_query_base.cpp
|
||||
unit_ip_tcp_SOURCES = unit/ip/tcp.cpp
|
||||
unit_ip_udp_SOURCES = unit/ip/udp.cpp
|
||||
unit_ip_unicast_SOURCES = unit/ip/unicast.cpp
|
||||
unit_ip_v6_only_SOURCES = unit/ip/v6_only.cpp
|
||||
unit_is_read_buffered_SOURCES = unit/is_read_buffered.cpp
|
||||
unit_is_write_buffered_SOURCES = unit/is_write_buffered.cpp
|
||||
unit_local_basic_endpoint_SOURCES = unit/local/basic_endpoint.cpp
|
||||
unit_local_connect_pair_SOURCES = unit/local/connect_pair.cpp
|
||||
unit_local_datagram_protocol_SOURCES = unit/local/datagram_protocol.cpp
|
||||
unit_local_stream_protocol_SOURCES = unit/local/stream_protocol.cpp
|
||||
unit_packaged_task_SOURCES = unit/packaged_task.cpp
|
||||
unit_placeholders_SOURCES = unit/placeholders.cpp
|
||||
unit_posix_basic_descriptor_SOURCES = unit/posix/basic_descriptor.cpp
|
||||
unit_posix_basic_stream_descriptor_SOURCES = unit/posix/basic_stream_descriptor.cpp
|
||||
unit_posix_descriptor_SOURCES = unit/posix/descriptor.cpp
|
||||
unit_posix_descriptor_base_SOURCES = unit/posix/descriptor_base.cpp
|
||||
unit_posix_stream_descriptor_SOURCES = unit/posix/stream_descriptor.cpp
|
||||
unit_post_SOURCES = unit/post.cpp
|
||||
unit_read_SOURCES = unit/read.cpp
|
||||
unit_read_at_SOURCES = unit/read_at.cpp
|
||||
unit_read_until_SOURCES = unit/read_until.cpp
|
||||
unit_redirect_error_SOURCES = unit/redirect_error.cpp
|
||||
unit_serial_port_SOURCES = unit/serial_port.cpp
|
||||
unit_serial_port_base_SOURCES = unit/serial_port_base.cpp
|
||||
unit_signal_set_SOURCES = unit/signal_set.cpp
|
||||
unit_socket_base_SOURCES = unit/socket_base.cpp
|
||||
unit_static_thread_pool_SOURCES = unit/static_thread_pool.cpp
|
||||
unit_steady_timer_SOURCES = unit/steady_timer.cpp
|
||||
unit_strand_SOURCES = unit/strand.cpp
|
||||
unit_streambuf_SOURCES = unit/streambuf.cpp
|
||||
unit_system_context_SOURCES = unit/system_context.cpp
|
||||
unit_system_executor_SOURCES = unit/system_executor.cpp
|
||||
unit_system_timer_SOURCES = unit/system_timer.cpp
|
||||
unit_this_coro_SOURCES = unit/this_coro.cpp
|
||||
unit_thread_SOURCES = unit/thread.cpp
|
||||
unit_thread_pool_SOURCES = unit/thread_pool.cpp
|
||||
unit_time_traits_SOURCES = unit/time_traits.cpp
|
||||
unit_ts_buffer_SOURCES = unit/ts/buffer.cpp
|
||||
unit_ts_executor_SOURCES = unit/ts/executor.cpp
|
||||
unit_ts_internet_SOURCES = unit/ts/internet.cpp
|
||||
unit_ts_io_context_SOURCES = unit/ts/io_context.cpp
|
||||
unit_ts_net_SOURCES = unit/ts/net.cpp
|
||||
unit_ts_netfwd_SOURCES = unit/ts/netfwd.cpp
|
||||
unit_ts_socket_SOURCES = unit/ts/socket.cpp
|
||||
unit_ts_timer_SOURCES = unit/ts/timer.cpp
|
||||
unit_use_awaitable_SOURCES = unit/use_awaitable.cpp
|
||||
unit_use_future_SOURCES = unit/use_future.cpp
|
||||
unit_uses_executor_SOURCES = unit/uses_executor.cpp
|
||||
unit_wait_traits_SOURCES = unit/wait_traits.cpp
|
||||
unit_windows_basic_object_handle_SOURCES = unit/windows/basic_object_handle.cpp
|
||||
unit_windows_basic_overlapped_handle_SOURCES = unit/windows/basic_overlapped_handle.cpp
|
||||
unit_windows_basic_random_access_handle_SOURCES = unit/windows/basic_random_access_handle.cpp
|
||||
unit_windows_basic_stream_handle_SOURCES = unit/windows/basic_stream_handle.cpp
|
||||
unit_windows_object_handle_SOURCES = unit/windows/object_handle.cpp
|
||||
unit_windows_overlapped_handle_SOURCES = unit/windows/overlapped_handle.cpp
|
||||
unit_windows_overlapped_ptr_SOURCES = unit/windows/overlapped_ptr.cpp
|
||||
unit_windows_random_access_handle_SOURCES = unit/windows/random_access_handle.cpp
|
||||
unit_windows_stream_handle_SOURCES = unit/windows/stream_handle.cpp
|
||||
unit_write_SOURCES = unit/write.cpp
|
||||
unit_write_at_SOURCES = unit/write_at.cpp
|
||||
|
||||
if HAVE_CXX14
|
||||
unit_experimental_deferred_SOURCES = unit/experimental/deferred.cpp
|
||||
endif
|
||||
|
||||
if HAVE_CXX20
|
||||
unit_experimental_promise_SOURCES = unit/experimental/promise.cpp
|
||||
|
||||
if HAVE_COROUTINES
|
||||
unit_experimental_awaitable_operators_SOURCES = unit/experimental/awaitable_operators.cpp
|
||||
unit_experimental_coro_cancel_SOURCES = unit/experimental/coro/cancel.cpp
|
||||
unit_experimental_coro_exception_SOURCES = unit/experimental/coro/exception.cpp
|
||||
unit_experimental_coro_partial_SOURCES = unit/experimental/coro/partial.cpp
|
||||
unit_experimental_coro_simple_test_SOURCES = unit/experimental/coro/simple_test.cpp
|
||||
unit_experimental_coro_stack_test_SOURCES = unit/experimental/coro/stack_test.cpp
|
||||
unit_experimental_coro_use_coro_SOURCES = unit/experimental/coro/use_coro.cpp
|
||||
endif
|
||||
endif
|
||||
|
||||
if HAVE_OPENSSL
|
||||
unit_ssl_context_base_SOURCES = unit/ssl/context_base.cpp
|
||||
unit_ssl_context_SOURCES = unit/ssl/context.cpp
|
||||
unit_ssl_error_SOURCES = unit/ssl/error.cpp
|
||||
unit_ssl_stream_base_SOURCES = unit/ssl/stream_base.cpp
|
||||
unit_ssl_host_name_verification_SOURCES = unit/ssl/host_name_verification.cpp
|
||||
unit_ssl_rfc2818_verification_SOURCES = unit/ssl/rfc2818_verification.cpp
|
||||
unit_ssl_stream_SOURCES = unit/ssl/stream.cpp
|
||||
endif
|
||||
|
||||
EXTRA_DIST = \
|
||||
latency/allocator.hpp \
|
||||
performance/handler_allocator.hpp \
|
||||
unit/archetypes/async_ops.hpp \
|
||||
unit/archetypes/async_result.hpp \
|
||||
unit/archetypes/gettable_socket_option.hpp \
|
||||
unit/archetypes/io_control_command.hpp \
|
||||
unit/archetypes/settable_socket_option.hpp
|
||||
|
||||
MAINTAINERCLEANFILES = \
|
||||
$(srcdir)/Makefile.in
|
||||
11
Plugins/GameLiftPlugin/Source/GameLiftServer/ThirdParty/asio/src/tests/latency/.gitignore
vendored
Normal file
11
Plugins/GameLiftPlugin/Source/GameLiftServer/ThirdParty/asio/src/tests/latency/.gitignore
vendored
Normal file
@@ -0,0 +1,11 @@
|
||||
.deps
|
||||
.dirstamp
|
||||
*.o
|
||||
*.obj
|
||||
*.exe
|
||||
*client
|
||||
*server
|
||||
*.ilk
|
||||
*.manifest
|
||||
*.pdb
|
||||
*.tds
|
||||
52
Plugins/GameLiftPlugin/Source/GameLiftServer/ThirdParty/asio/src/tests/latency/allocator.hpp
vendored
Normal file
52
Plugins/GameLiftPlugin/Source/GameLiftServer/ThirdParty/asio/src/tests/latency/allocator.hpp
vendored
Normal file
@@ -0,0 +1,52 @@
|
||||
//
|
||||
// allocator.hpp
|
||||
// ~~~~~~~~~~~~~
|
||||
//
|
||||
// Copyright (c) 2003-2021 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 ALLOCATOR_HPP
|
||||
#define ALLOCATOR_HPP
|
||||
|
||||
#include <boost/aligned_storage.hpp>
|
||||
|
||||
// Represents a single connection from a client.
|
||||
class allocator
|
||||
{
|
||||
public:
|
||||
allocator()
|
||||
: in_use_(false)
|
||||
{
|
||||
}
|
||||
|
||||
void* allocate(std::size_t n)
|
||||
{
|
||||
if (in_use_ || n >= 1024)
|
||||
return ::operator new(n);
|
||||
in_use_ = true;
|
||||
return static_cast<void*>(&space_);
|
||||
}
|
||||
|
||||
void deallocate(void* p)
|
||||
{
|
||||
if (p != static_cast<void*>(&space_))
|
||||
::operator delete(p);
|
||||
else
|
||||
in_use_ = false;
|
||||
}
|
||||
|
||||
private:
|
||||
allocator(const allocator&);
|
||||
allocator& operator=(const allocator&);
|
||||
|
||||
// Whether the reusable memory space is currently in use.
|
||||
bool in_use_;
|
||||
|
||||
// The reusable memory space made available by the allocator.
|
||||
boost::aligned_storage<1024>::type space_;
|
||||
};
|
||||
|
||||
#endif // ALLOCATOR_HPP
|
||||
@@ -0,0 +1,53 @@
|
||||
//
|
||||
// high_res_clock.hpp
|
||||
// ~~~~~~~~~~~~~~~~~~
|
||||
//
|
||||
// Copyright (c) 2003-2021 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 HIGH_RES_CLOCK_HPP
|
||||
#define HIGH_RES_CLOCK_HPP
|
||||
|
||||
#include <boost/config.hpp>
|
||||
#include <boost/cstdint.hpp>
|
||||
|
||||
#if defined(ASIO_WINDOWS)
|
||||
|
||||
inline boost::uint64_t high_res_clock()
|
||||
{
|
||||
LARGE_INTEGER i;
|
||||
QueryPerformanceCounter(&i);
|
||||
return i.QuadPart;
|
||||
}
|
||||
|
||||
#elif defined(__GNUC__) && defined(__x86_64__)
|
||||
|
||||
inline boost::uint64_t high_res_clock()
|
||||
{
|
||||
unsigned long low, high;
|
||||
__asm__ __volatile__("rdtsc" : "=a" (low), "=d" (high));
|
||||
return (((boost::uint64_t)high) << 32) | low;
|
||||
}
|
||||
|
||||
#else
|
||||
|
||||
#include <boost/date_time/posix_time/posix_time_types.hpp>
|
||||
|
||||
inline boost::uint64_t high_res_clock()
|
||||
{
|
||||
boost::posix_time::ptime now =
|
||||
boost::posix_time::microsec_clock::universal_time();
|
||||
|
||||
boost::posix_time::ptime epoch(
|
||||
boost::gregorian::date(1970, 1, 1),
|
||||
boost::posix_time::seconds(0));
|
||||
|
||||
return (now - epoch).total_microseconds();
|
||||
}
|
||||
|
||||
#endif
|
||||
|
||||
#endif // HIGH_RES_CLOCK_HPP
|
||||
124
Plugins/GameLiftPlugin/Source/GameLiftServer/ThirdParty/asio/src/tests/latency/tcp_client.cpp
vendored
Normal file
124
Plugins/GameLiftPlugin/Source/GameLiftServer/ThirdParty/asio/src/tests/latency/tcp_client.cpp
vendored
Normal file
@@ -0,0 +1,124 @@
|
||||
//
|
||||
// tcp_client.cpp
|
||||
// ~~~~~~~~~~~~~~
|
||||
//
|
||||
// Copyright (c) 2003-2021 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/ip/tcp.hpp>
|
||||
#include <asio/read.hpp>
|
||||
#include <asio/write.hpp>
|
||||
#include <boost/date_time/posix_time/posix_time_types.hpp>
|
||||
#include <boost/shared_ptr.hpp>
|
||||
#include <cstdio>
|
||||
#include <cstdlib>
|
||||
#include <cstring>
|
||||
#include <vector>
|
||||
#include "high_res_clock.hpp"
|
||||
|
||||
using asio::ip::tcp;
|
||||
using boost::posix_time::ptime;
|
||||
using boost::posix_time::microsec_clock;
|
||||
|
||||
const int num_samples = 100000;
|
||||
|
||||
struct transfer_all
|
||||
{
|
||||
typedef std::size_t result_type;
|
||||
std::size_t operator()(const asio::error_code& ec, std::size_t)
|
||||
{
|
||||
return (ec && ec != asio::error::would_block) ? 0 : ~0;
|
||||
}
|
||||
};
|
||||
|
||||
int main(int argc, char* argv[])
|
||||
{
|
||||
if (argc != 6)
|
||||
{
|
||||
std::fprintf(stderr,
|
||||
"Usage: tcp_client <ip> <port> "
|
||||
"<nconns> <bufsize> {spin|block}\n");
|
||||
return 1;
|
||||
}
|
||||
|
||||
const char* ip = argv[1];
|
||||
unsigned short port = static_cast<unsigned short>(std::atoi(argv[2]));
|
||||
int num_connections = std::atoi(argv[3]);
|
||||
std::size_t buf_size = static_cast<std::size_t>(std::atoi(argv[4]));
|
||||
bool spin = (std::strcmp(argv[5], "spin") == 0);
|
||||
|
||||
asio::io_context io_context;
|
||||
std::vector<boost::shared_ptr<tcp::socket> > sockets;
|
||||
|
||||
for (int i = 0; i < num_connections; ++i)
|
||||
{
|
||||
boost::shared_ptr<tcp::socket> s(new tcp::socket(io_context));
|
||||
|
||||
tcp::endpoint target(asio::ip::make_address(ip), port);
|
||||
s->connect(target);
|
||||
|
||||
s->set_option(tcp::no_delay(true));
|
||||
|
||||
if (spin)
|
||||
{
|
||||
s->non_blocking(true);
|
||||
}
|
||||
|
||||
sockets.push_back(s);
|
||||
}
|
||||
|
||||
std::vector<unsigned char> write_buf(buf_size);
|
||||
std::vector<unsigned char> read_buf(buf_size);
|
||||
|
||||
ptime start = microsec_clock::universal_time();
|
||||
boost::uint64_t start_hr = high_res_clock();
|
||||
|
||||
boost::uint64_t samples[num_samples];
|
||||
for (int i = 0; i < num_samples; ++i)
|
||||
{
|
||||
tcp::socket& socket = *sockets[i % num_connections];
|
||||
|
||||
boost::uint64_t t = high_res_clock();
|
||||
|
||||
asio::error_code ec;
|
||||
asio::write(socket,
|
||||
asio::buffer(write_buf),
|
||||
transfer_all(), ec);
|
||||
|
||||
asio::read(socket,
|
||||
asio::buffer(read_buf),
|
||||
transfer_all(), ec);
|
||||
|
||||
samples[i] = high_res_clock() - t;
|
||||
}
|
||||
|
||||
ptime stop = microsec_clock::universal_time();
|
||||
boost::uint64_t stop_hr = high_res_clock();
|
||||
boost::uint64_t elapsed_usec = (stop - start).total_microseconds();
|
||||
boost::uint64_t elapsed_hr = stop_hr - start_hr;
|
||||
double scale = 1.0 * elapsed_usec / elapsed_hr;
|
||||
|
||||
std::sort(samples, samples + num_samples);
|
||||
std::printf(" 0.0%%\t%f\n", samples[0] * scale);
|
||||
std::printf(" 0.1%%\t%f\n", samples[num_samples / 1000 - 1] * scale);
|
||||
std::printf(" 1.0%%\t%f\n", samples[num_samples / 100 - 1] * scale);
|
||||
std::printf(" 10.0%%\t%f\n", samples[num_samples / 10 - 1] * scale);
|
||||
std::printf(" 20.0%%\t%f\n", samples[num_samples * 2 / 10 - 1] * scale);
|
||||
std::printf(" 30.0%%\t%f\n", samples[num_samples * 3 / 10 - 1] * scale);
|
||||
std::printf(" 40.0%%\t%f\n", samples[num_samples * 4 / 10 - 1] * scale);
|
||||
std::printf(" 50.0%%\t%f\n", samples[num_samples * 5 / 10 - 1] * scale);
|
||||
std::printf(" 60.0%%\t%f\n", samples[num_samples * 6 / 10 - 1] * scale);
|
||||
std::printf(" 70.0%%\t%f\n", samples[num_samples * 7 / 10 - 1] * scale);
|
||||
std::printf(" 80.0%%\t%f\n", samples[num_samples * 8 / 10 - 1] * scale);
|
||||
std::printf(" 90.0%%\t%f\n", samples[num_samples * 9 / 10 - 1] * scale);
|
||||
std::printf(" 99.0%%\t%f\n", samples[num_samples * 99 / 100 - 1] * scale);
|
||||
std::printf(" 99.9%%\t%f\n", samples[num_samples * 999 / 1000 - 1] * scale);
|
||||
std::printf("100.0%%\t%f\n", samples[num_samples - 1] * scale);
|
||||
|
||||
double total = 0.0;
|
||||
for (int i = 0; i < num_samples; ++i) total += samples[i] * scale;
|
||||
std::printf(" mean\t%f\n", total / num_samples);
|
||||
}
|
||||
114
Plugins/GameLiftPlugin/Source/GameLiftServer/ThirdParty/asio/src/tests/latency/tcp_server.cpp
vendored
Normal file
114
Plugins/GameLiftPlugin/Source/GameLiftServer/ThirdParty/asio/src/tests/latency/tcp_server.cpp
vendored
Normal file
@@ -0,0 +1,114 @@
|
||||
//
|
||||
// tcp_server.cpp
|
||||
// ~~~~~~~~~~~~~~
|
||||
//
|
||||
// Copyright (c) 2003-2021 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/io_context.hpp>
|
||||
#include <asio/ip/tcp.hpp>
|
||||
#include <asio/read.hpp>
|
||||
#include <asio/write.hpp>
|
||||
#include <boost/shared_ptr.hpp>
|
||||
#include <cstdio>
|
||||
#include <cstdlib>
|
||||
#include <cstring>
|
||||
#include <vector>
|
||||
|
||||
using asio::ip::tcp;
|
||||
|
||||
#include <asio/yield.hpp>
|
||||
|
||||
class tcp_server : asio::coroutine
|
||||
{
|
||||
public:
|
||||
tcp_server(tcp::acceptor& acceptor, std::size_t buf_size) :
|
||||
acceptor_(acceptor),
|
||||
socket_(acceptor_.get_executor()),
|
||||
buffer_(buf_size)
|
||||
{
|
||||
}
|
||||
|
||||
void operator()(asio::error_code ec, std::size_t n = 0)
|
||||
{
|
||||
reenter (this) for (;;)
|
||||
{
|
||||
yield acceptor_.async_accept(socket_, ref(this));
|
||||
|
||||
while (!ec)
|
||||
{
|
||||
yield asio::async_read(socket_,
|
||||
asio::buffer(buffer_), ref(this));
|
||||
|
||||
if (!ec)
|
||||
{
|
||||
for (std::size_t i = 0; i < n; ++i) buffer_[i] = ~buffer_[i];
|
||||
|
||||
yield asio::async_write(socket_,
|
||||
asio::buffer(buffer_), ref(this));
|
||||
}
|
||||
}
|
||||
|
||||
socket_.close();
|
||||
}
|
||||
}
|
||||
|
||||
struct ref
|
||||
{
|
||||
explicit ref(tcp_server* p)
|
||||
: p_(p)
|
||||
{
|
||||
}
|
||||
|
||||
void operator()(asio::error_code ec, std::size_t n = 0)
|
||||
{
|
||||
(*p_)(ec, n);
|
||||
}
|
||||
|
||||
private:
|
||||
tcp_server* p_;
|
||||
};
|
||||
|
||||
private:
|
||||
tcp::acceptor& acceptor_;
|
||||
tcp::socket socket_;
|
||||
std::vector<unsigned char> buffer_;
|
||||
tcp::endpoint sender_;
|
||||
};
|
||||
|
||||
#include <asio/unyield.hpp>
|
||||
|
||||
int main(int argc, char* argv[])
|
||||
{
|
||||
if (argc != 5)
|
||||
{
|
||||
std::fprintf(stderr,
|
||||
"Usage: tcp_server <port> <nconns> "
|
||||
"<bufsize> {spin|block}\n");
|
||||
return 1;
|
||||
}
|
||||
|
||||
unsigned short port = static_cast<unsigned short>(std::atoi(argv[1]));
|
||||
int max_connections = std::atoi(argv[2]);
|
||||
std::size_t buf_size = std::atoi(argv[3]);
|
||||
bool spin = (std::strcmp(argv[4], "spin") == 0);
|
||||
|
||||
asio::io_context io_context(1);
|
||||
tcp::acceptor acceptor(io_context, tcp::endpoint(tcp::v4(), port));
|
||||
std::vector<boost::shared_ptr<tcp_server> > servers;
|
||||
|
||||
for (int i = 0; i < max_connections; ++i)
|
||||
{
|
||||
boost::shared_ptr<tcp_server> s(new tcp_server(acceptor, buf_size));
|
||||
servers.push_back(s);
|
||||
(*s)(asio::error_code());
|
||||
}
|
||||
|
||||
if (spin)
|
||||
for (;;) io_context.poll();
|
||||
else
|
||||
io_context.run();
|
||||
}
|
||||
104
Plugins/GameLiftPlugin/Source/GameLiftServer/ThirdParty/asio/src/tests/latency/udp_client.cpp
vendored
Normal file
104
Plugins/GameLiftPlugin/Source/GameLiftServer/ThirdParty/asio/src/tests/latency/udp_client.cpp
vendored
Normal file
@@ -0,0 +1,104 @@
|
||||
//
|
||||
// udp_client.cpp
|
||||
// ~~~~~~~~~~~~~~
|
||||
//
|
||||
// Copyright (c) 2003-2021 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/ip/udp.hpp>
|
||||
#include <boost/date_time/posix_time/posix_time_types.hpp>
|
||||
#include <algorithm>
|
||||
#include <cstdio>
|
||||
#include <cstdlib>
|
||||
#include <cstring>
|
||||
#include <vector>
|
||||
#include "high_res_clock.hpp"
|
||||
|
||||
using asio::ip::udp;
|
||||
using boost::posix_time::ptime;
|
||||
using boost::posix_time::microsec_clock;
|
||||
|
||||
const int num_samples = 100000;
|
||||
|
||||
int main(int argc, char* argv[])
|
||||
{
|
||||
if (argc != 6)
|
||||
{
|
||||
std::fprintf(stderr,
|
||||
"Usage: udp_client <ip> <port1> "
|
||||
"<nports> <bufsize> {spin|block}\n");
|
||||
return 1;
|
||||
}
|
||||
|
||||
const char* ip = argv[1];
|
||||
unsigned short first_port = static_cast<unsigned short>(std::atoi(argv[2]));
|
||||
unsigned short num_ports = static_cast<unsigned short>(std::atoi(argv[3]));
|
||||
std::size_t buf_size = static_cast<std::size_t>(std::atoi(argv[4]));
|
||||
bool spin = (std::strcmp(argv[5], "spin") == 0);
|
||||
|
||||
asio::io_context io_context;
|
||||
|
||||
udp::socket socket(io_context, udp::endpoint(udp::v4(), 0));
|
||||
|
||||
if (spin)
|
||||
{
|
||||
socket.non_blocking(true);
|
||||
}
|
||||
|
||||
udp::endpoint target(asio::ip::make_address(ip), first_port);
|
||||
unsigned short last_port = first_port + num_ports - 1;
|
||||
std::vector<unsigned char> write_buf(buf_size);
|
||||
std::vector<unsigned char> read_buf(buf_size);
|
||||
|
||||
ptime start = microsec_clock::universal_time();
|
||||
boost::uint64_t start_hr = high_res_clock();
|
||||
|
||||
boost::uint64_t samples[num_samples];
|
||||
for (int i = 0; i < num_samples; ++i)
|
||||
{
|
||||
boost::uint64_t t = high_res_clock();
|
||||
|
||||
asio::error_code ec;
|
||||
socket.send_to(asio::buffer(write_buf), target, 0, ec);
|
||||
|
||||
do socket.receive(asio::buffer(read_buf), 0, ec);
|
||||
while (ec == asio::error::would_block);
|
||||
|
||||
samples[i] = high_res_clock() - t;
|
||||
|
||||
if (target.port() == last_port)
|
||||
target.port(first_port);
|
||||
else
|
||||
target.port(target.port() + 1);
|
||||
}
|
||||
|
||||
ptime stop = microsec_clock::universal_time();
|
||||
boost::uint64_t stop_hr = high_res_clock();
|
||||
boost::uint64_t elapsed_usec = (stop - start).total_microseconds();
|
||||
boost::uint64_t elapsed_hr = stop_hr - start_hr;
|
||||
double scale = 1.0 * elapsed_usec / elapsed_hr;
|
||||
|
||||
std::sort(samples, samples + num_samples);
|
||||
std::printf(" 0.0%%\t%f\n", samples[0] * scale);
|
||||
std::printf(" 0.1%%\t%f\n", samples[num_samples / 1000 - 1] * scale);
|
||||
std::printf(" 1.0%%\t%f\n", samples[num_samples / 100 - 1] * scale);
|
||||
std::printf(" 10.0%%\t%f\n", samples[num_samples / 10 - 1] * scale);
|
||||
std::printf(" 20.0%%\t%f\n", samples[num_samples * 2 / 10 - 1] * scale);
|
||||
std::printf(" 30.0%%\t%f\n", samples[num_samples * 3 / 10 - 1] * scale);
|
||||
std::printf(" 40.0%%\t%f\n", samples[num_samples * 4 / 10 - 1] * scale);
|
||||
std::printf(" 50.0%%\t%f\n", samples[num_samples * 5 / 10 - 1] * scale);
|
||||
std::printf(" 60.0%%\t%f\n", samples[num_samples * 6 / 10 - 1] * scale);
|
||||
std::printf(" 70.0%%\t%f\n", samples[num_samples * 7 / 10 - 1] * scale);
|
||||
std::printf(" 80.0%%\t%f\n", samples[num_samples * 8 / 10 - 1] * scale);
|
||||
std::printf(" 90.0%%\t%f\n", samples[num_samples * 9 / 10 - 1] * scale);
|
||||
std::printf(" 99.0%%\t%f\n", samples[num_samples * 99 / 100 - 1] * scale);
|
||||
std::printf(" 99.9%%\t%f\n", samples[num_samples * 999 / 1000 - 1] * scale);
|
||||
std::printf("100.0%%\t%f\n", samples[num_samples - 1] * scale);
|
||||
|
||||
double total = 0.0;
|
||||
for (int i = 0; i < num_samples; ++i) total += samples[i] * scale;
|
||||
std::printf(" mean\t%f\n", total / num_samples);
|
||||
}
|
||||
125
Plugins/GameLiftPlugin/Source/GameLiftServer/ThirdParty/asio/src/tests/latency/udp_server.cpp
vendored
Normal file
125
Plugins/GameLiftPlugin/Source/GameLiftServer/ThirdParty/asio/src/tests/latency/udp_server.cpp
vendored
Normal file
@@ -0,0 +1,125 @@
|
||||
//
|
||||
// udp_server.cpp
|
||||
// ~~~~~~~~~~~~~~
|
||||
//
|
||||
// Copyright (c) 2003-2021 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/io_context.hpp>
|
||||
#include <asio/ip/udp.hpp>
|
||||
#include <boost/shared_ptr.hpp>
|
||||
#include <cstdio>
|
||||
#include <cstdlib>
|
||||
#include <cstring>
|
||||
#include <vector>
|
||||
#include "allocator.hpp"
|
||||
|
||||
using asio::ip::udp;
|
||||
|
||||
#include <asio/yield.hpp>
|
||||
|
||||
class udp_server : asio::coroutine
|
||||
{
|
||||
public:
|
||||
udp_server(asio::io_context& io_context,
|
||||
unsigned short port, std::size_t buf_size) :
|
||||
socket_(io_context, udp::endpoint(udp::v4(), port)),
|
||||
buffer_(buf_size)
|
||||
{
|
||||
}
|
||||
|
||||
void operator()(asio::error_code ec, std::size_t n = 0)
|
||||
{
|
||||
reenter (this) for (;;)
|
||||
{
|
||||
yield socket_.async_receive_from(
|
||||
asio::buffer(buffer_),
|
||||
sender_, ref(this));
|
||||
|
||||
if (!ec)
|
||||
{
|
||||
for (std::size_t i = 0; i < n; ++i) buffer_[i] = ~buffer_[i];
|
||||
socket_.send_to(asio::buffer(buffer_, n), sender_, 0, ec);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
friend void* asio_handler_allocate(std::size_t n, udp_server* s)
|
||||
{
|
||||
return s->allocator_.allocate(n);
|
||||
}
|
||||
|
||||
friend void asio_handler_deallocate(void* p, std::size_t, udp_server* s)
|
||||
{
|
||||
s->allocator_.deallocate(p);
|
||||
}
|
||||
|
||||
struct ref
|
||||
{
|
||||
explicit ref(udp_server* p)
|
||||
: p_(p)
|
||||
{
|
||||
}
|
||||
|
||||
void operator()(asio::error_code ec, std::size_t n = 0)
|
||||
{
|
||||
(*p_)(ec, n);
|
||||
}
|
||||
|
||||
private:
|
||||
udp_server* p_;
|
||||
|
||||
friend void* asio_handler_allocate(std::size_t n, ref* r)
|
||||
{
|
||||
return asio_handler_allocate(n, r->p_);
|
||||
}
|
||||
|
||||
friend void asio_handler_deallocate(void* p, std::size_t n, ref* r)
|
||||
{
|
||||
asio_handler_deallocate(p, n, r->p_);
|
||||
}
|
||||
};
|
||||
|
||||
private:
|
||||
udp::socket socket_;
|
||||
std::vector<unsigned char> buffer_;
|
||||
udp::endpoint sender_;
|
||||
allocator allocator_;
|
||||
};
|
||||
|
||||
#include <asio/unyield.hpp>
|
||||
|
||||
int main(int argc, char* argv[])
|
||||
{
|
||||
if (argc != 5)
|
||||
{
|
||||
std::fprintf(stderr,
|
||||
"Usage: udp_server <port1> <nports> "
|
||||
"<bufsize> {spin|block}\n");
|
||||
return 1;
|
||||
}
|
||||
|
||||
unsigned short first_port = static_cast<unsigned short>(std::atoi(argv[1]));
|
||||
unsigned short num_ports = static_cast<unsigned short>(std::atoi(argv[2]));
|
||||
std::size_t buf_size = std::atoi(argv[3]);
|
||||
bool spin = (std::strcmp(argv[4], "spin") == 0);
|
||||
|
||||
asio::io_context io_context(1);
|
||||
std::vector<boost::shared_ptr<udp_server> > servers;
|
||||
|
||||
for (unsigned short i = 0; i < num_ports; ++i)
|
||||
{
|
||||
unsigned short port = first_port + i;
|
||||
boost::shared_ptr<udp_server> s(new udp_server(io_context, port, buf_size));
|
||||
servers.push_back(s);
|
||||
(*s)(asio::error_code());
|
||||
}
|
||||
|
||||
if (spin)
|
||||
for (;;) io_context.poll();
|
||||
else
|
||||
io_context.run();
|
||||
}
|
||||
11
Plugins/GameLiftPlugin/Source/GameLiftServer/ThirdParty/asio/src/tests/performance/.gitignore
vendored
Normal file
11
Plugins/GameLiftPlugin/Source/GameLiftServer/ThirdParty/asio/src/tests/performance/.gitignore
vendored
Normal file
@@ -0,0 +1,11 @@
|
||||
.deps
|
||||
.dirstamp
|
||||
*.o
|
||||
*.obj
|
||||
*.exe
|
||||
client
|
||||
server
|
||||
*.ilk
|
||||
*.manifest
|
||||
*.pdb
|
||||
*.tds
|
||||
286
Plugins/GameLiftPlugin/Source/GameLiftServer/ThirdParty/asio/src/tests/performance/client.cpp
vendored
Normal file
286
Plugins/GameLiftPlugin/Source/GameLiftServer/ThirdParty/asio/src/tests/performance/client.cpp
vendored
Normal file
@@ -0,0 +1,286 @@
|
||||
//
|
||||
// client.cpp
|
||||
// ~~~~~~~~~~
|
||||
//
|
||||
// Copyright (c) 2003-2021 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.hpp"
|
||||
#include <algorithm>
|
||||
#include <boost/bind/bind.hpp>
|
||||
#include <boost/mem_fn.hpp>
|
||||
#include <iostream>
|
||||
#include <list>
|
||||
#include <string>
|
||||
#include "handler_allocator.hpp"
|
||||
|
||||
class stats
|
||||
{
|
||||
public:
|
||||
stats()
|
||||
: mutex_(),
|
||||
total_bytes_written_(0),
|
||||
total_bytes_read_(0)
|
||||
{
|
||||
}
|
||||
|
||||
void add(size_t bytes_written, size_t bytes_read)
|
||||
{
|
||||
asio::detail::mutex::scoped_lock lock(mutex_);
|
||||
total_bytes_written_ += bytes_written;
|
||||
total_bytes_read_ += bytes_read;
|
||||
}
|
||||
|
||||
void print()
|
||||
{
|
||||
asio::detail::mutex::scoped_lock lock(mutex_);
|
||||
std::cout << total_bytes_written_ << " total bytes written\n";
|
||||
std::cout << total_bytes_read_ << " total bytes read\n";
|
||||
}
|
||||
|
||||
private:
|
||||
asio::detail::mutex mutex_;
|
||||
size_t total_bytes_written_;
|
||||
size_t total_bytes_read_;
|
||||
};
|
||||
|
||||
class session
|
||||
{
|
||||
public:
|
||||
session(asio::io_context& ioc, size_t block_size, stats& s)
|
||||
: strand_(ioc.get_executor()),
|
||||
socket_(ioc),
|
||||
block_size_(block_size),
|
||||
read_data_(new char[block_size]),
|
||||
read_data_length_(0),
|
||||
write_data_(new char[block_size]),
|
||||
unwritten_count_(0),
|
||||
bytes_written_(0),
|
||||
bytes_read_(0),
|
||||
stats_(s)
|
||||
{
|
||||
for (size_t i = 0; i < block_size_; ++i)
|
||||
write_data_[i] = static_cast<char>(i % 128);
|
||||
}
|
||||
|
||||
~session()
|
||||
{
|
||||
stats_.add(bytes_written_, bytes_read_);
|
||||
|
||||
delete[] read_data_;
|
||||
delete[] write_data_;
|
||||
}
|
||||
|
||||
void start(asio::ip::tcp::resolver::results_type endpoints)
|
||||
{
|
||||
asio::async_connect(socket_, endpoints,
|
||||
asio::bind_executor(strand_,
|
||||
boost::bind(&session::handle_connect, this,
|
||||
asio::placeholders::error)));
|
||||
}
|
||||
|
||||
void stop()
|
||||
{
|
||||
asio::post(strand_, boost::bind(&session::close_socket, this));
|
||||
}
|
||||
|
||||
private:
|
||||
void handle_connect(const asio::error_code& err)
|
||||
{
|
||||
if (!err)
|
||||
{
|
||||
asio::error_code set_option_err;
|
||||
asio::ip::tcp::no_delay no_delay(true);
|
||||
socket_.set_option(no_delay, set_option_err);
|
||||
if (!set_option_err)
|
||||
{
|
||||
++unwritten_count_;
|
||||
async_write(socket_, asio::buffer(write_data_, block_size_),
|
||||
asio::bind_executor(strand_,
|
||||
make_custom_alloc_handler(write_allocator_,
|
||||
boost::bind(&session::handle_write, this,
|
||||
asio::placeholders::error,
|
||||
asio::placeholders::bytes_transferred))));
|
||||
socket_.async_read_some(asio::buffer(read_data_, block_size_),
|
||||
asio::bind_executor(strand_,
|
||||
make_custom_alloc_handler(read_allocator_,
|
||||
boost::bind(&session::handle_read, this,
|
||||
asio::placeholders::error,
|
||||
asio::placeholders::bytes_transferred))));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void handle_read(const asio::error_code& err, size_t length)
|
||||
{
|
||||
if (!err)
|
||||
{
|
||||
bytes_read_ += length;
|
||||
|
||||
read_data_length_ = length;
|
||||
++unwritten_count_;
|
||||
if (unwritten_count_ == 1)
|
||||
{
|
||||
std::swap(read_data_, write_data_);
|
||||
async_write(socket_, asio::buffer(write_data_, read_data_length_),
|
||||
asio::bind_executor(strand_,
|
||||
make_custom_alloc_handler(write_allocator_,
|
||||
boost::bind(&session::handle_write, this,
|
||||
asio::placeholders::error,
|
||||
asio::placeholders::bytes_transferred))));
|
||||
socket_.async_read_some(asio::buffer(read_data_, block_size_),
|
||||
asio::bind_executor(strand_,
|
||||
make_custom_alloc_handler(read_allocator_,
|
||||
boost::bind(&session::handle_read, this,
|
||||
asio::placeholders::error,
|
||||
asio::placeholders::bytes_transferred))));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void handle_write(const asio::error_code& err, size_t length)
|
||||
{
|
||||
if (!err && length > 0)
|
||||
{
|
||||
bytes_written_ += length;
|
||||
|
||||
--unwritten_count_;
|
||||
if (unwritten_count_ == 1)
|
||||
{
|
||||
std::swap(read_data_, write_data_);
|
||||
async_write(socket_, asio::buffer(write_data_, read_data_length_),
|
||||
asio::bind_executor(strand_,
|
||||
make_custom_alloc_handler(write_allocator_,
|
||||
boost::bind(&session::handle_write, this,
|
||||
asio::placeholders::error,
|
||||
asio::placeholders::bytes_transferred))));
|
||||
socket_.async_read_some(asio::buffer(read_data_, block_size_),
|
||||
asio::bind_executor(strand_,
|
||||
make_custom_alloc_handler(read_allocator_,
|
||||
boost::bind(&session::handle_read, this,
|
||||
asio::placeholders::error,
|
||||
asio::placeholders::bytes_transferred))));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void close_socket()
|
||||
{
|
||||
socket_.close();
|
||||
}
|
||||
|
||||
private:
|
||||
asio::strand<asio::io_context::executor_type> strand_;
|
||||
asio::ip::tcp::socket socket_;
|
||||
size_t block_size_;
|
||||
char* read_data_;
|
||||
size_t read_data_length_;
|
||||
char* write_data_;
|
||||
int unwritten_count_;
|
||||
size_t bytes_written_;
|
||||
size_t bytes_read_;
|
||||
stats& stats_;
|
||||
handler_allocator read_allocator_;
|
||||
handler_allocator write_allocator_;
|
||||
};
|
||||
|
||||
class client
|
||||
{
|
||||
public:
|
||||
client(asio::io_context& ioc,
|
||||
const asio::ip::tcp::resolver::results_type endpoints,
|
||||
size_t block_size, size_t session_count, int timeout)
|
||||
: io_context_(ioc),
|
||||
stop_timer_(ioc),
|
||||
sessions_(),
|
||||
stats_()
|
||||
{
|
||||
stop_timer_.expires_after(asio::chrono::seconds(timeout));
|
||||
stop_timer_.async_wait(boost::bind(&client::handle_timeout, this));
|
||||
|
||||
for (size_t i = 0; i < session_count; ++i)
|
||||
{
|
||||
session* new_session = new session(io_context_, block_size, stats_);
|
||||
new_session->start(endpoints);
|
||||
sessions_.push_back(new_session);
|
||||
}
|
||||
}
|
||||
|
||||
~client()
|
||||
{
|
||||
while (!sessions_.empty())
|
||||
{
|
||||
delete sessions_.front();
|
||||
sessions_.pop_front();
|
||||
}
|
||||
|
||||
stats_.print();
|
||||
}
|
||||
|
||||
void handle_timeout()
|
||||
{
|
||||
std::for_each(sessions_.begin(), sessions_.end(),
|
||||
boost::mem_fn(&session::stop));
|
||||
}
|
||||
|
||||
private:
|
||||
asio::io_context& io_context_;
|
||||
asio::steady_timer stop_timer_;
|
||||
std::list<session*> sessions_;
|
||||
stats stats_;
|
||||
};
|
||||
|
||||
int main(int argc, char* argv[])
|
||||
{
|
||||
try
|
||||
{
|
||||
if (argc != 7)
|
||||
{
|
||||
std::cerr << "Usage: client <host> <port> <threads> <blocksize> ";
|
||||
std::cerr << "<sessions> <time>\n";
|
||||
return 1;
|
||||
}
|
||||
|
||||
using namespace std; // For atoi.
|
||||
const char* host = argv[1];
|
||||
const char* port = argv[2];
|
||||
int thread_count = atoi(argv[3]);
|
||||
size_t block_size = atoi(argv[4]);
|
||||
size_t session_count = atoi(argv[5]);
|
||||
int timeout = atoi(argv[6]);
|
||||
|
||||
asio::io_context ioc;
|
||||
|
||||
asio::ip::tcp::resolver r(ioc);
|
||||
asio::ip::tcp::resolver::results_type endpoints =
|
||||
r.resolve(host, port);
|
||||
|
||||
client c(ioc, endpoints, block_size, session_count, timeout);
|
||||
|
||||
std::list<asio::thread*> threads;
|
||||
while (--thread_count > 0)
|
||||
{
|
||||
asio::thread* new_thread = new asio::thread(
|
||||
boost::bind(&asio::io_context::run, &ioc));
|
||||
threads.push_back(new_thread);
|
||||
}
|
||||
|
||||
ioc.run();
|
||||
|
||||
while (!threads.empty())
|
||||
{
|
||||
threads.front()->join();
|
||||
delete threads.front();
|
||||
threads.pop_front();
|
||||
}
|
||||
}
|
||||
catch (std::exception& e)
|
||||
{
|
||||
std::cerr << "Exception: " << e.what() << "\n";
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
@@ -0,0 +1,112 @@
|
||||
//
|
||||
// handler_allocator.cpp
|
||||
// ~~~~~~~~~~~~~~~~~~~~~
|
||||
//
|
||||
// Copyright (c) 2003-2021 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 HANDLER_ALLOCATOR_HPP
|
||||
#define HANDLER_ALLOCATOR_HPP
|
||||
|
||||
#include "asio.hpp"
|
||||
#include <boost/aligned_storage.hpp>
|
||||
#include <boost/noncopyable.hpp>
|
||||
|
||||
// Class to manage the memory to be used for handler-based custom allocation.
|
||||
// It contains a single block of memory which may be returned for allocation
|
||||
// requests. If the memory is in use when an allocation request is made, the
|
||||
// allocator delegates allocation to the global heap.
|
||||
class handler_allocator
|
||||
: private boost::noncopyable
|
||||
{
|
||||
public:
|
||||
handler_allocator()
|
||||
: in_use_(false)
|
||||
{
|
||||
}
|
||||
|
||||
void* allocate(std::size_t size)
|
||||
{
|
||||
if (!in_use_ && size < storage_.size)
|
||||
{
|
||||
in_use_ = true;
|
||||
return storage_.address();
|
||||
}
|
||||
|
||||
return ::operator new(size);
|
||||
}
|
||||
|
||||
void deallocate(void* pointer)
|
||||
{
|
||||
if (pointer == storage_.address())
|
||||
{
|
||||
in_use_ = false;
|
||||
}
|
||||
else
|
||||
{
|
||||
::operator delete(pointer);
|
||||
}
|
||||
}
|
||||
|
||||
private:
|
||||
// Storage space used for handler-based custom memory allocation.
|
||||
boost::aligned_storage<1024> storage_;
|
||||
|
||||
// Whether the handler-based custom allocation storage has been used.
|
||||
bool in_use_;
|
||||
};
|
||||
|
||||
// Wrapper class template for handler objects to allow handler memory
|
||||
// allocation to be customised. Calls to operator() are forwarded to the
|
||||
// encapsulated handler.
|
||||
template <typename Handler>
|
||||
class custom_alloc_handler
|
||||
{
|
||||
public:
|
||||
custom_alloc_handler(handler_allocator& a, Handler h)
|
||||
: allocator_(a),
|
||||
handler_(h)
|
||||
{
|
||||
}
|
||||
|
||||
template <typename Arg1>
|
||||
void operator()(Arg1 arg1)
|
||||
{
|
||||
handler_(arg1);
|
||||
}
|
||||
|
||||
template <typename Arg1, typename Arg2>
|
||||
void operator()(Arg1 arg1, Arg2 arg2)
|
||||
{
|
||||
handler_(arg1, arg2);
|
||||
}
|
||||
|
||||
friend void* asio_handler_allocate(std::size_t size,
|
||||
custom_alloc_handler<Handler>* this_handler)
|
||||
{
|
||||
return this_handler->allocator_.allocate(size);
|
||||
}
|
||||
|
||||
friend void asio_handler_deallocate(void* pointer, std::size_t /*size*/,
|
||||
custom_alloc_handler<Handler>* this_handler)
|
||||
{
|
||||
this_handler->allocator_.deallocate(pointer);
|
||||
}
|
||||
|
||||
private:
|
||||
handler_allocator& allocator_;
|
||||
Handler handler_;
|
||||
};
|
||||
|
||||
// Helper function to wrap a handler object to add custom allocation.
|
||||
template <typename Handler>
|
||||
inline custom_alloc_handler<Handler> make_custom_alloc_handler(
|
||||
handler_allocator& a, Handler h)
|
||||
{
|
||||
return custom_alloc_handler<Handler>(a, h);
|
||||
}
|
||||
|
||||
#endif // HANDLER_ALLOCATOR_HPP
|
||||
233
Plugins/GameLiftPlugin/Source/GameLiftServer/ThirdParty/asio/src/tests/performance/server.cpp
vendored
Normal file
233
Plugins/GameLiftPlugin/Source/GameLiftServer/ThirdParty/asio/src/tests/performance/server.cpp
vendored
Normal file
@@ -0,0 +1,233 @@
|
||||
//
|
||||
// server.cpp
|
||||
// ~~~~~~~~~~
|
||||
//
|
||||
// Copyright (c) 2003-2021 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.hpp"
|
||||
#include <algorithm>
|
||||
#include <boost/bind/bind.hpp>
|
||||
#include <iostream>
|
||||
#include <list>
|
||||
#include "handler_allocator.hpp"
|
||||
|
||||
class session
|
||||
{
|
||||
public:
|
||||
session(asio::io_context& ioc, size_t block_size)
|
||||
: io_context_(ioc),
|
||||
strand_(ioc.get_executor()),
|
||||
socket_(ioc),
|
||||
block_size_(block_size),
|
||||
read_data_(new char[block_size]),
|
||||
read_data_length_(0),
|
||||
write_data_(new char[block_size]),
|
||||
unsent_count_(0),
|
||||
op_count_(0)
|
||||
{
|
||||
}
|
||||
|
||||
~session()
|
||||
{
|
||||
delete[] read_data_;
|
||||
delete[] write_data_;
|
||||
}
|
||||
|
||||
asio::ip::tcp::socket& socket()
|
||||
{
|
||||
return socket_;
|
||||
}
|
||||
|
||||
void start()
|
||||
{
|
||||
asio::error_code set_option_err;
|
||||
asio::ip::tcp::no_delay no_delay(true);
|
||||
socket_.set_option(no_delay, set_option_err);
|
||||
if (!set_option_err)
|
||||
{
|
||||
++op_count_;
|
||||
socket_.async_read_some(asio::buffer(read_data_, block_size_),
|
||||
asio::bind_executor(strand_,
|
||||
make_custom_alloc_handler(read_allocator_,
|
||||
boost::bind(&session::handle_read, this,
|
||||
asio::placeholders::error,
|
||||
asio::placeholders::bytes_transferred))));
|
||||
}
|
||||
else
|
||||
{
|
||||
asio::post(io_context_, boost::bind(&session::destroy, this));
|
||||
}
|
||||
}
|
||||
|
||||
void handle_read(const asio::error_code& err, size_t length)
|
||||
{
|
||||
--op_count_;
|
||||
|
||||
if (!err)
|
||||
{
|
||||
read_data_length_ = length;
|
||||
++unsent_count_;
|
||||
if (unsent_count_ == 1)
|
||||
{
|
||||
op_count_ += 2;
|
||||
std::swap(read_data_, write_data_);
|
||||
async_write(socket_, asio::buffer(write_data_, read_data_length_),
|
||||
asio::bind_executor(strand_,
|
||||
make_custom_alloc_handler(write_allocator_,
|
||||
boost::bind(&session::handle_write, this,
|
||||
asio::placeholders::error))));
|
||||
socket_.async_read_some(asio::buffer(read_data_, block_size_),
|
||||
asio::bind_executor(strand_,
|
||||
make_custom_alloc_handler(read_allocator_,
|
||||
boost::bind(&session::handle_read, this,
|
||||
asio::placeholders::error,
|
||||
asio::placeholders::bytes_transferred))));
|
||||
}
|
||||
}
|
||||
|
||||
if (op_count_ == 0)
|
||||
asio::post(io_context_, boost::bind(&session::destroy, this));
|
||||
}
|
||||
|
||||
void handle_write(const asio::error_code& err)
|
||||
{
|
||||
--op_count_;
|
||||
|
||||
if (!err)
|
||||
{
|
||||
--unsent_count_;
|
||||
if (unsent_count_ == 1)
|
||||
{
|
||||
op_count_ += 2;
|
||||
std::swap(read_data_, write_data_);
|
||||
async_write(socket_, asio::buffer(write_data_, read_data_length_),
|
||||
asio::bind_executor(strand_,
|
||||
make_custom_alloc_handler(write_allocator_,
|
||||
boost::bind(&session::handle_write, this,
|
||||
asio::placeholders::error))));
|
||||
socket_.async_read_some(asio::buffer(read_data_, block_size_),
|
||||
asio::bind_executor(strand_,
|
||||
make_custom_alloc_handler(read_allocator_,
|
||||
boost::bind(&session::handle_read, this,
|
||||
asio::placeholders::error,
|
||||
asio::placeholders::bytes_transferred))));
|
||||
}
|
||||
}
|
||||
|
||||
if (op_count_ == 0)
|
||||
asio::post(io_context_, boost::bind(&session::destroy, this));
|
||||
}
|
||||
|
||||
static void destroy(session* s)
|
||||
{
|
||||
delete s;
|
||||
}
|
||||
|
||||
private:
|
||||
asio::io_context& io_context_;
|
||||
asio::strand<asio::io_context::executor_type> strand_;
|
||||
asio::ip::tcp::socket socket_;
|
||||
size_t block_size_;
|
||||
char* read_data_;
|
||||
size_t read_data_length_;
|
||||
char* write_data_;
|
||||
int unsent_count_;
|
||||
int op_count_;
|
||||
handler_allocator read_allocator_;
|
||||
handler_allocator write_allocator_;
|
||||
};
|
||||
|
||||
class server
|
||||
{
|
||||
public:
|
||||
server(asio::io_context& ioc, const asio::ip::tcp::endpoint& endpoint,
|
||||
size_t block_size)
|
||||
: io_context_(ioc),
|
||||
acceptor_(ioc),
|
||||
block_size_(block_size)
|
||||
{
|
||||
acceptor_.open(endpoint.protocol());
|
||||
acceptor_.set_option(asio::ip::tcp::acceptor::reuse_address(1));
|
||||
acceptor_.bind(endpoint);
|
||||
acceptor_.listen();
|
||||
|
||||
start_accept();
|
||||
}
|
||||
|
||||
void start_accept()
|
||||
{
|
||||
session* new_session = new session(io_context_, block_size_);
|
||||
acceptor_.async_accept(new_session->socket(),
|
||||
boost::bind(&server::handle_accept, this, new_session,
|
||||
asio::placeholders::error));
|
||||
}
|
||||
|
||||
void handle_accept(session* new_session, const asio::error_code& err)
|
||||
{
|
||||
if (!err)
|
||||
{
|
||||
new_session->start();
|
||||
}
|
||||
else
|
||||
{
|
||||
delete new_session;
|
||||
}
|
||||
|
||||
start_accept();
|
||||
}
|
||||
|
||||
private:
|
||||
asio::io_context& io_context_;
|
||||
asio::ip::tcp::acceptor acceptor_;
|
||||
size_t block_size_;
|
||||
};
|
||||
|
||||
int main(int argc, char* argv[])
|
||||
{
|
||||
try
|
||||
{
|
||||
if (argc != 5)
|
||||
{
|
||||
std::cerr << "Usage: server <address> <port> <threads> <blocksize>\n";
|
||||
return 1;
|
||||
}
|
||||
|
||||
using namespace std; // For atoi.
|
||||
asio::ip::address address = asio::ip::make_address(argv[1]);
|
||||
short port = atoi(argv[2]);
|
||||
int thread_count = atoi(argv[3]);
|
||||
size_t block_size = atoi(argv[4]);
|
||||
|
||||
asio::io_context ioc;
|
||||
|
||||
server s(ioc, asio::ip::tcp::endpoint(address, port), block_size);
|
||||
|
||||
// Threads not currently supported in this test.
|
||||
std::list<asio::thread*> threads;
|
||||
while (--thread_count > 0)
|
||||
{
|
||||
asio::thread* new_thread = new asio::thread(
|
||||
boost::bind(&asio::io_context::run, &ioc));
|
||||
threads.push_back(new_thread);
|
||||
}
|
||||
|
||||
ioc.run();
|
||||
|
||||
while (!threads.empty())
|
||||
{
|
||||
threads.front()->join();
|
||||
delete threads.front();
|
||||
threads.pop_front();
|
||||
}
|
||||
}
|
||||
catch (std::exception& e)
|
||||
{
|
||||
std::cerr << "Exception: " << e.what() << "\n";
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
8
Plugins/GameLiftPlugin/Source/GameLiftServer/ThirdParty/asio/src/tests/properties/.gitignore
vendored
Normal file
8
Plugins/GameLiftPlugin/Source/GameLiftServer/ThirdParty/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
Plugins/GameLiftPlugin/Source/GameLiftServer/ThirdParty/asio/src/tests/properties/Makefile.am
vendored
Normal file
367
Plugins/GameLiftPlugin/Source/GameLiftServer/ThirdParty/asio/src/tests/properties/Makefile.am
vendored
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
Plugins/GameLiftPlugin/Source/GameLiftServer/ThirdParty/asio/src/tests/properties/Makefile.msc
vendored
Normal file
308
Plugins/GameLiftPlugin/Source/GameLiftServer/ThirdParty/asio/src/tests/properties/Makefile.msc
vendored
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
|
||||
@@ -0,0 +1,59 @@
|
||||
//
|
||||
// cpp03/can_prefer_free_prefer.cpp
|
||||
// ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||
//
|
||||
// Copyright (c) 2003-2021 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));
|
||||
}
|
||||
@@ -0,0 +1,59 @@
|
||||
//
|
||||
// cpp03/can_prefer_free_require.cpp
|
||||
// ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||
//
|
||||
// Copyright (c) 2003-2021 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));
|
||||
}
|
||||
@@ -0,0 +1,59 @@
|
||||
//
|
||||
// cpp03/can_prefer_member_prefer.cpp
|
||||
// ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||
//
|
||||
// Copyright (c) 2003-2021 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-2021 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-2021 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-2021 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-2021 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-2021 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-2021 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-2021 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-2021 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-2021 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-2021 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-2021 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-2021 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-2021 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));
|
||||
}
|
||||
@@ -0,0 +1,52 @@
|
||||
//
|
||||
// cpp03/can_prefer_static.cpp
|
||||
// ~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||
//
|
||||
// Copyright (c) 2003-2021 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));
|
||||
}
|
||||
@@ -0,0 +1,43 @@
|
||||
//
|
||||
// cpp03/can_prefer_unsupported.cpp
|
||||
// ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||
//
|
||||
// Copyright (c) 2003-2021 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));
|
||||
}
|
||||
@@ -0,0 +1,48 @@
|
||||
//
|
||||
// cpp03/can_query_free.cpp
|
||||
// ~~~~~~~~~~~~~~~~~~~~~~~~
|
||||
//
|
||||
// Copyright (c) 2003-2021 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));
|
||||
}
|
||||
@@ -0,0 +1,48 @@
|
||||
//
|
||||
// cpp03/can_query_member.cpp
|
||||
// ~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||
//
|
||||
// Copyright (c) 2003-2021 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-2021 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-2021 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-2021 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-2021 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));
|
||||
}
|
||||
@@ -0,0 +1,48 @@
|
||||
//
|
||||
// cpp03/can_query_static.cpp
|
||||
// ~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||
//
|
||||
// Copyright (c) 2003-2021 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));
|
||||
}
|
||||
@@ -0,0 +1,36 @@
|
||||
//
|
||||
// cpp03/can_query_unsupported.cpp
|
||||
// ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||
//
|
||||
// Copyright (c) 2003-2021 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));
|
||||
}
|
||||
@@ -0,0 +1,55 @@
|
||||
//
|
||||
// cpp03/can_require_concept_free.cpp
|
||||
// ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||
//
|
||||
// Copyright (c) 2003-2021 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-2021 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-2021 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-2021 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-2021 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-2021 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-2021 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-2021 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));
|
||||
}
|
||||
@@ -0,0 +1,59 @@
|
||||
//
|
||||
// cpp03/can_require_free.cpp
|
||||
// ~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||
//
|
||||
// Copyright (c) 2003-2021 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));
|
||||
}
|
||||
@@ -0,0 +1,59 @@
|
||||
//
|
||||
// cpp03/can_require_member.cpp
|
||||
// ~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||
//
|
||||
// Copyright (c) 2003-2021 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-2021 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-2021 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-2021 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-2021 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));
|
||||
}
|
||||
@@ -0,0 +1,52 @@
|
||||
//
|
||||
// cpp03/can_require_static.cpp
|
||||
// ~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||
//
|
||||
// Copyright (c) 2003-2021 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));
|
||||
}
|
||||
@@ -0,0 +1,42 @@
|
||||
//
|
||||
// cpp03/can_require_unsupported.cpp
|
||||
// ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||
//
|
||||
// Copyright (c) 2003-2021 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));
|
||||
}
|
||||
@@ -0,0 +1,68 @@
|
||||
//
|
||||
// cpp03/prefer_free_prefer.cpp
|
||||
// ~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||
//
|
||||
// Copyright (c) 2003-2021 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;
|
||||
}
|
||||
@@ -0,0 +1,68 @@
|
||||
//
|
||||
// cpp03/prefer_free_require.cpp
|
||||
// ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||
//
|
||||
// Copyright (c) 2003-2021 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;
|
||||
}
|
||||
@@ -0,0 +1,68 @@
|
||||
//
|
||||
// cpp03/prefer_member_prefer.cpp
|
||||
// ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||
//
|
||||
// Copyright (c) 2003-2021 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;
|
||||
}
|
||||
@@ -0,0 +1,68 @@
|
||||
//
|
||||
// cpp03/prefer_member_require.cpp
|
||||
// ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||
//
|
||||
// Copyright (c) 2003-2021 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;
|
||||
}
|
||||
@@ -0,0 +1,61 @@
|
||||
//
|
||||
// cpp03/prefer_static.cpp
|
||||
// ~~~~~~~~~~~~~~~~~~~~~~~
|
||||
//
|
||||
// Copyright (c) 2003-2021 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;
|
||||
}
|
||||
@@ -0,0 +1,46 @@
|
||||
//
|
||||
// cpp03/prefer_unsupported.cpp
|
||||
// ~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||
//
|
||||
// Copyright (c) 2003-2021 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;
|
||||
}
|
||||
@@ -0,0 +1,55 @@
|
||||
//
|
||||
// cpp03/query_free.cpp
|
||||
// ~~~~~~~~~~~~~~~~~~~~
|
||||
//
|
||||
// Copyright (c) 2003-2021 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;
|
||||
}
|
||||
@@ -0,0 +1,55 @@
|
||||
//
|
||||
// cpp03/query_member.cpp
|
||||
// ~~~~~~~~~~~~~~~~~~~~~~
|
||||
//
|
||||
// Copyright (c) 2003-2021 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;
|
||||
}
|
||||
@@ -0,0 +1,55 @@
|
||||
//
|
||||
// cpp03/query_static.cpp
|
||||
// ~~~~~~~~~~~~~~~~~~~~~~
|
||||
//
|
||||
// Copyright (c) 2003-2021 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;
|
||||
}
|
||||
@@ -0,0 +1,60 @@
|
||||
//
|
||||
// cpp03/require_concept_free.cpp
|
||||
// ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||
//
|
||||
// Copyright (c) 2003-2021 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;
|
||||
}
|
||||
@@ -0,0 +1,60 @@
|
||||
//
|
||||
// cpp03/require_concept_member.cpp
|
||||
// ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||
//
|
||||
// Copyright (c) 2003-2021 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;
|
||||
}
|
||||
@@ -0,0 +1,55 @@
|
||||
//
|
||||
// cpp03/require_concept_static.cpp
|
||||
// ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||
//
|
||||
// Copyright (c) 2003-2021 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;
|
||||
}
|
||||
@@ -0,0 +1,68 @@
|
||||
//
|
||||
// cpp03/require_free.cpp
|
||||
// ~~~~~~~~~~~~~~~~~~~~~~
|
||||
//
|
||||
// Copyright (c) 2003-2021 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;
|
||||
}
|
||||
@@ -0,0 +1,68 @@
|
||||
//
|
||||
// cpp03/require_member.cpp
|
||||
// ~~~~~~~~~~~~~~~~~~~~~~~~
|
||||
//
|
||||
// Copyright (c) 2003-2021 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;
|
||||
}
|
||||
@@ -0,0 +1,61 @@
|
||||
//
|
||||
// cpp03/require_static.cpp
|
||||
// ~~~~~~~~~~~~~~~~~~~~~~~~
|
||||
//
|
||||
// Copyright (c) 2003-2021 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;
|
||||
}
|
||||
@@ -0,0 +1,48 @@
|
||||
//
|
||||
// cpp11/can_prefer_free_prefer.cpp
|
||||
// ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||
//
|
||||
// Copyright (c) 2003-2021 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, "");
|
||||
}
|
||||
@@ -0,0 +1,48 @@
|
||||
//
|
||||
// cpp11/can_prefer_free_require.cpp
|
||||
// ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||
//
|
||||
// Copyright (c) 2003-2021 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, "");
|
||||
}
|
||||
@@ -0,0 +1,48 @@
|
||||
//
|
||||
// cpp11/can_prefer_member_prefer.cpp
|
||||
// ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||
//
|
||||
// Copyright (c) 2003-2021 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-2021 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-2021 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-2021 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-2021 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-2021 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-2021 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-2021 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-2021 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-2021 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-2021 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-2021 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-2021 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-2021 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, "");
|
||||
}
|
||||
@@ -0,0 +1,52 @@
|
||||
//
|
||||
// cpp11/can_prefer_static.cpp
|
||||
// ~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||
//
|
||||
// Copyright (c) 2003-2021 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 {
|
||||
|
||||
template<int N, int M>
|
||||
struct is_applicable_property<object<N>, prop<M> >
|
||||
{
|
||||
static constexpr bool value = true;
|
||||
};
|
||||
|
||||
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,43 @@
|
||||
//
|
||||
// cpp11/can_prefer_unsupported.cpp
|
||||
// ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||
//
|
||||
// Copyright (c) 2003-2021 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 {
|
||||
|
||||
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,37 @@
|
||||
//
|
||||
// cpp11/can_query_free.cpp
|
||||
// ~~~~~~~~~~~~~~~~~~~~~~~~
|
||||
//
|
||||
// Copyright (c) 2003-2021 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 constexpr int query(const object&, prop) { return 123; }
|
||||
};
|
||||
|
||||
namespace asio {
|
||||
|
||||
template<>
|
||||
struct is_applicable_property<object, prop>
|
||||
{
|
||||
static constexpr bool value = true;
|
||||
};
|
||||
|
||||
} // namespace asio
|
||||
|
||||
int main()
|
||||
{
|
||||
static_assert(asio::can_query<object, prop>::value, "");
|
||||
static_assert(asio::can_query<const object, prop>::value, "");
|
||||
}
|
||||
@@ -0,0 +1,37 @@
|
||||
//
|
||||
// cpp11/can_query_member.cpp
|
||||
// ~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||
//
|
||||
// Copyright (c) 2003-2021 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
|
||||
{
|
||||
constexpr int query(prop) const { return 123; }
|
||||
};
|
||||
|
||||
namespace asio {
|
||||
|
||||
template<>
|
||||
struct is_applicable_property<object, prop>
|
||||
{
|
||||
static constexpr bool value = true;
|
||||
};
|
||||
|
||||
} // namespace asio
|
||||
|
||||
int main()
|
||||
{
|
||||
static_assert(asio::can_query<object, prop>::value, "");
|
||||
static_assert(asio::can_query<const object, prop>::value, "");
|
||||
}
|
||||
@@ -0,0 +1,27 @@
|
||||
//
|
||||
// cpp11/can_query_not_applicable_free.cpp
|
||||
// ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||
//
|
||||
// Copyright (c) 2003-2021 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 constexpr int query(const object&, prop) { return 123; }
|
||||
};
|
||||
|
||||
int main()
|
||||
{
|
||||
static_assert(!asio::can_query<object, prop>::value, "");
|
||||
static_assert(!asio::can_query<const object, prop>::value, "");
|
||||
}
|
||||
@@ -0,0 +1,27 @@
|
||||
//
|
||||
// cpp11/can_query_not_applicable_member.cpp
|
||||
// ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||
//
|
||||
// Copyright (c) 2003-2021 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
|
||||
{
|
||||
constexpr int query(prop) const { return 123; }
|
||||
};
|
||||
|
||||
int main()
|
||||
{
|
||||
static_assert(!asio::can_query<object, prop>::value, "");
|
||||
static_assert(!asio::can_query<const object, prop>::value, "");
|
||||
}
|
||||
@@ -0,0 +1,41 @@
|
||||
//
|
||||
// cpp11/can_query_not_applicable_static.cpp
|
||||
// ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||
//
|
||||
// Copyright (c) 2003-2021 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 constexpr bool is_valid = true;
|
||||
static constexpr bool is_noexcept = true;
|
||||
typedef int result_type;
|
||||
static constexpr int value() { return 123; }
|
||||
};
|
||||
|
||||
} // namespace traits
|
||||
} // namespace asio
|
||||
|
||||
int main()
|
||||
{
|
||||
static_assert(!asio::can_query<object, prop>::value, "");
|
||||
static_assert(!asio::can_query<const object, prop>::value, "");
|
||||
}
|
||||
@@ -0,0 +1,26 @@
|
||||
//
|
||||
// cpp11/can_query_not_applicable_unsupported.cpp
|
||||
// ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||
//
|
||||
// Copyright (c) 2003-2021 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()
|
||||
{
|
||||
static_assert(!asio::can_query<object, prop>::value, "");
|
||||
static_assert(!asio::can_query<const object, prop>::value, "");
|
||||
}
|
||||
@@ -0,0 +1,48 @@
|
||||
//
|
||||
// cpp11/can_query_static.cpp
|
||||
// ~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||
//
|
||||
// Copyright (c) 2003-2021 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 constexpr bool value = true;
|
||||
};
|
||||
|
||||
namespace traits {
|
||||
|
||||
template<>
|
||||
struct static_query<object, prop>
|
||||
{
|
||||
static constexpr bool is_valid = true;
|
||||
static constexpr bool is_noexcept = true;
|
||||
typedef int result_type;
|
||||
static constexpr int value() { return 123; }
|
||||
};
|
||||
|
||||
} // namespace traits
|
||||
} // namespace asio
|
||||
|
||||
int main()
|
||||
{
|
||||
static_assert(asio::can_query<object, prop>::value, "");
|
||||
static_assert(asio::can_query<const object, prop>::value, "");
|
||||
}
|
||||
@@ -0,0 +1,36 @@
|
||||
//
|
||||
// cpp11/can_query_unsupported.cpp
|
||||
// ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||
//
|
||||
// Copyright (c) 2003-2021 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 constexpr bool value = true;
|
||||
};
|
||||
|
||||
} // namespace asio
|
||||
|
||||
int main()
|
||||
{
|
||||
static_assert(!asio::can_query<object, prop>::value, "");
|
||||
static_assert(!asio::can_query<const object, prop>::value, "");
|
||||
}
|
||||
@@ -0,0 +1,44 @@
|
||||
//
|
||||
// cpp11/can_require_concept_free.cpp
|
||||
// ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||
//
|
||||
// Copyright (c) 2003-2021 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 constexpr bool is_requirable_concept = true;
|
||||
};
|
||||
|
||||
template <int>
|
||||
struct object
|
||||
{
|
||||
template <int N>
|
||||
friend constexpr 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 constexpr bool value = true;
|
||||
};
|
||||
|
||||
} // namespace asio
|
||||
|
||||
int main()
|
||||
{
|
||||
static_assert(asio::can_require_concept<object<1>, prop<2>>::value, "");
|
||||
static_assert(asio::can_require_concept<const object<1>, prop<2>>::value, "");
|
||||
}
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user