From 455c9213743d5604712fd4fe73102b2f43d7f372 Mon Sep 17 00:00:00 2001 From: greshilov Date: Tue, 27 Feb 2018 11:51:52 +0300 Subject: [PATCH] [boost] Update repo boost sources to 1.64 --- 3party/boost/TODO_OMIM.txt | 16 - 3party/boost/boost/algorithm/algorithm.hpp | 14 +- 3party/boost/boost/algorithm/cxx11/all_of.hpp | 3 - 3party/boost/boost/algorithm/cxx11/any_of.hpp | 1 - .../boost/boost/algorithm/cxx11/copy_if.hpp | 4 +- 3party/boost/boost/algorithm/cxx11/copy_n.hpp | 4 - .../boost/algorithm/cxx11/find_if_not.hpp | 4 - 3party/boost/boost/algorithm/cxx11/iota.hpp | 4 - .../boost/algorithm/cxx11/is_partitioned.hpp | 4 - .../boost/algorithm/cxx11/is_permutation.hpp | 8 +- .../boost/boost/algorithm/cxx11/is_sorted.hpp | 1 - .../boost/boost/algorithm/cxx11/none_of.hpp | 7 +- .../boost/algorithm/cxx11/partition_copy.hpp | 5 +- .../boost/algorithm/cxx11/partition_point.hpp | 4 +- 3party/boost/boost/algorithm/cxx14/equal.hpp | 3 +- .../boost/algorithm/cxx14/is_permutation.hpp | 7 +- .../boost/boost/algorithm/cxx14/mismatch.hpp | 1 - 3party/boost/boost/algorithm/hex.hpp | 123 +- .../boost/boost/algorithm/is_palindrome.hpp | 161 + .../boost/algorithm/searching/boyer_moore.hpp | 32 +- .../searching/boyer_moore_horspool.hpp | 33 +- .../algorithm/searching/detail/bm_traits.hpp | 2 +- .../searching/knuth_morris_pratt.hpp | 33 +- .../boost/boost/algorithm/sort_subrange.hpp | 109 + .../boost/boost/algorithm/string/replace.hpp | 2 - 3party/boost/boost/align.hpp | 11 +- 3party/boost/boost/align/align.hpp | 9 +- 3party/boost/boost/align/align_down.hpp | 25 + 3party/boost/boost/align/align_up.hpp | 25 + 3party/boost/boost/align/aligned_alloc.hpp | 13 +- .../boost/boost/align/aligned_allocator.hpp | 76 +- .../boost/align/aligned_allocator_adaptor.hpp | 107 +- .../aligned_allocator_adaptor_forward.hpp | 13 +- .../boost/align/aligned_allocator_forward.hpp | 13 +- 3party/boost/boost/align/aligned_delete.hpp | 19 +- .../boost/align/aligned_delete_forward.hpp | 15 +- 3party/boost/boost/align/alignment_of.hpp | 27 +- .../boost/align/alignment_of_forward.hpp | 13 +- 3party/boost/boost/align/assume_aligned.hpp | 15 +- 3party/boost/boost/align/detail/address.hpp | 29 - 3party/boost/boost/align/detail/addressof.hpp | 15 +- 3party/boost/boost/align/detail/align.hpp | 42 +- .../boost/boost/align/detail/align_cxx11.hpp | 13 +- .../boost/boost/align/detail/align_down.hpp | 28 + 3party/boost/boost/align/detail/align_up.hpp | 28 + .../boost/align/detail/aligned_alloc.hpp | 42 +- .../align/detail/aligned_alloc_android.hpp | 24 +- .../align/detail/aligned_alloc_macos.hpp | 26 +- .../boost/align/detail/aligned_alloc_msvc.hpp | 24 +- .../align/detail/aligned_alloc_posix.hpp | 24 +- .../align/detail/aligned_alloc_sunos.hpp | 24 +- .../boost/boost/align/detail/alignment_of.hpp | 26 +- .../boost/align/detail/alignment_of_clang.hpp | 18 +- .../align/detail/alignment_of_codegear.hpp | 18 +- .../boost/align/detail/alignment_of_cxx11.hpp | 15 +- .../boost/align/detail/alignment_of_gcc.hpp | 18 +- .../boost/align/detail/alignment_of_msvc.hpp | 27 +- .../boost/align/detail/assume_aligned.hpp | 13 +- .../align/detail/assume_aligned_clang.hpp | 19 +- .../boost/align/detail/assume_aligned_gcc.hpp | 17 +- .../align/detail/assume_aligned_intel.hpp | 13 +- .../align/detail/assume_aligned_msvc.hpp | 17 +- .../{remove_traits.hpp => element_type.hpp} | 63 +- .../boost/align/detail/integral_constant.hpp | 34 +- .../boost/boost/align/detail/is_aligned.hpp | 31 +- .../boost/boost/align/detail/is_alignment.hpp | 20 +- .../align/detail/is_alignment_constant.hpp | 18 +- 3party/boost/boost/align/detail/max_align.hpp | 24 +- .../boost/boost/align/detail/max_count_of.hpp | 29 - .../boost/boost/align/detail/max_objects.hpp | 27 + 3party/boost/boost/align/detail/max_size.hpp | 26 + 3party/boost/boost/align/detail/min_size.hpp | 18 +- .../boost/align/detail/offset_object.hpp | 26 - 3party/boost/boost/align/is_aligned.hpp | 22 +- 3party/boost/boost/aligned_storage.hpp | 127 +- 3party/boost/boost/any.hpp | 20 +- 3party/boost/boost/archive/add_facet.hpp | 55 - .../boost/boost/archive/archive_exception.hpp | 3 +- .../boost/archive/basic_binary_iarchive.hpp | 2 +- .../boost/archive/basic_binary_iprimitive.hpp | 26 +- .../boost/archive/basic_binary_oarchive.hpp | 2 +- .../boost/archive/basic_binary_oprimitive.hpp | 39 +- .../archive/basic_streambuf_locale_saver.hpp | 63 +- .../boost/archive/basic_text_iarchive.hpp | 2 +- .../boost/archive/basic_text_iprimitive.hpp | 29 +- .../boost/archive/basic_text_oarchive.hpp | 2 +- .../boost/archive/basic_text_oprimitive.hpp | 27 +- .../boost/archive/basic_xml_iarchive.hpp | 21 +- .../boost/archive/basic_xml_oarchive.hpp | 31 +- .../boost/archive/binary_iarchive_impl.hpp | 5 +- .../boost/boost/archive/binary_oarchive.hpp | 2 +- .../boost/archive/binary_oarchive_impl.hpp | 5 +- 3party/boost/boost/archive/codecvt_null.hpp | 4 +- .../boost/archive/detail/basic_iarchive.hpp | 16 +- .../archive/detail/basic_iserializer.hpp | 8 +- .../boost/archive/detail/basic_oarchive.hpp | 10 +- .../archive/detail/basic_oserializer.hpp | 6 +- .../detail/basic_pointer_iserializer.hpp | 6 +- .../detail/basic_pointer_oserializer.hpp | 8 +- .../boost/archive/detail/basic_serializer.hpp | 4 +- .../boost/archive/detail/common_iarchive.hpp | 2 +- .../boost/archive/detail/common_oarchive.hpp | 3 +- 3party/boost/boost/archive/detail/decl.hpp | 4 +- .../archive/detail/interface_iarchive.hpp | 2 +- .../archive/detail/interface_oarchive.hpp | 6 +- .../boost/archive/detail/iserializer.hpp | 46 +- .../boost/archive/detail/oserializer.hpp | 13 +- .../detail/polymorphic_iarchive_route.hpp | 4 +- .../detail/polymorphic_oarchive_route.hpp | 4 +- .../archive/detail/utf8_codecvt_facet.hpp | 24 +- .../archive/impl/basic_binary_iprimitive.ipp | 53 +- .../archive/impl/basic_binary_oprimitive.ipp | 50 +- .../archive/impl/basic_text_iprimitive.ipp | 29 +- .../archive/impl/basic_text_oprimitive.ipp | 32 +- .../boost/archive/impl/basic_xml_grammar.hpp | 2 +- .../boost/archive/impl/basic_xml_iarchive.ipp | 3 +- .../boost/archive/impl/basic_xml_oarchive.ipp | 18 +- .../boost/archive/impl/text_iarchive_impl.ipp | 2 +- .../boost/archive/impl/text_oarchive_impl.ipp | 4 +- .../archive/impl/text_wiarchive_impl.ipp | 2 +- .../boost/archive/impl/xml_iarchive_impl.ipp | 64 +- .../boost/archive/impl/xml_oarchive_impl.ipp | 25 + .../boost/archive/impl/xml_wiarchive_impl.ipp | 28 +- .../boost/archive/impl/xml_woarchive_impl.ipp | 44 +- .../boost/archive/iterators/dataflow.hpp | 1 - .../boost/archive/iterators/head_iterator.hpp | 80 - .../archive/iterators/istream_iterator.hpp | 15 - .../boost/archive/iterators/mb_from_wchar.hpp | 35 +- .../archive/iterators/transform_width.hpp | 2 +- .../boost/archive/iterators/wchar_from_mb.hpp | 150 +- .../boost/archive/iterators/xml_unescape.hpp | 2 +- .../boost/archive/polymorphic_iarchive.hpp | 4 +- .../boost/archive/polymorphic_oarchive.hpp | 6 +- 3party/boost/boost/archive/text_iarchive.hpp | 25 +- 3party/boost/boost/archive/text_oarchive.hpp | 30 +- 3party/boost/boost/archive/text_wiarchive.hpp | 4 +- 3party/boost/boost/archive/text_woarchive.hpp | 2 +- .../boost/archive/xml_archive_exception.hpp | 4 +- 3party/boost/boost/archive/xml_iarchive.hpp | 20 +- 3party/boost/boost/archive/xml_oarchive.hpp | 60 +- 3party/boost/boost/archive/xml_wiarchive.hpp | 32 +- 3party/boost/boost/archive/xml_woarchive.hpp | 53 +- 3party/boost/boost/array.hpp | 95 +- 3party/boost/boost/asio.hpp | 2 +- 3party/boost/boost/asio/async_result.hpp | 2 +- .../boost/asio/basic_datagram_socket.hpp | 2 +- .../boost/boost/asio/basic_deadline_timer.hpp | 2 +- 3party/boost/boost/asio/basic_io_object.hpp | 24 +- 3party/boost/boost/asio/basic_raw_socket.hpp | 2 +- .../boost/asio/basic_seq_packet_socket.hpp | 2 +- 3party/boost/boost/asio/basic_serial_port.hpp | 4 +- 3party/boost/boost/asio/basic_signal_set.hpp | 2 +- 3party/boost/boost/asio/basic_socket.hpp | 7 +- .../boost/asio/basic_socket_acceptor.hpp | 7 +- .../boost/asio/basic_socket_iostream.hpp | 2 +- .../boost/asio/basic_socket_streambuf.hpp | 2 +- .../boost/boost/asio/basic_stream_socket.hpp | 2 +- 3party/boost/boost/asio/basic_streambuf.hpp | 2 +- .../boost/boost/asio/basic_streambuf_fwd.hpp | 2 +- .../boost/boost/asio/basic_waitable_timer.hpp | 2 +- 3party/boost/boost/asio/buffer.hpp | 2 +- .../boost/boost/asio/buffered_read_stream.hpp | 2 +- .../boost/asio/buffered_read_stream_fwd.hpp | 2 +- 3party/boost/boost/asio/buffered_stream.hpp | 2 +- .../boost/boost/asio/buffered_stream_fwd.hpp | 2 +- .../boost/asio/buffered_write_stream.hpp | 2 +- .../boost/asio/buffered_write_stream_fwd.hpp | 2 +- 3party/boost/boost/asio/buffers_iterator.hpp | 2 +- .../boost/boost/asio/completion_condition.hpp | 2 +- 3party/boost/boost/asio/connect.hpp | 2 +- 3party/boost/boost/asio/coroutine.hpp | 2 +- .../boost/asio/datagram_socket_service.hpp | 8 +- 3party/boost/boost/asio/deadline_timer.hpp | 2 +- .../boost/asio/deadline_timer_service.hpp | 2 +- 3party/boost/boost/asio/detail/addressof.hpp | 2 +- 3party/boost/boost/asio/detail/array.hpp | 2 +- 3party/boost/boost/asio/detail/array_fwd.hpp | 2 +- 3party/boost/boost/asio/detail/assert.hpp | 2 +- .../boost/boost/asio/detail/atomic_count.hpp | 2 +- .../asio/detail/base_from_completion_cond.hpp | 2 +- .../boost/boost/asio/detail/bind_handler.hpp | 2 +- .../boost/asio/detail/buffer_resize_guard.hpp | 2 +- .../asio/detail/buffer_sequence_adapter.hpp | 2 +- .../asio/detail/buffered_stream_storage.hpp | 2 +- 3party/boost/boost/asio/detail/call_stack.hpp | 2 +- .../boost/asio/detail/chrono_time_traits.hpp | 2 +- .../boost/asio/detail/completion_handler.hpp | 2 +- 3party/boost/boost/asio/detail/config.hpp | 121 +- .../boost/asio/detail/consuming_buffers.hpp | 2 +- 3party/boost/boost/asio/detail/cstdint.hpp | 2 +- .../boost/boost/asio/detail/date_time_fwd.hpp | 2 +- .../asio/detail/deadline_timer_service.hpp | 2 +- .../boost/asio/detail/dependent_type.hpp | 2 +- .../boost/asio/detail/descriptor_ops.hpp | 2 +- .../boost/asio/detail/descriptor_read_op.hpp | 2 +- .../boost/asio/detail/descriptor_write_op.hpp | 2 +- .../boost/asio/detail/dev_poll_reactor.hpp | 2 +- .../boost/boost/asio/detail/epoll_reactor.hpp | 2 +- 3party/boost/boost/asio/detail/event.hpp | 2 +- .../detail/eventfd_select_interrupter.hpp | 2 +- .../boost/asio/detail/fd_set_adapter.hpp | 2 +- .../boost/boost/asio/detail/fenced_block.hpp | 6 +- 3party/boost/boost/asio/detail/function.hpp | 2 +- .../asio/detail/gcc_arm_fenced_block.hpp | 2 +- .../asio/detail/gcc_hppa_fenced_block.hpp | 2 +- .../asio/detail/gcc_sync_fenced_block.hpp | 2 +- .../asio/detail/gcc_x86_fenced_block.hpp | 2 +- .../asio/detail/handler_alloc_helpers.hpp | 2 +- .../asio/detail/handler_cont_helpers.hpp | 2 +- .../asio/detail/handler_invoke_helpers.hpp | 2 +- .../boost/asio/detail/handler_tracking.hpp | 2 +- .../asio/detail/handler_type_requirements.hpp | 12 +- 3party/boost/boost/asio/detail/hash_map.hpp | 8 +- .../detail/impl/buffer_sequence_adapter.ipp | 2 +- .../boost/asio/detail/impl/descriptor_ops.ipp | 2 +- .../asio/detail/impl/dev_poll_reactor.hpp | 2 +- .../asio/detail/impl/dev_poll_reactor.ipp | 2 +- .../boost/asio/detail/impl/epoll_reactor.hpp | 2 +- .../boost/asio/detail/impl/epoll_reactor.ipp | 28 +- .../impl/eventfd_select_interrupter.ipp | 2 +- .../asio/detail/impl/handler_tracking.ipp | 2 +- .../boost/asio/detail/impl/kqueue_reactor.hpp | 2 +- .../boost/asio/detail/impl/kqueue_reactor.ipp | 2 +- .../detail/impl/pipe_select_interrupter.ipp | 2 +- .../boost/asio/detail/impl/posix_event.ipp | 2 +- .../boost/asio/detail/impl/posix_mutex.ipp | 2 +- .../boost/asio/detail/impl/posix_thread.ipp | 2 +- .../boost/asio/detail/impl/posix_tss_ptr.ipp | 2 +- .../impl/reactive_descriptor_service.ipp | 2 +- .../impl/reactive_serial_port_service.ipp | 2 +- .../impl/reactive_socket_service_base.ipp | 2 +- .../detail/impl/resolver_service_base.ipp | 2 +- .../boost/asio/detail/impl/select_reactor.hpp | 2 +- .../boost/asio/detail/impl/select_reactor.ipp | 2 +- .../asio/detail/impl/service_registry.hpp | 2 +- .../asio/detail/impl/service_registry.ipp | 2 +- .../asio/detail/impl/signal_set_service.ipp | 2 +- .../boost/asio/detail/impl/socket_ops.ipp | 45 +- .../detail/impl/socket_select_interrupter.ipp | 5 +- .../boost/asio/detail/impl/strand_service.hpp | 2 +- .../boost/asio/detail/impl/strand_service.ipp | 2 +- .../asio/detail/impl/task_io_service.hpp | 2 +- .../asio/detail/impl/task_io_service.ipp | 2 +- .../boost/asio/detail/impl/throw_error.ipp | 2 +- .../asio/detail/impl/timer_queue_ptime.ipp | 2 +- .../asio/detail/impl/timer_queue_set.ipp | 2 +- .../boost/asio/detail/impl/win_event.ipp | 14 +- .../detail/impl/win_iocp_handle_service.ipp | 4 +- .../asio/detail/impl/win_iocp_io_service.hpp | 2 +- .../asio/detail/impl/win_iocp_io_service.ipp | 2 +- .../impl/win_iocp_serial_port_service.ipp | 2 +- .../impl/win_iocp_socket_service_base.ipp | 2 +- .../boost/asio/detail/impl/win_mutex.ipp | 8 +- .../detail/impl/win_object_handle_service.ipp | 2 +- .../asio/detail/impl/win_static_mutex.ipp | 20 +- .../boost/asio/detail/impl/win_thread.ipp | 14 +- .../boost/asio/detail/impl/win_tss_ptr.ipp | 2 +- .../impl/winrt_ssocket_service_base.ipp | 2 +- .../detail/impl/winrt_timer_scheduler.hpp | 2 +- .../detail/impl/winrt_timer_scheduler.ipp | 2 +- .../boost/asio/detail/impl/winsock_init.ipp | 2 +- 3party/boost/boost/asio/detail/io_control.hpp | 2 +- .../boost/asio/detail/keyword_tss_ptr.hpp | 2 +- .../boost/asio/detail/kqueue_reactor.hpp | 2 +- .../asio/detail/local_free_on_block_exit.hpp | 4 +- .../boost/asio/detail/macos_fenced_block.hpp | 2 +- 3party/boost/boost/asio/detail/memory.hpp | 31 + 3party/boost/boost/asio/detail/mutex.hpp | 2 +- .../boost/boost/asio/detail/noncopyable.hpp | 2 +- 3party/boost/boost/asio/detail/null_event.hpp | 2 +- .../boost/asio/detail/null_fenced_block.hpp | 2 +- 3party/boost/boost/asio/detail/null_mutex.hpp | 2 +- .../boost/boost/asio/detail/null_reactor.hpp | 2 +- .../boost/asio/detail/null_signal_blocker.hpp | 2 +- .../boost/asio/detail/null_socket_service.hpp | 3 +- .../boost/asio/detail/null_static_mutex.hpp | 2 +- .../boost/boost/asio/detail/null_thread.hpp | 2 +- .../boost/boost/asio/detail/null_tss_ptr.hpp | 2 +- .../boost/boost/asio/detail/object_pool.hpp | 2 +- .../boost/asio/detail/old_win_sdk_compat.hpp | 2 +- 3party/boost/boost/asio/detail/op_queue.hpp | 2 +- 3party/boost/boost/asio/detail/operation.hpp | 2 +- .../asio/detail/pipe_select_interrupter.hpp | 2 +- .../boost/boost/asio/detail/pop_options.hpp | 2 +- .../boost/boost/asio/detail/posix_event.hpp | 2 +- .../asio/detail/posix_fd_set_adapter.hpp | 2 +- .../boost/boost/asio/detail/posix_mutex.hpp | 2 +- .../asio/detail/posix_signal_blocker.hpp | 2 +- .../boost/asio/detail/posix_static_mutex.hpp | 2 +- .../boost/boost/asio/detail/posix_thread.hpp | 2 +- .../boost/boost/asio/detail/posix_tss_ptr.hpp | 2 +- .../boost/boost/asio/detail/push_options.hpp | 2 +- .../detail/reactive_descriptor_service.hpp | 2 +- .../asio/detail/reactive_null_buffers_op.hpp | 2 +- .../detail/reactive_serial_port_service.hpp | 2 +- .../asio/detail/reactive_socket_accept_op.hpp | 2 +- .../detail/reactive_socket_connect_op.hpp | 2 +- .../asio/detail/reactive_socket_recv_op.hpp | 2 +- .../detail/reactive_socket_recvfrom_op.hpp | 2 +- .../detail/reactive_socket_recvmsg_op.hpp | 2 +- .../asio/detail/reactive_socket_send_op.hpp | 2 +- .../asio/detail/reactive_socket_sendto_op.hpp | 2 +- .../asio/detail/reactive_socket_service.hpp | 3 +- .../detail/reactive_socket_service_base.hpp | 2 +- 3party/boost/boost/asio/detail/reactor.hpp | 2 +- .../boost/boost/asio/detail/reactor_fwd.hpp | 2 +- 3party/boost/boost/asio/detail/reactor_op.hpp | 2 +- .../boost/asio/detail/reactor_op_queue.hpp | 2 +- 3party/boost/boost/asio/detail/regex_fwd.hpp | 2 +- .../boost/asio/detail/resolve_endpoint_op.hpp | 2 +- 3party/boost/boost/asio/detail/resolve_op.hpp | 2 +- .../boost/asio/detail/resolver_service.hpp | 2 +- .../asio/detail/resolver_service_base.hpp | 2 +- .../boost/boost/asio/detail/scoped_lock.hpp | 2 +- 3party/boost/boost/asio/detail/scoped_ptr.hpp | 2 +- .../boost/asio/detail/select_interrupter.hpp | 2 +- .../boost/asio/detail/select_reactor.hpp | 2 +- .../boost/asio/detail/service_registry.hpp | 2 +- 3party/boost/boost/asio/detail/shared_ptr.hpp | 2 +- .../boost/asio/detail/signal_blocker.hpp | 2 +- .../boost/asio/detail/signal_handler.hpp | 2 +- .../boost/boost/asio/detail/signal_init.hpp | 2 +- 3party/boost/boost/asio/detail/signal_op.hpp | 2 +- .../boost/asio/detail/signal_set_service.hpp | 2 +- .../boost/boost/asio/detail/socket_holder.hpp | 2 +- 3party/boost/boost/asio/detail/socket_ops.hpp | 2 +- .../boost/boost/asio/detail/socket_option.hpp | 2 +- .../asio/detail/socket_select_interrupter.hpp | 2 +- .../boost/boost/asio/detail/socket_types.hpp | 14 +- .../asio/detail/solaris_fenced_block.hpp | 2 +- .../boost/boost/asio/detail/static_mutex.hpp | 2 +- 3party/boost/boost/asio/detail/std_event.hpp | 2 +- .../boost/asio/detail/std_fenced_block.hpp | 64 + 3party/boost/boost/asio/detail/std_mutex.hpp | 2 +- .../boost/asio/detail/std_static_mutex.hpp | 2 +- 3party/boost/boost/asio/detail/std_thread.hpp | 2 +- .../boost/asio/detail/strand_service.hpp | 2 +- .../boost/asio/detail/task_io_service.hpp | 2 +- .../asio/detail/task_io_service_operation.hpp | 2 +- .../detail/task_io_service_thread_info.hpp | 2 +- 3party/boost/boost/asio/detail/thread.hpp | 10 +- .../boost/asio/detail/thread_info_base.hpp | 2 +- .../boost/boost/asio/detail/throw_error.hpp | 2 +- .../boost/asio/detail/throw_exception.hpp | 2 +- .../boost/boost/asio/detail/timer_queue.hpp | 2 +- .../boost/asio/detail/timer_queue_base.hpp | 2 +- .../boost/asio/detail/timer_queue_ptime.hpp | 2 +- .../boost/asio/detail/timer_queue_set.hpp | 2 +- .../boost/asio/detail/timer_scheduler.hpp | 2 +- .../boost/asio/detail/timer_scheduler_fwd.hpp | 2 +- 3party/boost/boost/asio/detail/tss_ptr.hpp | 2 +- .../boost/boost/asio/detail/type_traits.hpp | 2 +- .../boost/asio/detail/variadic_templates.hpp | 2 +- .../boost/boost/asio/detail/wait_handler.hpp | 2 +- 3party/boost/boost/asio/detail/wait_op.hpp | 2 +- 3party/boost/boost/asio/detail/weak_ptr.hpp | 2 +- 3party/boost/boost/asio/detail/win_event.hpp | 6 +- .../boost/asio/detail/win_fd_set_adapter.hpp | 2 +- .../boost/asio/detail/win_fenced_block.hpp | 2 +- .../asio/detail/win_iocp_handle_read_op.hpp | 2 +- .../asio/detail/win_iocp_handle_service.hpp | 2 +- .../asio/detail/win_iocp_handle_write_op.hpp | 2 +- .../boost/asio/detail/win_iocp_io_service.hpp | 2 +- .../asio/detail/win_iocp_null_buffers_op.hpp | 2 +- .../boost/asio/detail/win_iocp_operation.hpp | 2 +- .../asio/detail/win_iocp_overlapped_op.hpp | 2 +- .../asio/detail/win_iocp_overlapped_ptr.hpp | 2 +- .../detail/win_iocp_serial_port_service.hpp | 2 +- .../asio/detail/win_iocp_socket_accept_op.hpp | 2 +- .../detail/win_iocp_socket_connect_op.hpp | 2 +- .../asio/detail/win_iocp_socket_recv_op.hpp | 2 +- .../detail/win_iocp_socket_recvfrom_op.hpp | 2 +- .../detail/win_iocp_socket_recvmsg_op.hpp | 2 +- .../asio/detail/win_iocp_socket_send_op.hpp | 2 +- .../asio/detail/win_iocp_socket_service.hpp | 3 +- .../detail/win_iocp_socket_service_base.hpp | 2 +- .../asio/detail/win_iocp_thread_info.hpp | 2 +- 3party/boost/boost/asio/detail/win_mutex.hpp | 2 +- .../asio/detail/win_object_handle_service.hpp | 2 +- .../boost/asio/detail/win_static_mutex.hpp | 2 +- 3party/boost/boost/asio/detail/win_thread.hpp | 10 +- .../boost/boost/asio/detail/win_tss_ptr.hpp | 2 +- .../{wince_thread.hpp => winapi_thread.hpp} | 40 +- .../boost/asio/detail/winrt_async_manager.hpp | 2 +- .../boost/asio/detail/winrt_async_op.hpp | 2 +- .../boost/asio/detail/winrt_resolve_op.hpp | 2 +- .../asio/detail/winrt_resolver_service.hpp | 2 +- .../asio/detail/winrt_socket_connect_op.hpp | 2 +- .../asio/detail/winrt_socket_recv_op.hpp | 2 +- .../asio/detail/winrt_socket_send_op.hpp | 2 +- .../asio/detail/winrt_ssocket_service.hpp | 3 +- .../detail/winrt_ssocket_service_base.hpp | 2 +- .../asio/detail/winrt_timer_scheduler.hpp | 2 +- .../boost/boost/asio/detail/winrt_utils.hpp | 2 +- .../boost/boost/asio/detail/winsock_init.hpp | 2 +- .../boost/asio/detail/wrapped_handler.hpp | 2 +- 3party/boost/boost/asio/error.hpp | 14 +- .../boost/asio/generic/basic_endpoint.hpp | 2 +- .../boost/asio/generic/datagram_protocol.hpp | 2 +- .../boost/asio/generic/detail/endpoint.hpp | 2 +- .../asio/generic/detail/impl/endpoint.ipp | 2 +- .../boost/boost/asio/generic/raw_protocol.hpp | 2 +- .../asio/generic/seq_packet_protocol.hpp | 2 +- .../boost/asio/generic/stream_protocol.hpp | 2 +- .../boost/boost/asio/handler_alloc_hook.hpp | 2 +- .../boost/asio/handler_continuation_hook.hpp | 2 +- .../boost/boost/asio/handler_invoke_hook.hpp | 2 +- 3party/boost/boost/asio/handler_type.hpp | 2 +- .../boost/asio/high_resolution_timer.hpp | 2 +- .../boost/asio/impl/buffered_read_stream.hpp | 2 +- .../boost/asio/impl/buffered_write_stream.hpp | 2 +- 3party/boost/boost/asio/impl/connect.hpp | 4 +- 3party/boost/boost/asio/impl/error.ipp | 2 +- .../boost/asio/impl/handler_alloc_hook.ipp | 2 +- 3party/boost/boost/asio/impl/io_service.hpp | 2 +- 3party/boost/boost/asio/impl/io_service.ipp | 2 +- 3party/boost/boost/asio/impl/read.hpp | 2 +- 3party/boost/boost/asio/impl/read_at.hpp | 2 +- 3party/boost/boost/asio/impl/read_until.hpp | 2 +- .../boost/asio/impl/serial_port_base.hpp | 2 +- .../boost/asio/impl/serial_port_base.ipp | 2 +- 3party/boost/boost/asio/impl/spawn.hpp | 2 +- 3party/boost/boost/asio/impl/src.cpp | 2 +- 3party/boost/boost/asio/impl/src.hpp | 2 +- 3party/boost/boost/asio/impl/use_future.hpp | 19 +- 3party/boost/boost/asio/impl/write.hpp | 2 +- 3party/boost/boost/asio/impl/write_at.hpp | 2 +- 3party/boost/boost/asio/io_service.hpp | 2 +- 3party/boost/boost/asio/ip/address.hpp | 2 +- 3party/boost/boost/asio/ip/address_v4.hpp | 2 +- 3party/boost/boost/asio/ip/address_v6.hpp | 2 +- 3party/boost/boost/asio/ip/basic_endpoint.hpp | 2 +- 3party/boost/boost/asio/ip/basic_resolver.hpp | 2 +- .../boost/asio/ip/basic_resolver_entry.hpp | 2 +- .../boost/asio/ip/basic_resolver_iterator.hpp | 2 +- .../boost/asio/ip/basic_resolver_query.hpp | 2 +- .../boost/boost/asio/ip/detail/endpoint.hpp | 2 +- .../boost/asio/ip/detail/impl/endpoint.ipp | 16 +- .../boost/asio/ip/detail/socket_option.hpp | 2 +- 3party/boost/boost/asio/ip/host_name.hpp | 2 +- 3party/boost/boost/asio/ip/icmp.hpp | 2 +- 3party/boost/boost/asio/ip/impl/address.hpp | 2 +- 3party/boost/boost/asio/ip/impl/address.ipp | 2 +- .../boost/boost/asio/ip/impl/address_v4.hpp | 2 +- .../boost/boost/asio/ip/impl/address_v4.ipp | 2 +- .../boost/boost/asio/ip/impl/address_v6.hpp | 2 +- .../boost/boost/asio/ip/impl/address_v6.ipp | 2 +- .../boost/asio/ip/impl/basic_endpoint.hpp | 2 +- 3party/boost/boost/asio/ip/impl/host_name.ipp | 2 +- 3party/boost/boost/asio/ip/multicast.hpp | 2 +- .../boost/asio/ip/resolver_query_base.hpp | 2 +- .../boost/boost/asio/ip/resolver_service.hpp | 2 +- 3party/boost/boost/asio/ip/tcp.hpp | 2 +- 3party/boost/boost/asio/ip/udp.hpp | 2 +- 3party/boost/boost/asio/ip/unicast.hpp | 2 +- 3party/boost/boost/asio/ip/v6_only.hpp | 2 +- 3party/boost/boost/asio/is_read_buffered.hpp | 2 +- 3party/boost/boost/asio/is_write_buffered.hpp | 2 +- .../boost/boost/asio/local/basic_endpoint.hpp | 2 +- .../boost/boost/asio/local/connect_pair.hpp | 2 +- .../boost/asio/local/datagram_protocol.hpp | 2 +- .../boost/asio/local/detail/endpoint.hpp | 2 +- .../boost/asio/local/detail/impl/endpoint.ipp | 2 +- .../boost/asio/local/stream_protocol.hpp | 2 +- 3party/boost/boost/asio/placeholders.hpp | 2 +- .../boost/asio/posix/basic_descriptor.hpp | 2 +- .../asio/posix/basic_stream_descriptor.hpp | 2 +- .../boost/asio/posix/descriptor_base.hpp | 2 +- .../boost/asio/posix/stream_descriptor.hpp | 2 +- .../asio/posix/stream_descriptor_service.hpp | 2 +- .../boost/boost/asio/raw_socket_service.hpp | 8 +- 3party/boost/boost/asio/read.hpp | 2 +- 3party/boost/boost/asio/read_at.hpp | 2 +- 3party/boost/boost/asio/read_until.hpp | 2 +- .../boost/asio/seq_packet_socket_service.hpp | 8 +- 3party/boost/boost/asio/serial_port.hpp | 2 +- 3party/boost/boost/asio/serial_port_base.hpp | 2 +- .../boost/boost/asio/serial_port_service.hpp | 2 +- 3party/boost/boost/asio/signal_set.hpp | 2 +- .../boost/boost/asio/signal_set_service.hpp | 2 +- .../boost/asio/socket_acceptor_service.hpp | 8 +- 3party/boost/boost/asio/socket_base.hpp | 2 +- 3party/boost/boost/asio/spawn.hpp | 2 +- 3party/boost/boost/asio/ssl.hpp | 2 +- 3party/boost/boost/asio/ssl/basic_context.hpp | 2 +- 3party/boost/boost/asio/ssl/context.hpp | 2 +- 3party/boost/boost/asio/ssl/context_base.hpp | 13 +- .../boost/boost/asio/ssl/context_service.hpp | 2 +- .../asio/ssl/detail/buffered_handshake_op.hpp | 2 +- 3party/boost/boost/asio/ssl/detail/engine.hpp | 2 +- .../boost/asio/ssl/detail/handshake_op.hpp | 2 +- .../boost/asio/ssl/detail/impl/engine.ipp | 12 +- .../asio/ssl/detail/impl/openssl_init.ipp | 45 +- 3party/boost/boost/asio/ssl/detail/io.hpp | 2 +- .../boost/asio/ssl/detail/openssl_init.hpp | 2 +- .../boost/asio/ssl/detail/openssl_types.hpp | 6 +- .../asio/ssl/detail/password_callback.hpp | 2 +- .../boost/boost/asio/ssl/detail/read_op.hpp | 2 +- .../boost/asio/ssl/detail/shutdown_op.hpp | 2 +- .../boost/asio/ssl/detail/stream_core.hpp | 2 +- .../boost/asio/ssl/detail/verify_callback.hpp | 2 +- .../boost/boost/asio/ssl/detail/write_op.hpp | 2 +- 3party/boost/boost/asio/ssl/error.hpp | 47 +- 3party/boost/boost/asio/ssl/impl/context.hpp | 2 +- 3party/boost/boost/asio/ssl/impl/context.ipp | 259 +- 3party/boost/boost/asio/ssl/impl/error.ipp | 47 +- .../asio/ssl/impl/rfc2818_verification.ipp | 2 +- 3party/boost/boost/asio/ssl/impl/src.hpp | 2 +- .../boost/asio/ssl/old/basic_context.hpp | 2 +- .../boost/asio/ssl/old/context_service.hpp | 2 +- .../old/detail/openssl_context_service.hpp | 10 +- .../ssl/old/detail/openssl_stream_service.hpp | 2 +- 3party/boost/boost/asio/ssl/old/stream.hpp | 2 +- .../boost/asio/ssl/old/stream_service.hpp | 2 +- .../boost/asio/ssl/rfc2818_verification.hpp | 2 +- 3party/boost/boost/asio/ssl/stream.hpp | 2 +- 3party/boost/boost/asio/ssl/stream_base.hpp | 2 +- .../boost/boost/asio/ssl/stream_service.hpp | 2 +- .../boost/boost/asio/ssl/verify_context.hpp | 2 +- 3party/boost/boost/asio/ssl/verify_mode.hpp | 2 +- 3party/boost/boost/asio/steady_timer.hpp | 2 +- 3party/boost/boost/asio/strand.hpp | 2 +- .../boost/asio/stream_socket_service.hpp | 8 +- 3party/boost/boost/asio/streambuf.hpp | 2 +- 3party/boost/boost/asio/system_timer.hpp | 2 +- 3party/boost/boost/asio/time_traits.hpp | 2 +- 3party/boost/boost/asio/unyield.hpp | 2 +- 3party/boost/boost/asio/use_future.hpp | 2 +- 3party/boost/boost/asio/version.hpp | 4 +- 3party/boost/boost/asio/wait_traits.hpp | 2 +- .../boost/asio/waitable_timer_service.hpp | 2 +- .../boost/boost/asio/windows/basic_handle.hpp | 2 +- .../asio/windows/basic_object_handle.hpp | 2 +- .../windows/basic_random_access_handle.hpp | 2 +- .../asio/windows/basic_stream_handle.hpp | 2 +- .../boost/asio/windows/object_handle.hpp | 2 +- .../asio/windows/object_handle_service.hpp | 2 +- .../boost/asio/windows/overlapped_ptr.hpp | 2 +- .../asio/windows/random_access_handle.hpp | 2 +- .../windows/random_access_handle_service.hpp | 2 +- .../boost/asio/windows/stream_handle.hpp | 2 +- .../asio/windows/stream_handle_service.hpp | 2 +- 3party/boost/boost/asio/write.hpp | 2 +- 3party/boost/boost/asio/write_at.hpp | 2 +- 3party/boost/boost/asio/yield.hpp | 2 +- 3party/boost/boost/assert.hpp | 9 +- .../boost/boost/atomic/detail/atomic_flag.hpp | 6 +- .../boost/atomic/detail/atomic_template.hpp | 144 +- .../boost/atomic/detail/bitwise_cast.hpp | 64 + .../boost/atomic/detail/caps_gcc_ppc.hpp | 2 +- .../boost/atomic/detail/caps_gcc_x86.hpp | 23 + .../boost/atomic/detail/caps_msvc_x86.hpp | 5 + 3party/boost/boost/atomic/detail/casts.hpp | 64 - 3party/boost/boost/atomic/detail/config.hpp | 37 + .../boost/boost/atomic/detail/int_sizes.hpp | 4 +- .../boost/boost/atomic/detail/interlocked.hpp | 9 +- .../boost/atomic/detail/operations_fwd.hpp | 3 +- .../boost/atomic/detail/ops_cas_based.hpp | 40 +- .../boost/atomic/detail/ops_emulated.hpp | 20 +- .../atomic/detail/ops_extending_cas_based.hpp | 9 +- .../boost/atomic/detail/ops_gcc_alpha.hpp | 4 + .../boost/boost/atomic/detail/ops_gcc_arm.hpp | 4 + .../boost/atomic/detail/ops_gcc_atomic.hpp | 20 + .../boost/boost/atomic/detail/ops_gcc_ppc.hpp | 381 +- .../boost/atomic/detail/ops_gcc_sparc.hpp | 45 +- .../boost/atomic/detail/ops_gcc_sync.hpp | 35 + .../boost/boost/atomic/detail/ops_gcc_x86.hpp | 8 +- .../boost/atomic/detail/ops_gcc_x86_dcas.hpp | 331 +- .../boost/atomic/detail/ops_linux_arm.hpp | 9 +- .../boost/atomic/detail/ops_msvc_arm.hpp | 6 + .../boost/atomic/detail/ops_msvc_x86.hpp | 68 +- .../boost/boost/atomic/detail/ops_windows.hpp | 3 + 3party/boost/boost/atomic/detail/platform.hpp | 14 +- .../boost/atomic/detail/storage_type.hpp | 138 +- .../boost/bimap/detail/debug/static_error.hpp | 1 - 3party/boost/boost/bind.hpp | 19 +- 3party/boost/boost/bind/arg.hpp | 17 +- 3party/boost/boost/bind/bind.hpp | 555 +- 3party/boost/boost/bind/placeholders.hpp | 65 +- 3party/boost/boost/cerrno.hpp | 4 +- .../boost/chrono/detail/inlined/chrono.hpp | 2 + .../chrono/detail/inlined/mac/chrono.hpp | 55 +- .../detail/inlined/mac/process_cpu_clocks.hpp | 2 +- .../detail/inlined/mac/thread_clock.hpp | 1 + .../chrono/detail/inlined/posix/chrono.hpp | 17 +- .../inlined/posix/process_cpu_clocks.hpp | 2 +- .../detail/inlined/posix/thread_clock.hpp | 1 + .../detail/inlined/process_cpu_clocks.hpp | 3 +- .../chrono/detail/inlined/thread_clock.hpp | 2 + .../chrono/detail/inlined/win/chrono.hpp | 3 +- .../detail/inlined/win/process_cpu_clocks.hpp | 8 +- .../detail/inlined/win/thread_clock.hpp | 23 +- 3party/boost/boost/chrono/duration.hpp | 5 +- .../boost/boost/chrono/io/ios_base_state.hpp | 7 +- .../boost/boost/chrono/io/time_point_get.hpp | 4 +- .../boost/boost/chrono/io/time_point_io.hpp | 10 +- .../boost/chrono/io/time_point_units.hpp | 15 +- .../chrono/io/utility/ios_base_state_ptr.hpp | 7 +- .../boost/boost/chrono/process_cpu_clocks.hpp | 13 +- 3party/boost/boost/circular_buffer.hpp | 5 +- 3party/boost/boost/circular_buffer/base.hpp | 15 +- .../boost/boost/circular_buffer/details.hpp | 5 +- .../boost/circular_buffer/space_optimized.hpp | 2 +- 3party/boost/boost/compute.hpp | 44 + 3party/boost/boost/compute/algorithm.hpp | 94 + .../boost/compute/algorithm/accumulate.hpp | 184 + .../compute/algorithm/adjacent_difference.hpp | 116 + .../boost/compute/algorithm/adjacent_find.hpp | 162 + .../boost/boost/compute/algorithm/all_of.hpp | 36 + .../boost/boost/compute/algorithm/any_of.hpp | 40 + .../boost/compute/algorithm/binary_search.hpp | 37 + 3party/boost/boost/compute/algorithm/copy.hpp | 856 + .../boost/boost/compute/algorithm/copy_if.hpp | 58 + .../boost/boost/compute/algorithm/copy_n.hpp | 51 + .../boost/boost/compute/algorithm/count.hpp | 55 + .../boost/compute/algorithm/count_if.hpp | 62 + .../algorithm/detail/balanced_path.hpp | 162 + .../compute/algorithm/detail/binary_find.hpp | 133 + .../compute/algorithm/detail/compact.hpp | 77 + .../algorithm/detail/copy_on_device.hpp | 190 + .../algorithm/detail/copy_to_device.hpp | 193 + .../compute/algorithm/detail/copy_to_host.hpp | 198 + .../algorithm/detail/count_if_with_ballot.hpp | 78 + .../algorithm/detail/count_if_with_reduce.hpp | 87 + .../detail/count_if_with_threads.hpp | 129 + .../compute/algorithm/detail/find_extrema.hpp | 70 + .../algorithm/detail/find_extrema_on_cpu.hpp | 138 + .../detail/find_extrema_with_atomics.hpp | 108 + .../detail/find_extrema_with_reduce.hpp | 443 + .../algorithm/detail/find_if_with_atomics.hpp | 212 + .../algorithm/detail/inplace_reduce.hpp | 136 + .../algorithm/detail/insertion_sort.hpp | 165 + .../compute/algorithm/detail/merge_path.hpp | 116 + .../algorithm/detail/merge_sort_on_cpu.hpp | 366 + .../algorithm/detail/merge_sort_on_gpu.hpp | 590 + .../detail/merge_with_merge_path.hpp | 203 + .../compute/algorithm/detail/radix_sort.hpp | 461 + .../compute/algorithm/detail/random_fill.hpp | 57 + .../algorithm/detail/reduce_by_key.hpp | 119 + .../detail/reduce_by_key_with_scan.hpp | 541 + .../algorithm/detail/reduce_on_cpu.hpp | 110 + .../algorithm/detail/reduce_on_gpu.hpp | 286 + .../boost/compute/algorithm/detail/scan.hpp | 45 + .../compute/algorithm/detail/scan_on_cpu.hpp | 207 + .../compute/algorithm/detail/scan_on_gpu.hpp | 330 + .../compute/algorithm/detail/search_all.hpp | 86 + .../algorithm/detail/serial_accumulate.hpp | 56 + .../algorithm/detail/serial_count_if.hpp | 68 + .../algorithm/detail/serial_find_extrema.hpp | 87 + .../compute/algorithm/detail/serial_merge.hpp | 97 + .../algorithm/detail/serial_reduce.hpp | 62 + .../algorithm/detail/serial_reduce_by_key.hpp | 108 + .../compute/algorithm/detail/serial_scan.hpp | 103 + .../boost/boost/compute/algorithm/equal.hpp | 53 + .../boost/compute/algorithm/equal_range.hpp | 42 + .../compute/algorithm/exclusive_scan.hpp | 96 + 3party/boost/boost/compute/algorithm/fill.hpp | 306 + .../boost/boost/compute/algorithm/fill_n.hpp | 36 + 3party/boost/boost/compute/algorithm/find.hpp | 57 + .../boost/compute/algorithm/find_end.hpp | 136 + .../boost/boost/compute/algorithm/find_if.hpp | 35 + .../boost/compute/algorithm/find_if_not.hpp | 43 + .../boost/compute/algorithm/for_each.hpp | 65 + .../boost/compute/algorithm/for_each_n.hpp | 35 + .../boost/boost/compute/algorithm/gather.hpp | 82 + .../boost/compute/algorithm/generate.hpp | 49 + .../boost/compute/algorithm/generate_n.hpp | 35 + .../boost/compute/algorithm/includes.hpp | 155 + .../compute/algorithm/inclusive_scan.hpp | 81 + .../boost/compute/algorithm/inner_product.hpp | 93 + .../boost/compute/algorithm/inplace_merge.hpp | 60 + 3party/boost/boost/compute/algorithm/iota.hpp | 48 + .../compute/algorithm/is_partitioned.hpp | 43 + .../compute/algorithm/is_permutation.hpp | 67 + .../boost/compute/algorithm/is_sorted.hpp | 64 + .../algorithm/lexicographical_compare.hpp | 117 + .../boost/compute/algorithm/lower_bound.hpp | 44 + .../boost/compute/algorithm/max_element.hpp | 74 + .../boost/boost/compute/algorithm/merge.hpp | 105 + .../boost/compute/algorithm/min_element.hpp | 74 + .../compute/algorithm/minmax_element.hpp | 70 + .../boost/compute/algorithm/mismatch.hpp | 89 + .../compute/algorithm/next_permutation.hpp | 170 + .../boost/boost/compute/algorithm/none_of.hpp | 36 + .../boost/compute/algorithm/nth_element.hpp | 87 + .../boost/compute/algorithm/partial_sum.hpp | 37 + .../boost/compute/algorithm/partition.hpp | 39 + .../compute/algorithm/partition_copy.hpp | 63 + .../compute/algorithm/partition_point.hpp | 46 + .../compute/algorithm/prev_permutation.hpp | 170 + .../compute/algorithm/random_shuffle.hpp | 75 + .../boost/boost/compute/algorithm/reduce.hpp | 301 + .../boost/compute/algorithm/reduce_by_key.hpp | 118 + .../boost/boost/compute/algorithm/remove.hpp | 54 + .../boost/compute/algorithm/remove_if.hpp | 47 + .../boost/boost/compute/algorithm/replace.hpp | 90 + .../boost/compute/algorithm/replace_copy.hpp | 62 + .../boost/boost/compute/algorithm/reverse.hpp | 74 + .../boost/compute/algorithm/reverse_copy.hpp | 79 + .../boost/boost/compute/algorithm/rotate.hpp | 54 + .../boost/compute/algorithm/rotate_copy.hpp | 41 + .../boost/boost/compute/algorithm/scatter.hpp | 99 + .../boost/compute/algorithm/scatter_if.hpp | 119 + .../boost/boost/compute/algorithm/search.hpp | 73 + .../boost/compute/algorithm/search_n.hpp | 140 + .../compute/algorithm/set_difference.hpp | 182 + .../compute/algorithm/set_intersection.hpp | 170 + .../algorithm/set_symmetric_difference.hpp | 194 + .../boost/compute/algorithm/set_union.hpp | 195 + 3party/boost/boost/compute/algorithm/sort.hpp | 205 + .../boost/compute/algorithm/sort_by_key.hpp | 161 + .../compute/algorithm/stable_partition.hpp | 72 + .../boost/compute/algorithm/stable_sort.hpp | 107 + .../compute/algorithm/stable_sort_by_key.hpp | 159 + .../boost/compute/algorithm/swap_ranges.hpp | 44 + .../boost/compute/algorithm/transform.hpp | 76 + .../boost/compute/algorithm/transform_if.hpp | 117 + .../compute/algorithm/transform_reduce.hpp | 89 + .../boost/boost/compute/algorithm/unique.hpp | 66 + .../boost/compute/algorithm/unique_copy.hpp | 164 + .../boost/compute/algorithm/upper_bound.hpp | 43 + 3party/boost/boost/compute/allocator.hpp | 21 + .../compute/allocator/buffer_allocator.hpp | 118 + .../compute/allocator/pinned_allocator.hpp | 53 + 3party/boost/boost/compute/async.hpp | 21 + 3party/boost/boost/compute/async/future.hpp | 166 + 3party/boost/boost/compute/async/wait.hpp | 56 + .../boost/boost/compute/async/wait_guard.hpp | 63 + 3party/boost/boost/compute/buffer.hpp | 227 + 3party/boost/boost/compute/cl.hpp | 20 + 3party/boost/boost/compute/cl_ext.hpp | 20 + 3party/boost/boost/compute/closure.hpp | 347 + 3party/boost/boost/compute/command_queue.hpp | 1881 ++ 3party/boost/boost/compute/config.hpp | 66 + 3party/boost/boost/compute/container.hpp | 27 + .../boost/boost/compute/container/array.hpp | 317 + .../boost/compute/container/basic_string.hpp | 331 + .../boost/compute/container/detail/scalar.hpp | 61 + .../compute/container/dynamic_bitset.hpp | 237 + .../boost/compute/container/flat_map.hpp | 406 + .../boost/compute/container/flat_set.hpp | 339 + .../boost/compute/container/mapped_view.hpp | 250 + .../boost/boost/compute/container/stack.hpp | 81 + .../boost/boost/compute/container/string.hpp | 25 + .../boost/compute/container/valarray.hpp | 499 + .../boost/boost/compute/container/vector.hpp | 779 + 3party/boost/boost/compute/context.hpp | 245 + 3party/boost/boost/compute/core.hpp | 32 + .../compute/detail/assert_cl_success.hpp | 24 + .../boost/compute/detail/buffer_value.hpp | 178 + .../boost/boost/compute/detail/device_ptr.hpp | 215 + .../boost/boost/compute/detail/diagnostic.hpp | 112 + .../boost/boost/compute/detail/duration.hpp | 50 + .../boost/compute/detail/get_object_info.hpp | 216 + 3party/boost/boost/compute/detail/getenv.hpp | 36 + .../boost/compute/detail/global_static.hpp | 37 + .../compute/detail/is_buffer_iterator.hpp | 30 + .../compute/detail/is_contiguous_iterator.hpp | 118 + .../compute/detail/iterator_plus_distance.hpp | 53 + .../compute/detail/iterator_range_size.hpp | 44 + .../boost/compute/detail/iterator_traits.hpp | 35 + 3party/boost/boost/compute/detail/literal.hpp | 53 + .../boost/boost/compute/detail/lru_cache.hpp | 139 + .../boost/compute/detail/meta_kernel.hpp | 1141 + .../compute/detail/mpl_vector_to_tuple.hpp | 65 + .../detail/nvidia_compute_capability.hpp | 60 + .../boost/compute/detail/parameter_cache.hpp | 215 + 3party/boost/boost/compute/detail/path.hpp | 73 + .../boost/compute/detail/print_range.hpp | 82 + .../detail/read_write_single_value.hpp | 77 + 3party/boost/boost/compute/detail/sha1.hpp | 53 + .../boost/compute/detail/variadic_macros.hpp | 35 + 3party/boost/boost/compute/detail/vendor.hpp | 50 + .../boost/boost/compute/detail/work_size.hpp | 37 + 3party/boost/boost/compute/device.hpp | 584 + 3party/boost/boost/compute/event.hpp | 338 + 3party/boost/boost/compute/exception.hpp | 23 + .../boost/compute/exception/context_error.hpp | 88 + .../compute/exception/no_device_found.hpp | 48 + .../boost/compute/exception/opencl_error.hpp | 158 + .../exception/unsupported_extension_error.hpp | 71 + .../compute/experimental/clamp_range.hpp | 49 + .../boost/compute/experimental/malloc.hpp | 51 + .../experimental/sort_by_transform.hpp | 66 + .../boost/compute/experimental/tabulate.hpp | 44 + 3party/boost/boost/compute/function.hpp | 454 + 3party/boost/boost/compute/functional.hpp | 34 + 3party/boost/boost/compute/functional/as.hpp | 51 + .../boost/boost/compute/functional/atomic.hpp | 141 + .../boost/boost/compute/functional/bind.hpp | 261 + .../boost/boost/compute/functional/common.hpp | 29 + .../boost/compute/functional/convert.hpp | 51 + .../compute/functional/detail/macros.hpp | 35 + .../functional/detail/nvidia_ballot.hpp | 48 + .../functional/detail/nvidia_popcount.hpp | 42 + .../compute/functional/detail/unpack.hpp | 143 + .../boost/boost/compute/functional/field.hpp | 86 + .../boost/compute/functional/geometry.hpp | 32 + 3party/boost/boost/compute/functional/get.hpp | 76 + .../boost/boost/compute/functional/hash.hpp | 91 + .../boost/compute/functional/identity.hpp | 64 + .../boost/compute/functional/integer.hpp | 30 + .../boost/compute/functional/logical.hpp | 208 + .../boost/boost/compute/functional/math.hpp | 80 + .../boost/compute/functional/operator.hpp | 100 + .../boost/compute/functional/popcount.hpp | 55 + .../boost/compute/functional/relational.hpp | 39 + 3party/boost/boost/compute/image.hpp | 25 + 3party/boost/boost/compute/image/image1d.hpp | 204 + 3party/boost/boost/compute/image/image2d.hpp | 262 + 3party/boost/boost/compute/image/image3d.hpp | 265 + .../boost/compute/image/image_format.hpp | 135 + .../boost/compute/image/image_object.hpp | 170 + .../boost/compute/image/image_sampler.hpp | 221 + 3party/boost/boost/compute/image2d.hpp | 12 + 3party/boost/boost/compute/image3d.hpp | 12 + 3party/boost/boost/compute/image_format.hpp | 12 + 3party/boost/boost/compute/image_sampler.hpp | 12 + 3party/boost/boost/compute/interop/eigen.hpp | 16 + .../boost/compute/interop/eigen/core.hpp | 72 + 3party/boost/boost/compute/interop/opencv.hpp | 17 + .../boost/compute/interop/opencv/core.hpp | 141 + .../boost/compute/interop/opencv/highgui.hpp | 33 + .../boost/compute/interop/opencv/ocl.hpp | 51 + 3party/boost/boost/compute/interop/opengl.hpp | 24 + .../boost/compute/interop/opengl/acquire.hpp | 100 + .../boost/compute/interop/opengl/cl_gl.hpp | 20 + .../compute/interop/opengl/cl_gl_ext.hpp | 20 + .../boost/compute/interop/opengl/context.hpp | 135 + .../boost/boost/compute/interop/opengl/gl.hpp | 20 + .../compute/interop/opengl/opengl_buffer.hpp | 106 + .../interop/opengl/opengl_renderbuffer.hpp | 129 + .../compute/interop/opengl/opengl_texture.hpp | 133 + 3party/boost/boost/compute/interop/qt.hpp | 17 + .../boost/boost/compute/interop/qt/qimage.hpp | 69 + .../boost/boost/compute/interop/qt/qpoint.hpp | 20 + .../boost/compute/interop/qt/qpointf.hpp | 20 + .../boost/boost/compute/interop/qt/qtcore.hpp | 18 + .../boost/boost/compute/interop/qt/qtgui.hpp | 16 + .../boost/compute/interop/qt/qvector.hpp | 48 + 3party/boost/boost/compute/interop/vtk.hpp | 19 + .../boost/compute/interop/vtk/bounds.hpp | 59 + .../boost/compute/interop/vtk/data_array.hpp | 65 + .../boost/compute/interop/vtk/matrix4x4.hpp | 46 + .../boost/compute/interop/vtk/points.hpp | 55 + 3party/boost/boost/compute/iterator.hpp | 28 + .../compute/iterator/buffer_iterator.hpp | 280 + .../iterator/constant_buffer_iterator.hpp | 209 + .../compute/iterator/constant_iterator.hpp | 171 + .../compute/iterator/counting_iterator.hpp | 185 + .../detail/get_base_iterator_buffer.hpp | 52 + .../iterator/detail/swizzle_iterator.hpp | 188 + .../compute/iterator/discard_iterator.hpp | 170 + .../iterator/function_input_iterator.hpp | 186 + .../compute/iterator/permutation_iterator.hpp | 192 + .../compute/iterator/strided_iterator.hpp | 296 + .../compute/iterator/transform_iterator.hpp | 227 + .../boost/compute/iterator/zip_iterator.hpp | 316 + 3party/boost/boost/compute/kernel.hpp | 418 + 3party/boost/boost/compute/lambda.hpp | 22 + 3party/boost/boost/compute/lambda/context.hpp | 329 + .../boost/boost/compute/lambda/functional.hpp | 242 + 3party/boost/boost/compute/lambda/get.hpp | 148 + .../boost/boost/compute/lambda/make_pair.hpp | 70 + .../boost/boost/compute/lambda/make_tuple.hpp | 127 + .../boost/compute/lambda/placeholder.hpp | 28 + .../boost/compute/lambda/placeholders.hpp | 93 + .../boost/boost/compute/lambda/result_of.hpp | 113 + 3party/boost/boost/compute/memory.hpp | 21 + .../boost/compute/memory/local_buffer.hpp | 91 + 3party/boost/boost/compute/memory/svm_ptr.hpp | 174 + 3party/boost/boost/compute/memory_object.hpp | 264 + 3party/boost/boost/compute/pipe.hpp | 154 + 3party/boost/boost/compute/platform.hpp | 235 + 3party/boost/boost/compute/program.hpp | 650 + 3party/boost/boost/compute/random.hpp | 28 + .../compute/random/bernoulli_distribution.hpp | 100 + .../compute/random/default_random_engine.hpp | 24 + .../compute/random/discrete_distribution.hpp | 160 + .../random/linear_congruential_engine.hpp | 238 + .../random/mersenne_twister_engine.hpp | 254 + .../compute/random/normal_distribution.hpp | 140 + .../boost/compute/random/threefry_engine.hpp | 311 + .../random/uniform_int_distribution.hpp | 119 + .../random/uniform_real_distribution.hpp | 116 + 3party/boost/boost/compute/source.hpp | 12 + 3party/boost/boost/compute/svm.hpp | 72 + 3party/boost/boost/compute/system.hpp | 280 + 3party/boost/boost/compute/type_traits.hpp | 25 + .../boost/compute/type_traits/common_type.hpp | 55 + .../type_traits/detail/capture_traits.hpp | 33 + .../type_traits/is_device_iterator.hpp | 39 + .../compute/type_traits/is_fundamental.hpp | 58 + .../compute/type_traits/is_vector_type.hpp | 38 + .../compute/type_traits/make_vector_type.hpp | 71 + .../boost/compute/type_traits/result_of.hpp | 39 + .../boost/compute/type_traits/scalar_type.hpp | 72 + .../compute/type_traits/type_definition.hpp | 39 + .../boost/compute/type_traits/type_name.hpp | 124 + .../boost/compute/type_traits/vector_size.hpp | 65 + 3party/boost/boost/compute/types.hpp | 24 + 3party/boost/boost/compute/types/builtin.hpp | 12 + 3party/boost/boost/compute/types/complex.hpp | 196 + .../boost/boost/compute/types/fundamental.hpp | 172 + 3party/boost/boost/compute/types/pair.hpp | 117 + 3party/boost/boost/compute/types/struct.hpp | 173 + 3party/boost/boost/compute/types/tuple.hpp | 220 + 3party/boost/boost/compute/user_event.hpp | 88 + 3party/boost/boost/compute/utility.hpp | 21 + 3party/boost/boost/compute/utility/dim.hpp | 76 + .../boost/boost/compute/utility/extents.hpp | 164 + 3party/boost/boost/compute/utility/invoke.hpp | 71 + .../boost/compute/utility/program_cache.hpp | 172 + 3party/boost/boost/compute/utility/source.hpp | 39 + .../boost/boost/compute/utility/wait_list.hpp | 217 + 3party/boost/boost/compute/version.hpp | 18 + 3party/boost/boost/compute/wait_list.hpp | 12 + 3party/boost/boost/concept_check.hpp | 17 +- 3party/boost/boost/config/auto_link.hpp | 11 +- .../boost/boost/config/compiler/borland.hpp | 2 + 3party/boost/boost/config/compiler/clang.hpp | 61 +- .../boost/boost/config/compiler/codegear.hpp | 2 + 3party/boost/boost/config/compiler/comeau.hpp | 2 +- .../boost/config/compiler/common_edg.hpp | 2 + .../boost/config/compiler/compaq_cxx.hpp | 2 +- 3party/boost/boost/config/compiler/cray.hpp | 4 +- .../boost/config/compiler/digitalmars.hpp | 2 + 3party/boost/boost/config/compiler/gcc.hpp | 41 +- .../boost/boost/config/compiler/gcc_xml.hpp | 4 +- .../boost/config/compiler/greenhills.hpp | 2 +- 3party/boost/boost/config/compiler/hp_acc.hpp | 4 +- 3party/boost/boost/config/compiler/intel.hpp | 46 +- 3party/boost/boost/config/compiler/kai.hpp | 2 +- .../boost/config/compiler/metrowerks.hpp | 2 + 3party/boost/boost/config/compiler/mpw.hpp | 2 + 3party/boost/boost/config/compiler/nvcc.hpp | 16 + .../boost/boost/config/compiler/pathscale.hpp | 2 + 3party/boost/boost/config/compiler/pgi.hpp | 2 + .../boost/config/compiler/sgi_mipspro.hpp | 2 +- .../boost/boost/config/compiler/sunpro_cc.hpp | 21 +- 3party/boost/boost/config/compiler/vacpp.hpp | 2 + .../boost/boost/config/compiler/visualc.hpp | 65 +- 3party/boost/boost/config/compiler/xlcpp.hpp | 5 + .../boost/boost/config/platform/cloudabi.hpp | 18 + 3party/boost/boost/config/platform/cygwin.hpp | 3 +- 3party/boost/boost/config/platform/linux.hpp | 2 +- 3party/boost/boost/config/platform/macos.hpp | 2 +- .../boost/boost/config/platform/solaris.hpp | 6 +- 3party/boost/boost/config/platform/win32.hpp | 8 + .../boost/config/select_compiler_config.hpp | 42 +- .../boost/config/select_platform_config.hpp | 4 + .../boost/config/select_stdlib_config.hpp | 6 +- .../boost/boost/config/stdlib/dinkumware.hpp | 56 +- 3party/boost/boost/config/stdlib/libcomo.hpp | 7 + 3party/boost/boost/config/stdlib/libcpp.hpp | 49 +- .../boost/boost/config/stdlib/libstdcpp3.hpp | 53 +- 3party/boost/boost/config/stdlib/modena.hpp | 7 + 3party/boost/boost/config/stdlib/msl.hpp | 7 + .../boost/boost/config/stdlib/roguewave.hpp | 7 + 3party/boost/boost/config/stdlib/sgi.hpp | 9 +- 3party/boost/boost/config/stdlib/stlport.hpp | 7 + 3party/boost/boost/config/stdlib/vacpp.hpp | 7 + 3party/boost/boost/config/suffix.hpp | 57 +- .../boost/boost/container/adaptive_pool.hpp | 36 +- 3party/boost/boost/container/allocator.hpp | 46 +- .../boost/container/allocator_traits.hpp | 63 +- .../boost/boost/container/container_fwd.hpp | 40 +- 3party/boost/boost/container/deque.hpp | 179 +- .../container/detail/adaptive_node_pool.hpp | 1 - .../boost/container/detail/addressof.hpp | 4 +- .../container/detail/advanced_insert_int.hpp | 8 +- .../boost/boost/container/detail/alloc_lib.h | 122 +- .../boost/container/detail/auto_link.hpp | 11 +- .../boost/container/detail/block_list.hpp | 139 + .../boost/container/detail/block_slist.hpp | 157 + .../container/detail/compare_functors.hpp | 8 +- .../boost/container/detail/config_begin.hpp | 3 + .../container/detail/construct_in_place.hpp | 43 +- .../boost/container/detail/copy_move_algo.hpp | 89 +- .../detail/dispatch_uses_allocator.hpp | 461 + .../boost/boost/container/detail/dlmalloc.hpp | 103 + .../boost/container/detail/flat_tree.hpp | 345 +- .../boost/container/detail/hash_table.hpp | 383 - .../boost/container/detail/is_sorted.hpp | 57 + .../boost/container/detail/iterators.hpp | 129 +- 3party/boost/boost/container/detail/mpl.hpp | 15 +- 3party/boost/boost/container/detail/mutex.hpp | 17 +- .../container/detail/node_alloc_holder.hpp | 63 +- 3party/boost/boost/container/detail/pair.hpp | 297 +- .../container/detail/pool_common_alloc.hpp | 12 +- .../boost/container/detail/pool_resource.hpp | 191 + .../boost/boost/container/detail/std_fwd.hpp | 30 +- 3party/boost/boost/container/detail/tree.hpp | 492 +- .../boost/container/detail/type_traits.hpp | 2 + .../boost/container/detail/value_init.hpp | 2 + .../detail/variadic_templates_tools.hpp | 45 +- .../boost/container/detail/workaround.hpp | 59 +- 3party/boost/boost/container/flat_map.hpp | 387 +- 3party/boost/boost/container/flat_set.hpp | 115 +- 3party/boost/boost/container/list.hpp | 153 +- 3party/boost/boost/container/map.hpp | 617 +- .../boost/boost/container/new_allocator.hpp | 12 +- .../boost/boost/container/node_allocator.hpp | 27 +- 3party/boost/boost/container/node_handle.hpp | 399 + 3party/boost/boost/container/pmr/deque.hpp | 45 + 3party/boost/boost/container/pmr/flat_map.hpp | 67 + 3party/boost/boost/container/pmr/flat_set.hpp | 63 + .../boost/container/pmr/global_resource.hpp | 66 + 3party/boost/boost/container/pmr/list.hpp | 45 + 3party/boost/boost/container/pmr/map.hpp | 67 + .../boost/container/pmr/memory_resource.hpp | 101 + .../pmr/monotonic_buffer_resource.hpp | 180 + .../container/pmr/polymorphic_allocator.hpp | 166 + .../boost/container/pmr/pool_options.hpp | 52 + .../boost/container/pmr/resource_adaptor.hpp | 193 + 3party/boost/boost/container/pmr/set.hpp | 63 + 3party/boost/boost/container/pmr/slist.hpp | 45 + .../boost/container/pmr/small_vector.hpp | 45 + .../boost/container/pmr/stable_vector.hpp | 45 + 3party/boost/boost/container/pmr/string.hpp | 50 + .../pmr/synchronized_pool_resource.hpp | 138 + .../pmr/unsynchronized_pool_resource.hpp | 194 + 3party/boost/boost/container/pmr/vector.hpp | 45 + .../boost/container/scoped_allocator.hpp | 454 +- .../boost/container/scoped_allocator_fwd.hpp | 31 +- 3party/boost/boost/container/set.hpp | 130 +- 3party/boost/boost/container/slist.hpp | 82 +- 3party/boost/boost/container/small_vector.hpp | 199 +- .../boost/boost/container/stable_vector.hpp | 100 +- .../boost/boost/container/static_vector.hpp | 69 +- 3party/boost/boost/container/string.hpp | 676 +- .../boost/boost/container/throw_exception.hpp | 1 + .../boost/boost/container/uses_allocator.hpp | 169 + .../boost/container/uses_allocator_fwd.hpp | 73 + 3party/boost/boost/container/vector.hpp | 537 +- 3party/boost/boost/context/all.hpp | 6 +- 3party/boost/boost/context/continuation.hpp | 554 + 3party/boost/boost/context/detail/apply.hpp | 74 + 3party/boost/boost/context/detail/config.hpp | 62 +- .../boost/context/detail/disable_overload.hpp | 40 + .../boost/boost/context/detail/exception.hpp | 36 + .../boost/boost/context/detail/exchange.hpp | 36 + .../boost/context/{ => detail}/fcontext.hpp | 35 +- .../boost/context/detail/index_sequence.hpp | 72 + 3party/boost/boost/context/detail/invoke.hpp | 12 +- 3party/boost/boost/context/detail/tuple.hpp | 129 + .../boost/boost/context/execution_context.hpp | 16 +- .../boost/boost/context/execution_context.ipp | 374 - .../boost/context/execution_context_v1.hpp | 497 + .../boost/context/execution_context_v2.hpp | 493 + .../context/execution_context_v2_void.ipp | 323 + .../context/execution_context_winfib.ipp | 308 - .../boost/boost/context/fixedsize_stack.hpp | 82 +- 3party/boost/boost/context/flags.hpp | 28 + .../boost/context/pooled_fixedsize_stack.hpp | 115 + .../boost/context/posix/fixedsize_stack.hpp | 80 + .../posix/protected_fixedsize_stack.hpp | 12 +- .../boost/context/posix/segmented_stack.hpp | 9 +- 3party/boost/boost/context/preallocated.hpp | 39 + 3party/boost/boost/context/stack_context.hpp | 47 +- 3party/boost/boost/context/stack_traits.hpp | 10 +- .../boost/context/windows/fixedsize_stack.hpp | 80 + .../windows/protected_fixedsize_stack.hpp | 18 +- 3party/boost/boost/convert.hpp | 4 +- 3party/boost/boost/convert/base.hpp | 111 +- .../convert/detail/boost_parameter_ext.hpp | 3 +- 3party/boost/boost/convert/detail/char.hpp | 3 +- 3party/boost/boost/convert/detail/forward.hpp | 16 +- .../boost/boost/convert/detail/has_member.hpp | 2 +- .../boost/convert/detail/is_callable.hpp | 2 +- .../boost/convert/detail/is_converter.hpp | 3 +- 3party/boost/boost/convert/detail/is_fun.hpp | 3 +- .../boost/boost/convert/detail/is_string.hpp | 2 +- 3party/boost/boost/convert/detail/range.hpp | 31 +- 3party/boost/boost/convert/lexical_cast.hpp | 2 +- 3party/boost/boost/convert/parameters.hpp | 2 +- 3party/boost/boost/convert/printf.hpp | 2 +- 3party/boost/boost/convert/spirit.hpp | 9 +- 3party/boost/boost/convert/stream.hpp | 12 +- 3party/boost/boost/convert/strtol.hpp | 55 +- 3party/boost/boost/core/addressof.hpp | 345 +- 3party/boost/boost/core/demangle.hpp | 42 +- 3party/boost/boost/core/enable_if.hpp | 9 + 3party/boost/boost/core/lightweight_test.hpp | 218 +- 3party/boost/boost/core/scoped_enum.hpp | 56 +- .../boost/coroutine/asymmetric_coroutine.hpp | 392 +- 3party/boost/boost/coroutine/attributes.hpp | 44 +- .../boost/boost/coroutine/detail/config.hpp | 16 +- .../coroutine/detail/coroutine_context.hpp | 19 +- 3party/boost/boost/coroutine/detail/data.hpp | 34 + 3party/boost/boost/coroutine/detail/flags.hpp | 3 +- .../coroutine/detail/pull_coroutine_impl.hpp | 48 +- .../detail/pull_coroutine_object.hpp | 33 +- .../detail/pull_coroutine_synthesized.hpp | 12 +- .../coroutine/detail/push_coroutine_impl.hpp | 47 +- .../detail/push_coroutine_object.hpp | 33 +- .../detail/push_coroutine_synthesized.hpp | 12 +- .../detail/symmetric_coroutine_call.hpp | 192 +- .../detail/symmetric_coroutine_impl.hpp | 66 +- .../detail/symmetric_coroutine_object.hpp | 27 +- .../boost/coroutine/detail/trampoline.hpp | 22 +- .../coroutine/detail/trampoline_pull.hpp | 12 +- .../coroutine/detail/trampoline_push.hpp | 22 +- 3party/boost/boost/coroutine/flags.hpp | 6 - .../posix/protected_stack_allocator.hpp | 2 +- .../posix/segmented_stack_allocator.hpp | 8 +- .../boost/boost/coroutine/stack_context.hpp | 2 +- .../boost/coroutine/symmetric_coroutine.hpp | 8 + .../windows/protected_stack_allocator.hpp | 2 +- 3party/boost/boost/coroutine2/all.hpp | 1 + 3party/boost/boost/coroutine2/coroutine.hpp | 4 +- .../boost/boost/coroutine2/detail/config.hpp | 15 +- .../boost/coroutine2/detail/coroutine.hpp | 25 +- .../detail/create_control_block.ipp | 60 + .../boost/coroutine2/detail/decay_copy.hpp | 36 + .../coroutine2/detail/disable_overload.hpp | 34 + .../boost/coroutine2/detail/forced_unwind.hpp | 8 +- .../coroutine2/detail/pull_control_block.hpp | 100 - .../coroutine2/detail/pull_control_block.ipp | 258 - .../detail/pull_control_block_cc.hpp | 128 + .../detail/pull_control_block_cc.ipp | 452 + .../detail/pull_control_block_ecv1.hpp | 119 + .../detail/pull_control_block_ecv1.ipp | 431 + .../coroutine2/detail/pull_coroutine.hpp | 133 +- .../coroutine2/detail/pull_coroutine.ipp | 159 +- .../coroutine2/detail/push_control_block.ipp | 281 - .../detail/push_control_block_cc.hpp | 104 + .../detail/push_control_block_cc.ipp | 400 + ..._block.hpp => push_control_block_ecv1.hpp} | 53 +- .../detail/push_control_block_ecv1.ipp | 428 + .../coroutine2/detail/push_coroutine.hpp | 113 +- .../coroutine2/detail/push_coroutine.ipp | 133 +- .../boost/boost/coroutine2/detail/state.hpp | 52 +- 3party/boost/boost/coroutine2/detail/wrap.hpp | 112 + .../boost/coroutine2/fixedsize_stack.hpp | 5 +- .../coroutine2/pooled_fixedsize_stack.hpp | 33 + .../coroutine2/protected_fixedsize_stack.hpp | 2 +- .../boost/coroutine2/segmented_stack.hpp | 3 +- 3party/boost/boost/cstdint.hpp | 2 +- 3party/boost/boost/current_function.hpp | 6 +- 3party/boost/boost/cxx11_char_types.hpp | 4 +- 3party/boost/boost/date_time/c_time.hpp | 26 +- .../boost/date_time/constrained_value.hpp | 6 +- 3party/boost/boost/date_time/date.hpp | 7 +- .../boost/boost/date_time/date_duration.hpp | 7 +- .../boost/date_time/date_duration_types.hpp | 11 +- 3party/boost/boost/date_time/date_facet.hpp | 4 +- .../boost/boost/date_time/date_names_put.hpp | 15 +- .../date_time/gregorian/greg_calendar.hpp | 3 +- .../boost/date_time/gregorian/greg_date.hpp | 3 +- .../boost/date_time/gregorian/greg_day.hpp | 7 +- .../date_time/gregorian/greg_day_of_year.hpp | 5 +- .../date_time/gregorian/greg_duration.hpp | 3 +- .../gregorian/greg_duration_types.hpp | 7 +- .../boost/date_time/gregorian/greg_facet.hpp | 34 +- .../boost/date_time/gregorian/greg_month.hpp | 10 +- .../date_time/gregorian/greg_serialize.hpp | 5 + .../date_time/gregorian/greg_weekday.hpp | 8 +- .../boost/date_time/gregorian/greg_year.hpp | 9 +- .../boost/date_time/gregorian_calendar.hpp | 3 +- .../boost/date_time/gregorian_calendar.ipp | 10 +- 3party/boost/boost/date_time/int_adapter.hpp | 4 +- .../date_time/local_time/local_date_time.hpp | 9 +- .../date_time/local_time/posix_time_zone.hpp | 7 +- 3party/boost/boost/date_time/period.hpp | 5 +- .../posix_time/date_duration_operators.hpp | 2 +- .../posix_time/posix_time_config.hpp | 4 +- .../posix_time/posix_time_duration.hpp | 15 +- .../boost/date_time/posix_time/ptime.hpp | 11 +- .../date_time/posix_time/time_parsers.hpp | 4 + .../boost/boost/date_time/time_duration.hpp | 4 +- 3party/boost/boost/date_time/time_facet.hpp | 9 +- .../boost/date_time/time_system_counted.hpp | 2 +- .../boost/boost/date_time/time_zone_base.hpp | 3 +- .../boost/boost/date_time/year_month_day.hpp | 4 +- .../boost/boost/detail/is_incrementable.hpp | 54 +- 3party/boost/boost/detail/iterator.hpp | 13 + 3party/boost/boost/detail/lcast_precision.hpp | 1 + .../boost/boost/detail/utf8_codecvt_facet.hpp | 24 +- .../boost/boost/detail/utf8_codecvt_facet.ipp | 18 +- .../boost/detail/winapi/GetCurrentProcess.hpp | 18 +- .../boost/detail/winapi/GetCurrentThread.hpp | 25 +- .../boost/detail/winapi/GetLastError.hpp | 18 +- .../boost/detail/winapi/GetProcessTimes.hpp | 25 +- .../boost/detail/winapi/GetThreadTimes.hpp | 24 +- .../boost/boost/detail/winapi/LocalFree.hpp | 33 - .../boost/detail/winapi/access_rights.hpp | 84 + 3party/boost/boost/detail/winapi/apc.hpp | 47 + .../boost/boost/detail/winapi/basic_types.hpp | 251 +- .../winapi/character_code_conversion.hpp | 108 + .../detail/winapi/condition_variable.hpp | 123 + 3party/boost/boost/detail/winapi/config.hpp | 36 +- .../boost/detail/winapi/critical_section.hpp | 184 + 3party/boost/boost/detail/winapi/crypt.hpp | 252 +- 3party/boost/boost/detail/winapi/dbghelp.hpp | 171 + .../boost/detail/winapi/detail/cast_ptr.hpp | 40 + .../detail/winapi/directory_management.hpp | 96 +- 3party/boost/boost/detail/winapi/dll.hpp | 257 +- .../boost/boost/detail/winapi/environment.hpp | 118 + .../boost/boost/detail/winapi/error_codes.hpp | 2959 ++ .../boost/detail/winapi/error_handling.hpp | 162 +- 3party/boost/boost/detail/winapi/event.hpp | 190 + .../boost/detail/winapi/file_management.hpp | 617 +- .../boost/detail/winapi/file_mapping.hpp | 238 + .../detail/winapi/get_current_process.hpp | 34 + .../detail/winapi/get_current_process_id.hpp | 33 + .../detail/winapi/get_current_thread.hpp | 34 + .../detail/winapi/get_current_thread_id.hpp | 34 + .../boost/detail/winapi/get_last_error.hpp | 33 + .../boost/detail/winapi/get_process_times.hpp | 60 + .../detail/winapi/get_system_directory.hpp | 63 + .../boost/detail/winapi/get_thread_times.hpp | 55 + .../boost/boost/detail/winapi/handle_info.hpp | 62 + 3party/boost/boost/detail/winapi/handles.hpp | 71 +- .../boost/boost/detail/winapi/heap_memory.hpp | 72 + .../boost/boost/detail/winapi/init_once.hpp | 123 + 3party/boost/boost/detail/winapi/jobs.hpp | 119 + 3party/boost/boost/detail/winapi/limits.hpp | 51 + .../boost/detail/winapi/local_memory.hpp | 51 + 3party/boost/boost/detail/winapi/memory.hpp | 46 +- 3party/boost/boost/detail/winapi/mutex.hpp | 184 + .../boost/boost/detail/winapi/overlapped.hpp | 51 + .../detail/winapi/page_protection_flags.hpp | 56 + 3party/boost/boost/detail/winapi/pipes.hpp | 317 + .../boost/detail/winapi/priority_class.hpp | 78 + 3party/boost/boost/detail/winapi/process.hpp | 415 +- 3party/boost/boost/detail/winapi/security.hpp | 93 +- .../boost/boost/detail/winapi/semaphore.hpp | 177 + 3party/boost/boost/detail/winapi/shell.hpp | 145 + .../boost/boost/detail/winapi/show_window.hpp | 105 + 3party/boost/boost/detail/winapi/srw_lock.hpp | 116 + .../boost/detail/winapi/synchronization.hpp | 285 +- 3party/boost/boost/detail/winapi/system.hpp | 91 +- 3party/boost/boost/detail/winapi/thread.hpp | 41 +- .../boost/boost/detail/winapi/thread_pool.hpp | 130 +- 3party/boost/boost/detail/winapi/time.hpp | 174 +- 3party/boost/boost/detail/winapi/timers.hpp | 42 +- 3party/boost/boost/detail/winapi/tls.hpp | 51 +- 3party/boost/boost/detail/winapi/wait.hpp | 84 + .../boost/detail/winapi/waitable_timer.hpp | 157 +- 3party/boost/boost/detail/workaround.hpp | 5 + 3party/boost/boost/dll.hpp | 27 + 3party/boost/boost/dll/alias.hpp | 264 + .../boost/dll/detail/aggressive_ptr_cast.hpp | 135 + 3party/boost/boost/dll/detail/ctor_dtor.hpp | 192 + .../dll/detail/demangling/demangle_symbol.hpp | 108 + .../boost/dll/detail/demangling/itanium.hpp | 326 + .../demangling/mangled_storage_base.hpp | 120 + .../boost/dll/detail/demangling/msvc.hpp | 439 + 3party/boost/boost/dll/detail/elf_info.hpp | 285 + .../boost/dll/detail/get_mem_fn_type.hpp | 40 + .../dll/detail/import_mangled_helpers.hpp | 290 + 3party/boost/boost/dll/detail/macho_info.hpp | 321 + 3party/boost/boost/dll/detail/pe_info.hpp | 429 + .../dll/detail/posix/path_from_handle.hpp | 169 + .../detail/posix/program_location_impl.hpp | 140 + .../dll/detail/posix/shared_library_impl.hpp | 215 + .../boost/boost/dll/detail/system_error.hpp | 56 + 3party/boost/boost/dll/detail/type_info.hpp | 83 + .../dll/detail/windows/path_from_handle.hpp | 62 + .../detail/windows/shared_library_impl.hpp | 177 + .../boost/dll/detail/x_info_interface.hpp | 32 + 3party/boost/boost/dll/import.hpp | 277 + 3party/boost/boost/dll/import_class.hpp | 558 + 3party/boost/boost/dll/import_mangled.hpp | 309 + 3party/boost/boost/dll/library_info.hpp | 181 + .../boost/boost/dll/runtime_symbol_info.hpp | 237 + 3party/boost/boost/dll/shared_library.hpp | 550 + .../boost/dll/shared_library_load_mode.hpp | 249 + 3party/boost/boost/dll/smart_library.hpp | 462 + .../boost/dynamic_bitset/dynamic_bitset.hpp | 28 + .../boost/dynamic_bitset/serialization.hpp | 46 + 3party/boost/boost/endian/arithmetic.hpp | 18 +- 3party/boost/boost/endian/buffers.hpp | 26 +- 3party/boost/boost/endian/conversion.hpp | 37 +- 3party/boost/boost/endian/detail/config.hpp | 6 +- .../boost/endian/detail/cover_operators.hpp | 24 +- .../boost/boost/endian/detail/intrinsic.hpp | 23 +- .../boost/endian/detail/lightweight_test.hpp | 2 +- .../exception/detail/error_info_impl.hpp | 11 + .../boost/exception/detail/shared_ptr.hpp | 17 + .../boost/exception/errinfo_api_function.hpp | 2 +- .../boost/boost/exception/errinfo_errno.hpp | 5 +- 3party/boost/boost/exception/exception.hpp | 38 +- .../boost/boost/exception/get_error_info.hpp | 3 +- 3party/boost/boost/exception/info.hpp | 115 +- 3party/boost/boost/fiber/algo/algorithm.hpp | 114 + 3party/boost/boost/fiber/algo/round_robin.hpp | 69 + 3party/boost/boost/fiber/algo/shared_work.hpp | 86 + .../boost/boost/fiber/algo/work_stealing.hpp | 84 + 3party/boost/boost/fiber/all.hpp | 38 + 3party/boost/boost/fiber/barrier.hpp | 48 + 3party/boost/boost/fiber/buffered_channel.hpp | 481 + .../boost/boost/fiber/channel_op_status.hpp | 34 + .../boost/boost/fiber/condition_variable.hpp | 254 + 3party/boost/boost/fiber/context.hpp | 611 + 3party/boost/boost/fiber/detail/config.hpp | 65 + .../fiber/detail/context_spinlock_queue.hpp | 118 + .../boost/fiber/detail/context_spmc_queue.hpp | 199 + 3party/boost/boost/fiber/detail/convert.hpp | 59 + 3party/boost/boost/fiber/detail/cpu_relax.hpp | 82 + 3party/boost/boost/fiber/detail/data.hpp | 71 + .../boost/boost/fiber/detail/decay_copy.hpp | 36 + .../boost/fiber/detail/disable_overload.hpp | 34 + 3party/boost/boost/fiber/detail/fss.hpp | 59 + 3party/boost/boost/fiber/detail/futex.hpp | 61 + 3party/boost/boost/fiber/detail/spinlock.hpp | 65 + .../boost/fiber/detail/spinlock_ttas.hpp | 115 + .../fiber/detail/spinlock_ttas_adaptive.hpp | 112 + .../detail/spinlock_ttas_adaptive_futex.hpp | 111 + .../fiber/detail/spinlock_ttas_futex.hpp | 104 + 3party/boost/boost/fiber/detail/wrap.hpp | 131 + 3party/boost/boost/fiber/exceptions.hpp | 148 + 3party/boost/boost/fiber/fiber.hpp | 162 + 3party/boost/boost/fiber/fixedsize_stack.hpp | 33 + 3party/boost/boost/fiber/fss.hpp | 107 + 3party/boost/boost/fiber/future.hpp | 10 + 3party/boost/boost/fiber/future/async.hpp | 112 + .../fiber/future/detail/shared_state.hpp | 313 + .../future/detail/shared_state_object.hpp | 58 + .../boost/fiber/future/detail/task_base.hpp | 41 + .../boost/fiber/future/detail/task_object.hpp | 170 + 3party/boost/boost/fiber/future/future.hpp | 474 + .../boost/fiber/future/future_status.hpp | 27 + .../boost/fiber/future/packaged_task.hpp | 141 + 3party/boost/boost/fiber/future/promise.hpp | 220 + 3party/boost/boost/fiber/mutex.hpp | 70 + 3party/boost/boost/fiber/operations.hpp | 90 + 3party/boost/boost/fiber/policy.hpp | 46 + .../boost/fiber/pooled_fixedsize_stack.hpp | 30 + 3party/boost/boost/fiber/properties.hpp | 79 + .../boost/fiber/protected_fixedsize_stack.hpp | 30 + 3party/boost/boost/fiber/recursive_mutex.hpp | 76 + .../boost/fiber/recursive_timed_mutex.hpp | 91 + 3party/boost/boost/fiber/scheduler.hpp | 173 + 3party/boost/boost/fiber/segmented_stack.hpp | 35 + 3party/boost/boost/fiber/timed_mutex.hpp | 85 + 3party/boost/boost/fiber/type.hpp | 107 + .../boost/boost/fiber/unbuffered_channel.hpp | 527 + 3party/boost/boost/filesystem.hpp | 1 + 3party/boost/boost/filesystem/config.hpp | 3 +- .../boost/filesystem/detail/macro_value.hpp | 44 + 3party/boost/boost/filesystem/operations.hpp | 393 +- 3party/boost/boost/filesystem/path.hpp | 172 +- 3party/boost/boost/filesystem/path_traits.hpp | 6 +- 3party/boost/boost/filesystem/string_file.hpp | 43 + .../flyweight/assoc_container_factory.hpp | 6 +- .../flyweight/detail/archive_constructed.hpp | 2 +- .../boost/flyweight/detail/perfect_fwd.hpp | 2 +- .../flyweight/detail/serialization_helper.hpp | 4 +- 3party/boost/boost/flyweight/flyweight.hpp | 6 +- .../boost/boost/flyweight/flyweight_fwd.hpp | 17 +- 3party/boost/boost/flyweight/serialize.hpp | 14 +- .../boost/boost/format/alt_sstream_impl.hpp | 4 +- 3party/boost/boost/format/feed_args.hpp | 4 + 3party/boost/boost/format/parsing.hpp | 6 +- 3party/boost/boost/function/function_base.hpp | 258 +- .../boost/function/function_template.hpp | 126 +- 3party/boost/boost/functional.hpp | 61 +- .../boost/functional/forward_adapter.hpp | 33 +- .../functional/hash/detail/hash_float.hpp | 2 +- .../boost/functional/hash/extensions.hpp | 6 +- 3party/boost/boost/functional/hash/hash.hpp | 42 +- .../lightweight_forward_adapter.hpp | 33 +- .../boost/fusion/adapted/adt/adapt_adt.hpp | 9 +- .../fusion/adapted/adt/adapt_assoc_adt.hpp | 10 +- .../fusion/adapted/adt/detail/adapt_base.hpp | 60 +- .../detail/adapt_base_assoc_attr_filler.hpp | 13 +- .../adt/detail/adapt_base_attr_filler.hpp | 40 +- .../boost/boost/fusion/adapted/std_array.hpp | 23 + .../adapted/std_array/detail/array_size.hpp | 25 + .../adapted/std_array/detail/at_impl.hpp | 45 + .../adapted/std_array/detail/begin_impl.hpp | 41 + .../std_array/detail/category_of_impl.hpp | 35 + .../adapted/std_array/detail/end_impl.hpp | 45 + .../std_array/detail/is_sequence_impl.hpp | 32 + .../adapted/std_array/detail/is_view_impl.hpp | 33 + .../adapted/std_array/detail/size_impl.hpp | 41 + .../std_array/detail/value_at_impl.hpp | 32 + .../adapted/std_array/std_array_iterator.hpp | 109 + .../boost/fusion/adapted/std_array/tag_of.hpp | 52 + .../adapted/struct/adapt_assoc_struct.hpp | 9 +- .../struct/adapt_assoc_struct_named.hpp | 11 +- .../fusion/adapted/struct/adapt_struct.hpp | 11 +- .../adapted/struct/adapt_struct_named.hpp | 2 +- .../adapted/struct/define_assoc_struct.hpp | 1 + .../fusion/adapted/struct/define_struct.hpp | 1 + .../adapted/struct/detail/adapt_auto.hpp | 5 +- .../adapted/struct/detail/adapt_base.hpp | 32 +- .../detail/adapt_base_assoc_attr_filler.hpp | 24 +- .../struct/detail/adapt_base_attr_filler.hpp | 26 +- .../adapted/struct/detail/adapt_is_tpl.hpp | 2 + .../adapted/struct/detail/define_struct.hpp | 272 +- .../struct/detail/define_struct_inline.hpp | 14 +- .../struct/detail/preprocessor/is_seq.hpp | 4 +- .../fusion/algorithm/iteration/accumulate.hpp | 15 +- .../algorithm/iteration/accumulate_fwd.hpp | 15 +- .../algorithm/iteration/detail/fold.hpp | 550 +- .../iteration/detail/preprocessed/fold.hpp | 447 +- .../detail/preprocessed/iter_fold.hpp | 447 +- .../detail/preprocessed/reverse_fold.hpp | 447 +- .../detail/preprocessed/reverse_iter_fold.hpp | 447 +- .../iteration/detail/segmented_fold.hpp | 7 +- .../boost/fusion/algorithm/iteration/fold.hpp | 12 +- .../fusion/algorithm/iteration/fold_fwd.hpp | 4 +- .../fusion/algorithm/iteration/iter_fold.hpp | 13 +- .../algorithm/iteration/iter_fold_fwd.hpp | 4 +- .../algorithm/iteration/reverse_fold.hpp | 12 +- .../algorithm/iteration/reverse_fold_fwd.hpp | 4 +- .../algorithm/iteration/reverse_iter_fold.hpp | 12 +- .../iteration/reverse_iter_fold_fwd.hpp | 4 +- .../fusion/algorithm/transformation/erase.hpp | 1 - .../algorithm/transformation/flatten.hpp | 4 +- .../algorithm/transformation/insert.hpp | 1 - .../algorithm/transformation/insert_range.hpp | 1 - .../fusion/algorithm/transformation/zip.hpp | 1 + .../boost/fusion/container/deque/deque.hpp | 7 +- .../container/deque/detail/convert_impl.hpp | 9 +- .../deque/detail/cpp03/build_deque.hpp | 1 + .../container/deque/detail/cpp03/deque.hpp | 12 +- .../detail/cpp03/preprocessed/deque10.hpp | 11 +- .../detail/cpp03/preprocessed/deque20.hpp | 11 +- .../detail/cpp03/preprocessed/deque30.hpp | 11 +- .../detail/cpp03/preprocessed/deque40.hpp | 11 +- .../detail/cpp03/preprocessed/deque50.hpp | 11 +- .../container/deque/detail/keyed_element.hpp | 10 +- .../generation/detail/pp_list_tie.hpp | 1 + .../generation/detail/pp_make_list.hpp | 1 + .../generation/detail/pp_make_set.hpp | 1 + .../generation/detail/pp_make_vector.hpp | 1 + .../generation/detail/pp_vector_tie.hpp | 1 + .../detail/preprocessed/make_set10.hpp | 2 +- .../detail/preprocessed/make_set20.hpp | 2 +- .../detail/preprocessed/make_set30.hpp | 2 +- .../detail/preprocessed/make_set40.hpp | 2 +- .../detail/preprocessed/make_set50.hpp | 2 +- .../fusion/container/generation/make_set.hpp | 41 +- .../container/generation/make_vector.hpp | 41 +- .../container/generation/vector_tie.hpp | 29 + .../boost/fusion/container/list/cons.hpp | 6 +- .../container/list/detail/cpp03/list.hpp | 4 +- .../list/detail/cpp03/list_forward_ctor.hpp | 3 +- .../list/detail/cpp03/list_to_cons_call.hpp | 3 +- .../list/detail/cpp03/preprocessed/list10.hpp | 16 +- .../list/detail/cpp03/preprocessed/list20.hpp | 16 +- .../list/detail/cpp03/preprocessed/list30.hpp | 16 +- .../list/detail/cpp03/preprocessed/list40.hpp | 16 +- .../list/detail/cpp03/preprocessed/list50.hpp | 16 +- .../map/detail/cpp03/preprocessed/map10.hpp | 2 +- .../map/detail/cpp03/preprocessed/map20.hpp | 2 +- .../map/detail/cpp03/preprocessed/map30.hpp | 2 +- .../map/detail/cpp03/preprocessed/map40.hpp | 2 +- .../map/detail/cpp03/preprocessed/map50.hpp | 2 +- .../boost/boost/fusion/container/map/map.hpp | 8 +- .../fusion/container/set/detail/as_set.hpp | 50 +- .../container/set/detail/convert_impl.hpp | 2 +- .../container/set/detail/cpp03/as_set.hpp | 1 + .../detail/cpp03/preprocessed/as_set10.hpp | 2 +- .../detail/cpp03/preprocessed/as_set20.hpp | 2 +- .../detail/cpp03/preprocessed/as_set30.hpp | 2 +- .../detail/cpp03/preprocessed/as_set40.hpp | 2 +- .../detail/cpp03/preprocessed/as_set50.hpp | 2 +- .../set/detail/cpp03/preprocessed/set10.hpp | 5 +- .../set/detail/cpp03/preprocessed/set20.hpp | 5 +- .../set/detail/cpp03/preprocessed/set30.hpp | 5 +- .../set/detail/cpp03/preprocessed/set40.hpp | 5 +- .../set/detail/cpp03/preprocessed/set50.hpp | 5 +- .../fusion/container/set/detail/cpp03/set.hpp | 5 +- .../set/detail/cpp03/set_forward_ctor.hpp | 3 +- .../boost/boost/fusion/container/set/set.hpp | 122 +- .../boost/fusion/container/set/set_fwd.hpp | 27 + .../boost/boost/fusion/container/vector.hpp | 19 +- .../container/vector/detail/as_vector.hpp | 53 +- .../container/vector/detail/at_impl.hpp | 9 +- .../fusion/container/vector/detail/config.hpp | 38 + .../vector/detail/cpp03/as_vector.hpp | 1 + .../container/vector/detail/cpp03/limits.hpp | 1 + .../detail/cpp03/preprocessed/as_vector10.hpp | 2 +- .../detail/cpp03/preprocessed/as_vector20.hpp | 2 +- .../detail/cpp03/preprocessed/as_vector30.hpp | 2 +- .../detail/cpp03/preprocessed/as_vector40.hpp | 2 +- .../detail/cpp03/preprocessed/as_vector50.hpp | 2 +- .../detail/cpp03/preprocessed/vector10.hpp | 26 +- .../cpp03/preprocessed/vector10_fwd.hpp | 2 +- .../detail/cpp03/preprocessed/vector20.hpp | 20 +- .../cpp03/preprocessed/vector20_fwd.hpp | 2 +- .../detail/cpp03/preprocessed/vector30.hpp | 20 +- .../cpp03/preprocessed/vector30_fwd.hpp | 2 +- .../detail/cpp03/preprocessed/vector40.hpp | 20 +- .../cpp03/preprocessed/vector40_fwd.hpp | 2 +- .../detail/cpp03/preprocessed/vector50.hpp | 20 +- .../cpp03/preprocessed/vector50_fwd.hpp | 2 +- .../detail/cpp03/preprocessed/vvector10.hpp | 56 +- .../detail/cpp03/preprocessed/vvector20.hpp | 96 +- .../detail/cpp03/preprocessed/vvector30.hpp | 136 +- .../detail/cpp03/preprocessed/vvector40.hpp | 176 +- .../detail/cpp03/preprocessed/vvector50.hpp | 216 +- .../container/vector/detail/cpp03/vector.hpp | 4 +- .../vector/detail/cpp03/vector20.hpp | 1 + .../vector/detail/cpp03/vector30.hpp | 1 + .../vector/detail/cpp03/vector40.hpp | 1 + .../vector/detail/cpp03/vector50.hpp | 1 + .../container/vector/detail/deref_impl.hpp | 6 +- .../container/vector/detail/value_at_impl.hpp | 40 + .../container/vector/detail/value_of_impl.hpp | 6 +- .../boost/fusion/container/vector/vector.hpp | 317 +- .../fusion/container/vector/vector10.hpp | 10 + .../fusion/container/vector/vector20.hpp | 10 + .../fusion/container/vector/vector30.hpp | 10 + .../fusion/container/vector/vector40.hpp | 10 + .../fusion/container/vector/vector50.hpp | 10 + .../fusion/container/vector/vector_fwd.hpp | 26 +- .../fusion/functional/adapter/limits.hpp | 11 +- .../fusion/functional/invocation/invoke.hpp | 8 +- .../invocation/invoke_function_object.hpp | 10 +- .../invocation/invoke_procedure.hpp | 4 +- .../boost/boost/fusion/sequence/convert.hpp | 11 +- .../boost/fusion/sequence/io/detail/manip.hpp | 3 +- .../boost/boost/fusion/support/detail/and.hpp | 39 + .../boost/fusion/support/detail/enabler.hpp | 19 +- .../fusion/support/detail/index_sequence.hpp | 21 + .../fusion/support/detail/is_same_size.hpp | 29 + .../boost/fusion/support/detail/result_of.hpp | 53 - .../fusion/support/segmented_fold_until.hpp | 5 - .../boost/fusion/tuple/detail/make_tuple.hpp | 1 + .../boost/boost/fusion/tuple/detail/tuple.hpp | 1 + .../boost/fusion/tuple/detail/tuple_fwd.hpp | 1 + .../boost/fusion/tuple/detail/tuple_tie.hpp | 1 + .../boost/boost/fusion/tuple/make_tuple.hpp | 31 + 3party/boost/boost/fusion/tuple/tuple.hpp | 104 +- 3party/boost/boost/fusion/tuple/tuple_fwd.hpp | 26 +- 3party/boost/boost/fusion/tuple/tuple_tie.hpp | 19 + .../view/detail/strictest_traversal.hpp | 2 +- .../boost/boost/fusion/view/flatten_view.hpp | 4 +- .../fusion/view/flatten_view/flatten_view.hpp | 4 +- .../flatten_view/flatten_view_iterator.hpp | 4 +- .../detail/segmented_iterator_range.hpp | 19 +- .../fusion/view/nview/detail/advance_impl.hpp | 9 +- .../fusion/view/nview/detail/at_impl.hpp | 3 +- .../fusion/view/nview/detail/begin_impl.hpp | 5 +- .../view/nview/detail/cpp03/nview_impl.hpp | 5 +- .../fusion/view/nview/detail/deref_impl.hpp | 6 +- .../fusion/view/nview/detail/end_impl.hpp | 5 +- .../fusion/view/nview/detail/next_impl.hpp | 8 +- .../fusion/view/nview/detail/nview_impl.hpp | 32 + .../fusion/view/nview/detail/prior_impl.hpp | 8 +- .../boost/boost/fusion/view/nview/nview.hpp | 8 +- .../fusion/view/nview/nview_iterator.hpp | 3 +- .../view/single_view/detail/next_impl.hpp | 5 +- .../boost/fusion/view/zip_view/zip_view.hpp | 2 +- .../boost/geometry/algorithms/append.hpp | 2 +- .../boost/boost/geometry/algorithms/area.hpp | 13 +- .../boost/geometry/algorithms/assign.hpp | 19 +- .../boost/geometry/algorithms/buffer.hpp | 24 +- .../boost/geometry/algorithms/centroid.hpp | 32 +- .../boost/boost/geometry/algorithms/clear.hpp | 2 +- .../boost/geometry/algorithms/convert.hpp | 2 +- .../boost/geometry/algorithms/convex_hull.hpp | 12 +- .../boost/geometry/algorithms/correct.hpp | 2 +- .../boost/geometry/algorithms/covered_by.hpp | 37 +- .../boost/geometry/algorithms/crosses.hpp | 143 +- .../algorithms/detail/andoyer_inverse.hpp | 163 - .../geometry/algorithms/detail/as_range.hpp | 2 - .../algorithms/detail/assign_box_corners.hpp | 4 +- .../detail/assign_indexed_point.hpp | 8 +- .../algorithms/detail/assign_values.hpp | 1 - .../geometry/algorithms/detail/azimuth.hpp | 30 +- .../detail/buffer/buffer_inserter.hpp | 88 +- .../detail/buffer/buffer_policies.hpp | 62 +- .../buffer/buffered_piece_collection.hpp | 106 +- .../detail/buffer/buffered_ring.hpp | 51 +- .../detail/buffer/get_piece_turns.hpp | 12 +- .../buffer/turn_in_original_visitor.hpp | 33 +- .../detail/buffer/turn_in_piece_visitor.hpp | 24 +- .../algorithms/detail/calculate_sum.hpp | 6 +- .../detail/comparable_distance/interface.hpp | 8 +- .../algorithms/detail/direction_code.hpp | 79 + .../detail/disjoint/areal_areal.hpp | 74 +- .../algorithms/detail/disjoint/box_box.hpp | 91 +- .../algorithms/detail/disjoint/interface.hpp | 159 +- .../detail/disjoint/linear_areal.hpp | 87 +- .../detail/disjoint/linear_linear.hpp | 38 +- .../detail/disjoint/linear_segment_or_box.hpp | 11 +- .../detail/disjoint/multipoint_geometry.hpp | 100 +- .../detail/disjoint/multirange_geometry.hpp | 25 +- .../algorithms/detail/disjoint/point_box.hpp | 66 +- .../detail/disjoint/point_geometry.hpp | 9 +- .../detail/disjoint/point_point.hpp | 18 +- .../detail/disjoint/segment_box.hpp | 235 +- .../algorithms/detail/distance/interface.hpp | 8 +- .../detail/distance/segment_to_box.hpp | 21 +- .../algorithms/detail/envelope/box.hpp | 17 +- .../detail/envelope/implementation.hpp | 13 +- .../algorithms/detail/envelope/interface.hpp | 128 +- .../algorithms/detail/envelope/linear.hpp | 28 +- .../algorithms/detail/envelope/multipoint.hpp | 13 +- .../algorithms/detail/envelope/point.hpp | 15 +- .../algorithms/detail/envelope/range.hpp | 44 +- .../detail/envelope/range_of_boxes.hpp | 21 +- .../algorithms/detail/envelope/segment.hpp | 273 +- .../detail/envelope/transform_units.hpp | 2 +- .../detail/equals/collect_vectors.hpp | 328 +- .../geometry/algorithms/detail/expand/box.hpp | 17 +- .../algorithms/detail/expand/indexed.hpp | 25 +- .../algorithms/detail/expand/interface.hpp | 107 +- .../algorithms/detail/expand/point.hpp | 27 +- .../algorithms/detail/expand/segment.hpp | 42 +- .../algorithms/detail/expand_by_epsilon.hpp | 113 + .../algorithms/detail/extreme_points.hpp | 6 +- .../detail/has_self_intersections.hpp | 23 +- .../detail/intersection/interface.hpp | 283 +- .../detail/is_simple/always_simple.hpp | 6 +- .../algorithms/detail/is_simple/areal.hpp | 30 +- .../algorithms/detail/is_simple/interface.hpp | 79 +- .../algorithms/detail/is_simple/linear.hpp | 36 +- .../detail/is_simple/multipoint.hpp | 10 +- .../algorithms/detail/is_valid/box.hpp | 19 +- .../is_valid/has_invalid_coordinate.hpp | 151 + .../detail/is_valid/has_valid_self_turns.hpp | 15 +- .../algorithms/detail/is_valid/interface.hpp | 165 +- .../algorithms/detail/is_valid/linear.hpp | 21 +- .../detail/is_valid/multipolygon.hpp | 33 +- .../algorithms/detail/is_valid/pointlike.hpp | 22 +- .../algorithms/detail/is_valid/polygon.hpp | 54 +- .../algorithms/detail/is_valid/ring.hpp | 74 +- .../algorithms/detail/is_valid/segment.hpp | 17 +- .../boost/geometry/algorithms/detail/not.hpp | 13 +- .../detail/overlay/aggregate_operations.hpp | 100 + .../overlay/append_no_dups_or_spikes.hpp | 2 +- .../detail/overlay/assign_parents.hpp | 9 +- .../detail/overlay/backtrack_check_si.hpp | 70 +- .../detail/overlay/clip_linestring.hpp | 13 +- .../detail/overlay/cluster_info.hpp | 49 + .../detail/overlay/copy_segment_point.hpp | 97 +- .../detail/overlay/copy_segments.hpp | 2 +- .../overlay/enrich_intersection_points.hpp | 536 +- .../detail/overlay/enrichment_info.hpp | 17 +- .../detail/overlay/follow_linear_linear.hpp | 26 +- .../overlay/get_intersection_points.hpp | 51 +- .../detail/overlay/get_relative_order.hpp | 2 +- .../detail/overlay/get_turn_info.hpp | 56 +- .../overlay/get_turn_info_for_endpoint.hpp | 23 +- .../detail/overlay/get_turn_info_helpers.hpp | 146 +- .../detail/overlay/get_turn_info_la.hpp | 63 +- .../detail/overlay/get_turn_info_ll.hpp | 33 +- .../algorithms/detail/overlay/get_turns.hpp | 140 +- .../detail/overlay/handle_colocations.hpp | 728 + .../detail/overlay/handle_tangencies.hpp | 786 - .../overlay/inconsistent_turns_exception.hpp | 38 + .../detail/overlay/intersection_box_box.hpp | 24 +- .../detail/overlay/intersection_insert.hpp | 199 +- .../detail/overlay/less_by_segment_ratio.hpp | 203 + .../detail/overlay/linear_linear.hpp | 11 +- .../algorithms/detail/overlay/overlay.hpp | 141 +- .../detail/overlay/overlay_type.hpp | 38 + .../detail/overlay/pointlike_linear.hpp | 42 +- .../detail/overlay/segment_identifier.hpp | 5 + .../detail/overlay/select_rings.hpp | 48 +- .../detail/overlay/self_turn_points.hpp | 44 +- .../detail/overlay/sort_by_side.hpp | 573 + .../algorithms/detail/overlay/traversal.hpp | 799 + .../detail/overlay/traversal_info.hpp | 2 +- .../detail/overlay/traversal_ring_creator.hpp | 335 + .../overlay/traversal_switch_detector.hpp | 343 + .../algorithms/detail/overlay/traverse.hpp | 420 +- .../algorithms/detail/overlay/turn_info.hpp | 35 +- .../algorithms/detail/overlay/visit_info.hpp | 18 +- .../geometry/algorithms/detail/partition.hpp | 499 +- .../detail/point_is_spike_or_equal.hpp | 36 +- .../algorithms/detail/point_on_border.hpp | 4 +- .../algorithms/detail/recalculate.hpp | 10 +- .../algorithms/detail/relate/areal_areal.hpp | 125 +- .../detail/relate/boundary_checker.hpp | 40 +- .../detail/relate/implementation.hpp | 7 +- .../algorithms/detail/relate/interface.hpp | 139 +- .../algorithms/detail/relate/linear_areal.hpp | 85 +- .../detail/relate/linear_linear.hpp | 16 +- .../detail/relate/point_geometry.hpp | 16 +- .../algorithms/detail/relate/point_point.hpp | 34 +- .../algorithms/detail/relate/relate_impl.hpp | 5 +- .../algorithms/detail/relate/result.hpp | 15 +- .../detail/relate/topology_check.hpp | 36 +- .../algorithms/detail/relate/turns.hpp | 28 +- .../algorithms/detail/relation/interface.hpp | 97 +- .../algorithms/detail/result_inverse.hpp | 44 - .../algorithms/detail/ring_identifier.hpp | 5 + .../detail/sections/range_by_section.hpp | 2 +- .../detail/sections/section_functions.hpp | 5 + .../detail/sections/sectionalize.hpp | 80 +- .../algorithms/detail/thomas_inverse.hpp | 191 - .../detail/throw_on_empty_input.hpp | 7 +- .../detail/within/point_in_geometry.hpp | 100 +- .../boost/geometry/algorithms/difference.hpp | 313 +- .../geometry/algorithms/dispatch/disjoint.hpp | 27 +- .../boost/geometry/algorithms/equals.hpp | 327 +- .../boost/geometry/algorithms/for_each.hpp | 4 +- .../boost/geometry/algorithms/intersects.hpp | 46 +- .../boost/geometry/algorithms/is_empty.hpp | 2 +- .../boost/geometry/algorithms/length.hpp | 12 +- .../boost/boost/geometry/algorithms/make.hpp | 12 +- .../geometry/algorithms/num_geometries.hpp | 2 +- .../algorithms/num_interior_rings.hpp | 2 +- .../boost/geometry/algorithms/num_points.hpp | 2 +- .../geometry/algorithms/num_segments.hpp | 2 +- .../boost/geometry/algorithms/overlaps.hpp | 62 +- .../boost/geometry/algorithms/perimeter.hpp | 2 +- .../geometry/algorithms/point_on_surface.hpp | 4 +- .../geometry/algorithms/remove_spikes.hpp | 4 +- .../boost/geometry/algorithms/reverse.hpp | 2 +- .../boost/geometry/algorithms/simplify.hpp | 18 +- .../geometry/algorithms/sym_difference.hpp | 302 +- .../boost/geometry/algorithms/touches.hpp | 247 +- .../boost/geometry/algorithms/transform.hpp | 10 +- .../boost/boost/geometry/algorithms/union.hpp | 302 +- .../boost/geometry/algorithms/unique.hpp | 2 +- .../algorithms/validity_failure_type.hpp | 5 +- .../boost/geometry/algorithms/within.hpp | 43 +- .../boost/geometry/arithmetic/arithmetic.hpp | 30 +- .../geometry/arithmetic/cross_product.hpp | 128 + .../boost/geometry/arithmetic/determinant.hpp | 6 +- .../boost/geometry/arithmetic/dot_product.hpp | 4 +- .../boost/geometry/arithmetic/normalize.hpp | 71 + 3party/boost/boost/geometry/core/access.hpp | 11 +- 3party/boost/boost/geometry/core/closure.hpp | 2 +- .../geometry/core/coordinate_dimension.hpp | 9 +- .../boost/geometry/core/coordinate_type.hpp | 2 +- .../boost/boost/geometry/core/exception.hpp | 1 + .../boost/geometry/core/exterior_ring.hpp | 1 + .../boost/geometry/core/interior_type.hpp | 3 + .../boost/geometry/core/mutable_range.hpp | 2 +- .../boost/boost/geometry/core/point_order.hpp | 2 +- 3party/boost/boost/geometry/core/radius.hpp | 1 + .../boost/geometry/core/reverse_dispatch.hpp | 3 +- 3party/boost/boost/geometry/core/srs.hpp | 9 +- 3party/boost/boost/geometry/core/tag.hpp | 1 - 3party/boost/boost/geometry/core/tag_cast.hpp | 2 +- .../geometry/formulas/andoyer_inverse.hpp | 260 + .../boost/geometry/formulas/area_formulas.hpp | 578 + .../formulas/differential_quantities.hpp | 303 + .../geometry/formulas/eccentricity_sqr.hpp | 70 + .../detail => formulas}/flattening.hpp | 19 +- .../boost/geometry/formulas/geographic.hpp | 457 + .../formulas/gnomonic_intersection.hpp | 148 + .../geometry/formulas/gnomonic_spheroid.hpp | 125 + .../boost/geometry/formulas/result_direct.hpp | 39 + .../geometry/formulas/result_inverse.hpp | 39 + .../formulas/sjoberg_intersection.hpp | 1219 + .../boost/geometry/formulas/spherical.hpp | 224 + .../boost/geometry/formulas/thomas_direct.hpp | 248 + .../geometry/formulas/thomas_inverse.hpp | 220 + .../geometry/formulas/vertex_latitude.hpp | 148 + .../detail => formulas}/vincenty_direct.hpp | 81 +- .../detail => formulas}/vincenty_inverse.hpp | 98 +- .../adapted/boost_polygon/ring_proxy.hpp | 2 +- .../geometry/geometries/adapted/std_array.hpp | 115 + .../boost/boost/geometry/geometries/box.hpp | 2 +- .../geometries/concepts/box_concept.hpp | 4 +- .../geometry/geometries/concepts/check.hpp | 40 +- .../concepts/linestring_concept.hpp | 8 +- .../concepts/multi_linestring_concept.hpp | 8 +- .../concepts/multi_point_concept.hpp | 8 +- .../concepts/multi_polygon_concept.hpp | 8 +- .../geometries/concepts/point_concept.hpp | 4 +- .../geometries/concepts/polygon_concept.hpp | 12 +- .../geometries/concepts/ring_concept.hpp | 8 +- .../geometries/concepts/segment_concept.hpp | 8 +- .../boost/geometry/geometries/linestring.hpp | 2 +- .../geometry/geometries/multi_linestring.hpp | 2 +- .../boost/geometry/geometries/multi_point.hpp | 2 +- .../geometry/geometries/multi_polygon.hpp | 2 +- .../geometry/geometries/pointing_segment.hpp | 4 +- .../boost/geometry/geometries/polygon.hpp | 2 +- .../boost/boost/geometry/geometries/ring.hpp | 2 +- .../boost/geometry/geometries/segment.hpp | 6 +- 3party/boost/boost/geometry/geometry.hpp | 6 +- .../index/detail/algorithms/bounds.hpp | 2 +- .../algorithms/intersection_content.hpp | 4 +- .../index/detail/algorithms/nth_element.hpp | 62 + .../index/detail/is_bounding_geometry.hpp | 35 + .../geometry/index/detail/is_indexable.hpp | 47 + .../geometry/index/detail/predicates.hpp | 10 +- .../geometry/index/detail/rtree/node/node.hpp | 40 +- .../index/detail/rtree/node/node_elements.hpp | 17 +- .../index/detail/rtree/pack_create.hpp | 45 +- .../detail/rtree/rstar/choose_next_node.hpp | 5 +- .../index/detail/rtree/rstar/insert.hpp | 20 +- .../rtree/rstar/redistribute_elements.hpp | 12 +- .../detail/rtree/utilities/are_boxes_ok.hpp | 20 +- .../detail/rtree/visitors/children_box.hpp | 4 +- .../index/detail/rtree/visitors/insert.hpp | 48 +- .../index/detail/rtree/visitors/remove.hpp | 15 +- .../boost/boost/geometry/index/equal_to.hpp | 11 +- .../boost/boost/geometry/index/indexable.hpp | 27 +- .../boost/boost/geometry/index/parameters.hpp | 24 +- .../boost/boost/geometry/index/predicates.hpp | 4 - 3party/boost/boost/geometry/index/rtree.hpp | 43 +- 3party/boost/boost/geometry/io/dsv/write.hpp | 2 +- 3party/boost/boost/geometry/io/io.hpp | 2 +- .../boost/geometry/io/svg/svg_mapper.hpp | 211 +- 3party/boost/boost/geometry/io/svg/write.hpp | 418 + .../boost/boost/geometry/io/svg/write_svg.hpp | 265 +- .../boost/geometry/io/svg/write_svg_multi.hpp | 65 +- 3party/boost/boost/geometry/io/wkt/read.hpp | 37 +- 3party/boost/boost/geometry/io/wkt/write.hpp | 2 +- .../is_valid/failing_reason_policy.hpp | 2 + .../policies/relate/intersection_points.hpp | 60 +- .../robustness/get_rescale_policy.hpp | 15 +- .../policies/robustness/rescale_policy.hpp | 2 - .../policies/robustness/robust_type.hpp | 2 +- .../policies/robustness/segment_ratio.hpp | 26 +- .../agnostic/point_in_box_by_side.hpp | 56 +- .../strategies/agnostic/point_in_point.hpp | 77 +- .../agnostic/point_in_poly_winding.hpp | 431 +- .../geometry/strategies/agnostic/relate.hpp | 122 - .../agnostic/simplify_douglas_peucker.hpp | 2 +- .../boost/geometry/strategies/azimuth.hpp | 44 + .../strategies/cartesian/area_surveyor.hpp | 22 +- .../geometry/strategies/cartesian/azimuth.hpp | 49 + .../strategies/cartesian/box_in_box.hpp | 181 +- .../cartesian/centroid_bashein_detmer.hpp | 2 +- .../cartesian/disjoint_segment_box.hpp | 320 + .../cartesian/distance_projected_point.hpp | 2 +- .../cartesian/distance_projected_point_ax.hpp | 2 - .../cartesian/distance_pythagoras.hpp | 9 +- .../cartesian/distance_pythagoras_box_box.hpp | 4 +- .../distance_pythagoras_point_box.hpp | 4 +- .../strategies/cartesian/envelope_segment.hpp | 71 + .../{cart_intersect.hpp => intersection.hpp} | 364 +- .../strategies/cartesian/point_in_box.hpp | 157 +- .../strategies/cartesian/side_by_triangle.hpp | 3 +- .../strategies/concepts/area_concept.hpp | 4 +- .../strategies/concepts/centroid_concept.hpp | 4 +- .../concepts/convex_hull_concept.hpp | 4 +- .../strategies/concepts/distance_concept.hpp | 4 +- .../concepts/segment_intersect_concept.hpp | 4 +- .../strategies/concepts/simplify_concept.hpp | 6 +- .../strategies/concepts/within_concept.hpp | 18 +- .../boost/geometry/strategies/covered_by.hpp | 51 +- .../boost/geometry/strategies/disjoint.hpp | 90 + .../boost/geometry/strategies/envelope.hpp | 45 + .../geometry/strategies/geographic/area.hpp | 216 + .../strategies/geographic/azimuth.hpp | 103 + .../strategies/geographic/distance.hpp | 195 + .../geographic/distance_andoyer.hpp | 140 +- .../strategies/geographic/distance_thomas.hpp | 67 +- .../geographic/distance_vincenty.hpp | 67 +- .../geographic/envelope_segment.hpp | 104 + .../strategies/geographic/intersection.hpp | 897 + .../geographic/intersection_elliptic.hpp | 243 + .../strategies/geographic/mapping_ssf.hpp | 6 +- .../strategies/geographic/parameters.hpp | 117 + .../geometry/strategies/geographic/side.hpp | 113 + .../strategies/geographic/side_andoyer.hpp | 25 +- .../strategies/geographic/side_detail.hpp | 139 - .../strategies/geographic/side_thomas.hpp | 25 +- .../strategies/geographic/side_vincenty.hpp | 25 +- .../geometry/strategies/intersection.hpp | 95 +- .../strategies/intersection_result.hpp | 18 +- .../strategies/intersection_strategies.hpp | 101 + .../boost/geometry/strategies/relate.hpp | 177 + .../boost/boost/geometry/strategies/side.hpp | 6 +- .../geometry/strategies/spherical/area.hpp | 182 + .../strategies/spherical/area_huiller.hpp | 214 - .../geometry/strategies/spherical/azimuth.hpp | 87 + .../spherical/distance_cross_track.hpp | 4 +- .../distance_cross_track_point_box.hpp | 4 +- .../strategies/spherical/envelope_segment.hpp | 86 + .../strategies/spherical/intersection.hpp | 980 + .../geometry/strategies/spherical/ssf.hpp | 12 +- .../boost/geometry/strategies/strategies.hpp | 35 +- .../transform/inverse_transformer.hpp | 30 +- .../strategies/transform/map_transformer.hpp | 53 +- .../transform/matrix_transformers.hpp | 95 +- .../boost/geometry/strategies/within.hpp | 51 +- .../boost/geometry/util/calculation_type.hpp | 4 +- .../boost/boost/geometry/util/combine_if.hpp | 2 - .../geometry/util/for_each_coordinate.hpp | 4 +- .../geometry/util/has_infinite_coordinate.hpp | 55 + .../geometry/util/has_nan_coordinate.hpp | 99 + .../util/has_non_finite_coordinate.hpp | 55 + 3party/boost/boost/geometry/util/math.hpp | 153 +- .../util/normalize_spheroidal_coordinates.hpp | 140 +- .../boost/geometry/util/parameter_type_of.hpp | 2 +- .../geometry/util/promote_floating_point.hpp | 2 +- 3party/boost/boost/geometry/util/range.hpp | 55 +- .../geometry/util/select_calculation_type.hpp | 2 +- .../geometry/util/select_most_precise.hpp | 3 +- .../detail/boundary_view/implementation.hpp | 2 +- 3party/boost/boost/gil/channel_algorithm.hpp | 2 +- .../boost/boost/graph/adjacency_iterator.hpp | 1 + 3party/boost/boost/graph/adjacency_list.hpp | 25 +- 3party/boost/boost/graph/adjacency_matrix.hpp | 2 +- 3party/boost/boost/graph/bc_clustering.hpp | 2 - 3party/boost/boost/graph/buffer_concepts.hpp | 3 +- 3party/boost/boost/graph/copy.hpp | 4 +- .../boost/boost/graph/depth_first_search.hpp | 20 +- .../boost/graph/detail/adjacency_list.hpp | 45 +- .../boost/graph/detail/array_binary_tree.hpp | 3 + 3party/boost/boost/graph/detail/edge.hpp | 2 + 3party/boost/boost/graph/detail/list_base.hpp | 12 +- .../boost/graph/detail/read_graphviz_new.hpp | 2 +- .../graph/detail/read_graphviz_spirit.hpp | 2 +- 3party/boost/boost/graph/directed_graph.hpp | 4 +- .../distributed/adjlist/serialization.hpp | 2 +- .../distributed/detail/mpi_process_group.ipp | 1 + .../hohberg_biconnected_components.hpp | 4 +- .../graph/distributed/mpi_process_group.hpp | 1 + 3party/boost/boost/graph/dominator_tree.hpp | 16 +- 3party/boost/boost/graph/filtered_graph.hpp | 20 + 3party/boost/boost/graph/find_flow_cost.hpp | 6 +- 3party/boost/boost/graph/graph_concepts.hpp | 2 + 3party/boost/boost/graph/graph_utility.hpp | 58 +- 3party/boost/boost/graph/graphml.hpp | 4 +- .../boost/boost/graph/gursoy_atun_layout.hpp | 7 +- .../graph/kamada_kawai_spring_layout.hpp | 2 +- 3party/boost/boost/graph/labeled_graph.hpp | 7 +- 3party/boost/boost/graph/metis.hpp | 3 +- .../boost/boost/graph/metric_tsp_approx.hpp | 6 +- .../boost/graph/named_function_params.hpp | 10 +- .../boost/boost/graph/parallel/properties.hpp | 6 +- .../boost/graph/planar_canonical_ordering.hpp | 2 +- .../planar_detail/boyer_myrvold_impl.hpp | 653 +- 3party/boost/boost/graph/properties.hpp | 7 - .../boost/boost/graph/r_c_shortest_paths.hpp | 1 + 3party/boost/boost/graph/random.hpp | 1 + 3party/boost/boost/graph/reverse_graph.hpp | 7 + .../boost/boost/graph/strong_components.hpp | 1 + 3party/boost/boost/graph/tree_traits.hpp | 2 + .../boost/boost/graph/vf2_sub_graph_iso.hpp | 15 +- 3party/boost/boost/hana.hpp | 208 + 3party/boost/boost/hana/accessors.hpp | 56 + 3party/boost/boost/hana/adapt_adt.hpp | 17 + 3party/boost/boost/hana/adapt_struct.hpp | 17 + 3party/boost/boost/hana/adjust.hpp | 55 + 3party/boost/boost/hana/adjust_if.hpp | 78 + 3party/boost/boost/hana/all.hpp | 48 + 3party/boost/boost/hana/all_of.hpp | 51 + 3party/boost/boost/hana/and.hpp | 58 + 3party/boost/boost/hana/any.hpp | 48 + 3party/boost/boost/hana/any_of.hpp | 192 + 3party/boost/boost/hana/ap.hpp | 78 + 3party/boost/boost/hana/append.hpp | 74 + 3party/boost/boost/hana/assert.hpp | 306 + 3party/boost/boost/hana/at.hpp | 57 + 3party/boost/boost/hana/at_key.hpp | 121 + 3party/boost/boost/hana/back.hpp | 53 + 3party/boost/boost/hana/basic_tuple.hpp | 261 + 3party/boost/boost/hana/bool.hpp | 269 + 3party/boost/boost/hana/cartesian_product.hpp | 113 + 3party/boost/boost/hana/chain.hpp | 50 + 3party/boost/boost/hana/comparing.hpp | 44 + 3party/boost/boost/hana/concat.hpp | 80 + 3party/boost/boost/hana/concept.hpp | 36 + .../boost/boost/hana/concept/applicative.hpp | 33 + 3party/boost/boost/hana/concept/comonad.hpp | 35 + .../boost/boost/hana/concept/comparable.hpp | 32 + 3party/boost/boost/hana/concept/constant.hpp | 31 + .../boost/hana/concept/euclidean_ring.hpp | 35 + 3party/boost/boost/hana/concept/foldable.hpp | 33 + 3party/boost/boost/hana/concept/functor.hpp | 33 + 3party/boost/boost/hana/concept/group.hpp | 34 + 3party/boost/boost/hana/concept/hashable.hpp | 32 + .../boost/hana/concept/integral_constant.hpp | 43 + 3party/boost/boost/hana/concept/iterable.hpp | 35 + 3party/boost/boost/hana/concept/logical.hpp | 35 + .../boost/boost/hana/concept/metafunction.hpp | 41 + 3party/boost/boost/hana/concept/monad.hpp | 33 + .../boost/boost/hana/concept/monad_plus.hpp | 33 + 3party/boost/boost/hana/concept/monoid.hpp | 34 + 3party/boost/boost/hana/concept/orderable.hpp | 32 + 3party/boost/boost/hana/concept/product.hpp | 33 + 3party/boost/boost/hana/concept/ring.hpp | 34 + .../boost/boost/hana/concept/searchable.hpp | 33 + 3party/boost/boost/hana/concept/sequence.hpp | 44 + 3party/boost/boost/hana/concept/struct.hpp | 31 + 3party/boost/boost/hana/config.hpp | 219 + 3party/boost/boost/hana/contains.hpp | 51 + 3party/boost/boost/hana/core.hpp | 22 + 3party/boost/boost/hana/core/common.hpp | 109 + 3party/boost/boost/hana/core/default.hpp | 32 + 3party/boost/boost/hana/core/dispatch.hpp | 18 + 3party/boost/boost/hana/core/is_a.hpp | 41 + 3party/boost/boost/hana/core/make.hpp | 45 + 3party/boost/boost/hana/core/tag_of.hpp | 49 + 3party/boost/boost/hana/core/to.hpp | 194 + 3party/boost/boost/hana/core/when.hpp | 15 + 3party/boost/boost/hana/count.hpp | 50 + 3party/boost/boost/hana/count_if.hpp | 92 + 3party/boost/boost/hana/cycle.hpp | 127 + 3party/boost/boost/hana/define_struct.hpp | 17 + 3party/boost/boost/hana/detail/algorithm.hpp | 186 + 3party/boost/boost/hana/detail/any_of.hpp | 46 + 3party/boost/boost/hana/detail/array.hpp | 105 + .../boost/hana/detail/canonical_constant.hpp | 80 + 3party/boost/boost/hana/detail/concepts.hpp | 78 + 3party/boost/boost/hana/detail/create.hpp | 33 + 3party/boost/boost/hana/detail/decay.hpp | 48 + .../boost/boost/hana/detail/dispatch_if.hpp | 56 + 3party/boost/boost/hana/detail/ebo.hpp | 115 + 3party/boost/boost/hana/detail/fast_and.hpp | 25 + .../hana/detail/first_unsatisfied_index.hpp | 56 + .../hana/detail/has_common_embedding.hpp | 69 + .../boost/hana/detail/has_duplicates.hpp | 65 + 3party/boost/boost/hana/detail/hash_table.hpp | 145 + 3party/boost/boost/hana/detail/index_if.hpp | 71 + .../boost/hana/detail/integral_constant.hpp | 245 + 3party/boost/boost/hana/detail/intrinsics.hpp | 67 + 3party/boost/boost/hana/detail/nested_by.hpp | 40 + .../boost/boost/hana/detail/nested_by_fwd.hpp | 55 + .../boost/boost/hana/detail/nested_than.hpp | 29 + .../boost/hana/detail/nested_than_fwd.hpp | 47 + 3party/boost/boost/hana/detail/nested_to.hpp | 28 + .../boost/boost/hana/detail/nested_to_fwd.hpp | 47 + .../boost/boost/hana/detail/operators/adl.hpp | 34 + .../hana/detail/operators/arithmetic.hpp | 78 + .../hana/detail/operators/comparable.hpp | 44 + .../boost/hana/detail/operators/iterable.hpp | 40 + .../boost/hana/detail/operators/logical.hpp | 51 + .../boost/hana/detail/operators/monad.hpp | 35 + .../boost/hana/detail/operators/orderable.hpp | 60 + .../hana/detail/operators/searchable.hpp | 40 + .../boost/boost/hana/detail/preprocessor.hpp | 106 + .../boost/hana/detail/std_common_type.hpp | 36 + .../boost/hana/detail/struct_macros.erb.hpp | 185 + .../boost/boost/hana/detail/struct_macros.hpp | 3469 +++ 3party/boost/boost/hana/detail/type_at.hpp | 57 + .../boost/boost/hana/detail/type_foldl1.hpp | 145 + .../boost/boost/hana/detail/type_foldr1.hpp | 149 + .../boost/hana/detail/unpack_flatten.hpp | 70 + .../boost/boost/hana/detail/variadic/at.hpp | 40 + .../boost/hana/detail/variadic/drop_into.hpp | 47 + .../boost/hana/detail/variadic/foldl1.hpp | 212 + .../boost/hana/detail/variadic/foldr1.hpp | 208 + .../hana/detail/variadic/reverse_apply.hpp | 27 + .../detail/variadic/reverse_apply/flat.hpp | 41 + .../variadic/reverse_apply/unrolled.hpp | 87 + .../boost/hana/detail/variadic/split_at.hpp | 153 + .../boost/boost/hana/detail/variadic/take.hpp | 51 + 3party/boost/boost/hana/detail/void_t.hpp | 21 + 3party/boost/boost/hana/detail/wrong.hpp | 33 + 3party/boost/boost/hana/difference.hpp | 39 + 3party/boost/boost/hana/div.hpp | 107 + 3party/boost/boost/hana/drop_back.hpp | 75 + 3party/boost/boost/hana/drop_front.hpp | 57 + .../boost/boost/hana/drop_front_exactly.hpp | 85 + 3party/boost/boost/hana/drop_while.hpp | 93 + 3party/boost/boost/hana/duplicate.hpp | 48 + 3party/boost/boost/hana/empty.hpp | 53 + 3party/boost/boost/hana/equal.hpp | 203 + 3party/boost/boost/hana/erase_key.hpp | 37 + 3party/boost/boost/hana/eval.hpp | 57 + 3party/boost/boost/hana/eval_if.hpp | 93 + .../boost/hana/experimental/printable.hpp | 257 + .../boost/hana/experimental/type_name.hpp | 64 + .../boost/boost/hana/experimental/types.hpp | 158 + 3party/boost/boost/hana/experimental/view.hpp | 514 + 3party/boost/boost/hana/ext/boost.hpp | 21 + 3party/boost/boost/hana/ext/boost/fusion.hpp | 22 + .../boost/hana/ext/boost/fusion/deque.hpp | 108 + .../hana/ext/boost/fusion/detail/common.hpp | 79 + .../boost/hana/ext/boost/fusion/list.hpp | 111 + .../boost/hana/ext/boost/fusion/tuple.hpp | 49 + .../boost/hana/ext/boost/fusion/vector.hpp | 110 + 3party/boost/boost/hana/ext/boost/mpl.hpp | 21 + .../boost/hana/ext/boost/mpl/integral_c.hpp | 81 + .../boost/boost/hana/ext/boost/mpl/list.hpp | 186 + .../boost/boost/hana/ext/boost/mpl/vector.hpp | 185 + 3party/boost/boost/hana/ext/boost/tuple.hpp | 138 + 3party/boost/boost/hana/ext/std.hpp | 30 + 3party/boost/boost/hana/ext/std/array.hpp | 163 + .../boost/hana/ext/std/integer_sequence.hpp | 140 + .../boost/hana/ext/std/integral_constant.hpp | 96 + 3party/boost/boost/hana/ext/std/pair.hpp | 91 + 3party/boost/boost/hana/ext/std/ratio.hpp | 164 + 3party/boost/boost/hana/ext/std/tuple.hpp | 191 + 3party/boost/boost/hana/ext/std/vector.hpp | 110 + 3party/boost/boost/hana/extend.hpp | 50 + 3party/boost/boost/hana/extract.hpp | 45 + 3party/boost/boost/hana/fill.hpp | 74 + 3party/boost/boost/hana/filter.hpp | 135 + 3party/boost/boost/hana/find.hpp | 61 + 3party/boost/boost/hana/find_if.hpp | 177 + 3party/boost/boost/hana/first.hpp | 45 + 3party/boost/boost/hana/flatten.hpp | 62 + 3party/boost/boost/hana/fold.hpp | 17 + 3party/boost/boost/hana/fold_left.hpp | 97 + 3party/boost/boost/hana/fold_right.hpp | 97 + 3party/boost/boost/hana/for_each.hpp | 62 + 3party/boost/boost/hana/front.hpp | 47 + 3party/boost/boost/hana/functional.hpp | 33 + 3party/boost/boost/hana/functional/always.hpp | 64 + 3party/boost/boost/hana/functional/apply.hpp | 85 + 3party/boost/boost/hana/functional/arg.hpp | 141 + .../boost/boost/hana/functional/capture.hpp | 112 + .../boost/boost/hana/functional/compose.hpp | 108 + 3party/boost/boost/hana/functional/curry.hpp | 170 + 3party/boost/boost/hana/functional/demux.hpp | 269 + 3party/boost/boost/hana/functional/fix.hpp | 83 + 3party/boost/boost/hana/functional/flip.hpp | 73 + 3party/boost/boost/hana/functional/id.hpp | 38 + 3party/boost/boost/hana/functional/infix.hpp | 185 + .../boost/boost/hana/functional/iterate.hpp | 201 + .../boost/boost/hana/functional/lockstep.hpp | 114 + 3party/boost/boost/hana/functional/on.hpp | 83 + .../boost/boost/hana/functional/overload.hpp | 88 + .../hana/functional/overload_linearly.hpp | 110 + .../boost/boost/hana/functional/partial.hpp | 105 + .../boost/hana/functional/placeholder.hpp | 263 + .../boost/hana/functional/reverse_partial.hpp | 103 + 3party/boost/boost/hana/fuse.hpp | 47 + 3party/boost/boost/hana/fwd/accessors.hpp | 50 + 3party/boost/boost/hana/fwd/adapt_adt.hpp | 48 + 3party/boost/boost/hana/fwd/adapt_struct.hpp | 48 + 3party/boost/boost/hana/fwd/adjust.hpp | 64 + 3party/boost/boost/hana/fwd/adjust_if.hpp | 69 + 3party/boost/boost/hana/fwd/all.hpp | 46 + 3party/boost/boost/hana/fwd/all_of.hpp | 54 + 3party/boost/boost/hana/fwd/and.hpp | 53 + 3party/boost/boost/hana/fwd/any.hpp | 46 + 3party/boost/boost/hana/fwd/any_of.hpp | 53 + 3party/boost/boost/hana/fwd/ap.hpp | 82 + 3party/boost/boost/hana/fwd/append.hpp | 68 + 3party/boost/boost/hana/fwd/at.hpp | 89 + 3party/boost/boost/hana/fwd/at_key.hpp | 67 + 3party/boost/boost/hana/fwd/back.hpp | 48 + 3party/boost/boost/hana/fwd/basic_tuple.hpp | 65 + 3party/boost/boost/hana/fwd/bool.hpp | 15 + .../boost/hana/fwd/cartesian_product.hpp | 62 + 3party/boost/boost/hana/fwd/chain.hpp | 67 + 3party/boost/boost/hana/fwd/comparing.hpp | 65 + 3party/boost/boost/hana/fwd/concat.hpp | 63 + .../boost/hana/fwd/concept/applicative.hpp | 117 + .../boost/boost/hana/fwd/concept/comonad.hpp | 111 + .../boost/hana/fwd/concept/comparable.hpp | 160 + .../boost/boost/hana/fwd/concept/constant.hpp | 210 + .../boost/hana/fwd/concept/euclidean_ring.hpp | 117 + .../boost/boost/hana/fwd/concept/foldable.hpp | 141 + .../boost/boost/hana/fwd/concept/functor.hpp | 139 + 3party/boost/boost/hana/fwd/concept/group.hpp | 111 + .../boost/boost/hana/fwd/concept/hashable.hpp | 68 + .../hana/fwd/concept/integral_constant.hpp | 73 + .../boost/boost/hana/fwd/concept/iterable.hpp | 149 + .../boost/boost/hana/fwd/concept/logical.hpp | 166 + .../boost/hana/fwd/concept/metafunction.hpp | 99 + 3party/boost/boost/hana/fwd/concept/monad.hpp | 198 + .../boost/hana/fwd/concept/monad_plus.hpp | 89 + .../boost/boost/hana/fwd/concept/monoid.hpp | 101 + .../boost/hana/fwd/concept/orderable.hpp | 187 + .../boost/boost/hana/fwd/concept/product.hpp | 103 + 3party/boost/boost/hana/fwd/concept/ring.hpp | 106 + .../boost/hana/fwd/concept/searchable.hpp | 143 + .../boost/boost/hana/fwd/concept/sequence.hpp | 165 + .../boost/boost/hana/fwd/concept/struct.hpp | 156 + 3party/boost/boost/hana/fwd/contains.hpp | 73 + 3party/boost/boost/hana/fwd/core.hpp | 21 + 3party/boost/boost/hana/fwd/core/common.hpp | 103 + 3party/boost/boost/hana/fwd/core/default.hpp | 56 + 3party/boost/boost/hana/fwd/core/is_a.hpp | 61 + 3party/boost/boost/hana/fwd/core/make.hpp | 70 + 3party/boost/boost/hana/fwd/core/tag_of.hpp | 120 + 3party/boost/boost/hana/fwd/core/to.hpp | 174 + 3party/boost/boost/hana/fwd/core/when.hpp | 74 + 3party/boost/boost/hana/fwd/count.hpp | 57 + 3party/boost/boost/hana/fwd/count_if.hpp | 56 + 3party/boost/boost/hana/fwd/cycle.hpp | 76 + 3party/boost/boost/hana/fwd/define_struct.hpp | 48 + 3party/boost/boost/hana/fwd/difference.hpp | 64 + 3party/boost/boost/hana/fwd/div.hpp | 59 + 3party/boost/boost/hana/fwd/drop_back.hpp | 63 + 3party/boost/boost/hana/fwd/drop_front.hpp | 66 + .../boost/hana/fwd/drop_front_exactly.hpp | 67 + 3party/boost/boost/hana/fwd/drop_while.hpp | 60 + 3party/boost/boost/hana/fwd/duplicate.hpp | 57 + 3party/boost/boost/hana/fwd/empty.hpp | 51 + 3party/boost/boost/hana/fwd/equal.hpp | 80 + 3party/boost/boost/hana/fwd/erase_key.hpp | 32 + 3party/boost/boost/hana/fwd/eval.hpp | 58 + 3party/boost/boost/hana/fwd/eval_if.hpp | 155 + 3party/boost/boost/hana/fwd/extend.hpp | 62 + 3party/boost/boost/hana/fwd/extract.hpp | 58 + 3party/boost/boost/hana/fwd/fill.hpp | 57 + 3party/boost/boost/hana/fwd/filter.hpp | 81 + 3party/boost/boost/hana/fwd/find.hpp | 60 + 3party/boost/boost/hana/fwd/find_if.hpp | 57 + 3party/boost/boost/hana/fwd/first.hpp | 49 + 3party/boost/boost/hana/fwd/flatten.hpp | 63 + 3party/boost/boost/hana/fwd/fold.hpp | 38 + 3party/boost/boost/hana/fwd/fold_left.hpp | 88 + 3party/boost/boost/hana/fwd/fold_right.hpp | 92 + 3party/boost/boost/hana/fwd/for_each.hpp | 55 + 3party/boost/boost/hana/fwd/front.hpp | 48 + 3party/boost/boost/hana/fwd/fuse.hpp | 55 + 3party/boost/boost/hana/fwd/greater.hpp | 53 + 3party/boost/boost/hana/fwd/greater_equal.hpp | 54 + 3party/boost/boost/hana/fwd/group.hpp | 103 + 3party/boost/boost/hana/fwd/hash.hpp | 68 + 3party/boost/boost/hana/fwd/if.hpp | 57 + 3party/boost/boost/hana/fwd/insert.hpp | 60 + 3party/boost/boost/hana/fwd/insert_range.hpp | 57 + .../boost/hana/fwd/integral_constant.hpp | 175 + 3party/boost/boost/hana/fwd/intersection.hpp | 53 + 3party/boost/boost/hana/fwd/intersperse.hpp | 57 + 3party/boost/boost/hana/fwd/is_disjoint.hpp | 50 + 3party/boost/boost/hana/fwd/is_empty.hpp | 49 + 3party/boost/boost/hana/fwd/is_subset.hpp | 79 + 3party/boost/boost/hana/fwd/keys.hpp | 50 + 3party/boost/boost/hana/fwd/lazy.hpp | 124 + 3party/boost/boost/hana/fwd/length.hpp | 50 + 3party/boost/boost/hana/fwd/less.hpp | 53 + 3party/boost/boost/hana/fwd/less_equal.hpp | 54 + .../hana/fwd/lexicographical_compare.hpp | 93 + 3party/boost/boost/hana/fwd/lift.hpp | 59 + 3party/boost/boost/hana/fwd/map.hpp | 260 + 3party/boost/boost/hana/fwd/max.hpp | 44 + 3party/boost/boost/hana/fwd/maximum.hpp | 116 + 3party/boost/boost/hana/fwd/members.hpp | 46 + 3party/boost/boost/hana/fwd/min.hpp | 51 + 3party/boost/boost/hana/fwd/minimum.hpp | 116 + 3party/boost/boost/hana/fwd/minus.hpp | 67 + 3party/boost/boost/hana/fwd/mod.hpp | 62 + .../boost/boost/hana/fwd/monadic_compose.hpp | 75 + .../boost/hana/fwd/monadic_fold_left.hpp | 104 + .../boost/hana/fwd/monadic_fold_right.hpp | 106 + 3party/boost/boost/hana/fwd/mult.hpp | 63 + 3party/boost/boost/hana/fwd/negate.hpp | 42 + 3party/boost/boost/hana/fwd/none.hpp | 46 + 3party/boost/boost/hana/fwd/none_of.hpp | 55 + 3party/boost/boost/hana/fwd/not.hpp | 47 + 3party/boost/boost/hana/fwd/not_equal.hpp | 70 + 3party/boost/boost/hana/fwd/one.hpp | 45 + 3party/boost/boost/hana/fwd/optional.hpp | 510 + 3party/boost/boost/hana/fwd/or.hpp | 53 + 3party/boost/boost/hana/fwd/ordering.hpp | 65 + 3party/boost/boost/hana/fwd/pair.hpp | 153 + 3party/boost/boost/hana/fwd/partition.hpp | 81 + 3party/boost/boost/hana/fwd/permutations.hpp | 50 + 3party/boost/boost/hana/fwd/plus.hpp | 63 + 3party/boost/boost/hana/fwd/power.hpp | 56 + 3party/boost/boost/hana/fwd/prefix.hpp | 72 + 3party/boost/boost/hana/fwd/prepend.hpp | 73 + 3party/boost/boost/hana/fwd/product.hpp | 70 + 3party/boost/boost/hana/fwd/range.hpp | 149 + 3party/boost/boost/hana/fwd/remove.hpp | 70 + 3party/boost/boost/hana/fwd/remove_at.hpp | 82 + 3party/boost/boost/hana/fwd/remove_if.hpp | 69 + 3party/boost/boost/hana/fwd/remove_range.hpp | 85 + 3party/boost/boost/hana/fwd/repeat.hpp | 58 + 3party/boost/boost/hana/fwd/replace.hpp | 64 + 3party/boost/boost/hana/fwd/replace_if.hpp | 63 + 3party/boost/boost/hana/fwd/replicate.hpp | 75 + 3party/boost/boost/hana/fwd/reverse.hpp | 49 + 3party/boost/boost/hana/fwd/reverse_fold.hpp | 84 + 3party/boost/boost/hana/fwd/scan_left.hpp | 105 + 3party/boost/boost/hana/fwd/scan_right.hpp | 105 + 3party/boost/boost/hana/fwd/second.hpp | 48 + 3party/boost/boost/hana/fwd/set.hpp | 190 + 3party/boost/boost/hana/fwd/size.hpp | 33 + 3party/boost/boost/hana/fwd/slice.hpp | 105 + 3party/boost/boost/hana/fwd/sort.hpp | 103 + 3party/boost/boost/hana/fwd/span.hpp | 85 + 3party/boost/boost/hana/fwd/string.hpp | 259 + 3party/boost/boost/hana/fwd/suffix.hpp | 72 + 3party/boost/boost/hana/fwd/sum.hpp | 79 + .../boost/hana/fwd/symmetric_difference.hpp | 54 + 3party/boost/boost/hana/fwd/take_back.hpp | 58 + 3party/boost/boost/hana/fwd/take_front.hpp | 78 + 3party/boost/boost/hana/fwd/take_while.hpp | 56 + 3party/boost/boost/hana/fwd/tap.hpp | 65 + 3party/boost/boost/hana/fwd/then.hpp | 52 + 3party/boost/boost/hana/fwd/transform.hpp | 57 + 3party/boost/boost/hana/fwd/tuple.hpp | 224 + 3party/boost/boost/hana/fwd/type.hpp | 535 + 3party/boost/boost/hana/fwd/unfold_left.hpp | 85 + 3party/boost/boost/hana/fwd/unfold_right.hpp | 85 + 3party/boost/boost/hana/fwd/union.hpp | 53 + 3party/boost/boost/hana/fwd/unique.hpp | 91 + 3party/boost/boost/hana/fwd/unpack.hpp | 95 + 3party/boost/boost/hana/fwd/value.hpp | 100 + 3party/boost/boost/hana/fwd/while.hpp | 71 + 3party/boost/boost/hana/fwd/zero.hpp | 45 + 3party/boost/boost/hana/fwd/zip.hpp | 61 + 3party/boost/boost/hana/fwd/zip_shortest.hpp | 61 + .../boost/hana/fwd/zip_shortest_with.hpp | 62 + 3party/boost/boost/hana/fwd/zip_with.hpp | 62 + 3party/boost/boost/hana/greater.hpp | 71 + 3party/boost/boost/hana/greater_equal.hpp | 74 + 3party/boost/boost/hana/group.hpp | 158 + 3party/boost/boost/hana/hash.hpp | 114 + 3party/boost/boost/hana/if.hpp | 61 + 3party/boost/boost/hana/insert.hpp | 52 + 3party/boost/boost/hana/insert_range.hpp | 64 + 3party/boost/boost/hana/integral_constant.hpp | 15 + 3party/boost/boost/hana/intersection.hpp | 39 + 3party/boost/boost/hana/intersperse.hpp | 76 + 3party/boost/boost/hana/is_disjoint.hpp | 65 + 3party/boost/boost/hana/is_empty.hpp | 45 + 3party/boost/boost/hana/is_subset.hpp | 84 + 3party/boost/boost/hana/keys.hpp | 48 + 3party/boost/boost/hana/lazy.hpp | 229 + 3party/boost/boost/hana/length.hpp | 57 + 3party/boost/boost/hana/less.hpp | 142 + 3party/boost/boost/hana/less_equal.hpp | 75 + .../boost/hana/lexicographical_compare.hpp | 110 + 3party/boost/boost/hana/lift.hpp | 54 + 3party/boost/boost/hana/map.hpp | 508 + 3party/boost/boost/hana/max.hpp | 58 + 3party/boost/boost/hana/maximum.hpp | 97 + 3party/boost/boost/hana/members.hpp | 65 + 3party/boost/boost/hana/min.hpp | 58 + 3party/boost/boost/hana/minimum.hpp | 97 + 3party/boost/boost/hana/minus.hpp | 114 + 3party/boost/boost/hana/mod.hpp | 107 + 3party/boost/boost/hana/monadic_compose.hpp | 51 + 3party/boost/boost/hana/monadic_fold_left.hpp | 132 + .../boost/boost/hana/monadic_fold_right.hpp | 131 + 3party/boost/boost/hana/mult.hpp | 107 + 3party/boost/boost/hana/negate.hpp | 61 + 3party/boost/boost/hana/none.hpp | 48 + 3party/boost/boost/hana/none_of.hpp | 50 + 3party/boost/boost/hana/not.hpp | 75 + 3party/boost/boost/hana/not_equal.hpp | 59 + 3party/boost/boost/hana/one.hpp | 79 + 3party/boost/boost/hana/optional.hpp | 417 + 3party/boost/boost/hana/or.hpp | 61 + 3party/boost/boost/hana/ordering.hpp | 44 + 3party/boost/boost/hana/pair.hpp | 207 + 3party/boost/boost/hana/partition.hpp | 116 + 3party/boost/boost/hana/permutations.hpp | 78 + 3party/boost/boost/hana/plus.hpp | 109 + 3party/boost/boost/hana/power.hpp | 65 + 3party/boost/boost/hana/prefix.hpp | 52 + 3party/boost/boost/hana/prepend.hpp | 74 + 3party/boost/boost/hana/product.hpp | 58 + 3party/boost/boost/hana/range.hpp | 294 + 3party/boost/boost/hana/remove.hpp | 54 + 3party/boost/boost/hana/remove_at.hpp | 86 + 3party/boost/boost/hana/remove_if.hpp | 52 + 3party/boost/boost/hana/remove_range.hpp | 100 + 3party/boost/boost/hana/repeat.hpp | 58 + 3party/boost/boost/hana/replace.hpp | 56 + 3party/boost/boost/hana/replace_if.hpp | 54 + 3party/boost/boost/hana/replicate.hpp | 74 + 3party/boost/boost/hana/reverse.hpp | 61 + 3party/boost/boost/hana/reverse_fold.hpp | 37 + 3party/boost/boost/hana/scan_left.hpp | 133 + 3party/boost/boost/hana/scan_right.hpp | 130 + 3party/boost/boost/hana/second.hpp | 45 + 3party/boost/boost/hana/set.hpp | 323 + 3party/boost/boost/hana/size.hpp | 17 + 3party/boost/boost/hana/slice.hpp | 99 + 3party/boost/boost/hana/sort.hpp | 173 + 3party/boost/boost/hana/span.hpp | 75 + 3party/boost/boost/hana/string.hpp | 319 + 3party/boost/boost/hana/suffix.hpp | 52 + 3party/boost/boost/hana/sum.hpp | 58 + .../boost/boost/hana/symmetric_difference.hpp | 46 + 3party/boost/boost/hana/take_back.hpp | 68 + 3party/boost/boost/hana/take_front.hpp | 75 + 3party/boost/boost/hana/take_while.hpp | 55 + 3party/boost/boost/hana/tap.hpp | 59 + 3party/boost/boost/hana/then.hpp | 55 + 3party/boost/boost/hana/traits.hpp | 213 + 3party/boost/boost/hana/transform.hpp | 76 + 3party/boost/boost/hana/tuple.hpp | 324 + 3party/boost/boost/hana/type.hpp | 245 + 3party/boost/boost/hana/unfold_left.hpp | 71 + 3party/boost/boost/hana/unfold_right.hpp | 71 + 3party/boost/boost/hana/union.hpp | 39 + 3party/boost/boost/hana/unique.hpp | 75 + 3party/boost/boost/hana/unpack.hpp | 141 + 3party/boost/boost/hana/value.hpp | 56 + 3party/boost/boost/hana/version.hpp | 53 + 3party/boost/boost/hana/while.hpp | 117 + 3party/boost/boost/hana/zero.hpp | 81 + 3party/boost/boost/hana/zip.hpp | 50 + 3party/boost/boost/hana/zip_shortest.hpp | 51 + 3party/boost/boost/hana/zip_shortest_with.hpp | 64 + 3party/boost/boost/hana/zip_with.hpp | 70 + 3party/boost/boost/heap/binomial_heap.hpp | 9 +- .../boost/boost/heap/detail/stable_heap.hpp | 83 +- .../boost/boost/heap/detail/tree_iterator.hpp | 6 +- 3party/boost/boost/heap/priority_queue.hpp | 18 +- 3party/boost/boost/icl/concept/interval.hpp | 6 +- .../boost/icl/concept/interval_associator.hpp | 4 +- .../icl/concept/interval_associator_base.hpp | 4 +- .../boost/boost/icl/concept/interval_map.hpp | 8 +- .../boost/boost/icl/detail/concept_check.hpp | 4 +- .../boost/icl/detail/interval_set_algo.hpp | 10 +- .../boost/icl/detail/subset_comparer.hpp | 4 +- 3party/boost/boost/icl/interval_base_map.hpp | 3 +- 3party/boost/boost/icl/map.hpp | 1 - .../boost/icl/type_traits/has_inverse.hpp | 4 +- .../boost/boost/icl/type_traits/infinity.hpp | 15 +- .../icl/type_traits/is_interval_separator.hpp | 2 + .../boost/icl/type_traits/is_numeric.hpp | 1 - 3party/boost/boost/integer/common_factor.hpp | 2 +- .../boost/boost/integer/common_factor_ct.hpp | 2 +- .../boost/boost/integer/common_factor_rt.hpp | 4 +- .../boost/interprocess/containers/pair.hpp | 1 - .../interprocess/detail/config_begin.hpp | 5 + .../boost/interprocess/detail/config_end.hpp | 3 + .../detail/managed_memory_impl.hpp | 4 +- .../detail/managed_multi_shared_memory.hpp | 4 +- .../detail/managed_open_or_create_impl.hpp | 0 .../boost/boost/interprocess/detail/mpl.hpp | 36 +- .../boost/interprocess/detail/named_proxy.hpp | 10 +- .../boost/interprocess/detail/nothrow.hpp | 3 +- .../interprocess/detail/os_file_functions.hpp | 6 + .../detail/os_thread_functions.hpp | 45 +- .../detail/posix_time_types_wrk.hpp | 5 +- .../detail/shared_dir_helpers.hpp | 21 +- .../boost/interprocess/detail/std_fwd.hpp | 40 +- .../boost/interprocess/detail/utilities.hpp | 38 +- .../boost/interprocess/detail/win32_api.hpp | 264 +- .../boost/interprocess/detail/workaround.hpp | 23 +- .../boost/interprocess/interprocess_fwd.hpp | 13 +- .../boost/interprocess/mapped_region.hpp | 11 +- .../boost/boost/interprocess/offset_ptr.hpp | 444 +- .../interprocess/streams/bufferstream.hpp | 24 +- .../interprocess/sync/interprocess_mutex.hpp | 2 +- .../sync/interprocess_recursive_mutex.hpp | 2 +- .../sync/interprocess_semaphore.hpp | 2 +- .../sync/shm/named_creation_functor.hpp | 2 +- 3party/boost/boost/interprocess/xsi_key.hpp | 8 +- 3party/boost/boost/intrusive/any_hook.hpp | 6 +- 3party/boost/boost/intrusive/avl_set.hpp | 115 +- 3party/boost/boost/intrusive/avl_set_hook.hpp | 6 +- 3party/boost/boost/intrusive/avltree.hpp | 39 +- .../boost/intrusive/avltree_algorithms.hpp | 43 +- 3party/boost/boost/intrusive/bs_set.hpp | 107 +- 3party/boost/boost/intrusive/bs_set_hook.hpp | 6 +- 3party/boost/boost/intrusive/bstree.hpp | 451 +- .../boost/intrusive/bstree_algorithms.hpp | 106 +- .../intrusive/circular_list_algorithms.hpp | 22 +- .../intrusive/circular_slist_algorithms.hpp | 12 +- .../boost/intrusive/detail/algo_type.hpp | 5 +- .../detail/any_node_and_algorithms.hpp | 103 +- .../boost/intrusive/detail/avltree_node.hpp | 53 +- .../detail/bstree_algorithms_base.hpp | 4 +- .../detail/common_slist_algorithms.hpp | 14 +- .../boost/intrusive/detail/config_begin.hpp | 11 +- .../detail/default_header_holder.hpp | 7 +- .../intrusive/detail/ebo_functor_holder.hpp | 147 +- .../boost/intrusive/detail/equal_to_value.hpp | 4 +- .../intrusive/detail/exception_disposer.hpp | 6 +- .../boost/intrusive/detail/generic_hook.hpp | 16 +- .../has_member_function_callable_with.hpp | 147 +- .../boost/intrusive/detail/hashtable_node.hpp | 60 +- .../boost/intrusive/detail/hook_traits.hpp | 17 +- .../boost/intrusive/detail/iiterator.hpp | 15 +- .../boost/boost/intrusive/detail/iterator.hpp | 35 +- .../intrusive/detail/key_nodeptr_comp.hpp | 114 +- .../boost/intrusive/detail/list_iterator.hpp | 43 +- .../boost/intrusive/detail/list_node.hpp | 13 +- 3party/boost/boost/intrusive/detail/math.hpp | 22 +- 3party/boost/boost/intrusive/detail/mpl.hpp | 2 +- .../intrusive/detail/parent_from_member.hpp | 13 +- .../boost/intrusive/detail/rbtree_node.hpp | 57 +- .../intrusive/detail/reverse_iterator.hpp | 45 +- .../boost/intrusive/detail/size_holder.hpp | 31 +- .../boost/intrusive/detail/slist_iterator.hpp | 41 +- .../boost/intrusive/detail/slist_node.hpp | 7 +- .../boost/boost/intrusive/detail/std_fwd.hpp | 30 +- .../boost/intrusive/detail/to_raw_pointer.hpp | 5 +- .../intrusive/detail/transform_iterator.hpp | 47 +- .../boost/intrusive/detail/tree_iterator.hpp | 60 +- .../boost/intrusive/detail/tree_node.hpp | 19 +- .../intrusive/detail/tree_value_compare.hpp | 141 +- .../boost/intrusive/detail/workaround.hpp | 15 + 3party/boost/boost/intrusive/hashtable.hpp | 516 +- .../boost/boost/intrusive/intrusive_fwd.hpp | 14 +- .../intrusive/linear_slist_algorithms.hpp | 4 +- 3party/boost/boost/intrusive/list.hpp | 27 +- 3party/boost/boost/intrusive/list_hook.hpp | 6 +- .../boost/intrusive/member_value_traits.hpp | 9 +- 3party/boost/boost/intrusive/options.hpp | 8 +- .../boost/intrusive/parent_from_member.hpp | 5 +- .../boost/intrusive/pointer_plus_bits.hpp | 22 +- .../boost/boost/intrusive/pointer_traits.hpp | 22 +- .../boost/intrusive/priority_compare.hpp | 26 +- 3party/boost/boost/intrusive/rbtree.hpp | 40 +- .../boost/intrusive/rbtree_algorithms.hpp | 62 +- 3party/boost/boost/intrusive/set.hpp | 107 +- 3party/boost/boost/intrusive/set_hook.hpp | 6 +- 3party/boost/boost/intrusive/sg_set.hpp | 112 +- 3party/boost/boost/intrusive/sgtree.hpp | 124 +- .../boost/intrusive/sgtree_algorithms.hpp | 52 +- 3party/boost/boost/intrusive/slist.hpp | 31 +- 3party/boost/boost/intrusive/slist_hook.hpp | 11 +- 3party/boost/boost/intrusive/splay_set.hpp | 107 +- 3party/boost/boost/intrusive/splaytree.hpp | 40 +- .../boost/intrusive/splaytree_algorithms.hpp | 27 + 3party/boost/boost/intrusive/treap.hpp | 190 +- .../boost/intrusive/treap_algorithms.hpp | 28 + 3party/boost/boost/intrusive/treap_set.hpp | 150 +- .../boost/intrusive/trivial_value_traits.hpp | 9 +- .../boost/boost/intrusive/unordered_set.hpp | 66 +- .../boost/intrusive/unordered_set_hook.hpp | 44 +- 3party/boost/boost/iostreams/categories.hpp | 2 +- 3party/boost/boost/iostreams/chain.hpp | 50 +- 3party/boost/boost/iostreams/char_traits.hpp | 2 +- 3party/boost/boost/iostreams/close.hpp | 8 +- .../boost/boost/iostreams/code_converter.hpp | 18 +- 3party/boost/boost/iostreams/combine.hpp | 2 +- 3party/boost/boost/iostreams/compose.hpp | 5 +- 3party/boost/boost/iostreams/concepts.hpp | 10 +- 3party/boost/boost/iostreams/constants.hpp | 2 +- 3party/boost/boost/iostreams/copy.hpp | 6 +- .../boost/iostreams/detail/access_control.hpp | 2 +- .../detail/adapter/direct_adapter.hpp | 2 +- .../iostreams/detail/adapter/mode_adapter.hpp | 22 +- .../adapter/output_iterator_adapter.hpp | 2 +- .../detail/adapter/range_adapter.hpp | 2 +- .../boost/iostreams/detail/add_facet.hpp | 2 +- .../boost/boost/iostreams/detail/buffer.hpp | 27 +- .../boost/iostreams/detail/call_traits.hpp | 2 +- .../boost/iostreams/detail/char_traits.hpp | 2 +- .../boost/iostreams/detail/codecvt_helper.hpp | 25 +- .../boost/iostreams/detail/codecvt_holder.hpp | 2 +- .../iostreams/detail/config/auto_link.hpp | 4 +- .../boost/iostreams/detail/config/bzip2.hpp | 4 +- .../boost/iostreams/detail/config/codecvt.hpp | 5 +- .../iostreams/detail/config/dyn_link.hpp | 2 +- .../boost/iostreams/detail/config/fpos.hpp | 16 +- .../boost/iostreams/detail/config/gcc.hpp | 2 +- .../detail/config/overload_resolution.hpp | 6 +- .../detail/config/unreachable_return.hpp | 3 +- .../iostreams/detail/config/wide_streams.hpp | 2 +- .../boost/iostreams/detail/config/zlib.hpp | 4 +- .../boost/iostreams/detail/counted_array.hpp | 20 +- .../boost/iostreams/detail/default_arg.hpp | 10 +- .../boost/boost/iostreams/detail/dispatch.hpp | 2 +- .../boost/iostreams/detail/double_object.hpp | 2 +- .../iostreams/detail/enable_if_stream.hpp | 2 +- 3party/boost/boost/iostreams/detail/error.hpp | 2 +- .../boost/boost/iostreams/detail/execute.hpp | 2 +- .../boost/boost/iostreams/detail/forward.hpp | 43 +- .../boost/boost/iostreams/detail/fstream.hpp | 2 +- .../boost/iostreams/detail/functional.hpp | 2 +- 3party/boost/boost/iostreams/detail/ios.hpp | 5 +- .../boost/boost/iostreams/detail/iostream.hpp | 2 +- .../iostreams/detail/is_dereferenceable.hpp | 9 +- .../iostreams/detail/is_iterator_range.hpp | 15 - .../boost/boost/iostreams/detail/newline.hpp | 2 +- .../boost/boost/iostreams/detail/optional.hpp | 2 +- .../boost/iostreams/detail/param_type.hpp | 2 +- 3party/boost/boost/iostreams/detail/push.hpp | 5 +- .../boost/iostreams/detail/push_params.hpp | 2 +- .../boost/boost/iostreams/detail/resolve.hpp | 19 +- .../boost/iostreams/detail/restrict_impl.hpp | 3 +- .../boost/boost/iostreams/detail/select.hpp | 2 +- .../boost/iostreams/detail/streambuf.hpp | 2 +- .../iostreams/detail/streambuf/chainbuf.hpp | 5 +- .../detail/streambuf/direct_streambuf.hpp | 4 +- .../detail/streambuf/indirect_streambuf.hpp | 41 +- .../detail/streambuf/linked_streambuf.hpp | 2 +- .../boost/iostreams/detail/system_failure.hpp | 2 +- .../iostreams/detail/translate_int_type.hpp | 2 +- .../boost/iostreams/detail/vc6/close.hpp | 129 - .../boost/boost/iostreams/detail/vc6/read.hpp | 238 - .../boost/iostreams/detail/vc6/write.hpp | 159 - .../boost/iostreams/detail/wrap_unwrap.hpp | 31 +- 3party/boost/boost/iostreams/device/array.hpp | 19 +- .../boost/iostreams/device/back_inserter.hpp | 2 +- 3party/boost/boost/iostreams/device/file.hpp | 2 +- .../iostreams/device/file_descriptor.hpp | 9 +- .../boost/iostreams/device/mapped_file.hpp | 14 +- 3party/boost/boost/iostreams/device/null.hpp | 4 +- .../boost/iostreams/filter/aggregate.hpp | 2 +- 3party/boost/boost/iostreams/filter/bzip2.hpp | 28 +- .../boost/boost/iostreams/filter/counter.hpp | 2 +- 3party/boost/boost/iostreams/filter/grep.hpp | 2 +- 3party/boost/boost/iostreams/filter/gzip.hpp | 42 +- 3party/boost/boost/iostreams/filter/line.hpp | 10 +- .../boost/boost/iostreams/filter/newline.hpp | 3 +- 3party/boost/boost/iostreams/filter/regex.hpp | 2 +- 3party/boost/boost/iostreams/filter/stdio.hpp | 2 +- .../boost/iostreams/filter/symmetric.hpp | 9 +- 3party/boost/boost/iostreams/filter/test.hpp | 33 +- 3party/boost/boost/iostreams/filter/zlib.hpp | 50 +- .../boost/iostreams/filtering_stream.hpp | 2 +- .../boost/iostreams/filtering_streambuf.hpp | 2 +- 3party/boost/boost/iostreams/flush.hpp | 2 +- 3party/boost/boost/iostreams/get.hpp | 2 +- 3party/boost/boost/iostreams/imbue.hpp | 2 +- .../boost/boost/iostreams/input_sequence.hpp | 2 +- 3party/boost/boost/iostreams/invert.hpp | 6 +- 3party/boost/boost/iostreams/operations.hpp | 2 +- .../boost/boost/iostreams/operations_fwd.hpp | 2 +- .../boost/iostreams/optimal_buffer_size.hpp | 2 +- .../boost/boost/iostreams/output_sequence.hpp | 2 +- 3party/boost/boost/iostreams/pipeline.hpp | 16 +- 3party/boost/boost/iostreams/positioning.hpp | 8 +- 3party/boost/boost/iostreams/put.hpp | 2 +- 3party/boost/boost/iostreams/putback.hpp | 2 +- 3party/boost/boost/iostreams/read.hpp | 8 +- 3party/boost/boost/iostreams/seek.hpp | 2 +- 3party/boost/boost/iostreams/skip.hpp | 2 +- 3party/boost/boost/iostreams/stream.hpp | 2 +- .../boost/boost/iostreams/stream_buffer.hpp | 2 +- 3party/boost/boost/iostreams/tee.hpp | 2 +- 3party/boost/boost/iostreams/traits.hpp | 34 +- 3party/boost/boost/iostreams/traits_fwd.hpp | 2 +- 3party/boost/boost/iostreams/write.hpp | 8 +- .../iterator/function_input_iterator.hpp | 10 +- 3party/boost/boost/iterator/zip_iterator.hpp | 423 +- .../boost/lambda/detail/lambda_functors.hpp | 2 +- 3party/boost/boost/lexical_cast.hpp | 9 +- .../boost/lexical_cast/bad_lexical_cast.hpp | 13 +- .../lexical_cast/detail/converter_lexical.hpp | 96 +- .../detail/converter_lexical_streams.hpp | 140 +- .../lexical_cast/detail/converter_numeric.hpp | 35 +- .../boost/lexical_cast/detail/inf_nan.hpp | 3 +- .../lexical_cast/detail/is_character.hpp | 5 +- .../detail/lcast_char_constants.hpp | 3 +- .../detail/lcast_unsigned_converters.hpp | 19 +- .../boost/lexical_cast/detail/widest_char.hpp | 1 + .../boost/lexical_cast/lexical_cast_old.hpp | 10 +- .../lexical_cast/try_lexical_convert.hpp | 47 +- .../boost/locale/boundary/boundary_point.hpp | 8 +- 3party/boost/boost/locale/boundary/facets.hpp | 4 +- 3party/boost/boost/locale/boundary/index.hpp | 16 +- .../boost/boost/locale/boundary/segment.hpp | 9 +- 3party/boost/boost/locale/conversion.hpp | 4 +- 3party/boost/boost/locale/encoding.hpp | 4 +- 3party/boost/boost/locale/format.hpp | 4 +- 3party/boost/boost/locale/generic_codecvt.hpp | 676 + 3party/boost/boost/locale/gnu_gettext.hpp | 4 +- 3party/boost/boost/locale/message.hpp | 8 +- 3party/boost/boost/locale/utf8_codecvt.hpp | 69 + 3party/boost/boost/locale/util.hpp | 15 + 3party/boost/boost/lockfree/detail/atomic.hpp | 31 +- .../boost/lockfree/detail/branch_hints.hpp | 38 - .../boost/lockfree/detail/copy_payload.hpp | 2 +- .../boost/boost/lockfree/detail/freelist.hpp | 29 +- .../boost/boost/lockfree/detail/parameter.hpp | 7 +- 3party/boost/boost/lockfree/detail/prefix.hpp | 45 +- .../boost/lockfree/detail/tagged_ptr.hpp | 2 +- .../boost/lockfree/detail/tagged_ptr_dcas.hpp | 12 +- .../detail/tagged_ptr_ptrcompression.hpp | 11 +- .../boost/boost/lockfree/lockfree_forward.hpp | 72 + 3party/boost/boost/lockfree/policies.hpp | 4 +- 3party/boost/boost/lockfree/queue.hpp | 27 +- 3party/boost/boost/lockfree/spsc_queue.hpp | 48 +- 3party/boost/boost/lockfree/stack.hpp | 239 +- .../boost/log/attributes/attribute_set.hpp | 13 +- .../log/attributes/attribute_value_impl.hpp | 4 +- .../boost/boost/log/attributes/constant.hpp | 2 +- 3party/boost/boost/log/attributes/counter.hpp | 168 +- .../boost/log/attributes/mutable_constant.hpp | 2 +- .../boost/log/attributes/scoped_attribute.hpp | 4 +- .../boost/log/attributes/value_extraction.hpp | 6 +- 3party/boost/boost/log/core/record.hpp | 6 +- 3party/boost/boost/log/core/record_view.hpp | 16 +- .../{spin_mutex.hpp => adaptive_mutex.hpp} | 180 +- .../log/detail/attachable_sstream_buf.hpp | 236 +- 3party/boost/boost/log/detail/c_str.hpp | 55 + .../boost/log/detail/code_conversion.hpp | 98 +- 3party/boost/boost/log/detail/config.hpp | 59 +- .../boost/log/detail/decomposed_time.hpp | 39 +- .../boost/log/detail/enqueued_record.hpp | 2 +- 3party/boost/boost/log/detail/format.hpp | 58 +- .../boost/log/detail/is_character_type.hpp | 2 - .../boost/boost/log/detail/light_function.hpp | 16 +- .../boost/log/detail/light_function_pp.hpp | 12 +- .../boost/boost/log/detail/light_rw_mutex.hpp | 51 +- 3party/boost/boost/log/detail/locks.hpp | 31 +- .../boost/log/detail/parameter_tools.hpp | 43 +- 3party/boost/boost/log/detail/pause.hpp | 61 + .../boost/boost/log/detail/setup_config.hpp | 15 +- .../boost/boost/log/detail/sfinae_tools.hpp | 44 + .../boost/log/detail/sink_init_helpers.hpp | 10 +- 3party/boost/boost/log/detail/snprintf.hpp | 29 +- .../boost/boost/log/detail/tagged_integer.hpp | 24 +- .../boost/log/detail/thread_specific.hpp | 10 +- .../boost/log/detail/threadsafe_queue.hpp | 9 +- 3party/boost/boost/log/detail/timestamp.hpp | 5 +- 3party/boost/boost/log/exceptions.hpp | 102 +- 3party/boost/boost/log/expressions/attr.hpp | 2 + 3party/boost/boost/log/expressions/filter.hpp | 12 +- .../boost/boost/log/expressions/formatter.hpp | 237 +- .../boost/log/expressions/formatters.hpp | 1 + .../expressions/formatters/char_decorator.hpp | 42 +- .../log/expressions/formatters/date_time.hpp | 8 +- .../log/expressions/formatters/format.hpp | 2 + .../boost/log/expressions/formatters/if.hpp | 4 + .../formatters/max_size_decorator.hpp | 561 + .../expressions/formatters/named_scope.hpp | 8 +- .../expressions/formatters/wrap_formatter.hpp | 10 +- .../predicates/channel_severity_filter.hpp | 2 + .../boost/boost/log/keywords/block_size.hpp | 40 + 3party/boost/boost/log/keywords/capacity.hpp | 40 + .../log/keywords/enable_final_rotation.hpp | 40 + 3party/boost/boost/log/keywords/max_files.hpp | 40 + 3party/boost/boost/log/keywords/name.hpp | 40 + .../boost/log/keywords/overflow_policy.hpp | 40 + .../boost/boost/log/keywords/permissions.hpp | 40 + 3party/boost/boost/log/sinks.hpp | 1 + .../boost/boost/log/sinks/async_frontend.hpp | 122 +- .../boost/log/sinks/attribute_mapping.hpp | 2 +- .../boost/log/sinks/basic_sink_frontend.hpp | 41 +- .../boost/boost/log/sinks/sync_frontend.hpp | 25 +- .../boost/log/sinks/text_file_backend.hpp | 45 +- .../sinks/text_ipc_message_queue_backend.hpp | 172 + .../log/sinks/text_multifile_backend.hpp | 3 + .../boost/log/sinks/unbounded_fifo_queue.hpp | 11 +- .../boost/log/sinks/unlocked_frontend.hpp | 25 +- .../boost/boost/log/sources/basic_logger.hpp | 4 +- .../boost/log/sources/channel_feature.hpp | 2 +- .../log/sources/exception_handler_feature.hpp | 2 +- .../log/sources/global_logger_storage.hpp | 19 +- .../boost/log/sources/record_ostream.hpp | 252 +- .../boost/log/sources/severity_feature.hpp | 2 +- 3party/boost/boost/log/support/date_time.hpp | 2 +- 3party/boost/boost/log/support/exception.hpp | 12 + .../boost/log/support/spirit_classic.hpp | 2 +- 3party/boost/boost/log/support/spirit_qi.hpp | 4 +- .../boost/log/utility/exception_handler.hpp | 10 +- .../boost/log/utility/formatting_ostream.hpp | 146 +- .../boost/log/utility/ipc/object_name.hpp | 271 + .../utility/ipc/reliable_message_queue.hpp | 776 + .../boost/log/utility/manipulators/dump.hpp | 4 +- 3party/boost/boost/log/utility/once_block.hpp | 2 +- 3party/boost/boost/log/utility/open_mode.hpp | 46 + .../boost/boost/log/utility/permissions.hpp | 213 + .../boost/log/utility/record_ordering.hpp | 6 +- 3party/boost/boost/log/utility/setup/file.hpp | 1 + .../boost/log/utility/setup/filter_parser.hpp | 10 +- .../log/utility/setup/formatter_parser.hpp | 6 +- .../boost/log/utility/setup/from_settings.hpp | 10 +- .../boost/log/utility/setup/settings.hpp | 4 +- .../boost/log/utility/strictest_lock.hpp | 5 + .../boost/log/utility/string_literal.hpp | 192 +- .../type_dispatch/dynamic_type_dispatcher.hpp | 2 +- .../type_dispatch/static_type_dispatcher.hpp | 13 +- .../boost/log/utility/type_info_wrapper.hpp | 194 - 3party/boost/boost/log/utility/value_ref.hpp | 96 +- 3party/boost/boost/make_default.hpp | 2 +- 3party/boost/boost/make_unique.hpp | 13 +- 3party/boost/boost/math/bindings/mpfr.hpp | 2 +- 3party/boost/boost/math/common_factor_rt.hpp | 762 +- .../boost/math/concepts/real_concept.hpp | 29 +- .../boost/math/concepts/std_real_concept.hpp | 2 +- .../boost/boost/math/constants/constants.hpp | 70 +- .../math/cstdfloat/cstdfloat_complex_std.hpp | 8 +- .../math/cstdfloat/cstdfloat_iostream.hpp | 5 +- .../boost/math/cstdfloat/cstdfloat_types.hpp | 8 +- .../boost/math/distributions/arcsine.hpp | 8 +- .../boost/math/distributions/bernoulli.hpp | 2 +- .../boost/math/distributions/binomial.hpp | 2 +- .../detail/hypergeometric_pdf.hpp | 2 +- .../detail/hypergeometric_quantile.hpp | 46 + .../boost/math/distributions/exponential.hpp | 4 +- .../math/distributions/extreme_value.hpp | 4 +- .../boost/math/distributions/fisher_f.hpp | 4 +- .../boost/math/distributions/geometric.hpp | 2 +- .../math/distributions/hyperexponential.hpp | 4 +- .../math/distributions/hypergeometric.hpp | 44 +- .../math/distributions/inverse_gaussian.hpp | 15 + .../math/distributions/negative_binomial.hpp | 2 +- .../math/distributions/non_central_beta.hpp | 6 +- .../distributions/non_central_chi_squared.hpp | 65 +- .../math/distributions/non_central_t.hpp | 4 +- .../boost/math/distributions/rayleigh.hpp | 2 +- .../boost/math/distributions/skew_normal.hpp | 18 +- .../boost/math/distributions/triangular.hpp | 12 +- .../boost/math/distributions/uniform.hpp | 21 +- .../boost/math/policies/error_handling.hpp | 212 +- 3party/boost/boost/math/policies/policy.hpp | 108 +- 3party/boost/boost/math/special_functions.hpp | 2 + .../boost/math/special_functions/acosh.hpp | 2 +- .../boost/math/special_functions/asinh.hpp | 6 + .../boost/math/special_functions/atanh.hpp | 6 + .../math/special_functions/bernoulli.hpp | 2 +- .../boost/math/special_functions/bessel.hpp | 38 +- .../math/special_functions/bessel_prime.hpp | 8 +- .../boost/math/special_functions/beta.hpp | 185 +- .../boost/math/special_functions/cbrt.hpp | 5 +- .../detail/bernoulli_details.hpp | 83 +- .../detail/bessel_derivatives_linear.hpp | 16 +- .../special_functions/detail/bessel_i0.hpp | 577 +- .../special_functions/detail/bessel_i1.hpp | 604 +- .../special_functions/detail/bessel_ik.hpp | 6 +- .../special_functions/detail/bessel_jn.hpp | 7 +- .../detail/bessel_jy_asym.hpp | 18 + .../detail/bessel_jy_derivatives_series.hpp | 5 +- .../special_functions/detail/bessel_k0.hpp | 551 +- .../special_functions/detail/bessel_k1.hpp | 615 +- .../special_functions/detail/bessel_kn.hpp | 8 +- .../special_functions/detail/bessel_y0.hpp | 6 + .../special_functions/detail/bessel_y1.hpp | 6 + .../special_functions/detail/bessel_yn.hpp | 34 +- .../math/special_functions/detail/erf_inv.hpp | 55 +- .../special_functions/detail/lanczos_sse2.hpp | 18 +- .../special_functions/detail/polygamma.hpp | 51 +- .../detail/t_distribution_inv.hpp | 40 +- .../detail/unchecked_factorial.hpp | 367 +- .../boost/math/special_functions/digamma.hpp | 9 +- .../boost/math/special_functions/ellint_1.hpp | 2 +- .../boost/math/special_functions/ellint_2.hpp | 23 +- .../boost/math/special_functions/ellint_3.hpp | 22 +- .../boost/math/special_functions/ellint_d.hpp | 17 +- .../math/special_functions/ellint_rg.hpp | 7 +- .../boost/math/special_functions/erf.hpp | 8 +- .../boost/math/special_functions/expint.hpp | 6 + .../boost/math/special_functions/expm1.hpp | 4 + .../math/special_functions/fpclassify.hpp | 36 +- .../boost/math/special_functions/gamma.hpp | 133 +- .../math/special_functions/heuman_lambda.hpp | 5 +- .../math/special_functions/jacobi_zeta.hpp | 5 +- .../boost/math/special_functions/lanczos.hpp | 2 +- .../boost/math/special_functions/log1p.hpp | 8 +- .../boost/math/special_functions/math_fwd.hpp | 36 +- .../boost/math/special_functions/next.hpp | 22 +- .../nonfinite_num_facets.hpp | 5 +- .../boost/math/special_functions/owens_t.hpp | 84 +- .../math/special_functions/polygamma.hpp | 3 +- .../boost/math/special_functions/powm1.hpp | 37 +- .../special_functions/relative_difference.hpp | 134 + .../boost/math/special_functions/trigamma.hpp | 35 +- .../boost/math/special_functions/ulp.hpp | 71 + .../boost/math/special_functions/zeta.hpp | 194 +- .../boost/boost/math/tools/big_constant.hpp | 6 +- 3party/boost/boost/math/tools/config.hpp | 69 +- .../boost/math/tools/convert_from_string.hpp | 51 + .../tools/detail/polynomial_horner1_10.hpp | 22 +- .../tools/detail/polynomial_horner1_11.hpp | 24 +- .../tools/detail/polynomial_horner1_12.hpp | 26 +- .../tools/detail/polynomial_horner1_13.hpp | 28 +- .../tools/detail/polynomial_horner1_14.hpp | 30 +- .../tools/detail/polynomial_horner1_15.hpp | 32 +- .../tools/detail/polynomial_horner1_16.hpp | 34 +- .../tools/detail/polynomial_horner1_17.hpp | 36 +- .../tools/detail/polynomial_horner1_18.hpp | 38 +- .../tools/detail/polynomial_horner1_19.hpp | 40 +- .../tools/detail/polynomial_horner1_2.hpp | 6 +- .../tools/detail/polynomial_horner1_20.hpp | 42 +- .../tools/detail/polynomial_horner1_3.hpp | 8 +- .../tools/detail/polynomial_horner1_4.hpp | 10 +- .../tools/detail/polynomial_horner1_5.hpp | 12 +- .../tools/detail/polynomial_horner1_6.hpp | 14 +- .../tools/detail/polynomial_horner1_7.hpp | 16 +- .../tools/detail/polynomial_horner1_8.hpp | 18 +- .../tools/detail/polynomial_horner1_9.hpp | 20 +- .../tools/detail/polynomial_horner2_10.hpp | 22 +- .../tools/detail/polynomial_horner2_11.hpp | 24 +- .../tools/detail/polynomial_horner2_12.hpp | 26 +- .../tools/detail/polynomial_horner2_13.hpp | 28 +- .../tools/detail/polynomial_horner2_14.hpp | 30 +- .../tools/detail/polynomial_horner2_15.hpp | 32 +- .../tools/detail/polynomial_horner2_16.hpp | 34 +- .../tools/detail/polynomial_horner2_17.hpp | 36 +- .../tools/detail/polynomial_horner2_18.hpp | 38 +- .../tools/detail/polynomial_horner2_19.hpp | 40 +- .../tools/detail/polynomial_horner2_2.hpp | 10 +- .../tools/detail/polynomial_horner2_20.hpp | 42 +- .../tools/detail/polynomial_horner2_3.hpp | 10 +- .../tools/detail/polynomial_horner2_4.hpp | 10 +- .../tools/detail/polynomial_horner2_5.hpp | 12 +- .../tools/detail/polynomial_horner2_6.hpp | 14 +- .../tools/detail/polynomial_horner2_7.hpp | 16 +- .../tools/detail/polynomial_horner2_8.hpp | 18 +- .../tools/detail/polynomial_horner2_9.hpp | 20 +- .../tools/detail/polynomial_horner3_10.hpp | 22 +- .../tools/detail/polynomial_horner3_11.hpp | 24 +- .../tools/detail/polynomial_horner3_12.hpp | 26 +- .../tools/detail/polynomial_horner3_13.hpp | 28 +- .../tools/detail/polynomial_horner3_14.hpp | 30 +- .../tools/detail/polynomial_horner3_15.hpp | 32 +- .../tools/detail/polynomial_horner3_16.hpp | 34 +- .../tools/detail/polynomial_horner3_17.hpp | 36 +- .../tools/detail/polynomial_horner3_18.hpp | 38 +- .../tools/detail/polynomial_horner3_19.hpp | 40 +- .../tools/detail/polynomial_horner3_2.hpp | 10 +- .../tools/detail/polynomial_horner3_20.hpp | 42 +- .../tools/detail/polynomial_horner3_3.hpp | 10 +- .../tools/detail/polynomial_horner3_4.hpp | 10 +- .../tools/detail/polynomial_horner3_5.hpp | 12 +- .../tools/detail/polynomial_horner3_6.hpp | 14 +- .../tools/detail/polynomial_horner3_7.hpp | 16 +- .../tools/detail/polynomial_horner3_8.hpp | 18 +- .../tools/detail/polynomial_horner3_9.hpp | 20 +- .../math/tools/detail/rational_horner1_10.hpp | 22 +- .../math/tools/detail/rational_horner1_11.hpp | 24 +- .../math/tools/detail/rational_horner1_12.hpp | 26 +- .../math/tools/detail/rational_horner1_13.hpp | 28 +- .../math/tools/detail/rational_horner1_14.hpp | 30 +- .../math/tools/detail/rational_horner1_15.hpp | 32 +- .../math/tools/detail/rational_horner1_16.hpp | 34 +- .../math/tools/detail/rational_horner1_17.hpp | 36 +- .../math/tools/detail/rational_horner1_18.hpp | 38 +- .../math/tools/detail/rational_horner1_19.hpp | 40 +- .../math/tools/detail/rational_horner1_2.hpp | 6 +- .../math/tools/detail/rational_horner1_20.hpp | 42 +- .../math/tools/detail/rational_horner1_3.hpp | 8 +- .../math/tools/detail/rational_horner1_4.hpp | 10 +- .../math/tools/detail/rational_horner1_5.hpp | 12 +- .../math/tools/detail/rational_horner1_6.hpp | 14 +- .../math/tools/detail/rational_horner1_7.hpp | 16 +- .../math/tools/detail/rational_horner1_8.hpp | 18 +- .../math/tools/detail/rational_horner1_9.hpp | 20 +- .../math/tools/detail/rational_horner2_10.hpp | 22 +- .../math/tools/detail/rational_horner2_11.hpp | 24 +- .../math/tools/detail/rational_horner2_12.hpp | 26 +- .../math/tools/detail/rational_horner2_13.hpp | 28 +- .../math/tools/detail/rational_horner2_14.hpp | 30 +- .../math/tools/detail/rational_horner2_15.hpp | 32 +- .../math/tools/detail/rational_horner2_16.hpp | 34 +- .../math/tools/detail/rational_horner2_17.hpp | 36 +- .../math/tools/detail/rational_horner2_18.hpp | 38 +- .../math/tools/detail/rational_horner2_19.hpp | 40 +- .../math/tools/detail/rational_horner2_2.hpp | 10 +- .../math/tools/detail/rational_horner2_20.hpp | 42 +- .../math/tools/detail/rational_horner2_3.hpp | 10 +- .../math/tools/detail/rational_horner2_4.hpp | 10 +- .../math/tools/detail/rational_horner2_5.hpp | 12 +- .../math/tools/detail/rational_horner2_6.hpp | 14 +- .../math/tools/detail/rational_horner2_7.hpp | 16 +- .../math/tools/detail/rational_horner2_8.hpp | 18 +- .../math/tools/detail/rational_horner2_9.hpp | 20 +- .../math/tools/detail/rational_horner3_10.hpp | 22 +- .../math/tools/detail/rational_horner3_11.hpp | 24 +- .../math/tools/detail/rational_horner3_12.hpp | 26 +- .../math/tools/detail/rational_horner3_13.hpp | 28 +- .../math/tools/detail/rational_horner3_14.hpp | 30 +- .../math/tools/detail/rational_horner3_15.hpp | 32 +- .../math/tools/detail/rational_horner3_16.hpp | 34 +- .../math/tools/detail/rational_horner3_17.hpp | 36 +- .../math/tools/detail/rational_horner3_18.hpp | 38 +- .../math/tools/detail/rational_horner3_19.hpp | 40 +- .../math/tools/detail/rational_horner3_2.hpp | 10 +- .../math/tools/detail/rational_horner3_20.hpp | 42 +- .../math/tools/detail/rational_horner3_3.hpp | 10 +- .../math/tools/detail/rational_horner3_4.hpp | 10 +- .../math/tools/detail/rational_horner3_5.hpp | 12 +- .../math/tools/detail/rational_horner3_6.hpp | 14 +- .../math/tools/detail/rational_horner3_7.hpp | 16 +- .../math/tools/detail/rational_horner3_8.hpp | 18 +- .../math/tools/detail/rational_horner3_9.hpp | 20 +- 3party/boost/boost/math/tools/fraction.hpp | 18 +- 3party/boost/boost/math/tools/minima.hpp | 2 + 3party/boost/boost/math/tools/polynomial.hpp | 490 +- 3party/boost/boost/math/tools/precision.hpp | 159 +- 3party/boost/boost/math/tools/promotion.hpp | 21 +- 3party/boost/boost/math/tools/rational.hpp | 32 +- 3party/boost/boost/math/tools/real_cast.hpp | 4 +- 3party/boost/boost/math/tools/roots.hpp | 485 +- 3party/boost/boost/math/tools/series.hpp | 16 +- .../boost/boost/math/tools/toms748_solve.hpp | 10 +- 3party/boost/boost/math/tools/traits.hpp | 7 +- 3party/boost/boost/math/tools/tuple.hpp | 3 +- 3party/boost/boost/math/tools/workaround.hpp | 4 +- 3party/boost/boost/math/tr1.hpp | 7 +- 3party/boost/boost/math_fwd.hpp | 11 - 3party/boost/boost/metaparse.hpp | 118 + 3party/boost/boost/metaparse/accept.hpp | 20 + 3party/boost/boost/metaparse/accept_tag.hpp | 20 + 3party/boost/boost/metaparse/accept_when.hpp | 20 + 3party/boost/boost/metaparse/alphanum.hpp | 20 + 3party/boost/boost/metaparse/always.hpp | 20 + 3party/boost/boost/metaparse/always_c.hpp | 20 + 3party/boost/boost/metaparse/build_parser.hpp | 20 + .../boost/metaparse/change_error_message.hpp | 20 + 3party/boost/boost/metaparse/config.hpp | 40 + .../boost/metaparse/debug_parsing_error.hpp | 21 + 3party/boost/boost/metaparse/define_error.hpp | 17 + 3party/boost/boost/metaparse/digit.hpp | 20 + 3party/boost/boost/metaparse/digit_val.hpp | 20 + 3party/boost/boost/metaparse/empty.hpp | 20 + 3party/boost/boost/metaparse/entire_input.hpp | 20 + .../boost/metaparse/error/digit_expected.hpp | 23 + .../metaparse/error/end_of_input_expected.hpp | 23 + .../metaparse/error/index_out_of_range.hpp | 23 + .../boost/metaparse/error/letter_expected.hpp | 23 + .../metaparse/error/literal_expected.hpp | 24 + .../none_of_the_expected_cases_found.hpp | 23 + .../metaparse/error/unexpected_character.hpp | 23 + .../error/unexpected_end_of_input.hpp | 24 + .../boost/boost/metaparse/error/unpaired.hpp | 23 + .../metaparse/error/whitespace_expected.hpp | 24 + 3party/boost/boost/metaparse/except.hpp | 20 + 3party/boost/boost/metaparse/fail.hpp | 20 + .../metaparse/fail_at_first_char_expected.hpp | 20 + 3party/boost/boost/metaparse/fail_tag.hpp | 21 + 3party/boost/boost/metaparse/first_of.hpp | 20 + 3party/boost/boost/metaparse/foldl.hpp | 20 + 3party/boost/boost/metaparse/foldl1.hpp | 20 + .../metaparse/foldl_reject_incomplete.hpp | 20 + .../metaparse/foldl_reject_incomplete1.hpp | 20 + ...dl_reject_incomplete_start_with_parser.hpp | 20 + .../metaparse/foldl_start_with_parser.hpp | 20 + 3party/boost/boost/metaparse/foldr.hpp | 20 + 3party/boost/boost/metaparse/foldr1.hpp | 20 + .../metaparse/foldr_reject_incomplete.hpp | 20 + .../metaparse/foldr_reject_incomplete1.hpp | 20 + .../metaparse/foldr_start_with_parser.hpp | 20 + 3party/boost/boost/metaparse/get_col.hpp | 20 + 3party/boost/boost/metaparse/get_line.hpp | 20 + 3party/boost/boost/metaparse/get_message.hpp | 20 + 3party/boost/boost/metaparse/get_position.hpp | 20 + .../boost/boost/metaparse/get_prev_char.hpp | 20 + .../boost/boost/metaparse/get_remaining.hpp | 20 + 3party/boost/boost/metaparse/get_result.hpp | 20 + 3party/boost/boost/metaparse/grammar.hpp | 19 + 3party/boost/boost/metaparse/if_.hpp | 20 + 3party/boost/boost/metaparse/int_.hpp | 20 + 3party/boost/boost/metaparse/is_error.hpp | 20 + 3party/boost/boost/metaparse/iterate.hpp | 20 + 3party/boost/boost/metaparse/iterate_c.hpp | 20 + 3party/boost/boost/metaparse/keyword.hpp | 20 + 3party/boost/boost/metaparse/last_of.hpp | 20 + 3party/boost/boost/metaparse/letter.hpp | 20 + .../metaparse/limit_one_char_except_size.hpp | 15 + .../boost/metaparse/limit_one_of_size.hpp | 14 + .../boost/metaparse/limit_sequence_size.hpp | 14 + .../boost/metaparse/limit_string_size.hpp | 14 + 3party/boost/boost/metaparse/lit.hpp | 21 + 3party/boost/boost/metaparse/lit_c.hpp | 21 + 3party/boost/boost/metaparse/look_ahead.hpp | 20 + 3party/boost/boost/metaparse/middle_of.hpp | 20 + 3party/boost/boost/metaparse/next_char.hpp | 20 + 3party/boost/boost/metaparse/next_line.hpp | 20 + 3party/boost/boost/metaparse/nth_of.hpp | 20 + 3party/boost/boost/metaparse/nth_of_c.hpp | 20 + 3party/boost/boost/metaparse/one_char.hpp | 21 + .../boost/boost/metaparse/one_char_except.hpp | 20 + .../boost/metaparse/one_char_except_c.hpp | 20 + 3party/boost/boost/metaparse/one_of.hpp | 20 + 3party/boost/boost/metaparse/one_of_c.hpp | 20 + 3party/boost/boost/metaparse/optional.hpp | 20 + 3party/boost/boost/metaparse/range.hpp | 20 + 3party/boost/boost/metaparse/range_c.hpp | 20 + 3party/boost/boost/metaparse/reject.hpp | 20 + 3party/boost/boost/metaparse/repeated.hpp | 20 + 3party/boost/boost/metaparse/repeated1.hpp | 20 + .../boost/boost/metaparse/repeated_one_of.hpp | 20 + .../boost/metaparse/repeated_one_of1.hpp | 20 + .../metaparse/repeated_reject_incomplete.hpp | 20 + .../metaparse/repeated_reject_incomplete1.hpp | 20 + 3party/boost/boost/metaparse/return_.hpp | 20 + 3party/boost/boost/metaparse/sequence.hpp | 20 + .../boost/boost/metaparse/sequence_apply.hpp | 36 + .../boost/boost/metaparse/source_position.hpp | 20 + .../boost/metaparse/source_position_tag.hpp | 20 + 3party/boost/boost/metaparse/space.hpp | 21 + 3party/boost/boost/metaparse/spaces.hpp | 20 + 3party/boost/boost/metaparse/start.hpp | 20 + 3party/boost/boost/metaparse/string.hpp | 28 + 3party/boost/boost/metaparse/string_tag.hpp | 20 + 3party/boost/boost/metaparse/token.hpp | 20 + 3party/boost/boost/metaparse/transform.hpp | 20 + .../boost/boost/metaparse/transform_error.hpp | 21 + .../metaparse/transform_error_message.hpp | 21 + 3party/boost/boost/metaparse/unless_error.hpp | 20 + .../boost/metaparse/util/digit_to_int.hpp | 23 + .../boost/metaparse/util/digit_to_int_c.hpp | 23 + .../boost/boost/metaparse/util/in_range.hpp | 23 + .../boost/boost/metaparse/util/in_range_c.hpp | 23 + .../boost/metaparse/util/int_to_digit.hpp | 23 + .../boost/metaparse/util/int_to_digit_c.hpp | 23 + .../boost/boost/metaparse/util/is_digit.hpp | 23 + .../boost/metaparse/util/is_lcase_letter.hpp | 23 + .../boost/boost/metaparse/util/is_letter.hpp | 23 + .../boost/metaparse/util/is_ucase_letter.hpp | 23 + .../boost/metaparse/util/is_whitespace.hpp | 23 + .../boost/metaparse/util/is_whitespace_c.hpp | 23 + 3party/boost/boost/metaparse/v1/accept.hpp | 36 + .../boost/boost/metaparse/v1/accept_tag.hpp | 47 + .../boost/boost/metaparse/v1/accept_when.hpp | 59 + 3party/boost/boost/metaparse/v1/alphanum.hpp | 25 + 3party/boost/boost/metaparse/v1/always.hpp | 51 + 3party/boost/boost/metaparse/v1/always_c.hpp | 25 + .../boost/boost/metaparse/v1/build_parser.hpp | 66 + .../metaparse/v1/change_error_message.hpp | 39 + .../metaparse/v1/debug_parsing_error.hpp | 105 + .../boost/boost/metaparse/v1/define_error.hpp | 25 + 3party/boost/boost/metaparse/v1/digit.hpp | 34 + 3party/boost/boost/metaparse/v1/digit_val.hpp | 26 + 3party/boost/boost/metaparse/v1/empty.hpp | 42 + .../boost/boost/metaparse/v1/entire_input.hpp | 33 + .../metaparse/v1/error/digit_expected.hpp | 26 + .../v1/error/end_of_input_expected.hpp | 29 + .../metaparse/v1/error/expected_to_fail.hpp | 30 + .../metaparse/v1/error/index_out_of_range.hpp | 41 + .../metaparse/v1/error/letter_expected.hpp | 26 + .../metaparse/v1/error/literal_expected.hpp | 36 + .../none_of_the_expected_cases_found.hpp | 29 + .../v1/error/unexpected_character.hpp | 29 + .../v1/error/unexpected_end_of_input.hpp | 30 + .../boost/metaparse/v1/error/unpaired.hpp | 50 + .../v1/error/whitespace_expected.hpp | 30 + 3party/boost/boost/metaparse/v1/except.hpp | 40 + 3party/boost/boost/metaparse/v1/fail.hpp | 30 + .../v1/fail_at_first_char_expected.hpp | 58 + 3party/boost/boost/metaparse/v1/fail_tag.hpp | 42 + 3party/boost/boost/metaparse/v1/first_of.hpp | 35 + 3party/boost/boost/metaparse/v1/foldl.hpp | 65 + 3party/boost/boost/metaparse/v1/foldl1.hpp | 38 + .../metaparse/v1/foldl_reject_incomplete.hpp | 77 + .../metaparse/v1/foldl_reject_incomplete1.hpp | 38 + ...dl_reject_incomplete_start_with_parser.hpp | 55 + .../metaparse/v1/foldl_start_with_parser.hpp | 45 + 3party/boost/boost/metaparse/v1/foldr.hpp | 25 + 3party/boost/boost/metaparse/v1/foldr1.hpp | 38 + .../metaparse/v1/foldr_reject_incomplete.hpp | 33 + .../metaparse/v1/foldr_reject_incomplete1.hpp | 38 + .../metaparse/v1/foldr_start_with_parser.hpp | 78 + .../boost/boost/metaparse/v1/fwd/accept.hpp | 22 + .../boost/metaparse/v1/fwd/build_parser.hpp | 22 + .../boost/boost/metaparse/v1/fwd/get_col.hpp | 26 + .../boost/boost/metaparse/v1/fwd/get_line.hpp | 25 + .../boost/metaparse/v1/fwd/get_message.hpp | 25 + .../boost/metaparse/v1/fwd/get_position.hpp | 25 + .../boost/metaparse/v1/fwd/get_prev_char.hpp | 25 + .../boost/metaparse/v1/fwd/get_remaining.hpp | 25 + .../boost/metaparse/v1/fwd/get_result.hpp | 25 + .../boost/metaparse/v1/fwd/next_char.hpp | 25 + .../boost/metaparse/v1/fwd/next_line.hpp | 25 + .../boost/boost/metaparse/v1/fwd/reject.hpp | 22 + .../metaparse/v1/fwd/source_position.hpp | 22 + .../boost/boost/metaparse/v1/fwd/string.hpp | 38 + 3party/boost/boost/metaparse/v1/get_col.hpp | 29 + 3party/boost/boost/metaparse/v1/get_line.hpp | 29 + .../boost/boost/metaparse/v1/get_message.hpp | 29 + .../boost/boost/metaparse/v1/get_position.hpp | 29 + .../boost/metaparse/v1/get_prev_char.hpp | 29 + .../boost/metaparse/v1/get_remaining.hpp | 29 + .../boost/boost/metaparse/v1/get_result.hpp | 29 + 3party/boost/boost/metaparse/v1/grammar.hpp | 386 + 3party/boost/boost/metaparse/v1/if_.hpp | 43 + .../boost/metaparse/v1/impl/apply_parser.hpp | 63 + .../v1/impl/assert_string_length.hpp | 31 + 3party/boost/boost/metaparse/v1/impl/at_c.hpp | 66 + .../boost/metaparse/v1/impl/back_inserter.hpp | 32 + .../boost/boost/metaparse/v1/impl/concat.hpp | 106 + .../boost/metaparse/v1/impl/empty_string.hpp | 44 + .../metaparse/v1/impl/front_inserter.hpp | 32 + .../metaparse/v1/impl/fwd/iterate_impl.hpp | 34 + .../boost/metaparse/v1/impl/has_type.hpp | 26 + .../boost/boost/metaparse/v1/impl/is_any.hpp | 70 + .../boost/metaparse/v1/impl/is_char_c.hpp | 33 + .../boost/metaparse/v1/impl/iterate_impl.hpp | 46 + .../v1/impl/iterate_impl_unchecked.hpp | 44 + .../boost/metaparse/v1/impl/later_result.hpp | 39 + .../boost/metaparse/v1/impl/next_digit.hpp | 36 + .../boost/boost/metaparse/v1/impl/no_char.hpp | 17 + .../boost/metaparse/v1/impl/nth_of_c.hpp | 61 + .../boost/metaparse/v1/impl/nth_of_c_impl.hpp | 77 + .../v1/impl/one_char_except_not_used.hpp | 24 + .../boost/boost/metaparse/v1/impl/one_of.hpp | 44 + .../boost/metaparse/v1/impl/one_of_fwd_op.hpp | 46 + .../boost/metaparse/v1/impl/pop_back.hpp | 52 + .../boost/metaparse/v1/impl/pop_front.hpp | 62 + .../boost/metaparse/v1/impl/push_back_c.hpp | 40 + .../boost/metaparse/v1/impl/push_front_c.hpp | 53 + .../v1/impl/remove_trailing_no_chars.hpp | 57 + .../boost/boost/metaparse/v1/impl/returns.hpp | 28 + .../boost/metaparse/v1/impl/sequence.hpp | 59 + .../boost/metaparse/v1/impl/sequence_impl.hpp | 37 + 3party/boost/boost/metaparse/v1/impl/size.hpp | 69 + .../boost/metaparse/v1/impl/skip_seq.hpp | 74 + .../boost/metaparse/v1/impl/split_at_c.hpp | 99 + .../boost/boost/metaparse/v1/impl/string.hpp | 2125 ++ .../boost/metaparse/v1/impl/string_at.hpp | 41 + .../metaparse/v1/impl/string_iterator.hpp | 159 + .../metaparse/v1/impl/string_iterator_tag.hpp | 27 + .../boost/metaparse/v1/impl/update_c.hpp | 93 + .../boost/boost/metaparse/v1/impl/void_.hpp | 25 + 3party/boost/boost/metaparse/v1/int_.hpp | 25 + 3party/boost/boost/metaparse/v1/is_error.hpp | 43 + 3party/boost/boost/metaparse/v1/iterate.hpp | 24 + 3party/boost/boost/metaparse/v1/iterate_c.hpp | 26 + 3party/boost/boost/metaparse/v1/keyword.hpp | 82 + 3party/boost/boost/metaparse/v1/last_of.hpp | 66 + 3party/boost/boost/metaparse/v1/letter.hpp | 29 + 3party/boost/boost/metaparse/v1/lit.hpp | 24 + 3party/boost/boost/metaparse/v1/lit_c.hpp | 34 + .../boost/boost/metaparse/v1/look_ahead.hpp | 50 + 3party/boost/boost/metaparse/v1/middle_of.hpp | 48 + 3party/boost/boost/metaparse/v1/next_char.hpp | 30 + 3party/boost/boost/metaparse/v1/next_line.hpp | 30 + 3party/boost/boost/metaparse/v1/nth_of.hpp | 39 + 3party/boost/boost/metaparse/v1/nth_of_c.hpp | 70 + 3party/boost/boost/metaparse/v1/one_char.hpp | 71 + .../boost/metaparse/v1/one_char_except.hpp | 85 + .../boost/metaparse/v1/one_char_except_c.hpp | 96 + 3party/boost/boost/metaparse/v1/one_of.hpp | 42 + 3party/boost/boost/metaparse/v1/one_of_c.hpp | 80 + 3party/boost/boost/metaparse/v1/optional.hpp | 40 + 3party/boost/boost/metaparse/v1/range.hpp | 33 + 3party/boost/boost/metaparse/v1/range_c.hpp | 33 + 3party/boost/boost/metaparse/v1/reject.hpp | 33 + 3party/boost/boost/metaparse/v1/repeated.hpp | 27 + 3party/boost/boost/metaparse/v1/repeated1.hpp | 29 + .../boost/metaparse/v1/repeated_one_of.hpp | 45 + .../boost/metaparse/v1/repeated_one_of1.hpp | 45 + .../v1/repeated_reject_incomplete.hpp | 29 + .../v1/repeated_reject_incomplete1.hpp | 29 + 3party/boost/boost/metaparse/v1/return_.hpp | 34 + 3party/boost/boost/metaparse/v1/sequence.hpp | 64 + .../boost/metaparse/v1/sequence_apply.hpp | 80 + .../boost/metaparse/v1/source_position.hpp | 156 + .../metaparse/v1/source_position_tag.hpp | 80 + 3party/boost/boost/metaparse/v1/space.hpp | 30 + 3party/boost/boost/metaparse/v1/spaces.hpp | 24 + 3party/boost/boost/metaparse/v1/start.hpp | 32 + 3party/boost/boost/metaparse/v1/string.hpp | 356 + .../boost/boost/metaparse/v1/string_tag.hpp | 24 + 3party/boost/boost/metaparse/v1/swap.hpp | 29 + 3party/boost/boost/metaparse/v1/token.hpp | 28 + 3party/boost/boost/metaparse/v1/transform.hpp | 50 + .../boost/metaparse/v1/transform_error.hpp | 40 + .../metaparse/v1/transform_error_message.hpp | 49 + .../boost/boost/metaparse/v1/unless_error.hpp | 29 + .../boost/metaparse/v1/util/digit_to_int.hpp | 38 + .../metaparse/v1/util/digit_to_int_c.hpp | 40 + .../boost/metaparse/v1/util/in_range.hpp | 75 + .../boost/metaparse/v1/util/in_range_c.hpp | 38 + .../boost/metaparse/v1/util/int_to_digit.hpp | 38 + .../metaparse/v1/util/int_to_digit_c.hpp | 38 + .../boost/metaparse/v1/util/is_digit.hpp | 38 + .../metaparse/v1/util/is_lcase_letter.hpp | 38 + .../boost/metaparse/v1/util/is_letter.hpp | 44 + .../metaparse/v1/util/is_ucase_letter.hpp | 38 + .../boost/metaparse/v1/util/is_whitespace.hpp | 38 + .../metaparse/v1/util/is_whitespace_c.hpp | 32 + 3party/boost/boost/metaparse/version.hpp | 14 + 3party/boost/boost/move/adl_move_swap.hpp | 53 +- .../boost/boost/move/algo/adaptive_merge.hpp | 67 + .../boost/boost/move/algo/adaptive_sort.hpp | 63 + .../move/algo/detail/adaptive_sort_merge.hpp | 2437 ++ .../boost/boost/move/algo/detail/basic_op.hpp | 121 + .../boost/move/algo/detail/insertion_sort.hpp | 127 + 3party/boost/boost/move/algo/detail/merge.hpp | 637 + .../boost/move/algo/detail/merge_sort.hpp | 139 + 3party/boost/boost/move/algo/move.hpp | 155 + 3party/boost/boost/move/algorithm.hpp | 117 +- 3party/boost/boost/move/core.hpp | 31 +- 3party/boost/boost/move/default_delete.hpp | 30 +- .../boost/boost/move/detail/config_begin.hpp | 2 + 3party/boost/boost/move/detail/destruct_n.hpp | 67 + 3party/boost/boost/move/detail/fwd_macros.hpp | 481 +- .../boost/move/detail/iterator_traits.hpp | 22 +- 3party/boost/boost/move/detail/meta_utils.hpp | 44 +- .../boost/move/detail/meta_utils_core.hpp | 14 +- .../boost/boost/move/detail/move_helpers.hpp | 334 +- .../detail/placement_new.hpp} | 22 +- .../boost/move/detail/reverse_iterator.hpp | 171 + .../boost/boost/move/detail/std_ns_begin.hpp | 30 + 3party/boost/boost/move/detail/std_ns_end.hpp | 14 + .../boost/boost/move/detail/type_traits.hpp | 46 +- .../move/detail/unique_ptr_meta_utils.hpp | 20 +- 3party/boost/boost/move/detail/workaround.hpp | 14 + 3party/boost/boost/move/iterator.hpp | 65 +- 3party/boost/boost/move/make_unique.hpp | 39 +- 3party/boost/boost/move/unique_ptr.hpp | 140 +- 3party/boost/boost/move/utility.hpp | 15 +- 3party/boost/boost/move/utility_core.hpp | 37 +- .../boost/boost/mpi/collectives/gatherv.hpp | 8 +- 3party/boost/boost/mpi/collectives/reduce.hpp | 4 +- 3party/boost/boost/mpi/collectives/scan.hpp | 2 +- .../boost/boost/mpi/collectives/scatterv.hpp | 6 +- 3party/boost/boost/mpi/communicator.hpp | 90 +- 3party/boost/boost/mpi/config.hpp | 14 +- 3party/boost/boost/mpi/datatype.hpp | 13 + .../mpi/detail/binary_buffer_iprimitive.hpp | 4 +- .../mpi/detail/binary_buffer_oprimitive.hpp | 4 +- .../boost/mpi/detail/forward_iprimitive.hpp | 2 +- .../boost/mpi/detail/forward_oprimitive.hpp | 2 +- .../mpi/detail/forward_skeleton_iarchive.hpp | 4 +- .../mpi/detail/forward_skeleton_oarchive.hpp | 4 +- .../boost/mpi/detail/ignore_iprimitive.hpp | 2 +- .../boost/mpi/detail/ignore_oprimitive.hpp | 2 +- .../mpi/detail/ignore_skeleton_oarchive.hpp | 4 +- .../mpi/detail/mpi_datatype_primitive.hpp | 2 +- .../boost/mpi/detail/packed_iprimitive.hpp | 4 +- .../boost/mpi/detail/packed_oprimitive.hpp | 2 +- .../boost/mpl/map/aux_/insert_range_impl.hpp | 4 +- 3party/boost/boost/mpl/print.hpp | 3 + .../boost/mpl/set/aux_/insert_range_impl.hpp | 4 +- 3party/boost/boost/mpl/string.hpp | 2 +- 3party/boost/boost/msm/front/euml/common.hpp | 2 +- .../boost/boost/multi_index/composite_key.hpp | 6 +- .../detail/archive_constructed.hpp | 6 +- .../multi_index/detail/cons_stdtuple.hpp | 4 +- .../multi_index/detail/hash_index_node.hpp | 2 +- .../detail/ignore_wstrict_aliasing.hpp | 18 + .../multi_index/detail/index_node_base.hpp | 6 +- .../multi_index/detail/ord_index_impl.hpp | 46 +- .../boost/multi_index/detail/promotes_arg.hpp | 12 +- .../detail/restore_wstrict_aliasing.hpp | 11 + .../multi_index/detail/rnk_index_ops.hpp | 14 +- .../multi_index/detail/seq_index_ops.hpp | 6 +- 3party/boost/boost/multi_index/global_fun.hpp | 10 +- .../boost/boost/multi_index/hashed_index.hpp | 2 +- 3party/boost/boost/multi_index/identity.hpp | 10 +- .../boost/multi_index/random_access_index.hpp | 2 +- .../boost/boost/multi_index/ranked_index.hpp | 16 +- .../boost/multi_index/sequenced_index.hpp | 2 +- .../concepts/mp_number_archetypes.hpp | 7 +- .../boost/multiprecision/cpp_bin_float.hpp | 535 +- .../boost/multiprecision/cpp_bin_float/io.hpp | 12 +- .../cpp_bin_float/transcendental.hpp | 1 + .../boost/multiprecision/cpp_dec_float.hpp | 106 +- 3party/boost/boost/multiprecision/cpp_int.hpp | 249 +- .../boost/multiprecision/cpp_int/add.hpp | 25 +- .../boost/multiprecision/cpp_int/bitwise.hpp | 508 +- .../boost/multiprecision/cpp_int/divide.hpp | 26 +- .../multiprecision/cpp_int/import_export.hpp | 252 + .../boost/multiprecision/cpp_int/limits.hpp | 14 +- .../boost/multiprecision/cpp_int/misc.hpp | 79 +- .../boost/multiprecision/cpp_int/multiply.hpp | 61 +- .../boost/multiprecision/debug_adaptor.hpp | 44 +- .../multiprecision/detail/big_lanczos.hpp | 4 +- .../boost/multiprecision/detail/bitscan.hpp | 38 +- .../multiprecision/detail/default_ops.hpp | 1123 +- .../detail/functions/constants.hpp | 33 +- .../multiprecision/detail/functions/pow.hpp | 230 +- .../multiprecision/detail/functions/trig.hpp | 121 +- .../detail/generic_interconvert.hpp | 106 +- .../multiprecision/detail/integer_ops.hpp | 14 +- .../boost/multiprecision/detail/min_max.hpp | 114 + .../multiprecision/detail/number_base.hpp | 265 +- .../multiprecision/detail/number_compare.hpp | 184 +- .../multiprecision/detail/ublas_interop.hpp | 12 + .../boost/boost/multiprecision/float128.hpp | 144 +- 3party/boost/boost/multiprecision/gmp.hpp | 227 +- .../boost/multiprecision/logged_adaptor.hpp | 29 + .../boost/multiprecision/miller_rabin.hpp | 4 +- 3party/boost/boost/multiprecision/mpfi.hpp | 265 +- 3party/boost/boost/multiprecision/mpfr.hpp | 440 +- 3party/boost/boost/multiprecision/number.hpp | 197 +- 3party/boost/boost/multiprecision/random.hpp | 583 +- .../boost/multiprecision/rational_adaptor.hpp | 11 + 3party/boost/boost/multiprecision/tommath.hpp | 23 +- .../traits/explicit_conversion.hpp | 92 +- .../traits/is_byte_container.hpp | 33 + 3party/boost/boost/none.hpp | 18 +- 3party/boost/boost/none_t.hpp | 21 +- .../boost/numeric/interval/hw_rounding.hpp | 4 +- 3party/boost/boost/numeric/odeint.hpp | 1 + .../odeint/algebra/algebra_dispatcher.hpp | 2 +- .../numeric/odeint/algebra/array_algebra.hpp | 2 +- .../odeint/algebra/default_operations.hpp | 4 +- .../odeint/external/eigen/eigen_algebra.hpp | 2 +- .../eigen/eigen_algebra_dispatcher.hpp | 4 +- .../odeint/integrate/check_adapter.hpp | 222 + .../integrate/detail/integrate_adaptive.hpp | 17 +- .../integrate/detail/integrate_const.hpp | 24 +- .../integrate/detail/integrate_n_steps.hpp | 18 +- .../integrate/detail/integrate_times.hpp | 22 +- .../numeric/odeint/integrate/integrate.hpp | 6 +- .../odeint/integrate/integrate_adaptive.hpp | 2 +- .../odeint/integrate/integrate_const.hpp | 207 +- .../odeint/integrate/integrate_n_steps.hpp | 82 +- .../odeint/integrate/integrate_times.hpp | 109 +- .../odeint/integrate/max_step_checker.hpp | 114 + .../odeint/stepper/adams_bashforth.hpp | 2 +- .../base/explicit_error_stepper_base.hpp | 6 +- .../base/explicit_error_stepper_fsal_base.hpp | 4 +- .../stepper/base/explicit_stepper_base.hpp | 4 +- .../numeric/odeint/stepper/bulirsch_stoer.hpp | 20 +- .../stepper/bulirsch_stoer_dense_out.hpp | 40 +- .../odeint/stepper/controlled_runge_kutta.hpp | 236 +- .../stepper/dense_output_runge_kutta.hpp | 20 +- .../generation_controlled_runge_kutta.hpp | 14 +- .../generation_dense_output_runge_kutta.hpp | 13 +- .../generation/generation_rosenbrock4.hpp | 7 + .../stepper/generation/make_controlled.hpp | 22 + .../stepper/generation/make_dense_output.hpp | 22 + .../odeint/stepper/rosenbrock4_controller.hpp | 32 +- .../stepper/rosenbrock4_dense_output.hpp | 11 +- .../odeint/stepper/runge_kutta4_classic.hpp | 10 +- .../odeint/util/detail/less_with_sign.hpp | 6 +- .../numeric/odeint/util/odeint_error.hpp | 77 + .../boost/numeric/odeint/util/resize.hpp | 2 +- .../boost/numeric/odeint/util/resizer.hpp | 2 +- .../boost/numeric/odeint/util/same_size.hpp | 2 +- .../numeric/odeint/util/unwrap_reference.hpp | 2 +- .../boost/numeric/ublas/detail/config.hpp | 1 + 3party/boost/boost/numeric/ublas/matrix.hpp | 4 +- .../boost/numeric/ublas/matrix_vector.hpp | 4 +- 3party/boost/boost/operators.hpp | 470 +- 3party/boost/boost/operators_v1.hpp | 951 + .../detail/old_optional_implementation.hpp | 1059 + .../detail/optional_aligned_storage.hpp | 75 + .../boost/optional/detail/optional_config.hpp | 116 + .../detail/optional_factory_support.hpp | 36 + .../detail/optional_reference_spec.hpp | 253 + .../boost/optional/detail/optional_relops.hpp | 196 + .../boost/optional/detail/optional_swap.hpp | 117 + 3party/boost/boost/optional/optional.hpp | 970 +- 3party/boost/boost/optional/optional_fwd.hpp | 13 +- 3party/boost/boost/optional/optional_io.hpp | 6 +- .../boost/boost/pending/container_traits.hpp | 29 - 3party/boost/boost/pending/relaxed_heap.hpp | 5 +- .../boost/phoenix/bind/bind_function.hpp | 146 +- .../phoenix/bind/bind_function_object.hpp | 75 +- .../phoenix/bind/bind_member_function.hpp | 293 +- .../bind/detail/cpp03/bind_function.hpp | 113 + .../detail/cpp03/bind_function_object.hpp | 74 + .../detail/cpp03/bind_member_function.hpp | 251 + .../bind/detail/{ => cpp03}/function_ptr.hpp | 9 +- .../{ => cpp03}/member_function_ptr.hpp | 9 +- .../cpp03}/preprocessed/bind_function.hpp | 10 +- .../cpp03}/preprocessed/bind_function_10.hpp | 0 .../cpp03}/preprocessed/bind_function_20.hpp | 0 .../cpp03}/preprocessed/bind_function_30.hpp | 0 .../cpp03}/preprocessed/bind_function_40.hpp | 0 .../cpp03}/preprocessed/bind_function_50.hpp | 0 .../preprocessed/bind_function_object.hpp | 10 +- .../preprocessed/bind_function_object_10.hpp | 0 .../preprocessed/bind_function_object_20.hpp | 0 .../preprocessed/bind_function_object_30.hpp | 0 .../preprocessed/bind_function_object_40.hpp | 0 .../preprocessed/bind_function_object_50.hpp | 0 .../preprocessed/bind_member_function.hpp | 10 +- .../preprocessed/bind_member_function_10.hpp | 0 .../preprocessed/bind_member_function_20.hpp | 0 .../preprocessed/bind_member_function_30.hpp | 0 .../preprocessed/bind_member_function_40.hpp | 0 .../preprocessed/bind_member_function_50.hpp | 0 .../{ => cpp03}/preprocessed/function_ptr.hpp | 10 +- .../preprocessed/function_ptr_10.hpp | 0 .../preprocessed/function_ptr_20.hpp | 0 .../preprocessed/function_ptr_30.hpp | 0 .../preprocessed/function_ptr_40.hpp | 0 .../preprocessed/function_ptr_50.hpp | 0 .../preprocessed/member_function_ptr.hpp | 10 +- .../preprocessed/member_function_ptr_10.hpp | 0 .../preprocessed/member_function_ptr_20.hpp | 0 .../preprocessed/member_function_ptr_30.hpp | 0 .../preprocessed/member_function_ptr_40.hpp | 0 .../preprocessed/member_function_ptr_50.hpp | 0 3party/boost/boost/phoenix/config.hpp | 69 +- 3party/boost/boost/phoenix/core/actor.hpp | 222 +- 3party/boost/boost/phoenix/core/argument.hpp | 6 +- 3party/boost/boost/phoenix/core/call.hpp | 65 +- .../boost/phoenix/core/detail/argument.hpp | 4 +- .../detail/{ => cpp03}/actor_operator.hpp | 4 +- .../detail/{ => cpp03}/actor_result_of.hpp | 21 +- .../phoenix/core/detail/cpp03/assign.hpp | 97 + .../phoenix/core/detail/{ => cpp03}/call.hpp | 7 +- .../phoenix/core/detail/cpp03/expression.hpp | 111 + .../core/detail/cpp03/function_equal.hpp | 77 + .../core/detail/cpp03/function_eval.hpp | 124 + .../core/detail/cpp03/function_eval_expr.hpp | 39 + .../phoenix/core/detail/cpp03/phx2_result.hpp | 73 + .../preprocessed/actor_operator.hpp | 10 +- .../preprocessed/actor_operator_10.hpp | 0 .../preprocessed/actor_operator_20.hpp | 0 .../preprocessed/actor_operator_30.hpp | 0 .../preprocessed/actor_operator_40.hpp | 0 .../preprocessed/actor_operator_50.hpp | 0 .../preprocessed/actor_result_of.hpp | 10 +- .../preprocessed/actor_result_of_10.hpp | 15 - .../preprocessed/actor_result_of_20.hpp | 15 - .../preprocessed/actor_result_of_30.hpp | 15 - .../preprocessed/actor_result_of_40.hpp | 15 - .../preprocessed/actor_result_of_50.hpp | 15 - .../cpp03}/preprocessed/argument.hpp | 20 +- .../argument_no_predefined_10.hpp | 18 + .../argument_no_predefined_20.hpp | 18 + .../argument_no_predefined_30.hpp | 18 + .../argument_no_predefined_40.hpp | 18 + .../argument_no_predefined_50.hpp | 18 + .../preprocessed/argument_predefined_10.hpp | 22 + .../preprocessed/argument_predefined_20.hpp | 22 + .../preprocessed/argument_predefined_30.hpp | 22 + .../preprocessed/argument_predefined_40.hpp | 22 + .../preprocessed/argument_predefined_50.hpp | 22 + .../cpp03/preprocessed/assign.hpp} | 14 +- .../cpp03/preprocessed/assign_10.hpp} | 0 .../cpp03/preprocessed/assign_20.hpp} | 0 .../cpp03/preprocessed/assign_30.hpp} | 0 .../cpp03/preprocessed/assign_40.hpp} | 0 .../cpp03/preprocessed/assign_50.hpp} | 0 .../detail/{ => cpp03}/preprocessed/call.hpp | 10 +- .../{ => cpp03}/preprocessed/call_10.hpp | 3 - .../{ => cpp03}/preprocessed/call_20.hpp | 3 - .../{ => cpp03}/preprocessed/call_30.hpp | 3 - .../{ => cpp03}/preprocessed/call_40.hpp | 3 - .../{ => cpp03}/preprocessed/call_50.hpp | 3 - .../cpp03}/preprocessed/expression.hpp | 10 +- .../cpp03}/preprocessed/expression_10.hpp | 67 +- .../cpp03}/preprocessed/expression_20.hpp | 127 +- .../cpp03}/preprocessed/expression_30.hpp | 187 +- .../cpp03}/preprocessed/expression_40.hpp | 247 +- .../cpp03}/preprocessed/expression_50.hpp | 307 +- .../cpp03}/preprocessed/function_equal.hpp | 10 +- .../cpp03}/preprocessed/function_equal_10.hpp | 0 .../cpp03}/preprocessed/function_equal_20.hpp | 0 .../cpp03}/preprocessed/function_equal_30.hpp | 0 .../cpp03}/preprocessed/function_equal_40.hpp | 0 .../cpp03}/preprocessed/function_equal_50.hpp | 0 .../preprocessed/function_eval.hpp | 10 +- .../preprocessed/function_eval_10.hpp | 50 - .../preprocessed/function_eval_20.hpp | 50 - .../preprocessed/function_eval_30.hpp | 50 - .../preprocessed/function_eval_40.hpp | 50 - .../preprocessed/function_eval_50.hpp | 50 - .../cpp03/preprocessed/function_eval_expr.hpp | 25 + .../preprocessed/function_eval_expr_10.hpp | 8 + .../preprocessed/function_eval_expr_20.hpp | 8 + .../preprocessed/function_eval_expr_30.hpp | 8 + .../preprocessed/function_eval_expr_40.hpp | 8 + .../preprocessed/function_eval_expr_50.hpp | 8 + .../{ => cpp03}/preprocessed/phx2_result.hpp | 10 +- .../preprocessed/phx2_result_10.hpp | 18 - .../preprocessed/phx2_result_20.hpp | 38 - .../preprocessed/phx2_result_30.hpp | 58 - .../preprocessed/phx2_result_40.hpp | 78 - .../preprocessed/phx2_result_50.hpp | 98 - .../boost/phoenix/core/detail/expression.hpp | 56 +- .../phoenix/core/detail/function_eval.hpp | 230 +- .../phoenix/core/detail/index_sequence.hpp | 17 + .../boost/phoenix/core/detail/phx2_result.hpp | 88 +- .../boost/boost/phoenix/core/expression.hpp | 128 +- .../boost/phoenix/core/function_equal.hpp | 96 +- 3party/boost/boost/phoenix/core/limits.hpp | 37 + 3party/boost/boost/phoenix/core/nothing.hpp | 4 +- .../phoenix/core/preprocessed/argument_10.hpp | 23 - .../argument_no_predefined_10.hpp | 18 - .../argument_no_predefined_20.hpp | 18 - .../argument_no_predefined_30.hpp | 18 - .../argument_no_predefined_40.hpp | 18 - .../argument_no_predefined_50.hpp | 18 - .../preprocessed/argument_predefined_10.hpp | 22 - .../preprocessed/argument_predefined_20.hpp | 22 - .../preprocessed/argument_predefined_30.hpp | 22 - .../preprocessed/argument_predefined_40.hpp | 22 - .../preprocessed/argument_predefined_50.hpp | 22 - .../boost/phoenix/function/adapt_function.hpp | 1 + .../detail/{ => cpp03}/function_operator.hpp | 4 +- .../preprocessed/function_operator.hpp | 10 +- .../preprocessed/function_operator_10.hpp | 0 .../preprocessed/function_operator_20.hpp | 0 .../preprocessed/function_operator_30.hpp | 0 .../preprocessed/function_operator_40.hpp | 0 .../preprocessed/function_operator_50.hpp | 0 .../function/detail/function_result_of.hpp | 57 - .../preprocessed/function_result_of.hpp | 25 - .../preprocessed/function_result_of_10.hpp | 167 - .../preprocessed/function_result_of_20.hpp | 327 - .../preprocessed/function_result_of_30.hpp | 487 - .../preprocessed/function_result_of_40.hpp | 647 - .../preprocessed/function_result_of_50.hpp | 807 - .../boost/boost/phoenix/function/function.hpp | 91 +- .../boost/phoenix/function/lazy_list.hpp | 61 +- .../boost/phoenix/function/lazy_operator.hpp | 177 +- .../boost/phoenix/function/lazy_prelude.hpp | 8 +- .../boost/phoenix/function/lazy_reuse.hpp | 58 +- .../boost/phoenix/function/lazy_signature.hpp | 335 + .../boost/phoenix/function/lazy_smart.hpp | 153 + .../boost/boost/phoenix/object/construct.hpp | 20 +- .../object/detail/{ => cpp03}/construct.hpp | 4 +- .../detail/{ => cpp03}/construct_eval.hpp | 4 +- .../object/detail/cpp03/construct_expr.hpp | 34 + .../phoenix/object/detail/{ => cpp03}/new.hpp | 4 +- .../object/detail/{ => cpp03}/new_eval.hpp | 4 +- .../phoenix/object/detail/cpp03/new_expr.hpp | 34 + .../{ => cpp03}/preprocessed/construct.hpp | 10 +- .../{ => cpp03}/preprocessed/construct_10.hpp | 0 .../{ => cpp03}/preprocessed/construct_20.hpp | 0 .../{ => cpp03}/preprocessed/construct_30.hpp | 0 .../{ => cpp03}/preprocessed/construct_40.hpp | 0 .../{ => cpp03}/preprocessed/construct_50.hpp | 0 .../preprocessed/construct_eval.hpp | 10 +- .../preprocessed/construct_eval_10.hpp | 0 .../preprocessed/construct_eval_20.hpp | 0 .../preprocessed/construct_eval_30.hpp | 0 .../preprocessed/construct_eval_40.hpp | 0 .../preprocessed/construct_eval_50.hpp | 0 .../cpp03/preprocessed/construct_expr.hpp | 25 + .../cpp03/preprocessed/construct_expr_10.hpp | 7 + .../cpp03/preprocessed/construct_expr_20.hpp | 7 + .../cpp03/preprocessed/construct_expr_30.hpp | 7 + .../cpp03/preprocessed/construct_expr_40.hpp | 7 + .../cpp03/preprocessed/construct_expr_50.hpp | 7 + .../detail/{ => cpp03}/preprocessed/new.hpp | 10 +- .../{ => cpp03}/preprocessed/new_10.hpp | 0 .../{ => cpp03}/preprocessed/new_20.hpp | 0 .../{ => cpp03}/preprocessed/new_30.hpp | 0 .../{ => cpp03}/preprocessed/new_40.hpp | 0 .../{ => cpp03}/preprocessed/new_50.hpp | 0 .../{ => cpp03}/preprocessed/new_eval.hpp | 10 +- .../{ => cpp03}/preprocessed/new_eval_10.hpp | 0 .../{ => cpp03}/preprocessed/new_eval_20.hpp | 0 .../{ => cpp03}/preprocessed/new_eval_30.hpp | 0 .../{ => cpp03}/preprocessed/new_eval_40.hpp | 0 .../{ => cpp03}/preprocessed/new_eval_50.hpp | 0 .../detail/cpp03/preprocessed/new_expr.hpp | 25 + .../detail/cpp03/preprocessed/new_expr_10.hpp | 7 + .../detail/cpp03/preprocessed/new_expr_20.hpp | 7 + .../detail/cpp03/preprocessed/new_expr_30.hpp | 7 + .../detail/cpp03/preprocessed/new_expr_40.hpp | 7 + .../detail/cpp03/preprocessed/new_expr_50.hpp | 7 + 3party/boost/boost/phoenix/object/new.hpp | 18 +- .../detail/cpp03/mem_fun_ptr_eval.hpp | 78 + .../mem_fun_ptr_eval_result_of.hpp | 2 +- .../detail/cpp03/mem_fun_ptr_expr.hpp | 33 + .../detail/{ => cpp03}/mem_fun_ptr_gen.hpp | 23 +- .../cpp03/preprocessed/mem_fun_ptr_eval.hpp | 25 + .../preprocessed/mem_fun_ptr_eval_10.hpp} | 218 +- .../preprocessed/mem_fun_ptr_eval_20.hpp} | 418 +- .../preprocessed/mem_fun_ptr_eval_30.hpp | 878 + .../preprocessed/mem_fun_ptr_eval_40.hpp} | 918 +- .../preprocessed/mem_fun_ptr_eval_50.hpp} | 1118 +- .../mem_fun_ptr_eval_result_of.hpp | 25 + .../cpp03/preprocessed/mem_fun_ptr_expr.hpp | 25 + .../preprocessed/mem_fun_ptr_expr_10.hpp} | 233 +- .../preprocessed/mem_fun_ptr_expr_20.hpp} | 443 +- .../preprocessed/mem_fun_ptr_expr_30.hpp} | 653 +- .../preprocessed/mem_fun_ptr_expr_40.hpp} | 863 +- .../preprocessed/mem_fun_ptr_expr_50.hpp} | 1073 +- .../preprocessed/mem_fun_ptr_gen.hpp | 10 +- .../cpp03/preprocessed/mem_fun_ptr_gen_10.hpp | 234 + .../cpp03/preprocessed/mem_fun_ptr_gen_20.hpp | 444 + .../cpp03/preprocessed/mem_fun_ptr_gen_30.hpp | 654 + .../cpp03/preprocessed/mem_fun_ptr_gen_40.hpp | 864 + .../cpp03/preprocessed/mem_fun_ptr_gen_50.hpp | 1074 + .../boost/boost/phoenix/operator/member.hpp | 108 +- .../phoenix/operator/preprocessed/member.hpp | 25 - .../operator/preprocessed/member_50.hpp | 2494 -- .../scope/detail/{ => cpp03}/dynamic.hpp | 4 +- .../phoenix/scope/detail/cpp03/lambda.hpp | 39 + .../phoenix/scope/detail/cpp03/local_gen.hpp | 66 + .../{ => cpp03}/preprocessed/dynamic.hpp | 10 +- .../{ => cpp03}/preprocessed/dynamic_10.hpp | 0 .../{ => cpp03}/preprocessed/dynamic_20.hpp | 0 .../{ => cpp03}/preprocessed/dynamic_30.hpp | 0 .../{ => cpp03}/preprocessed/dynamic_40.hpp | 0 .../{ => cpp03}/preprocessed/dynamic_50.hpp | 0 .../cpp03}/preprocessed/lambda.hpp | 10 +- .../cpp03}/preprocessed/lambda_10.hpp | 293 +- .../cpp03}/preprocessed/lambda_20.hpp | 293 +- .../cpp03}/preprocessed/lambda_30.hpp | 293 +- .../cpp03}/preprocessed/lambda_40.hpp | 293 +- .../cpp03}/preprocessed/lambda_50.hpp | 293 +- .../boost/phoenix/scope/detail/local_gen.hpp | 73 +- .../phoenix/scope/detail/make_locals.hpp | 108 - .../scope/detail/preprocessed/make_locals.hpp | 25 - .../detail/preprocessed/make_locals_10.hpp | 227 - .../detail/preprocessed/make_locals_20.hpp | 447 - .../detail/preprocessed/make_locals_30.hpp | 667 - .../detail/preprocessed/make_locals_40.hpp | 887 - .../detail/preprocessed/make_locals_50.hpp | 1107 - 3party/boost/boost/phoenix/scope/dynamic.hpp | 10 +- 3party/boost/boost/phoenix/scope/lambda.hpp | 51 +- 3party/boost/boost/phoenix/scope/let.hpp | 4 + .../boost/phoenix/scope/local_variable.hpp | 56 +- .../phoenix/scope/scoped_environment.hpp | 2 +- .../statement/detail/catch_push_back.hpp | 44 +- .../preprocessed/catch_push_back_10.hpp | 324 +- .../preprocessed/catch_push_back_20.hpp | 684 +- .../preprocessed/catch_push_back_30.hpp | 1044 +- .../preprocessed/catch_push_back_40.hpp | 1404 +- .../preprocessed/catch_push_back_50.hpp | 1764 +- .../detail/preprocessed/try_catch_eval_10.hpp | 68 +- .../detail/preprocessed/try_catch_eval_20.hpp | 138 +- .../detail/preprocessed/try_catch_eval_30.hpp | 208 +- .../detail/preprocessed/try_catch_eval_40.hpp | 278 +- .../detail/preprocessed/try_catch_eval_50.hpp | 348 +- .../statement/detail/try_catch_eval.hpp | 7 +- .../boost/phoenix/statement/try_catch.hpp | 184 +- .../phoenix/stl/algorithm/detail/begin.hpp | 10 +- .../phoenix/stl/algorithm/detail/end.hpp | 12 +- .../phoenix/stl/algorithm/detail/has_find.hpp | 9 + .../detail/is_unordered_set_or_map.hpp | 95 + .../detail/std_unordered_set_or_map_fwd.hpp | 74 + .../boost/phoenix/stl/algorithm/querying.hpp | 118 +- .../phoenix/stl/algorithm/transformation.hpp | 64 +- 3party/boost/boost/phoenix/stl/cmath.hpp | 40 +- .../boost/phoenix/stl/container/container.hpp | 70 +- .../stl/container/detail/container.hpp | 20 - .../support/preprocessed/vector_10.hpp | 109 + .../support/preprocessed/vector_20.hpp | 199 + .../support/preprocessed/vector_30.hpp | 289 + .../support/preprocessed/vector_40.hpp | 379 + .../support/preprocessed/vector_50.hpp | 469 + 3party/boost/boost/phoenix/support/vector.hpp | 22 + 3party/boost/boost/pointer_cast.hpp | 76 + .../boost/boost/polygon/detail/boolean_op.hpp | 6 - .../boost/polygon/detail/boolean_op_45.hpp | 4 - .../polygon/detail/polygon_45_formation.hpp | 17 - .../polygon/detail/polygon_90_set_view.hpp | 4 +- .../detail/polygon_arbitrary_formation.hpp | 38 - .../polygon/detail/polygon_formation.hpp | 376 +- .../boost/polygon/detail/property_merge.hpp | 6 +- .../polygon/detail/rectangle_formation.hpp | 2 +- .../boost/polygon/detail/scan_arbitrary.hpp | 2 +- 3party/boost/boost/polygon/isotropy.hpp | 24 +- 3party/boost/boost/polygon/point_data.hpp | 8 +- .../boost/polygon/polygon_45_set_data.hpp | 4 +- .../boost/polygon/polygon_90_set_data.hpp | 6 +- .../boost/boost/polygon/polygon_set_data.hpp | 6 +- 3party/boost/boost/polygon/polygon_traits.hpp | 12 - 3party/boost/boost/polygon/segment_data.hpp | 2 +- 3party/boost/boost/pool/detail/mutex.hpp | 22 +- 3party/boost/boost/pool/pool_alloc.hpp | 24 + 3party/boost/boost/predef.h | 1 + 3party/boost/boost/predef/compiler/intel.h | 11 +- 3party/boost/boost/predef/compiler/visualc.h | 16 +- 3party/boost/boost/predef/detail/_cassert.h | 2 +- 3party/boost/boost/predef/detail/_exception.h | 2 +- 3party/boost/boost/predef/hardware.h | 16 + 3party/boost/boost/predef/hardware/simd.h | 119 + 3party/boost/boost/predef/hardware/simd/arm.h | 57 + .../boost/predef/hardware/simd/arm/versions.h | 32 + 3party/boost/boost/predef/hardware/simd/ppc.h | 69 + .../boost/predef/hardware/simd/ppc/versions.h | 51 + 3party/boost/boost/predef/hardware/simd/x86.h | 123 + .../boost/predef/hardware/simd/x86/versions.h | 129 + .../boost/predef/hardware/simd/x86_amd.h | 87 + .../predef/hardware/simd/x86_amd/versions.h | 51 + 3party/boost/boost/predef/os/cygwin.h | 2 +- .../boost/predef/platform/windows_desktop.h | 2 +- .../boost/predef/platform/windows_phone.h | 2 +- .../boost/predef/platform/windows_runtime.h | 2 +- .../boost/predef/platform/windows_store.h | 2 +- 3party/boost/boost/predef/version.h | 4 +- 3party/boost/boost/predef/version_number.h | 21 +- 3party/boost/boost/preprocessor/cat.hpp | 2 +- .../boost/preprocessor/config/config.hpp | 12 +- .../facilities/detail/is_empty.hpp | 2 +- .../preprocessor/facilities/identity.hpp | 4 + .../seq/detail/binary_transform.hpp | 11 +- .../preprocessor/seq/detail/to_list_msvc.hpp | 55 + .../boost/boost/preprocessor/seq/to_list.hpp | 12 + 3party/boost/boost/preprocessor/tuple/eat.hpp | 11 +- 3party/boost/boost/process.hpp | 41 + 3party/boost/boost/process/args.hpp | 279 + 3party/boost/boost/process/async.hpp | 130 + 3party/boost/boost/process/async_pipe.hpp | 215 + 3party/boost/boost/process/async_system.hpp | 142 + 3party/boost/boost/process/child.hpp | 147 + 3party/boost/boost/process/cmd.hpp | 122 + .../boost/process/detail/async_handler.hpp | 117 + .../boost/boost/process/detail/basic_cmd.hpp | 292 + .../boost/boost/process/detail/child_decl.hpp | 243 + 3party/boost/boost/process/detail/config.hpp | 99 + .../boost/process/detail/execute_impl.hpp | 284 + 3party/boost/boost/process/detail/handler.hpp | 75 + .../boost/process/detail/handler_base.hpp | 49 + 3party/boost/boost/process/detail/on_exit.hpp | 53 + .../boost/process/detail/posix/asio_fwd.hpp | 79 + .../process/detail/posix/async_handler.hpp | 40 + .../boost/process/detail/posix/async_in.hpp | 95 + .../boost/process/detail/posix/async_out.hpp | 170 + .../boost/process/detail/posix/async_pipe.hpp | 355 + .../boost/process/detail/posix/basic_cmd.hpp | 177 + .../boost/process/detail/posix/basic_pipe.hpp | 193 + .../process/detail/posix/child_handle.hpp | 60 + .../boost/process/detail/posix/close_in.hpp | 30 + .../boost/process/detail/posix/close_out.hpp | 55 + .../boost/boost/process/detail/posix/cmd.hpp | 104 + .../process/detail/posix/compare_handles.hpp | 42 + .../boost/process/detail/posix/env_init.hpp | 41 + .../process/detail/posix/environment.hpp | 322 + .../boost/boost/process/detail/posix/exe.hpp | 36 + .../boost/process/detail/posix/executor.hpp | 547 + .../boost/boost/process/detail/posix/fd.hpp | 92 + .../process/detail/posix/file_descriptor.hpp | 76 + .../boost/process/detail/posix/file_in.hpp | 40 + .../boost/process/detail/posix/file_out.hpp | 65 + .../process/detail/posix/group_handle.hpp | 103 + .../boost/process/detail/posix/group_ref.hpp | 52 + .../boost/process/detail/posix/handler.hpp | 74 + .../process/detail/posix/io_service_ref.hpp | 155 + .../boost/process/detail/posix/is_running.hpp | 78 + .../boost/process/detail/posix/null_in.hpp | 35 + .../boost/process/detail/posix/null_out.hpp | 58 + .../boost/process/detail/posix/on_exit.hpp | 35 + .../boost/process/detail/posix/pipe_in.hpp | 90 + .../boost/process/detail/posix/pipe_out.hpp | 116 + .../process/detail/posix/search_path.hpp | 39 + .../boost/process/detail/posix/shell_path.hpp | 32 + .../boost/process/detail/posix/signal.hpp | 79 + .../boost/process/detail/posix/start_dir.hpp | 38 + .../boost/process/detail/posix/terminate.hpp | 44 + .../boost/process/detail/posix/use_vfork.hpp | 33 + .../process/detail/posix/wait_for_exit.hpp | 205 + .../boost/process/detail/posix/wait_group.hpp | 191 + .../boost/process/detail/throw_on_error.hpp | 36 + 3party/boost/boost/process/detail/traits.hpp | 17 + .../boost/process/detail/traits/async.hpp | 34 + .../process/detail/traits/cmd_or_exe.hpp | 85 + .../boost/process/detail/traits/decl.hpp | 76 + .../boost/boost/process/detail/traits/env.hpp | 53 + .../boost/process/detail/traits/error.hpp | 27 + .../boost/process/detail/traits/group.hpp | 37 + .../boost/process/detail/traits/wchar_t.hpp | 274 + .../boost/process/detail/windows/asio_fwd.hpp | 71 + .../process/detail/windows/async_handler.hpp | 40 + .../boost/process/detail/windows/async_in.hpp | 105 + .../process/detail/windows/async_out.hpp | 176 + .../process/detail/windows/async_pipe.hpp | 415 + .../process/detail/windows/basic_cmd.hpp | 164 + .../process/detail/windows/basic_pipe.hpp | 225 + .../process/detail/windows/child_handle.hpp | 98 + .../boost/process/detail/windows/close_in.hpp | 31 + .../process/detail/windows/close_out.hpp | 53 + .../boost/process/detail/windows/cmd.hpp | 49 + .../detail/windows/compare_handles.hpp | 41 + .../boost/process/detail/windows/env_init.hpp | 54 + .../process/detail/windows/environment.hpp | 356 + .../boost/process/detail/windows/executor.hpp | 259 + .../detail/windows/file_descriptor.hpp | 104 + .../boost/process/detail/windows/file_in.hpp | 44 + .../boost/process/detail/windows/file_out.hpp | 77 + .../process/detail/windows/group_handle.hpp | 191 + .../process/detail/windows/group_ref.hpp | 51 + .../boost/process/detail/windows/handler.hpp | 20 + .../process/detail/windows/io_service_ref.hpp | 160 + .../process/detail/windows/is_running.hpp | 64 + .../process/detail/windows/job_workaround.hpp | 139 + .../boost/process/detail/windows/locale.hpp | 103 + .../boost/process/detail/windows/null_in.hpp | 41 + .../boost/process/detail/windows/null_out.hpp | 75 + .../boost/process/detail/windows/on_exit.hpp | 40 + .../boost/process/detail/windows/pipe_in.hpp | 89 + .../boost/process/detail/windows/pipe_out.hpp | 122 + .../process/detail/windows/search_path.hpp | 54 + .../process/detail/windows/shell_path.hpp | 53 + .../process/detail/windows/show_window.hpp | 39 + .../process/detail/windows/start_dir.hpp | 36 + .../process/detail/windows/terminate.hpp | 49 + .../process/detail/windows/wait_for_exit.hpp | 193 + .../process/detail/windows/wait_group.hpp | 121 + 3party/boost/boost/process/env.hpp | 502 + 3party/boost/boost/process/environment.hpp | 698 + 3party/boost/boost/process/error.hpp | 211 + 3party/boost/boost/process/exception.hpp | 30 + 3party/boost/boost/process/exe.hpp | 79 + 3party/boost/boost/process/extend.hpp | 339 + 3party/boost/boost/process/group.hpp | 228 + 3party/boost/boost/process/io.hpp | 551 + 3party/boost/boost/process/locale.hpp | 246 + 3party/boost/boost/process/pipe.hpp | 475 + 3party/boost/boost/process/posix.hpp | 75 + 3party/boost/boost/process/search_path.hpp | 54 + 3party/boost/boost/process/shell.hpp | 92 + 3party/boost/boost/process/spawn.hpp | 69 + 3party/boost/boost/process/start_dir.hpp | 110 + 3party/boost/boost/process/system.hpp | 154 + 3party/boost/boost/process/windows.hpp | 58 + .../program_options/environment_iterator.hpp | 2 +- 3party/boost/boost/progress.hpp | 7 +- .../parallel/parallel_property_maps.hpp | 1 - .../boost/boost/property_map/property_map.hpp | 31 +- .../property_tree/detail/info_parser_read.hpp | 4 +- .../detail/json_parser/parser.hpp | 524 - .../property_tree/detail/json_parser/read.hpp | 55 - .../property_tree/detail/ptree_utils.hpp | 4 +- .../property_tree/detail/xml_parser_utils.hpp | 12 +- .../property_tree/detail/xml_parser_write.hpp | 18 +- .../detail/xml_parser_writer_settings.hpp | 6 +- .../boost/boost/property_tree/json_parser.hpp | 6 +- .../detail}/narrow_encoding.hpp | 13 +- .../json_parser/detail/parser.hpp | 530 + .../property_tree/json_parser/detail/read.hpp | 90 + .../detail}/standard_callbacks.hpp | 5 +- .../detail}/wide_encoding.hpp | 17 +- .../detail/write.hpp} | 8 +- .../error.hpp} | 0 .../property_tree/ptree_serialization.hpp | 2 +- .../boost/property_tree/stream_translator.hpp | 10 +- .../boost/boost/proto/transform/default.hpp | 2 +- 3party/boost/boost/python/cast.hpp | 2 +- 3party/boost/boost/python/class.hpp | 4 +- .../boost/python/converter/pyobject_type.hpp | 7 +- .../boost/python/converter/registered.hpp | 42 +- .../converter/shared_ptr_from_python.hpp | 78 +- .../python/converter/shared_ptr_to_python.hpp | 29 +- 3party/boost/boost/python/data_members.hpp | 2 +- 3party/boost/boost/python/def.hpp | 2 +- 3party/boost/boost/python/detail/config.hpp | 35 +- .../boost/boost/python/detail/def_helper.hpp | 1 - .../boost/python/detail/defaults_gen.hpp | 4 +- .../boost/python/detail/exception_handler.hpp | 2 +- .../boost/python/detail/is_shared_ptr.hpp | 18 +- .../python/detail/value_is_shared_ptr.hpp | 23 +- .../boost/boost/python/detail/wrap_python.hpp | 13 +- .../boost/python/detail/wrapper_base.hpp | 2 +- 3party/boost/boost/python/errors.hpp | 2 +- 3party/boost/boost/python/init.hpp | 6 +- .../boost/boost/python/make_constructor.hpp | 15 +- 3party/boost/boost/python/make_function.hpp | 2 +- 3party/boost/boost/python/numpy.hpp | 34 + 3party/boost/boost/python/numpy/config.hpp | 78 + 3party/boost/boost/python/numpy/dtype.hpp | 118 + 3party/boost/boost/python/numpy/internal.hpp | 35 + .../boost/python/numpy/invoke_matching.hpp | 186 + 3party/boost/boost/python/numpy/matrix.hpp | 84 + 3party/boost/boost/python/numpy/ndarray.hpp | 313 + .../python/numpy/numpy_object_mgr_traits.hpp | 38 + 3party/boost/boost/python/numpy/scalars.hpp | 58 + 3party/boost/boost/python/numpy/ufunc.hpp | 206 + .../boost/python/object/class_metadata.hpp | 107 +- 3party/boost/boost/python/object/instance.hpp | 2 +- .../boost/python/object/make_ptr_instance.hpp | 6 +- .../boost/python/object/pickle_support.hpp | 2 +- .../boost/python/object/pointer_holder.hpp | 8 + .../boost/boost/python/object/py_function.hpp | 10 +- 3party/boost/boost/python/object_core.hpp | 1 + 3party/boost/boost/python/refcount.hpp | 2 + 3party/boost/boost/python/signature.hpp | 18 +- 3party/boost/boost/python/slice.hpp | 4 +- 3party/boost/boost/python/str.hpp | 2 +- .../boost/boost/python/to_python_indirect.hpp | 4 +- 3party/boost/boost/python/to_python_value.hpp | 52 +- 3party/boost/boost/qvm/all.hpp | 32 + 3party/boost/boost/qvm/assert.hpp | 9 + 3party/boost/boost/qvm/deduce_mat.hpp | 90 + 3party/boost/boost/qvm/deduce_quat.hpp | 63 + 3party/boost/boost/qvm/deduce_scalar.hpp | 131 + 3party/boost/boost/qvm/deduce_vec.hpp | 85 + .../boost/boost/qvm/detail/cofactor_impl.hpp | 64 + .../boost/qvm/detail/determinant_impl.hpp | 79 + .../boost/boost/qvm/detail/remove_const.hpp | 35 + .../boost/boost/qvm/detail/swizzle_traits.hpp | 338 + 3party/boost/boost/qvm/detail/transp_impl.hpp | 128 + 3party/boost/boost/qvm/enable_if.hpp | 24 + 3party/boost/boost/qvm/error.hpp | 40 + .../boost/boost/qvm/gen/mat_operations2.hpp | 1823 ++ .../boost/boost/qvm/gen/mat_operations3.hpp | 2025 ++ .../boost/boost/qvm/gen/mat_operations4.hpp | 2248 ++ 3party/boost/boost/qvm/gen/swizzle2.hpp | 714 + 3party/boost/boost/qvm/gen/swizzle3.hpp | 4158 +++ 3party/boost/boost/qvm/gen/swizzle4.hpp | 24330 ++++++++++++++++ .../boost/qvm/gen/vec_mat_operations2.hpp | 113 + .../boost/qvm/gen/vec_mat_operations3.hpp | 127 + .../boost/qvm/gen/vec_mat_operations4.hpp | 145 + .../boost/boost/qvm/gen/vec_operations2.hpp | 666 + .../boost/boost/qvm/gen/vec_operations3.hpp | 688 + .../boost/boost/qvm/gen/vec_operations4.hpp | 710 + 3party/boost/boost/qvm/inline.hpp | 34 + 3party/boost/boost/qvm/map.hpp | 13 + 3party/boost/boost/qvm/map_mat_mat.hpp | 895 + 3party/boost/boost/qvm/map_mat_vec.hpp | 537 + 3party/boost/boost/qvm/map_vec_mat.hpp | 591 + 3party/boost/boost/qvm/mat.hpp | 98 + 3party/boost/boost/qvm/mat_access.hpp | 258 + 3party/boost/boost/qvm/mat_operations.hpp | 1991 ++ 3party/boost/boost/qvm/mat_operations2.hpp | 6 + 3party/boost/boost/qvm/mat_operations3.hpp | 6 + 3party/boost/boost/qvm/mat_operations4.hpp | 6 + 3party/boost/boost/qvm/mat_traits.hpp | 33 + 3party/boost/boost/qvm/mat_traits_array.hpp | 118 + .../boost/boost/qvm/mat_traits_defaults.hpp | 95 + 3party/boost/boost/qvm/math.hpp | 87 + 3party/boost/boost/qvm/operations.hpp | 15 + 3party/boost/boost/qvm/quat.hpp | 68 + 3party/boost/boost/qvm/quat_access.hpp | 128 + 3party/boost/boost/qvm/quat_operations.hpp | 1508 + 3party/boost/boost/qvm/quat_traits.hpp | 49 + 3party/boost/boost/qvm/quat_traits_array.hpp | 130 + .../boost/boost/qvm/quat_traits_defaults.hpp | 40 + .../boost/boost/qvm/quat_vec_operations.hpp | 62 + 3party/boost/boost/qvm/scalar_traits.hpp | 92 + 3party/boost/boost/qvm/static_assert.hpp | 9 + 3party/boost/boost/qvm/swizzle.hpp | 13 + 3party/boost/boost/qvm/swizzle2.hpp | 6 + 3party/boost/boost/qvm/swizzle3.hpp | 6 + 3party/boost/boost/qvm/swizzle4.hpp | 6 + 3party/boost/boost/qvm/throw_exception.hpp | 9 + 3party/boost/boost/qvm/to_string.hpp | 31 + 3party/boost/boost/qvm/vec.hpp | 89 + 3party/boost/boost/qvm/vec_access.hpp | 82 + 3party/boost/boost/qvm/vec_mat_operations.hpp | 168 + .../boost/boost/qvm/vec_mat_operations2.hpp | 6 + .../boost/boost/qvm/vec_mat_operations3.hpp | 6 + .../boost/boost/qvm/vec_mat_operations4.hpp | 6 + 3party/boost/boost/qvm/vec_operations.hpp | 1014 + 3party/boost/boost/qvm/vec_operations2.hpp | 6 + 3party/boost/boost/qvm/vec_operations3.hpp | 6 + 3party/boost/boost/qvm/vec_operations4.hpp | 6 + 3party/boost/boost/qvm/vec_traits.hpp | 32 + 3party/boost/boost/qvm/vec_traits_array.hpp | 108 + .../boost/boost/qvm/vec_traits_defaults.hpp | 94 + 3party/boost/boost/random.hpp | 5 + .../boost/random/binomial_distribution.hpp | 2 +- .../boost/random/chi_squared_distribution.hpp | 6 +- .../boost/boost/random/detail/auto_link.hpp | 12 +- .../boost/random/detail/int_float_pair.hpp | 121 + .../boost/boost/random/detail/polynomial.hpp | 8 +- .../boost/boost/random/detail/seed_impl.hpp | 18 +- .../random/detail/signed_unsigned_tools.hpp | 10 +- .../boost/random/discrete_distribution.hpp | 14 +- .../boost/random/exponential_distribution.hpp | 210 +- .../boost/boost/random/generate_canonical.hpp | 2 +- .../random/hyperexponential_distribution.hpp | 883 + .../boost/boost/random/independent_bits.hpp | 29 +- .../non_central_chi_squared_distribution.hpp | 46 +- .../boost/random/normal_distribution.hpp | 163 +- .../piecewise_constant_distribution.hpp | 2 +- .../random/piecewise_linear_distribution.hpp | 3 +- 3party/boost/boost/random/seed_seq.hpp | 16 +- 3party/boost/boost/random/shuffle_order.hpp | 2 +- .../boost/random/subtract_with_carry.hpp | 4 +- 3party/boost/boost/random/traits.hpp | 107 + .../boost/random/triangle_distribution.hpp | 2 +- 3party/boost/boost/random/uniform_01.hpp | 32 +- .../boost/random/uniform_int_distribution.hpp | 50 +- .../boost/boost/random/uniform_on_sphere.hpp | 1 + .../random/uniform_real_distribution.hpp | 2 +- .../boost/boost/random/uniform_smallint.hpp | 32 +- 3party/boost/boost/range/const_iterator.hpp | 8 +- 3party/boost/boost/range/size_type.hpp | 5 - 3party/boost/boost/rational.hpp | 567 +- 3party/boost/boost/regex/concepts.hpp | 32 +- 3party/boost/boost/regex/config.hpp | 62 +- 3party/boost/boost/regex/icu.hpp | 184 +- 3party/boost/boost/regex/mfc.hpp | 4 +- 3party/boost/boost/regex/pattern_except.hpp | 4 +- .../boost/regex/pending/unicode_iterator.hpp | 3 + 3party/boost/boost/regex/v4/basic_regex.hpp | 31 +- .../boost/regex/v4/basic_regex_creator.hpp | 233 +- .../boost/regex/v4/basic_regex_parser.hpp | 278 +- .../boost/boost/regex/v4/cpp_regex_traits.hpp | 219 +- 3party/boost/boost/regex/v4/cregex.hpp | 14 +- 3party/boost/boost/regex/v4/fileiter.hpp | 22 +- 3party/boost/boost/regex/v4/instances.hpp | 23 +- .../boost/boost/regex/v4/iterator_traits.hpp | 4 +- 3party/boost/boost/regex/v4/match_flags.hpp | 16 +- 3party/boost/boost/regex/v4/match_results.hpp | 34 +- .../boost/boost/regex/v4/mem_block_cache.hpp | 48 +- 3party/boost/boost/regex/v4/perl_matcher.hpp | 62 +- .../boost/regex/v4/perl_matcher_common.hpp | 49 +- .../regex/v4/perl_matcher_non_recursive.hpp | 348 +- .../boost/regex/v4/perl_matcher_recursive.hpp | 160 +- .../boost/regex/v4/primary_transform.hpp | 4 +- .../boost/boost/regex/v4/protected_call.hpp | 2 +- 3party/boost/boost/regex/v4/regex_format.hpp | 32 +- 3party/boost/boost/regex/v4/regex_grep.hpp | 2 +- .../boost/boost/regex/v4/regex_iterator.hpp | 6 +- 3party/boost/boost/regex/v4/regex_match.hpp | 2 +- .../boost/boost/regex/v4/regex_raw_buffer.hpp | 4 +- 3party/boost/boost/regex/v4/regex_replace.hpp | 8 +- 3party/boost/boost/regex/v4/regex_search.hpp | 4 +- 3party/boost/boost/regex/v4/regex_split.hpp | 8 +- .../boost/regex/v4/regex_token_iterator.hpp | 6 +- 3party/boost/boost/regex/v4/regex_traits.hpp | 18 +- .../boost/regex/v4/regex_traits_defaults.hpp | 20 +- .../boost/boost/regex/v4/regex_workaround.hpp | 8 +- 3party/boost/boost/regex/v4/states.hpp | 26 +- 3party/boost/boost/regex/v4/sub_match.hpp | 143 +- .../boost/regex/v4/u32regex_iterator.hpp | 4 +- .../regex/v4/u32regex_token_iterator.hpp | 4 +- .../boost/boost/regex/v4/w32_regex_traits.hpp | 84 +- .../archive_input_unordered_map.hpp | 85 + .../archive_input_unordered_set.hpp | 72 + 3party/boost/boost/serialization/array.hpp | 132 +- .../serialization/array_optimization.hpp | 37 + .../boost/serialization/array_wrapper.hpp | 121 + .../boost/serialization/assume_abstract.hpp | 1 + .../boost/boost/serialization/base_object.hpp | 1 - .../boost/boost/serialization/boost_array.hpp | 33 + .../serialization/boost_unordered_map.hpp | 154 + .../serialization/boost_unordered_set.hpp | 150 + .../boost/serialization/collection_traits.hpp | 2 +- .../serialization/collections_load_imp.hpp | 5 +- 3party/boost/boost/serialization/deque.hpp | 3 +- .../boost/serialization/detail/get_data.hpp | 61 - .../detail/is_default_constructible.hpp | 2 +- .../detail/stack_constructor.hpp | 5 +- .../boost/boost/serialization/ephemeral.hpp | 1 - 3party/boost/boost/serialization/export.hpp | 2 +- .../serialization/extended_type_info.hpp | 6 +- .../extended_type_info_typeid.hpp | 4 +- 3party/boost/boost/serialization/factory.hpp | 1 + .../boost/serialization/forward_list.hpp | 11 +- 3party/boost/boost/serialization/hash_map.hpp | 5 +- 3party/boost/boost/serialization/hash_set.hpp | 5 +- .../serialization/is_bitwise_serializable.hpp | 2 +- 3party/boost/boost/serialization/list.hpp | 1 - 3party/boost/boost/serialization/map.hpp | 8 +- 3party/boost/boost/serialization/nvp.hpp | 34 +- 3party/boost/boost/serialization/optional.hpp | 44 +- .../boost/serialization/priority_queue.hpp | 2 + 3party/boost/boost/serialization/queue.hpp | 2 + 3party/boost/boost/serialization/set.hpp | 6 +- .../boost/boost/serialization/shared_ptr.hpp | 2 +- .../boost/serialization/shared_ptr_helper.hpp | 7 +- .../boost/boost/serialization/singleton.hpp | 28 +- 3party/boost/boost/serialization/slist.hpp | 9 +- 3party/boost/boost/serialization/stack.hpp | 2 + .../boost/serialization/static_warning.hpp | 3 +- .../boost/serialization/strong_typedef.hpp | 36 +- 3party/boost/boost/serialization/traits.hpp | 2 +- .../boost/boost/serialization/unique_ptr.hpp | 4 +- .../unordered_collections_load_imp.hpp | 1 - .../boost/serialization/unordered_map.hpp | 89 +- .../boost/serialization/unordered_set.hpp | 74 +- 3party/boost/boost/serialization/valarray.hpp | 34 +- 3party/boost/boost/serialization/variant.hpp | 1 - 3party/boost/boost/serialization/vector.hpp | 18 +- .../boost/boost/serialization/vector_135.hpp | 2 +- 3party/boost/boost/serialization/wrapper.hpp | 2 +- 3party/boost/boost/signals2/connection.hpp | 8 +- 3party/boost/boost/signals2/deconstruct.hpp | 2 +- .../boost/signals2/detail/auto_buffer.hpp | 8 +- .../boost/signals2/detail/foreign_ptr.hpp | 5 - .../boost/signals2/detail/signal_template.hpp | 5 +- .../signals2/detail/signals_common_macros.hpp | 6 +- .../signals2/detail/slot_call_iterator.hpp | 8 +- .../boost/signals2/detail/slot_template.hpp | 2 +- .../signals2/detail/variadic_arg_type.hpp | 19 +- .../signals2/detail/variadic_slot_invoker.hpp | 29 +- 3party/boost/boost/signals2/last_value.hpp | 14 +- .../boost/signals2/optional_last_value.hpp | 11 +- .../boost/signals2/postconstructible.hpp | 2 +- .../boost/signals2/preprocessed_signal.hpp | 2 +- 3party/boost/boost/signals2/slot_base.hpp | 2 + 3party/boost/boost/signals2/trackable.hpp | 4 +- .../boost/boost/signals2/variadic_signal.hpp | 2 +- .../boost/smart_ptr/allocate_shared_array.hpp | 1173 +- 3party/boost/boost/smart_ptr/bad_weak_ptr.hpp | 9 + .../smart_ptr/detail/array_allocator.hpp | 318 - .../smart_ptr/detail/array_count_impl.hpp | 67 - .../boost/smart_ptr/detail/array_traits.hpp | 60 - .../boost/smart_ptr/detail/array_utility.hpp | 214 - .../boost/smart_ptr/detail/atomic_count.hpp | 3 + .../boost/smart_ptr/detail/operator_bool.hpp | 3 +- .../boost/smart_ptr/detail/shared_count.hpp | 72 +- .../smart_ptr/detail/sp_counted_base.hpp | 7 +- .../detail/sp_counted_base_clang.hpp | 11 +- .../smart_ptr/detail/sp_counted_impl.hpp | 8 - .../detail/sp_disable_deprecated.hpp | 40 + .../boost/smart_ptr/detail/sp_has_sync.hpp | 6 +- .../boost/smart_ptr/detail/sp_if_array.hpp | 34 - .../boost/smart_ptr/detail/sp_interlocked.hpp | 11 + .../boost/smart_ptr/detail/sp_noexcept.hpp | 30 + .../boost/boost/smart_ptr/detail/spinlock.hpp | 3 + .../boost/smart_ptr/detail/up_if_array.hpp | 26 - .../smart_ptr/detail/up_if_not_array.hpp | 31 - .../boost/boost/smart_ptr/detail/yield_k.hpp | 9 + .../smart_ptr/enable_shared_from_raw.hpp | 2 +- .../smart_ptr/enable_shared_from_this.hpp | 9 +- .../boost/boost/smart_ptr/intrusive_ptr.hpp | 31 +- .../boost/smart_ptr/intrusive_ref_counter.hpp | 2 +- .../boost/smart_ptr/make_shared_array.hpp | 204 +- .../boost/smart_ptr/make_shared_object.hpp | 658 +- 3party/boost/boost/smart_ptr/make_unique.hpp | 113 +- .../boost/smart_ptr/make_unique_array.hpp | 31 - .../boost/smart_ptr/make_unique_object.hpp | 45 - 3party/boost/boost/smart_ptr/owner_less.hpp | 45 +- 3party/boost/boost/smart_ptr/scoped_array.hpp | 3 +- 3party/boost/boost/smart_ptr/scoped_ptr.hpp | 13 +- 3party/boost/boost/smart_ptr/shared_array.hpp | 13 +- 3party/boost/boost/smart_ptr/shared_ptr.hpp | 88 +- 3party/boost/boost/smart_ptr/weak_ptr.hpp | 11 +- .../sort/spreadsort/detail/float_sort.hpp | 69 +- .../sort/spreadsort/detail/integer_sort.hpp | 8 +- .../sort/spreadsort/detail/string_sort.hpp | 12 +- .../boost/sort/spreadsort/integer_sort.hpp | 1 + .../boost/sort/spreadsort/spreadsort.hpp | 35 +- .../core/non_terminal/impl/grammar.ipp | 6 +- .../classic/core/non_terminal/impl/rule.ipp | 1 + .../core/non_terminal/impl/subrule.ipp | 2 + .../classic/core/non_terminal/subrule.hpp | 3 + .../classic/iterator/position_iterator.hpp | 2 +- .../spirit/home/classic/tree/parse_tree.hpp | 1 - .../home/classic/tree/parse_tree_utils.hpp | 2 +- .../spirit/home/karma/directive/duplicate.hpp | 2 +- .../home/karma/directive/left_alignment.hpp | 4 +- .../boost/spirit/home/karma/string/lit.hpp | 3 - .../boost/spirit/home/qi/detail/assign_to.hpp | 11 + .../spirit/home/qi/detail/attributes.hpp | 2 +- .../home/qi/numeric/detail/numeric_utils.hpp | 31 +- .../home/qi/numeric/detail/real_impl.hpp | 18 +- .../boost/spirit/home/qi/string/tst_map.hpp | 3 +- .../boost/spirit/home/support/attributes.hpp | 5 +- .../home/support/char_encoding/ascii.hpp | 29 +- .../home/support/detail/endian/endian.hpp | 21 +- .../spirit/home/support/extended_variant.hpp | 5 + .../boost/spirit/home/support/terminal.hpp | 55 +- .../boost/spirit/home/x3/auxiliary/eol.hpp | 2 +- .../boost/spirit/home/x3/binary/binary.hpp | 1 + .../boost/spirit/home/x3/char/any_char.hpp | 2 +- .../boost/spirit/home/x3/char/char_set.hpp | 4 +- .../spirit/home/x3/char/literal_char.hpp | 2 +- .../boost/boost/spirit/home/x3/core/parse.hpp | 3 + .../boost/spirit/home/x3/directive/expect.hpp | 32 +- .../boost/spirit/home/x3/directive/with.hpp | 2 +- .../home/x3/nonterminal/detail/rule.hpp | 23 +- .../detail/transform_attribute.hpp | 8 +- .../home/x3/nonterminal/simple_trace.hpp | 2 +- .../home/x3/operator/detail/sequence.hpp | 26 +- .../x3/string/detail/no_case_string_parse.hpp | 2 +- .../home/x3/string/detail/string_parse.hpp | 2 +- .../spirit/home/x3/string/literal_string.hpp | 16 +- .../boost/spirit/home/x3/string/symbols.hpp | 4 +- .../spirit/home/x3/support/ast/variant.hpp | 5 + .../x3/support/traits/container_traits.hpp | 93 +- .../spirit/home/x3/support/traits/move_to.hpp | 32 +- .../spirit/home/x3/support/utility/sfinae.hpp | 2 +- 3party/boost/boost/static_assert.hpp | 23 +- 3party/boost/boost/system/cygwin_error.hpp | 6 +- 3party/boost/boost/system/error_code.hpp | 17 +- 3party/boost/boost/system/linux_error.hpp | 6 +- 3party/boost/boost/system/system_error.hpp | 6 +- 3party/boost/boost/system/windows_error.hpp | 6 +- 3party/boost/boost/test/auto_unit_test.hpp | 2 +- 3party/boost/boost/test/data/config.hpp | 8 +- 3party/boost/boost/test/data/dataset.hpp | 3 +- .../boost/boost/test/data/for_each_sample.hpp | 117 + 3party/boost/boost/test/data/generators.hpp | 3 +- .../boost/boost/test/data/index_sequence.hpp | 62 + 3party/boost/boost/test/data/monomorphic.hpp | 4 +- .../boost/test/data/monomorphic/array.hpp | 75 +- .../test/data/monomorphic/collection.hpp | 69 +- .../boost/test/data/monomorphic/dataset.hpp | 173 - .../boost/boost/test/data/monomorphic/fwd.hpp | 217 +- .../boost/test/data/monomorphic/generate.hpp | 54 +- .../test/data/monomorphic/generators.hpp | 3 +- .../data/monomorphic/generators/keywords.hpp | 2 +- .../data/monomorphic/generators/random.hpp | 34 +- .../data/monomorphic/generators/xrange.hpp | 39 +- .../boost/test/data/monomorphic/grid.hpp | 192 +- .../data/monomorphic/initializer_list.hpp | 81 + .../boost/test/data/monomorphic/join.hpp | 153 +- .../test/data/monomorphic/sample_merge.hpp | 103 + .../boost/test/data/monomorphic/singleton.hpp | 101 +- .../boost/boost/test/data/monomorphic/zip.hpp | 187 +- 3party/boost/boost/test/data/size.hpp | 3 +- 3party/boost/boost/test/data/test_case.hpp | 180 +- 3party/boost/boost/test/debug.hpp | 2 +- 3party/boost/boost/test/debug_config.hpp | 2 +- 3party/boost/boost/test/detail/config.hpp | 14 +- .../boost/test/detail/enable_warnings.hpp | 9 +- 3party/boost/boost/test/detail/fwd_decl.hpp | 2 +- .../boost/test/detail/global_typedef.hpp | 22 +- 3party/boost/boost/test/detail/log_level.hpp | 2 +- .../boost/boost/test/detail/pp_variadic.hpp | 2 +- .../boost/test/detail/suppress_warnings.hpp | 14 +- .../boost/test/detail/throw_exception.hpp | 40 +- 3party/boost/boost/test/detail/workaround.hpp | 2 +- 3party/boost/boost/test/execution_monitor.hpp | 96 +- .../boost/test/floating_point_comparison.hpp | 2 +- 3party/boost/boost/test/framework.hpp | 16 +- .../test/impl/compiler_log_formatter.ipp | 43 +- 3party/boost/boost/test/impl/cpp_main.ipp | 8 +- 3party/boost/boost/test/impl/debug.ipp | 50 +- 3party/boost/boost/test/impl/decorator.ipp | 6 +- .../boost/test/impl/execution_monitor.ipp | 126 +- 3party/boost/boost/test/impl/framework.ipp | 348 +- .../boost/test/impl/junit_log_formatter.ipp | 772 + .../test/impl/plain_report_formatter.ipp | 14 +- .../boost/test/impl/progress_monitor.ipp | 34 +- .../boost/test/impl/results_collector.ipp | 13 +- .../boost/test/impl/results_reporter.ipp | 31 +- 3party/boost/boost/test/impl/test_main.ipp | 2 +- 3party/boost/boost/test/impl/test_tools.ipp | 179 +- 3party/boost/boost/test/impl/test_tree.ipp | 20 +- .../boost/boost/test/impl/unit_test_log.ipp | 441 +- .../boost/boost/test/impl/unit_test_main.ipp | 35 +- .../boost/test/impl/unit_test_monitor.ipp | 14 +- .../boost/test/impl/unit_test_parameters.ipp | 1187 +- .../boost/test/impl/xml_log_formatter.ipp | 45 +- .../boost/test/impl/xml_report_formatter.ipp | 25 +- .../boost/test/included/execution_monitor.hpp | 2 +- .../boost/test/included/prg_exec_monitor.hpp | 2 +- .../boost/test/included/test_exec_monitor.hpp | 3 +- .../boost/boost/test/included/unit_test.hpp | 7 +- .../test/included/unit_test_framework.hpp | 2 +- 3party/boost/boost/test/minimal.hpp | 2 +- .../test/output/compiler_log_formatter.hpp | 15 +- .../boost/test/output/junit_log_formatter.hpp | 167 + .../test/output/plain_report_formatter.hpp | 5 +- .../boost/test/output/xml_log_formatter.hpp | 2 +- .../test/output/xml_report_formatter.hpp | 2 +- .../boost/boost/test/output_test_stream.hpp | 2 +- .../boost/boost/test/parameterized_test.hpp | 2 +- 3party/boost/boost/test/predicate_result.hpp | 2 +- 3party/boost/boost/test/prg_exec_monitor.hpp | 2 +- 3party/boost/boost/test/progress_monitor.hpp | 2 +- 3party/boost/boost/test/results_collector.hpp | 80 +- 3party/boost/boost/test/results_reporter.hpp | 2 +- .../boost/boost/test/test_case_template.hpp | 2 +- 3party/boost/boost/test/test_exec_monitor.hpp | 2 +- 3party/boost/boost/test/test_tools.hpp | 17 +- 3party/boost/boost/test/tools/assertion.hpp | 15 +- .../boost/test/tools/assertion_result.hpp | 2 +- .../test/tools/collection_comparison_op.hpp | 69 +- 3party/boost/boost/test/tools/context.hpp | 2 +- .../test/tools/cstring_comparison_op.hpp | 23 +- .../boost/test/tools/detail/bitwise_manip.hpp | 8 +- .../test/tools/detail/expression_holder.hpp | 2 +- 3party/boost/boost/test/tools/detail/fwd.hpp | 2 +- .../boost/test/tools/detail/indirections.hpp | 2 +- .../boost/boost/test/tools/detail/it_pair.hpp | 2 +- .../test/tools/detail/lexicographic_manip.hpp | 2 +- .../test/tools/detail/per_element_manip.hpp | 2 +- .../boost/test/tools/detail/print_helper.hpp | 56 +- .../test/tools/detail/tolerance_manip.hpp | 12 +- .../test/tools/floating_point_comparison.hpp | 20 +- 3party/boost/boost/test/tools/fpc_op.hpp | 23 +- .../boost/boost/test/tools/fpc_tolerance.hpp | 2 +- 3party/boost/boost/test/tools/interface.hpp | 23 +- 3party/boost/boost/test/tools/old/impl.hpp | 2 +- .../boost/boost/test/tools/old/interface.hpp | 26 +- .../boost/test/tools/output_test_stream.hpp | 27 +- .../boost/test/tree/auto_registration.hpp | 3 +- 3party/boost/boost/test/tree/decorator.hpp | 2 +- 3party/boost/boost/test/tree/fixture.hpp | 3 +- .../boost/boost/test/tree/global_fixture.hpp | 10 +- 3party/boost/boost/test/tree/observer.hpp | 61 +- .../boost/test/tree/test_case_counter.hpp | 11 +- .../boost/test/tree/test_case_template.hpp | 19 +- 3party/boost/boost/test/tree/test_unit.hpp | 10 +- 3party/boost/boost/test/tree/traverse.hpp | 2 +- 3party/boost/boost/test/tree/visitor.hpp | 3 +- 3party/boost/boost/test/unit_test.hpp | 2 +- 3party/boost/boost/test/unit_test_log.hpp | 105 +- .../boost/test/unit_test_log_formatter.hpp | 128 +- 3party/boost/boost/test/unit_test_monitor.hpp | 2 +- .../boost/boost/test/unit_test_parameters.hpp | 149 +- 3party/boost/boost/test/unit_test_suite.hpp | 41 +- 3party/boost/boost/test/utils/algorithm.hpp | 105 +- 3party/boost/boost/test/utils/assign_op.hpp | 2 +- .../utils/basic_cstring/basic_cstring.hpp | 2 +- .../utils/basic_cstring/basic_cstring_fwd.hpp | 2 +- .../utils/basic_cstring/bcs_char_traits.hpp | 2 +- .../test/utils/basic_cstring/compare.hpp | 2 +- .../boost/test/utils/basic_cstring/io.hpp | 2 +- .../boost/test/utils/class_properties.hpp | 2 +- .../boost/boost/test/utils/custom_manip.hpp | 4 +- .../boost/boost/test/utils/fixed_mapping.hpp | 120 - 3party/boost/boost/test/utils/foreach.hpp | 2 +- 3party/boost/boost/test/utils/is_cstring.hpp | 33 +- .../boost/test/utils/is_forward_iterable.hpp | 127 +- .../utils/iterator/ifstream_line_iterator.hpp | 105 - .../utils/iterator/input_iterator_facade.hpp | 7 +- .../utils/iterator/istream_line_iterator.hpp | 93 - .../test/utils/iterator/token_iterator.hpp | 31 +- .../boost/boost/test/utils/lazy_ostream.hpp | 4 +- .../boost/boost/test/utils/named_params.hpp | 246 +- 3party/boost/boost/test/utils/nullstream.hpp | 2 +- 3party/boost/boost/test/utils/rtti.hpp | 4 +- .../boost/test/utils/runtime/argument.hpp | 105 +- .../test/utils/runtime/argument_factory.hpp | 242 + .../utils/runtime/cla/argument_factory.hpp | 216 - .../test/utils/runtime/cla/argv_traverser.cpp | 16 - .../test/utils/runtime/cla/argv_traverser.hpp | 119 +- .../test/utils/runtime/cla/argv_traverser.ipp | 212 - .../utils/runtime/cla/basic_parameter.hpp | 85 - .../test/utils/runtime/cla/char_parameter.cpp | 16 - .../test/utils/runtime/cla/char_parameter.hpp | 100 - .../test/utils/runtime/cla/char_parameter.ipp | 57 - .../cla/detail/argument_value_usage.hpp | 81 - .../utils/runtime/cla/dual_name_parameter.cpp | 16 - .../utils/runtime/cla/dual_name_parameter.hpp | 98 - .../utils/runtime/cla/dual_name_parameter.ipp | 90 - .../boost/test/utils/runtime/cla/fwd.hpp | 55 - .../test/utils/runtime/cla/id_policy.cpp | 16 - .../test/utils/runtime/cla/id_policy.hpp | 147 - .../test/utils/runtime/cla/id_policy.ipp | 118 - .../runtime/cla/iface/argument_factory.hpp | 51 - .../utils/runtime/cla/iface/id_policy.hpp | 73 - .../boost/test/utils/runtime/cla/modifier.hpp | 69 - .../utils/runtime/cla/named_parameter.cpp | 16 - .../utils/runtime/cla/named_parameter.hpp | 95 - .../utils/runtime/cla/named_parameter.ipp | 129 - .../test/utils/runtime/cla/parameter.hpp | 151 - .../boost/test/utils/runtime/cla/parser.cpp | 18 - .../boost/test/utils/runtime/cla/parser.hpp | 552 +- .../boost/test/utils/runtime/cla/parser.ipp | 267 - .../runtime/cla/positional_parameter.hpp | 91 - .../utils/runtime/cla/typed_parameter.hpp | 70 - .../test/utils/runtime/cla/validation.cpp | 16 - .../test/utils/runtime/cla/validation.hpp | 57 - .../test/utils/runtime/cla/validation.ipp | 61 - .../utils/runtime/cla/value_generator.hpp | 81 - .../test/utils/runtime/cla/value_handler.hpp | 57 - .../boost/boost/test/utils/runtime/config.hpp | 162 - .../test/utils/runtime/configuration.hpp | 61 - .../test/utils/runtime/env/environment.cpp | 23 - .../test/utils/runtime/env/environment.hpp | 171 - .../test/utils/runtime/env/environment.ipp | 125 - .../boost/test/utils/runtime/env/fetch.hpp | 108 + .../boost/test/utils/runtime/env/fwd.hpp | 61 - .../boost/test/utils/runtime/env/modifier.hpp | 47 - .../boost/test/utils/runtime/env/variable.hpp | 223 - .../boost/boost/test/utils/runtime/errors.hpp | 195 + .../test/utils/runtime/file/config_file.cpp | 249 - .../test/utils/runtime/file/config_file.hpp | 182 - .../runtime/file/config_file_iterator.cpp | 685 - .../runtime/file/config_file_iterator.hpp | 166 - .../boost/test/utils/runtime/finalize.hpp | 56 + 3party/boost/boost/test/utils/runtime/fwd.hpp | 24 +- .../runtime/interpret_argument_value.hpp | 163 - .../boost/test/utils/runtime/modifier.hpp | 106 + .../boost/test/utils/runtime/parameter.hpp | 452 +- .../boost/boost/test/utils/runtime/trace.hpp | 30 - .../boost/test/utils/runtime/validation.hpp | 85 - 3party/boost/boost/test/utils/setcolor.hpp | 13 +- 3party/boost/boost/test/utils/string_cast.hpp | 69 + .../boost/test/utils/trivial_singleton.hpp | 2 +- .../boost/test/utils/wrap_stringstream.hpp | 2 +- 3party/boost/boost/test/utils/xml_printer.hpp | 37 +- 3party/boost/boost/thread/barrier.hpp | 9 +- .../boost/boost/thread/completion_latch.hpp | 1 - .../thread/concurrent_queues/queue_views.hpp | 11 - .../thread/concurrent_queues/sync_queue.hpp | 7 + .../concurrent_queues/sync_timed_queue.hpp | 12 +- 3party/boost/boost/thread/csbl/devector.hpp | 8 +- 3party/boost/boost/thread/detail/config.hpp | 13 +- 3party/boost/boost/thread/detail/invoker.hpp | 36 +- 3party/boost/boost/thread/detail/move.hpp | 19 + .../boost/thread/detail/nullary_function.hpp | 2 +- 3party/boost/boost/thread/detail/thread.hpp | 20 +- .../boost/thread/detail/thread_group.hpp | 3 +- 3party/boost/boost/thread/exceptions.hpp | 16 +- .../thread/executors/basic_thread_pool.hpp | 31 +- .../boost/boost/thread/executors/executor.hpp | 7 +- .../thread/executors/executor_adaptor.hpp | 9 +- .../thread/executors/generic_executor_ref.hpp | 30 +- .../boost/thread/executors/loop_executor.hpp | 58 +- .../executors/scheduled_thread_pool.hpp | 1 + .../thread/executors/serial_executor.hpp | 15 +- .../thread/executors/serial_executor_cont.hpp | 2 +- .../thread/executors/thread_executor.hpp | 1 + .../experimental/parallel/v2/task_region.hpp | 2 +- 3party/boost/boost/thread/future.hpp | 1539 +- 3party/boost/boost/thread/futures/launch.hpp | 2 + .../boost/thread/futures/wait_for_all.hpp | 2 +- 3party/boost/boost/thread/latch.hpp | 3 + 3party/boost/boost/thread/lock_types.hpp | 18 +- 3party/boost/boost/thread/locks.hpp | 1 + 3party/boost/boost/thread/poly_lockable.hpp | 4 +- .../thread/pthread/condition_variable.hpp | 150 +- .../thread/pthread/condition_variable_fwd.hpp | 187 +- .../boost/thread/pthread/once_atomic.hpp | 4 +- .../boost/thread/pthread/shared_mutex.hpp | 4 +- .../boost/thread/pthread/thread_data.hpp | 10 +- .../boost/boost/thread/pthread/timespec.hpp | 29 + 3party/boost/boost/thread/scoped_thread.hpp | 41 +- 3party/boost/boost/thread/shared_mutex.hpp | 1 + .../boost/boost/thread/synchronized_value.hpp | 12 +- 3party/boost/boost/thread/thread_functors.hpp | 23 +- 3party/boost/boost/thread/thread_guard.hpp | 6 +- 3party/boost/boost/thread/user_scheduler.hpp | 2 +- 3party/boost/boost/thread/v2/thread.hpp | 17 +- .../boost/thread/win32/condition_variable.hpp | 16 +- .../boost/thread/win32/interlocked_read.hpp | 151 +- 3party/boost/boost/thread/win32/once.hpp | 4 +- .../boost/boost/thread/win32/shared_mutex.hpp | 4 +- .../boost/boost/thread/win32/thread_data.hpp | 26 +- .../boost/thread/win32/thread_primitives.hpp | 23 +- 3party/boost/boost/timer/timer.hpp | 2 +- 3party/boost/boost/type_erasure/binding.hpp | 36 + .../type_erasure/detail/adapt_to_vtable.hpp | 38 + .../boost/type_erasure/detail/auto_link.hpp | 38 + .../boost/type_erasure/detail/check_map.hpp | 2 + .../type_erasure/detail/dynamic_vtable.hpp | 172 + .../detail/rebind_placeholders.hpp | 1 + .../boost/type_erasure/detail/storage.hpp | 4 +- .../boost/type_erasure/dynamic_any_cast.hpp | 234 + .../boost/type_erasure/dynamic_binding.hpp | 46 + .../boost/type_erasure/is_placeholder.hpp | 7 - 3party/boost/boost/type_erasure/iterator.hpp | 7 +- .../boost/type_erasure/register_binding.hpp | 169 + 3party/boost/boost/type_index.hpp | 4 +- .../boost/type_index/ctti_type_index.hpp | 75 +- .../detail/compile_time_type_info.hpp | 201 +- .../boost/boost/type_index/runtime_cast.hpp | 28 + .../runtime_cast/boost_shared_ptr_cast.hpp | 46 + .../runtime_cast/detail/runtime_cast_impl.hpp | 57 + .../type_index/runtime_cast/pointer_cast.hpp | 74 + .../runtime_cast/reference_cast.hpp | 66 + .../runtime_cast/register_runtime_class.hpp | 138 + .../runtime_cast/std_shared_ptr_cast.hpp | 46 + .../boost/boost/type_index/stl_type_index.hpp | 6 +- .../boost/type_index/type_index_facade.hpp | 16 +- 3party/boost/boost/type_traits.hpp | 223 +- 3party/boost/boost/type_traits/add_const.hpp | 17 +- 3party/boost/boost/type_traits/add_cv.hpp | 9 +- .../type_traits/add_lvalue_reference.hpp | 15 +- .../boost/boost/type_traits/add_pointer.hpp | 23 +- .../boost/boost/type_traits/add_reference.hpp | 45 +- .../type_traits/add_rvalue_reference.hpp | 10 +- .../boost/boost/type_traits/add_volatile.hpp | 9 +- .../boost/type_traits/aligned_storage.hpp | 145 +- .../boost/boost/type_traits/alignment_of.hpp | 25 +- .../type_traits/broken_compiler_spec.hpp | 17 +- .../boost/boost/type_traits/common_type.hpp | 246 +- .../boost/boost/type_traits/conditional.hpp | 9 +- 3party/boost/boost/type_traits/config.hpp | 65 +- 3party/boost/boost/type_traits/copy_cv.hpp | 34 + 3party/boost/boost/type_traits/decay.hpp | 25 +- 3party/boost/boost/type_traits/declval.hpp | 44 + .../type_traits/detail/bool_trait_def.hpp | 23 +- .../detail/common_arithmetic_type.hpp | 218 + .../type_traits/detail/common_type_imp.hpp | 333 - .../type_traits/detail/common_type_impl.hpp | 107 + .../detail/composite_member_pointer_type.hpp | 113 + .../detail/composite_pointer_type.hpp | 153 + .../boost/boost/type_traits/detail/config.hpp | 72 + .../type_traits/detail/cv_traits_impl.hpp | 140 - .../boost/type_traits/detail/false_result.hpp | 28 - .../detail/has_binary_operator.hpp | 23 +- .../detail/has_postfix_operator.hpp | 23 +- .../detail/has_prefix_operator.hpp | 25 +- .../boost/type_traits/detail/ice_and.hpp | 7 + .../boost/boost/type_traits/detail/ice_eq.hpp | 7 + .../boost/type_traits/detail/ice_not.hpp | 7 + .../boost/boost/type_traits/detail/ice_or.hpp | 7 + .../detail/is_function_ptr_helper.hpp | 18 +- .../detail/is_function_ptr_tester.hpp | 17 +- .../detail/is_mem_fun_pointer_impl.hpp | 16 +- .../detail/is_mem_fun_pointer_tester.hpp | 18 +- .../boost/type_traits/detail/mp_defer.hpp | 56 + .../type_traits/detail/size_t_trait_def.hpp | 51 - .../type_traits/detail/size_t_trait_undef.hpp | 16 - .../detail/template_arity_spec.hpp | 29 +- .../type_traits/detail/type_trait_def.hpp | 67 - .../type_traits/detail/type_trait_undef.hpp | 19 - .../boost/boost/type_traits/detail/wrap.hpp | 18 - 3party/boost/boost/type_traits/extent.hpp | 8 +- .../type_traits/floating_point_promotion.hpp | 81 +- .../boost/boost/type_traits/has_bit_and.hpp | 38 +- .../boost/type_traits/has_bit_and_assign.hpp | 46 +- 3party/boost/boost/type_traits/has_bit_or.hpp | 38 +- .../boost/type_traits/has_bit_or_assign.hpp | 46 +- .../boost/boost/type_traits/has_bit_xor.hpp | 38 +- .../boost/type_traits/has_bit_xor_assign.hpp | 46 +- .../boost/type_traits/has_complement.hpp | 14 +- .../boost/type_traits/has_dereference.hpp | 10 +- .../boost/boost/type_traits/has_divides.hpp | 28 +- .../boost/type_traits/has_divides_assign.hpp | 36 +- .../boost/boost/type_traits/has_equal_to.hpp | 40 +- .../boost/boost/type_traits/has_greater.hpp | 40 +- .../boost/type_traits/has_greater_equal.hpp | 40 +- .../boost/type_traits/has_left_shift.hpp | 38 +- .../type_traits/has_left_shift_assign.hpp | 46 +- 3party/boost/boost/type_traits/has_less.hpp | 40 +- .../boost/type_traits/has_less_equal.hpp | 40 +- .../boost/type_traits/has_logical_and.hpp | 32 +- .../boost/type_traits/has_logical_or.hpp | 32 +- 3party/boost/boost/type_traits/has_minus.hpp | 58 +- .../boost/type_traits/has_minus_assign.hpp | 58 +- .../boost/boost/type_traits/has_modulus.hpp | 38 +- .../boost/type_traits/has_modulus_assign.hpp | 46 +- .../boost/type_traits/has_multiplies.hpp | 28 +- .../type_traits/has_multiplies_assign.hpp | 36 +- .../boost/type_traits/has_new_operator.hpp | 23 +- .../boost/type_traits/has_not_equal_to.hpp | 40 +- .../boost/type_traits/has_nothrow_assign.hpp | 78 +- .../type_traits/has_nothrow_constructor.hpp | 70 +- .../boost/type_traits/has_nothrow_copy.hpp | 77 +- .../type_traits/has_nothrow_destructor.hpp | 30 +- 3party/boost/boost/type_traits/has_plus.hpp | 46 +- .../boost/type_traits/has_plus_assign.hpp | 62 +- .../boost/type_traits/has_post_decrement.hpp | 22 +- .../boost/type_traits/has_post_increment.hpp | 22 +- .../boost/type_traits/has_pre_decrement.hpp | 22 +- .../boost/type_traits/has_pre_increment.hpp | 22 +- .../boost/type_traits/has_right_shift.hpp | 38 +- .../type_traits/has_right_shift_assign.hpp | 46 +- .../boost/type_traits/has_trivial_assign.hpp | 53 +- .../type_traits/has_trivial_constructor.hpp | 56 +- .../boost/type_traits/has_trivial_copy.hpp | 81 +- .../type_traits/has_trivial_destructor.hpp | 47 +- .../type_traits/has_trivial_move_assign.hpp | 66 +- .../has_trivial_move_constructor.hpp | 71 +- .../type_traits/has_virtual_destructor.hpp | 9 +- .../boost/type_traits/integral_constant.hpp | 111 +- .../boost/type_traits/integral_promotion.hpp | 33 +- 3party/boost/boost/type_traits/intrinsics.hpp | 128 +- .../boost/boost/type_traits/is_abstract.hpp | 13 +- .../boost/boost/type_traits/is_arithmetic.hpp | 35 +- 3party/boost/boost/type_traits/is_array.hpp | 31 +- .../boost/boost/type_traits/is_assignable.hpp | 77 + .../boost/type_traits/is_base_and_derived.hpp | 24 +- 3party/boost/boost/type_traits/is_base_of.hpp | 26 +- .../boost/type_traits/is_base_of_tr1.hpp | 23 +- 3party/boost/boost/type_traits/is_class.hpp | 49 +- 3party/boost/boost/type_traits/is_complex.hpp | 22 +- .../boost/boost/type_traits/is_compound.hpp | 26 +- 3party/boost/boost/type_traits/is_const.hpp | 61 +- .../boost/type_traits/is_constructible.hpp | 80 + .../boost/type_traits/is_convertible.hpp | 124 +- .../boost/type_traits/is_copy_assignable.hpp | 20 +- .../type_traits/is_copy_constructible.hpp | 216 +- .../type_traits/is_default_constructible.hpp | 84 + .../boost/type_traits/is_destructible.hpp | 61 + 3party/boost/boost/type_traits/is_empty.hpp | 38 +- 3party/boost/boost/type_traits/is_enum.hpp | 56 +- 3party/boost/boost/type_traits/is_final.hpp | 23 +- 3party/boost/boost/type_traits/is_float.hpp | 11 +- .../boost/type_traits/is_floating_point.hpp | 21 +- .../boost/boost/type_traits/is_function.hpp | 21 +- .../boost/type_traits/is_fundamental.hpp | 23 +- .../boost/boost/type_traits/is_integral.hpp | 75 +- .../boost/type_traits/is_lvalue_reference.hpp | 20 +- .../is_member_function_pointer.hpp | 43 +- .../type_traits/is_member_object_pointer.hpp | 28 +- .../boost/type_traits/is_member_pointer.hpp | 34 +- .../is_nothrow_move_assignable.hpp | 77 +- .../is_nothrow_move_constructible.hpp | 104 +- 3party/boost/boost/type_traits/is_object.hpp | 31 +- 3party/boost/boost/type_traits/is_pod.hpp | 50 +- 3party/boost/boost/type_traits/is_pointer.hpp | 63 +- .../boost/type_traits/is_polymorphic.hpp | 19 +- .../boost/boost/type_traits/is_reference.hpp | 27 +- .../boost/type_traits/is_rvalue_reference.hpp | 14 +- 3party/boost/boost/type_traits/is_same.hpp | 12 +- 3party/boost/boost/type_traits/is_scalar.hpp | 34 +- 3party/boost/boost/type_traits/is_signed.hpp | 143 +- .../boost/boost/type_traits/is_stateless.hpp | 31 +- 3party/boost/boost/type_traits/is_union.hpp | 38 +- .../boost/boost/type_traits/is_unsigned.hpp | 144 +- .../boost/type_traits/is_virtual_base_of.hpp | 26 +- 3party/boost/boost/type_traits/is_void.hpp | 26 +- .../boost/boost/type_traits/is_volatile.hpp | 60 +- .../boost/boost/type_traits/make_signed.hpp | 90 +- .../boost/boost/type_traits/make_unsigned.hpp | 89 +- 3party/boost/boost/type_traits/make_void.hpp | 52 + 3party/boost/boost/type_traits/promote.hpp | 22 +- 3party/boost/boost/type_traits/rank.hpp | 10 +- .../boost/type_traits/remove_all_extents.hpp | 25 +- .../boost/boost/type_traits/remove_bounds.hpp | 27 +- .../boost/boost/type_traits/remove_const.hpp | 62 +- 3party/boost/boost/type_traits/remove_cv.hpp | 51 +- .../boost/boost/type_traits/remove_extent.hpp | 25 +- .../boost/type_traits/remove_pointer.hpp | 20 +- .../boost/type_traits/remove_reference.hpp | 15 +- .../boost/type_traits/remove_volatile.hpp | 59 +- .../type_traits/transform_traits_spec.hpp | 14 - .../boost/boost/type_traits/type_identity.hpp | 22 + .../boost/type_traits/type_with_alignment.hpp | 282 +- .../boost/boost/units/base_units/cgs/biot.hpp | 2 +- .../units/base_units/information/bit.hpp | 2 +- .../units/base_units/information/byte.hpp | 2 +- .../units/base_units/information/hartley.hpp | 4 +- .../units/base_units/information/nat.hpp | 4 +- .../units/base_units/information/shannon.hpp | 2 +- 3party/boost/boost/units/conversion.hpp | 2 +- 3party/boost/boost/units/io.hpp | 83 +- .../units/physical_dimensions/information.hpp | 6 +- .../boost/boost/units/systems/information.hpp | 2 +- .../boost/units/systems/information/bit.hpp | 4 +- .../boost/units/systems/information/byte.hpp | 4 +- .../units/systems/information/hartley.hpp | 4 +- .../boost/units/systems/information/nat.hpp | 4 +- .../units/systems/information/prefixes.hpp | 2 +- .../units/systems/information/shannon.hpp | 4 +- .../si/codata/physico-chemical_constants.hpp | 24 +- .../boost/boost/unordered/detail/allocate.hpp | 1128 - .../boost/boost/unordered/detail/buckets.hpp | 928 - .../boost/unordered/detail/equivalent.hpp | 686 - .../boost/unordered/detail/extract_key.hpp | 188 - 3party/boost/boost/unordered/detail/fwd.hpp | 46 +- .../boost/unordered/detail/implementation.hpp | 4986 ++++ 3party/boost/boost/unordered/detail/map.hpp | 107 + 3party/boost/boost/unordered/detail/set.hpp | 105 + 3party/boost/boost/unordered/detail/table.hpp | 873 - .../boost/boost/unordered/detail/unique.hpp | 628 - 3party/boost/boost/unordered/detail/util.hpp | 266 - .../boost/boost/unordered/unordered_map.hpp | 3275 ++- .../boost/unordered/unordered_map_fwd.hpp | 80 +- .../boost/boost/unordered/unordered_set.hpp | 2871 +- .../boost/unordered/unordered_set_fwd.hpp | 76 +- 3party/boost/boost/utility.hpp | 4 +- .../boost/boost/utility/base_from_member.hpp | 13 +- .../boost/boost/utility/compare_pointees.hpp | 12 +- 3party/boost/boost/utility/declval.hpp | 33 +- 3party/boost/boost/utility/string_ref.hpp | 67 +- 3party/boost/boost/utility/string_view.hpp | 690 + .../boost/boost/utility/string_view_fwd.hpp | 39 + 3party/boost/boost/uuid/detail/config.hpp | 22 +- 3party/boost/boost/uuid/detail/uuid_x86.hpp | 34 +- 3party/boost/boost/uuid/random_generator.hpp | 12 +- 3party/boost/boost/uuid/seed_rng.hpp | 17 +- 3party/boost/boost/uuid/uuid_io.hpp | 6 +- 3party/boost/boost/variant.hpp | 14 +- 3party/boost/boost/variant/apply_visitor.hpp | 6 +- .../variant/detail/apply_visitor_binary.hpp | 16 +- .../variant/detail/apply_visitor_delayed.hpp | 10 +- .../variant/detail/apply_visitor_unary.hpp | 14 +- .../boost/variant/detail/backup_holder.hpp | 4 +- .../boost/variant/detail/bool_trait_def.hpp | 30 - .../boost/variant/detail/bool_trait_undef.hpp | 21 - .../boost/variant/detail/cast_storage.hpp | 2 +- 3party/boost/boost/variant/detail/config.hpp | 26 +- .../boost/variant/detail/element_index.hpp | 12 +- .../boost/variant/detail/enable_recursive.hpp | 28 +- .../variant/detail/enable_recursive_fwd.hpp | 6 +- .../boost/variant/detail/forced_return.hpp | 98 +- .../variant/detail/generic_result_type.hpp | 2 +- .../boost/variant/detail/has_result_type.hpp | 5 +- .../boost/variant/detail/initializer.hpp | 34 +- .../variant/detail/make_variant_list.hpp | 8 +- 3party/boost/boost/variant/detail/move.hpp | 8 +- .../detail/multivisitors_cpp11_based.hpp | 21 +- .../detail/multivisitors_cpp14_based.hpp | 5 +- .../multivisitors_preprocessor_based.hpp | 7 +- .../boost/variant/detail/over_sequence.hpp | 2 +- .../boost/boost/variant/detail/substitute.hpp | 26 +- .../boost/variant/detail/substitute_fwd.hpp | 10 +- .../boost/boost/variant/detail/variant_io.hpp | 6 +- .../boost/variant/detail/visitation_impl.hpp | 42 +- 3party/boost/boost/variant/get.hpp | 30 +- 3party/boost/boost/variant/multivisitors.hpp | 2 +- .../boost/boost/variant/polymorphic_get.hpp | 34 +- .../boost/boost/variant/recursive_variant.hpp | 36 +- .../boost/boost/variant/recursive_wrapper.hpp | 6 +- .../boost/variant/recursive_wrapper_fwd.hpp | 41 +- 3party/boost/boost/variant/static_visitor.hpp | 8 +- 3party/boost/boost/variant/variant.hpp | 326 +- 3party/boost/boost/variant/variant_fwd.hpp | 41 +- 3party/boost/boost/variant/visitor_ptr.hpp | 16 +- 3party/boost/boost/version.hpp | 4 +- 3party/boost/boost/vmd/array.hpp | 18 + 3party/boost/boost/vmd/array/to_seq.hpp | 49 + 3party/boost/boost/vmd/array/to_tuple.hpp | 49 + 3party/boost/boost/vmd/assert.hpp | 58 + 3party/boost/boost/vmd/assert_is_array.hpp | 113 + 3party/boost/boost/vmd/assert_is_empty.hpp | 105 + .../boost/boost/vmd/assert_is_identifier.hpp | 158 + 3party/boost/boost/vmd/assert_is_list.hpp | 113 + 3party/boost/boost/vmd/assert_is_number.hpp | 73 + 3party/boost/boost/vmd/assert_is_seq.hpp | 113 + 3party/boost/boost/vmd/assert_is_tuple.hpp | 73 + 3party/boost/boost/vmd/assert_is_type.hpp | 113 + .../boost/vmd/detail/adjust_tuple_type.hpp | 97 + 3party/boost/boost/vmd/detail/array.hpp | 189 + 3party/boost/boost/vmd/detail/assert.hpp | 69 + 3party/boost/boost/vmd/detail/data_equal.hpp | 202 + .../boost/vmd/detail/data_equal_common.hpp | 409 + .../boost/boost/vmd/detail/empty_result.hpp | 12 + 3party/boost/boost/vmd/detail/equal.hpp | 562 + .../boost/boost/vmd/detail/equal_common.hpp | 153 + 3party/boost/boost/vmd/detail/equal_type.hpp | 21 + 3party/boost/boost/vmd/detail/identifier.hpp | 429 + .../boost/vmd/detail/identifier_concat.hpp | 21 + .../boost/vmd/detail/identifier_type.hpp | 118 + 3party/boost/boost/vmd/detail/idprefix.hpp | 14 + 3party/boost/boost/vmd/detail/is_array.hpp | 41 + .../boost/vmd/detail/is_array_common.hpp | 248 + 3party/boost/boost/vmd/detail/is_empty.hpp | 61 + .../boost/boost/vmd/detail/is_empty_array.hpp | 20 + .../boost/boost/vmd/detail/is_empty_tuple.hpp | 74 + 3party/boost/boost/vmd/detail/is_entire.hpp | 23 + .../boost/boost/vmd/detail/is_identifier.hpp | 96 + 3party/boost/boost/vmd/detail/is_list.hpp | 207 + 3party/boost/boost/vmd/detail/is_number.hpp | 38 + 3party/boost/boost/vmd/detail/is_seq.hpp | 27 + 3party/boost/boost/vmd/detail/is_tuple.hpp | 20 + 3party/boost/boost/vmd/detail/is_type.hpp | 57 + .../boost/boost/vmd/detail/is_type_type.hpp | 25 + 3party/boost/boost/vmd/detail/list.hpp | 212 + .../boost/vmd/detail/match_identifier.hpp | 160 + .../vmd/detail/match_identifier_common.hpp | 37 + .../vmd/detail/match_single_identifier.hpp | 16 + 3party/boost/boost/vmd/detail/modifiers.hpp | 104 + 3party/boost/boost/vmd/detail/mods.hpp | 707 + .../boost/vmd/detail/nil_registration.hpp | 13 + 3party/boost/boost/vmd/detail/not_empty.hpp | 20 + .../boost/vmd/detail/number_registration.hpp | 784 + 3party/boost/boost/vmd/detail/only_after.hpp | 37 + 3party/boost/boost/vmd/detail/parens.hpp | 54 + .../boost/boost/vmd/detail/parens_common.hpp | 21 + .../boost/boost/vmd/detail/parens_split.hpp | 24 + .../recurse/data_equal/data_equal_1.hpp | 185 + .../recurse/data_equal/data_equal_10.hpp | 185 + .../recurse/data_equal/data_equal_11.hpp | 185 + .../recurse/data_equal/data_equal_12.hpp | 185 + .../recurse/data_equal/data_equal_13.hpp | 185 + .../recurse/data_equal/data_equal_14.hpp | 185 + .../recurse/data_equal/data_equal_15.hpp | 185 + .../recurse/data_equal/data_equal_16.hpp | 185 + .../recurse/data_equal/data_equal_2.hpp | 185 + .../recurse/data_equal/data_equal_3.hpp | 185 + .../recurse/data_equal/data_equal_4.hpp | 185 + .../recurse/data_equal/data_equal_5.hpp | 185 + .../recurse/data_equal/data_equal_6.hpp | 185 + .../recurse/data_equal/data_equal_7.hpp | 185 + .../recurse/data_equal/data_equal_8.hpp | 185 + .../recurse/data_equal/data_equal_9.hpp | 185 + .../recurse/data_equal/data_equal_headers.hpp | 22 + .../data_equal/data_equal_specific.hpp | 185 + .../vmd/detail/recurse/equal/equal_1.hpp | 282 + .../vmd/detail/recurse/equal/equal_10.hpp | 282 + .../vmd/detail/recurse/equal/equal_11.hpp | 282 + .../vmd/detail/recurse/equal/equal_12.hpp | 282 + .../vmd/detail/recurse/equal/equal_13.hpp | 282 + .../vmd/detail/recurse/equal/equal_14.hpp | 282 + .../vmd/detail/recurse/equal/equal_15.hpp | 282 + .../vmd/detail/recurse/equal/equal_16.hpp | 282 + .../vmd/detail/recurse/equal/equal_2.hpp | 282 + .../vmd/detail/recurse/equal/equal_3.hpp | 282 + .../vmd/detail/recurse/equal/equal_4.hpp | 282 + .../vmd/detail/recurse/equal/equal_5.hpp | 282 + .../vmd/detail/recurse/equal/equal_6.hpp | 282 + .../vmd/detail/recurse/equal/equal_7.hpp | 282 + .../vmd/detail/recurse/equal/equal_8.hpp | 282 + .../vmd/detail/recurse/equal/equal_9.hpp | 282 + .../detail/recurse/equal/equal_headers.hpp | 23 + 3party/boost/boost/vmd/detail/seq.hpp | 236 + .../boost/boost/vmd/detail/sequence_arity.hpp | 66 + .../boost/vmd/detail/sequence_common.hpp | 766 + .../boost/boost/vmd/detail/sequence_elem.hpp | 985 + .../boost/boost/vmd/detail/sequence_enum.hpp | 40 + .../boost/boost/vmd/detail/sequence_size.hpp | 21 + .../boost/vmd/detail/sequence_to_array.hpp | 47 + .../boost/vmd/detail/sequence_to_list.hpp | 47 + .../boost/vmd/detail/sequence_to_seq.hpp | 45 + .../boost/vmd/detail/sequence_to_tuple.hpp | 45 + .../boost/boost/vmd/detail/sequence_type.hpp | 274 + 3party/boost/boost/vmd/detail/setup.hpp | 41 + 3party/boost/boost/vmd/detail/tuple.hpp | 196 + .../boost/vmd/detail/type_registration.hpp | 43 + .../boost/vmd/detail/variadic_pop_front.hpp | 24 + 3party/boost/boost/vmd/elem.hpp | 292 + 3party/boost/boost/vmd/empty.hpp | 41 + 3party/boost/boost/vmd/enum.hpp | 103 + 3party/boost/boost/vmd/equal.hpp | 89 + 3party/boost/boost/vmd/get_type.hpp | 123 + 3party/boost/boost/vmd/identity.hpp | 76 + 3party/boost/boost/vmd/is_array.hpp | 73 + 3party/boost/boost/vmd/is_empty.hpp | 95 + 3party/boost/boost/vmd/is_empty_array.hpp | 98 + 3party/boost/boost/vmd/is_empty_list.hpp | 73 + 3party/boost/boost/vmd/is_identifier.hpp | 117 + 3party/boost/boost/vmd/is_list.hpp | 73 + 3party/boost/boost/vmd/is_multi.hpp | 67 + 3party/boost/boost/vmd/is_number.hpp | 52 + 3party/boost/boost/vmd/is_parens_empty.hpp | 73 + 3party/boost/boost/vmd/is_seq.hpp | 71 + 3party/boost/boost/vmd/is_tuple.hpp | 45 + 3party/boost/boost/vmd/is_type.hpp | 73 + 3party/boost/boost/vmd/is_unary.hpp | 67 + 3party/boost/boost/vmd/list.hpp | 18 + 3party/boost/boost/vmd/list/to_seq.hpp | 49 + 3party/boost/boost/vmd/list/to_tuple.hpp | 49 + 3party/boost/boost/vmd/not_equal.hpp | 94 + 3party/boost/boost/vmd/seq.hpp | 26 + 3party/boost/boost/vmd/seq/is_vmd_seq.hpp | 56 + 3party/boost/boost/vmd/seq/pop_back.hpp | 51 + 3party/boost/boost/vmd/seq/pop_front.hpp | 51 + 3party/boost/boost/vmd/seq/push_back.hpp | 53 + 3party/boost/boost/vmd/seq/push_front.hpp | 53 + 3party/boost/boost/vmd/seq/remove.hpp | 57 + 3party/boost/boost/vmd/seq/size.hpp | 52 + 3party/boost/boost/vmd/seq/to_array.hpp | 52 + 3party/boost/boost/vmd/seq/to_list.hpp | 65 + 3party/boost/boost/vmd/seq/to_tuple.hpp | 49 + 3party/boost/boost/vmd/size.hpp | 57 + 3party/boost/boost/vmd/to_array.hpp | 101 + 3party/boost/boost/vmd/to_list.hpp | 101 + 3party/boost/boost/vmd/to_seq.hpp | 101 + 3party/boost/boost/vmd/to_tuple.hpp | 101 + 3party/boost/boost/vmd/tuple.hpp | 26 + 3party/boost/boost/vmd/tuple/is_vmd_tuple.hpp | 56 + 3party/boost/boost/vmd/tuple/pop_back.hpp | 73 + 3party/boost/boost/vmd/tuple/pop_front.hpp | 73 + 3party/boost/boost/vmd/tuple/push_back.hpp | 53 + 3party/boost/boost/vmd/tuple/push_front.hpp | 53 + 3party/boost/boost/vmd/tuple/remove.hpp | 84 + 3party/boost/boost/vmd/tuple/size.hpp | 52 + 3party/boost/boost/vmd/tuple/to_array.hpp | 52 + 3party/boost/boost/vmd/tuple/to_list.hpp | 52 + 3party/boost/boost/vmd/tuple/to_seq.hpp | 49 + 3party/boost/boost/vmd/vmd.hpp | 54 + .../boost/libs/filesystem/src/operations.cpp | 349 +- 3party/boost/libs/filesystem/src/path.cpp | 240 +- .../filesystem/src/windows_file_codecvt.hpp | 12 +- .../boost/libs/iostreams/src/mapped_file.cpp | 64 +- 4870 files changed, 328183 insertions(+), 75959 deletions(-) delete mode 100644 3party/boost/TODO_OMIM.txt create mode 100644 3party/boost/boost/algorithm/is_palindrome.hpp create mode 100644 3party/boost/boost/algorithm/sort_subrange.hpp create mode 100644 3party/boost/boost/align/align_down.hpp create mode 100644 3party/boost/boost/align/align_up.hpp delete mode 100644 3party/boost/boost/align/detail/address.hpp create mode 100644 3party/boost/boost/align/detail/align_down.hpp create mode 100644 3party/boost/boost/align/detail/align_up.hpp rename 3party/boost/boost/align/detail/{remove_traits.hpp => element_type.hpp} (67%) delete mode 100644 3party/boost/boost/align/detail/max_count_of.hpp create mode 100644 3party/boost/boost/align/detail/max_objects.hpp create mode 100644 3party/boost/boost/align/detail/max_size.hpp delete mode 100644 3party/boost/boost/align/detail/offset_object.hpp delete mode 100644 3party/boost/boost/archive/add_facet.hpp delete mode 100644 3party/boost/boost/archive/iterators/head_iterator.hpp create mode 100644 3party/boost/boost/asio/detail/memory.hpp create mode 100644 3party/boost/boost/asio/detail/std_fenced_block.hpp rename 3party/boost/boost/asio/detail/{wince_thread.hpp => winapi_thread.hpp} (62%) create mode 100644 3party/boost/boost/atomic/detail/bitwise_cast.hpp delete mode 100644 3party/boost/boost/atomic/detail/casts.hpp create mode 100644 3party/boost/boost/compute.hpp create mode 100644 3party/boost/boost/compute/algorithm.hpp create mode 100644 3party/boost/boost/compute/algorithm/accumulate.hpp create mode 100644 3party/boost/boost/compute/algorithm/adjacent_difference.hpp create mode 100644 3party/boost/boost/compute/algorithm/adjacent_find.hpp create mode 100644 3party/boost/boost/compute/algorithm/all_of.hpp create mode 100644 3party/boost/boost/compute/algorithm/any_of.hpp create mode 100644 3party/boost/boost/compute/algorithm/binary_search.hpp create mode 100644 3party/boost/boost/compute/algorithm/copy.hpp create mode 100644 3party/boost/boost/compute/algorithm/copy_if.hpp create mode 100644 3party/boost/boost/compute/algorithm/copy_n.hpp create mode 100644 3party/boost/boost/compute/algorithm/count.hpp create mode 100644 3party/boost/boost/compute/algorithm/count_if.hpp create mode 100644 3party/boost/boost/compute/algorithm/detail/balanced_path.hpp create mode 100644 3party/boost/boost/compute/algorithm/detail/binary_find.hpp create mode 100644 3party/boost/boost/compute/algorithm/detail/compact.hpp create mode 100644 3party/boost/boost/compute/algorithm/detail/copy_on_device.hpp create mode 100644 3party/boost/boost/compute/algorithm/detail/copy_to_device.hpp create mode 100644 3party/boost/boost/compute/algorithm/detail/copy_to_host.hpp create mode 100644 3party/boost/boost/compute/algorithm/detail/count_if_with_ballot.hpp create mode 100644 3party/boost/boost/compute/algorithm/detail/count_if_with_reduce.hpp create mode 100644 3party/boost/boost/compute/algorithm/detail/count_if_with_threads.hpp create mode 100644 3party/boost/boost/compute/algorithm/detail/find_extrema.hpp create mode 100644 3party/boost/boost/compute/algorithm/detail/find_extrema_on_cpu.hpp create mode 100644 3party/boost/boost/compute/algorithm/detail/find_extrema_with_atomics.hpp create mode 100644 3party/boost/boost/compute/algorithm/detail/find_extrema_with_reduce.hpp create mode 100644 3party/boost/boost/compute/algorithm/detail/find_if_with_atomics.hpp create mode 100644 3party/boost/boost/compute/algorithm/detail/inplace_reduce.hpp create mode 100644 3party/boost/boost/compute/algorithm/detail/insertion_sort.hpp create mode 100644 3party/boost/boost/compute/algorithm/detail/merge_path.hpp create mode 100644 3party/boost/boost/compute/algorithm/detail/merge_sort_on_cpu.hpp create mode 100644 3party/boost/boost/compute/algorithm/detail/merge_sort_on_gpu.hpp create mode 100644 3party/boost/boost/compute/algorithm/detail/merge_with_merge_path.hpp create mode 100644 3party/boost/boost/compute/algorithm/detail/radix_sort.hpp create mode 100644 3party/boost/boost/compute/algorithm/detail/random_fill.hpp create mode 100644 3party/boost/boost/compute/algorithm/detail/reduce_by_key.hpp create mode 100644 3party/boost/boost/compute/algorithm/detail/reduce_by_key_with_scan.hpp create mode 100644 3party/boost/boost/compute/algorithm/detail/reduce_on_cpu.hpp create mode 100644 3party/boost/boost/compute/algorithm/detail/reduce_on_gpu.hpp create mode 100644 3party/boost/boost/compute/algorithm/detail/scan.hpp create mode 100644 3party/boost/boost/compute/algorithm/detail/scan_on_cpu.hpp create mode 100644 3party/boost/boost/compute/algorithm/detail/scan_on_gpu.hpp create mode 100644 3party/boost/boost/compute/algorithm/detail/search_all.hpp create mode 100644 3party/boost/boost/compute/algorithm/detail/serial_accumulate.hpp create mode 100644 3party/boost/boost/compute/algorithm/detail/serial_count_if.hpp create mode 100644 3party/boost/boost/compute/algorithm/detail/serial_find_extrema.hpp create mode 100644 3party/boost/boost/compute/algorithm/detail/serial_merge.hpp create mode 100644 3party/boost/boost/compute/algorithm/detail/serial_reduce.hpp create mode 100644 3party/boost/boost/compute/algorithm/detail/serial_reduce_by_key.hpp create mode 100644 3party/boost/boost/compute/algorithm/detail/serial_scan.hpp create mode 100644 3party/boost/boost/compute/algorithm/equal.hpp create mode 100644 3party/boost/boost/compute/algorithm/equal_range.hpp create mode 100644 3party/boost/boost/compute/algorithm/exclusive_scan.hpp create mode 100644 3party/boost/boost/compute/algorithm/fill.hpp create mode 100644 3party/boost/boost/compute/algorithm/fill_n.hpp create mode 100644 3party/boost/boost/compute/algorithm/find.hpp create mode 100644 3party/boost/boost/compute/algorithm/find_end.hpp create mode 100644 3party/boost/boost/compute/algorithm/find_if.hpp create mode 100644 3party/boost/boost/compute/algorithm/find_if_not.hpp create mode 100644 3party/boost/boost/compute/algorithm/for_each.hpp create mode 100644 3party/boost/boost/compute/algorithm/for_each_n.hpp create mode 100644 3party/boost/boost/compute/algorithm/gather.hpp create mode 100644 3party/boost/boost/compute/algorithm/generate.hpp create mode 100644 3party/boost/boost/compute/algorithm/generate_n.hpp create mode 100644 3party/boost/boost/compute/algorithm/includes.hpp create mode 100644 3party/boost/boost/compute/algorithm/inclusive_scan.hpp create mode 100644 3party/boost/boost/compute/algorithm/inner_product.hpp create mode 100644 3party/boost/boost/compute/algorithm/inplace_merge.hpp create mode 100644 3party/boost/boost/compute/algorithm/iota.hpp create mode 100644 3party/boost/boost/compute/algorithm/is_partitioned.hpp create mode 100644 3party/boost/boost/compute/algorithm/is_permutation.hpp create mode 100644 3party/boost/boost/compute/algorithm/is_sorted.hpp create mode 100644 3party/boost/boost/compute/algorithm/lexicographical_compare.hpp create mode 100644 3party/boost/boost/compute/algorithm/lower_bound.hpp create mode 100644 3party/boost/boost/compute/algorithm/max_element.hpp create mode 100644 3party/boost/boost/compute/algorithm/merge.hpp create mode 100644 3party/boost/boost/compute/algorithm/min_element.hpp create mode 100644 3party/boost/boost/compute/algorithm/minmax_element.hpp create mode 100644 3party/boost/boost/compute/algorithm/mismatch.hpp create mode 100644 3party/boost/boost/compute/algorithm/next_permutation.hpp create mode 100644 3party/boost/boost/compute/algorithm/none_of.hpp create mode 100644 3party/boost/boost/compute/algorithm/nth_element.hpp create mode 100644 3party/boost/boost/compute/algorithm/partial_sum.hpp create mode 100644 3party/boost/boost/compute/algorithm/partition.hpp create mode 100644 3party/boost/boost/compute/algorithm/partition_copy.hpp create mode 100644 3party/boost/boost/compute/algorithm/partition_point.hpp create mode 100644 3party/boost/boost/compute/algorithm/prev_permutation.hpp create mode 100644 3party/boost/boost/compute/algorithm/random_shuffle.hpp create mode 100644 3party/boost/boost/compute/algorithm/reduce.hpp create mode 100644 3party/boost/boost/compute/algorithm/reduce_by_key.hpp create mode 100644 3party/boost/boost/compute/algorithm/remove.hpp create mode 100644 3party/boost/boost/compute/algorithm/remove_if.hpp create mode 100644 3party/boost/boost/compute/algorithm/replace.hpp create mode 100644 3party/boost/boost/compute/algorithm/replace_copy.hpp create mode 100644 3party/boost/boost/compute/algorithm/reverse.hpp create mode 100644 3party/boost/boost/compute/algorithm/reverse_copy.hpp create mode 100644 3party/boost/boost/compute/algorithm/rotate.hpp create mode 100644 3party/boost/boost/compute/algorithm/rotate_copy.hpp create mode 100644 3party/boost/boost/compute/algorithm/scatter.hpp create mode 100644 3party/boost/boost/compute/algorithm/scatter_if.hpp create mode 100644 3party/boost/boost/compute/algorithm/search.hpp create mode 100644 3party/boost/boost/compute/algorithm/search_n.hpp create mode 100644 3party/boost/boost/compute/algorithm/set_difference.hpp create mode 100644 3party/boost/boost/compute/algorithm/set_intersection.hpp create mode 100644 3party/boost/boost/compute/algorithm/set_symmetric_difference.hpp create mode 100644 3party/boost/boost/compute/algorithm/set_union.hpp create mode 100644 3party/boost/boost/compute/algorithm/sort.hpp create mode 100644 3party/boost/boost/compute/algorithm/sort_by_key.hpp create mode 100644 3party/boost/boost/compute/algorithm/stable_partition.hpp create mode 100644 3party/boost/boost/compute/algorithm/stable_sort.hpp create mode 100644 3party/boost/boost/compute/algorithm/stable_sort_by_key.hpp create mode 100644 3party/boost/boost/compute/algorithm/swap_ranges.hpp create mode 100644 3party/boost/boost/compute/algorithm/transform.hpp create mode 100644 3party/boost/boost/compute/algorithm/transform_if.hpp create mode 100644 3party/boost/boost/compute/algorithm/transform_reduce.hpp create mode 100644 3party/boost/boost/compute/algorithm/unique.hpp create mode 100644 3party/boost/boost/compute/algorithm/unique_copy.hpp create mode 100644 3party/boost/boost/compute/algorithm/upper_bound.hpp create mode 100644 3party/boost/boost/compute/allocator.hpp create mode 100644 3party/boost/boost/compute/allocator/buffer_allocator.hpp create mode 100644 3party/boost/boost/compute/allocator/pinned_allocator.hpp create mode 100644 3party/boost/boost/compute/async.hpp create mode 100644 3party/boost/boost/compute/async/future.hpp create mode 100644 3party/boost/boost/compute/async/wait.hpp create mode 100644 3party/boost/boost/compute/async/wait_guard.hpp create mode 100644 3party/boost/boost/compute/buffer.hpp create mode 100644 3party/boost/boost/compute/cl.hpp create mode 100644 3party/boost/boost/compute/cl_ext.hpp create mode 100644 3party/boost/boost/compute/closure.hpp create mode 100644 3party/boost/boost/compute/command_queue.hpp create mode 100644 3party/boost/boost/compute/config.hpp create mode 100644 3party/boost/boost/compute/container.hpp create mode 100644 3party/boost/boost/compute/container/array.hpp create mode 100644 3party/boost/boost/compute/container/basic_string.hpp create mode 100644 3party/boost/boost/compute/container/detail/scalar.hpp create mode 100644 3party/boost/boost/compute/container/dynamic_bitset.hpp create mode 100644 3party/boost/boost/compute/container/flat_map.hpp create mode 100644 3party/boost/boost/compute/container/flat_set.hpp create mode 100644 3party/boost/boost/compute/container/mapped_view.hpp create mode 100644 3party/boost/boost/compute/container/stack.hpp create mode 100644 3party/boost/boost/compute/container/string.hpp create mode 100644 3party/boost/boost/compute/container/valarray.hpp create mode 100644 3party/boost/boost/compute/container/vector.hpp create mode 100644 3party/boost/boost/compute/context.hpp create mode 100644 3party/boost/boost/compute/core.hpp create mode 100644 3party/boost/boost/compute/detail/assert_cl_success.hpp create mode 100644 3party/boost/boost/compute/detail/buffer_value.hpp create mode 100644 3party/boost/boost/compute/detail/device_ptr.hpp create mode 100644 3party/boost/boost/compute/detail/diagnostic.hpp create mode 100644 3party/boost/boost/compute/detail/duration.hpp create mode 100644 3party/boost/boost/compute/detail/get_object_info.hpp create mode 100644 3party/boost/boost/compute/detail/getenv.hpp create mode 100644 3party/boost/boost/compute/detail/global_static.hpp create mode 100644 3party/boost/boost/compute/detail/is_buffer_iterator.hpp create mode 100644 3party/boost/boost/compute/detail/is_contiguous_iterator.hpp create mode 100644 3party/boost/boost/compute/detail/iterator_plus_distance.hpp create mode 100644 3party/boost/boost/compute/detail/iterator_range_size.hpp create mode 100644 3party/boost/boost/compute/detail/iterator_traits.hpp create mode 100644 3party/boost/boost/compute/detail/literal.hpp create mode 100644 3party/boost/boost/compute/detail/lru_cache.hpp create mode 100644 3party/boost/boost/compute/detail/meta_kernel.hpp create mode 100644 3party/boost/boost/compute/detail/mpl_vector_to_tuple.hpp create mode 100644 3party/boost/boost/compute/detail/nvidia_compute_capability.hpp create mode 100644 3party/boost/boost/compute/detail/parameter_cache.hpp create mode 100644 3party/boost/boost/compute/detail/path.hpp create mode 100644 3party/boost/boost/compute/detail/print_range.hpp create mode 100644 3party/boost/boost/compute/detail/read_write_single_value.hpp create mode 100644 3party/boost/boost/compute/detail/sha1.hpp create mode 100644 3party/boost/boost/compute/detail/variadic_macros.hpp create mode 100644 3party/boost/boost/compute/detail/vendor.hpp create mode 100644 3party/boost/boost/compute/detail/work_size.hpp create mode 100644 3party/boost/boost/compute/device.hpp create mode 100644 3party/boost/boost/compute/event.hpp create mode 100644 3party/boost/boost/compute/exception.hpp create mode 100644 3party/boost/boost/compute/exception/context_error.hpp create mode 100644 3party/boost/boost/compute/exception/no_device_found.hpp create mode 100644 3party/boost/boost/compute/exception/opencl_error.hpp create mode 100644 3party/boost/boost/compute/exception/unsupported_extension_error.hpp create mode 100644 3party/boost/boost/compute/experimental/clamp_range.hpp create mode 100644 3party/boost/boost/compute/experimental/malloc.hpp create mode 100644 3party/boost/boost/compute/experimental/sort_by_transform.hpp create mode 100644 3party/boost/boost/compute/experimental/tabulate.hpp create mode 100644 3party/boost/boost/compute/function.hpp create mode 100644 3party/boost/boost/compute/functional.hpp create mode 100644 3party/boost/boost/compute/functional/as.hpp create mode 100644 3party/boost/boost/compute/functional/atomic.hpp create mode 100644 3party/boost/boost/compute/functional/bind.hpp create mode 100644 3party/boost/boost/compute/functional/common.hpp create mode 100644 3party/boost/boost/compute/functional/convert.hpp create mode 100644 3party/boost/boost/compute/functional/detail/macros.hpp create mode 100644 3party/boost/boost/compute/functional/detail/nvidia_ballot.hpp create mode 100644 3party/boost/boost/compute/functional/detail/nvidia_popcount.hpp create mode 100644 3party/boost/boost/compute/functional/detail/unpack.hpp create mode 100644 3party/boost/boost/compute/functional/field.hpp create mode 100644 3party/boost/boost/compute/functional/geometry.hpp create mode 100644 3party/boost/boost/compute/functional/get.hpp create mode 100644 3party/boost/boost/compute/functional/hash.hpp create mode 100644 3party/boost/boost/compute/functional/identity.hpp create mode 100644 3party/boost/boost/compute/functional/integer.hpp create mode 100644 3party/boost/boost/compute/functional/logical.hpp create mode 100644 3party/boost/boost/compute/functional/math.hpp create mode 100644 3party/boost/boost/compute/functional/operator.hpp create mode 100644 3party/boost/boost/compute/functional/popcount.hpp create mode 100644 3party/boost/boost/compute/functional/relational.hpp create mode 100644 3party/boost/boost/compute/image.hpp create mode 100644 3party/boost/boost/compute/image/image1d.hpp create mode 100644 3party/boost/boost/compute/image/image2d.hpp create mode 100644 3party/boost/boost/compute/image/image3d.hpp create mode 100644 3party/boost/boost/compute/image/image_format.hpp create mode 100644 3party/boost/boost/compute/image/image_object.hpp create mode 100644 3party/boost/boost/compute/image/image_sampler.hpp create mode 100644 3party/boost/boost/compute/image2d.hpp create mode 100644 3party/boost/boost/compute/image3d.hpp create mode 100644 3party/boost/boost/compute/image_format.hpp create mode 100644 3party/boost/boost/compute/image_sampler.hpp create mode 100644 3party/boost/boost/compute/interop/eigen.hpp create mode 100644 3party/boost/boost/compute/interop/eigen/core.hpp create mode 100644 3party/boost/boost/compute/interop/opencv.hpp create mode 100644 3party/boost/boost/compute/interop/opencv/core.hpp create mode 100644 3party/boost/boost/compute/interop/opencv/highgui.hpp create mode 100644 3party/boost/boost/compute/interop/opencv/ocl.hpp create mode 100644 3party/boost/boost/compute/interop/opengl.hpp create mode 100644 3party/boost/boost/compute/interop/opengl/acquire.hpp create mode 100644 3party/boost/boost/compute/interop/opengl/cl_gl.hpp create mode 100644 3party/boost/boost/compute/interop/opengl/cl_gl_ext.hpp create mode 100644 3party/boost/boost/compute/interop/opengl/context.hpp create mode 100644 3party/boost/boost/compute/interop/opengl/gl.hpp create mode 100644 3party/boost/boost/compute/interop/opengl/opengl_buffer.hpp create mode 100644 3party/boost/boost/compute/interop/opengl/opengl_renderbuffer.hpp create mode 100644 3party/boost/boost/compute/interop/opengl/opengl_texture.hpp create mode 100644 3party/boost/boost/compute/interop/qt.hpp create mode 100644 3party/boost/boost/compute/interop/qt/qimage.hpp create mode 100644 3party/boost/boost/compute/interop/qt/qpoint.hpp create mode 100644 3party/boost/boost/compute/interop/qt/qpointf.hpp create mode 100644 3party/boost/boost/compute/interop/qt/qtcore.hpp create mode 100644 3party/boost/boost/compute/interop/qt/qtgui.hpp create mode 100644 3party/boost/boost/compute/interop/qt/qvector.hpp create mode 100644 3party/boost/boost/compute/interop/vtk.hpp create mode 100644 3party/boost/boost/compute/interop/vtk/bounds.hpp create mode 100644 3party/boost/boost/compute/interop/vtk/data_array.hpp create mode 100644 3party/boost/boost/compute/interop/vtk/matrix4x4.hpp create mode 100644 3party/boost/boost/compute/interop/vtk/points.hpp create mode 100644 3party/boost/boost/compute/iterator.hpp create mode 100644 3party/boost/boost/compute/iterator/buffer_iterator.hpp create mode 100644 3party/boost/boost/compute/iterator/constant_buffer_iterator.hpp create mode 100644 3party/boost/boost/compute/iterator/constant_iterator.hpp create mode 100644 3party/boost/boost/compute/iterator/counting_iterator.hpp create mode 100644 3party/boost/boost/compute/iterator/detail/get_base_iterator_buffer.hpp create mode 100644 3party/boost/boost/compute/iterator/detail/swizzle_iterator.hpp create mode 100644 3party/boost/boost/compute/iterator/discard_iterator.hpp create mode 100644 3party/boost/boost/compute/iterator/function_input_iterator.hpp create mode 100644 3party/boost/boost/compute/iterator/permutation_iterator.hpp create mode 100644 3party/boost/boost/compute/iterator/strided_iterator.hpp create mode 100644 3party/boost/boost/compute/iterator/transform_iterator.hpp create mode 100644 3party/boost/boost/compute/iterator/zip_iterator.hpp create mode 100644 3party/boost/boost/compute/kernel.hpp create mode 100644 3party/boost/boost/compute/lambda.hpp create mode 100644 3party/boost/boost/compute/lambda/context.hpp create mode 100644 3party/boost/boost/compute/lambda/functional.hpp create mode 100644 3party/boost/boost/compute/lambda/get.hpp create mode 100644 3party/boost/boost/compute/lambda/make_pair.hpp create mode 100644 3party/boost/boost/compute/lambda/make_tuple.hpp create mode 100644 3party/boost/boost/compute/lambda/placeholder.hpp create mode 100644 3party/boost/boost/compute/lambda/placeholders.hpp create mode 100644 3party/boost/boost/compute/lambda/result_of.hpp create mode 100644 3party/boost/boost/compute/memory.hpp create mode 100644 3party/boost/boost/compute/memory/local_buffer.hpp create mode 100644 3party/boost/boost/compute/memory/svm_ptr.hpp create mode 100644 3party/boost/boost/compute/memory_object.hpp create mode 100644 3party/boost/boost/compute/pipe.hpp create mode 100644 3party/boost/boost/compute/platform.hpp create mode 100644 3party/boost/boost/compute/program.hpp create mode 100644 3party/boost/boost/compute/random.hpp create mode 100644 3party/boost/boost/compute/random/bernoulli_distribution.hpp create mode 100644 3party/boost/boost/compute/random/default_random_engine.hpp create mode 100644 3party/boost/boost/compute/random/discrete_distribution.hpp create mode 100644 3party/boost/boost/compute/random/linear_congruential_engine.hpp create mode 100644 3party/boost/boost/compute/random/mersenne_twister_engine.hpp create mode 100644 3party/boost/boost/compute/random/normal_distribution.hpp create mode 100644 3party/boost/boost/compute/random/threefry_engine.hpp create mode 100644 3party/boost/boost/compute/random/uniform_int_distribution.hpp create mode 100644 3party/boost/boost/compute/random/uniform_real_distribution.hpp create mode 100644 3party/boost/boost/compute/source.hpp create mode 100644 3party/boost/boost/compute/svm.hpp create mode 100644 3party/boost/boost/compute/system.hpp create mode 100644 3party/boost/boost/compute/type_traits.hpp create mode 100644 3party/boost/boost/compute/type_traits/common_type.hpp create mode 100644 3party/boost/boost/compute/type_traits/detail/capture_traits.hpp create mode 100644 3party/boost/boost/compute/type_traits/is_device_iterator.hpp create mode 100644 3party/boost/boost/compute/type_traits/is_fundamental.hpp create mode 100644 3party/boost/boost/compute/type_traits/is_vector_type.hpp create mode 100644 3party/boost/boost/compute/type_traits/make_vector_type.hpp create mode 100644 3party/boost/boost/compute/type_traits/result_of.hpp create mode 100644 3party/boost/boost/compute/type_traits/scalar_type.hpp create mode 100644 3party/boost/boost/compute/type_traits/type_definition.hpp create mode 100644 3party/boost/boost/compute/type_traits/type_name.hpp create mode 100644 3party/boost/boost/compute/type_traits/vector_size.hpp create mode 100644 3party/boost/boost/compute/types.hpp create mode 100644 3party/boost/boost/compute/types/builtin.hpp create mode 100644 3party/boost/boost/compute/types/complex.hpp create mode 100644 3party/boost/boost/compute/types/fundamental.hpp create mode 100644 3party/boost/boost/compute/types/pair.hpp create mode 100644 3party/boost/boost/compute/types/struct.hpp create mode 100644 3party/boost/boost/compute/types/tuple.hpp create mode 100644 3party/boost/boost/compute/user_event.hpp create mode 100644 3party/boost/boost/compute/utility.hpp create mode 100644 3party/boost/boost/compute/utility/dim.hpp create mode 100644 3party/boost/boost/compute/utility/extents.hpp create mode 100644 3party/boost/boost/compute/utility/invoke.hpp create mode 100644 3party/boost/boost/compute/utility/program_cache.hpp create mode 100644 3party/boost/boost/compute/utility/source.hpp create mode 100644 3party/boost/boost/compute/utility/wait_list.hpp create mode 100644 3party/boost/boost/compute/version.hpp create mode 100644 3party/boost/boost/compute/wait_list.hpp create mode 100644 3party/boost/boost/config/platform/cloudabi.hpp create mode 100644 3party/boost/boost/container/detail/block_list.hpp create mode 100644 3party/boost/boost/container/detail/block_slist.hpp create mode 100644 3party/boost/boost/container/detail/dispatch_uses_allocator.hpp create mode 100644 3party/boost/boost/container/detail/dlmalloc.hpp delete mode 100644 3party/boost/boost/container/detail/hash_table.hpp create mode 100644 3party/boost/boost/container/detail/is_sorted.hpp create mode 100644 3party/boost/boost/container/detail/pool_resource.hpp create mode 100644 3party/boost/boost/container/node_handle.hpp create mode 100644 3party/boost/boost/container/pmr/deque.hpp create mode 100644 3party/boost/boost/container/pmr/flat_map.hpp create mode 100644 3party/boost/boost/container/pmr/flat_set.hpp create mode 100644 3party/boost/boost/container/pmr/global_resource.hpp create mode 100644 3party/boost/boost/container/pmr/list.hpp create mode 100644 3party/boost/boost/container/pmr/map.hpp create mode 100644 3party/boost/boost/container/pmr/memory_resource.hpp create mode 100644 3party/boost/boost/container/pmr/monotonic_buffer_resource.hpp create mode 100644 3party/boost/boost/container/pmr/polymorphic_allocator.hpp create mode 100644 3party/boost/boost/container/pmr/pool_options.hpp create mode 100644 3party/boost/boost/container/pmr/resource_adaptor.hpp create mode 100644 3party/boost/boost/container/pmr/set.hpp create mode 100644 3party/boost/boost/container/pmr/slist.hpp create mode 100644 3party/boost/boost/container/pmr/small_vector.hpp create mode 100644 3party/boost/boost/container/pmr/stable_vector.hpp create mode 100644 3party/boost/boost/container/pmr/string.hpp create mode 100644 3party/boost/boost/container/pmr/synchronized_pool_resource.hpp create mode 100644 3party/boost/boost/container/pmr/unsynchronized_pool_resource.hpp create mode 100644 3party/boost/boost/container/pmr/vector.hpp create mode 100644 3party/boost/boost/container/uses_allocator.hpp create mode 100644 3party/boost/boost/container/uses_allocator_fwd.hpp create mode 100644 3party/boost/boost/context/continuation.hpp create mode 100644 3party/boost/boost/context/detail/apply.hpp create mode 100644 3party/boost/boost/context/detail/disable_overload.hpp create mode 100644 3party/boost/boost/context/detail/exception.hpp create mode 100644 3party/boost/boost/context/detail/exchange.hpp rename 3party/boost/boost/context/{ => detail}/fcontext.hpp (55%) create mode 100644 3party/boost/boost/context/detail/index_sequence.hpp create mode 100644 3party/boost/boost/context/detail/tuple.hpp delete mode 100644 3party/boost/boost/context/execution_context.ipp create mode 100644 3party/boost/boost/context/execution_context_v1.hpp create mode 100644 3party/boost/boost/context/execution_context_v2.hpp create mode 100644 3party/boost/boost/context/execution_context_v2_void.ipp delete mode 100644 3party/boost/boost/context/execution_context_winfib.ipp create mode 100644 3party/boost/boost/context/flags.hpp create mode 100644 3party/boost/boost/context/pooled_fixedsize_stack.hpp create mode 100644 3party/boost/boost/context/posix/fixedsize_stack.hpp create mode 100644 3party/boost/boost/context/preallocated.hpp create mode 100644 3party/boost/boost/context/windows/fixedsize_stack.hpp create mode 100644 3party/boost/boost/coroutine/detail/data.hpp create mode 100644 3party/boost/boost/coroutine2/detail/create_control_block.ipp create mode 100644 3party/boost/boost/coroutine2/detail/decay_copy.hpp create mode 100644 3party/boost/boost/coroutine2/detail/disable_overload.hpp delete mode 100644 3party/boost/boost/coroutine2/detail/pull_control_block.hpp delete mode 100644 3party/boost/boost/coroutine2/detail/pull_control_block.ipp create mode 100644 3party/boost/boost/coroutine2/detail/pull_control_block_cc.hpp create mode 100644 3party/boost/boost/coroutine2/detail/pull_control_block_cc.ipp create mode 100644 3party/boost/boost/coroutine2/detail/pull_control_block_ecv1.hpp create mode 100644 3party/boost/boost/coroutine2/detail/pull_control_block_ecv1.ipp delete mode 100644 3party/boost/boost/coroutine2/detail/push_control_block.ipp create mode 100644 3party/boost/boost/coroutine2/detail/push_control_block_cc.hpp create mode 100644 3party/boost/boost/coroutine2/detail/push_control_block_cc.ipp rename 3party/boost/boost/coroutine2/detail/{push_control_block.hpp => push_control_block_ecv1.hpp} (58%) create mode 100644 3party/boost/boost/coroutine2/detail/push_control_block_ecv1.ipp create mode 100644 3party/boost/boost/coroutine2/detail/wrap.hpp create mode 100644 3party/boost/boost/coroutine2/pooled_fixedsize_stack.hpp delete mode 100644 3party/boost/boost/detail/winapi/LocalFree.hpp create mode 100644 3party/boost/boost/detail/winapi/access_rights.hpp create mode 100644 3party/boost/boost/detail/winapi/apc.hpp create mode 100644 3party/boost/boost/detail/winapi/character_code_conversion.hpp create mode 100644 3party/boost/boost/detail/winapi/condition_variable.hpp create mode 100644 3party/boost/boost/detail/winapi/critical_section.hpp create mode 100644 3party/boost/boost/detail/winapi/dbghelp.hpp create mode 100644 3party/boost/boost/detail/winapi/detail/cast_ptr.hpp create mode 100644 3party/boost/boost/detail/winapi/environment.hpp create mode 100644 3party/boost/boost/detail/winapi/error_codes.hpp create mode 100644 3party/boost/boost/detail/winapi/event.hpp create mode 100644 3party/boost/boost/detail/winapi/file_mapping.hpp create mode 100644 3party/boost/boost/detail/winapi/get_current_process.hpp create mode 100644 3party/boost/boost/detail/winapi/get_current_process_id.hpp create mode 100644 3party/boost/boost/detail/winapi/get_current_thread.hpp create mode 100644 3party/boost/boost/detail/winapi/get_current_thread_id.hpp create mode 100644 3party/boost/boost/detail/winapi/get_last_error.hpp create mode 100644 3party/boost/boost/detail/winapi/get_process_times.hpp create mode 100644 3party/boost/boost/detail/winapi/get_system_directory.hpp create mode 100644 3party/boost/boost/detail/winapi/get_thread_times.hpp create mode 100644 3party/boost/boost/detail/winapi/handle_info.hpp create mode 100644 3party/boost/boost/detail/winapi/heap_memory.hpp create mode 100644 3party/boost/boost/detail/winapi/init_once.hpp create mode 100644 3party/boost/boost/detail/winapi/jobs.hpp create mode 100644 3party/boost/boost/detail/winapi/limits.hpp create mode 100644 3party/boost/boost/detail/winapi/local_memory.hpp create mode 100644 3party/boost/boost/detail/winapi/mutex.hpp create mode 100644 3party/boost/boost/detail/winapi/overlapped.hpp create mode 100644 3party/boost/boost/detail/winapi/page_protection_flags.hpp create mode 100644 3party/boost/boost/detail/winapi/pipes.hpp create mode 100644 3party/boost/boost/detail/winapi/priority_class.hpp create mode 100644 3party/boost/boost/detail/winapi/semaphore.hpp create mode 100644 3party/boost/boost/detail/winapi/shell.hpp create mode 100644 3party/boost/boost/detail/winapi/show_window.hpp create mode 100644 3party/boost/boost/detail/winapi/srw_lock.hpp create mode 100644 3party/boost/boost/detail/winapi/wait.hpp create mode 100644 3party/boost/boost/dll.hpp create mode 100644 3party/boost/boost/dll/alias.hpp create mode 100644 3party/boost/boost/dll/detail/aggressive_ptr_cast.hpp create mode 100644 3party/boost/boost/dll/detail/ctor_dtor.hpp create mode 100644 3party/boost/boost/dll/detail/demangling/demangle_symbol.hpp create mode 100644 3party/boost/boost/dll/detail/demangling/itanium.hpp create mode 100644 3party/boost/boost/dll/detail/demangling/mangled_storage_base.hpp create mode 100644 3party/boost/boost/dll/detail/demangling/msvc.hpp create mode 100644 3party/boost/boost/dll/detail/elf_info.hpp create mode 100644 3party/boost/boost/dll/detail/get_mem_fn_type.hpp create mode 100644 3party/boost/boost/dll/detail/import_mangled_helpers.hpp create mode 100644 3party/boost/boost/dll/detail/macho_info.hpp create mode 100644 3party/boost/boost/dll/detail/pe_info.hpp create mode 100644 3party/boost/boost/dll/detail/posix/path_from_handle.hpp create mode 100644 3party/boost/boost/dll/detail/posix/program_location_impl.hpp create mode 100644 3party/boost/boost/dll/detail/posix/shared_library_impl.hpp create mode 100644 3party/boost/boost/dll/detail/system_error.hpp create mode 100644 3party/boost/boost/dll/detail/type_info.hpp create mode 100644 3party/boost/boost/dll/detail/windows/path_from_handle.hpp create mode 100644 3party/boost/boost/dll/detail/windows/shared_library_impl.hpp create mode 100644 3party/boost/boost/dll/detail/x_info_interface.hpp create mode 100644 3party/boost/boost/dll/import.hpp create mode 100644 3party/boost/boost/dll/import_class.hpp create mode 100644 3party/boost/boost/dll/import_mangled.hpp create mode 100644 3party/boost/boost/dll/library_info.hpp create mode 100644 3party/boost/boost/dll/runtime_symbol_info.hpp create mode 100644 3party/boost/boost/dll/shared_library.hpp create mode 100644 3party/boost/boost/dll/shared_library_load_mode.hpp create mode 100644 3party/boost/boost/dll/smart_library.hpp create mode 100644 3party/boost/boost/dynamic_bitset/serialization.hpp create mode 100644 3party/boost/boost/exception/detail/shared_ptr.hpp create mode 100644 3party/boost/boost/fiber/algo/algorithm.hpp create mode 100644 3party/boost/boost/fiber/algo/round_robin.hpp create mode 100644 3party/boost/boost/fiber/algo/shared_work.hpp create mode 100644 3party/boost/boost/fiber/algo/work_stealing.hpp create mode 100644 3party/boost/boost/fiber/all.hpp create mode 100644 3party/boost/boost/fiber/barrier.hpp create mode 100644 3party/boost/boost/fiber/buffered_channel.hpp create mode 100644 3party/boost/boost/fiber/channel_op_status.hpp create mode 100644 3party/boost/boost/fiber/condition_variable.hpp create mode 100644 3party/boost/boost/fiber/context.hpp create mode 100644 3party/boost/boost/fiber/detail/config.hpp create mode 100644 3party/boost/boost/fiber/detail/context_spinlock_queue.hpp create mode 100644 3party/boost/boost/fiber/detail/context_spmc_queue.hpp create mode 100644 3party/boost/boost/fiber/detail/convert.hpp create mode 100644 3party/boost/boost/fiber/detail/cpu_relax.hpp create mode 100644 3party/boost/boost/fiber/detail/data.hpp create mode 100644 3party/boost/boost/fiber/detail/decay_copy.hpp create mode 100644 3party/boost/boost/fiber/detail/disable_overload.hpp create mode 100644 3party/boost/boost/fiber/detail/fss.hpp create mode 100644 3party/boost/boost/fiber/detail/futex.hpp create mode 100644 3party/boost/boost/fiber/detail/spinlock.hpp create mode 100644 3party/boost/boost/fiber/detail/spinlock_ttas.hpp create mode 100644 3party/boost/boost/fiber/detail/spinlock_ttas_adaptive.hpp create mode 100644 3party/boost/boost/fiber/detail/spinlock_ttas_adaptive_futex.hpp create mode 100644 3party/boost/boost/fiber/detail/spinlock_ttas_futex.hpp create mode 100644 3party/boost/boost/fiber/detail/wrap.hpp create mode 100644 3party/boost/boost/fiber/exceptions.hpp create mode 100644 3party/boost/boost/fiber/fiber.hpp create mode 100644 3party/boost/boost/fiber/fixedsize_stack.hpp create mode 100644 3party/boost/boost/fiber/fss.hpp create mode 100644 3party/boost/boost/fiber/future.hpp create mode 100644 3party/boost/boost/fiber/future/async.hpp create mode 100644 3party/boost/boost/fiber/future/detail/shared_state.hpp create mode 100644 3party/boost/boost/fiber/future/detail/shared_state_object.hpp create mode 100644 3party/boost/boost/fiber/future/detail/task_base.hpp create mode 100644 3party/boost/boost/fiber/future/detail/task_object.hpp create mode 100644 3party/boost/boost/fiber/future/future.hpp create mode 100644 3party/boost/boost/fiber/future/future_status.hpp create mode 100644 3party/boost/boost/fiber/future/packaged_task.hpp create mode 100644 3party/boost/boost/fiber/future/promise.hpp create mode 100644 3party/boost/boost/fiber/mutex.hpp create mode 100644 3party/boost/boost/fiber/operations.hpp create mode 100644 3party/boost/boost/fiber/policy.hpp create mode 100644 3party/boost/boost/fiber/pooled_fixedsize_stack.hpp create mode 100644 3party/boost/boost/fiber/properties.hpp create mode 100644 3party/boost/boost/fiber/protected_fixedsize_stack.hpp create mode 100644 3party/boost/boost/fiber/recursive_mutex.hpp create mode 100644 3party/boost/boost/fiber/recursive_timed_mutex.hpp create mode 100644 3party/boost/boost/fiber/scheduler.hpp create mode 100644 3party/boost/boost/fiber/segmented_stack.hpp create mode 100644 3party/boost/boost/fiber/timed_mutex.hpp create mode 100644 3party/boost/boost/fiber/type.hpp create mode 100644 3party/boost/boost/fiber/unbuffered_channel.hpp create mode 100644 3party/boost/boost/filesystem/detail/macro_value.hpp create mode 100644 3party/boost/boost/filesystem/string_file.hpp create mode 100644 3party/boost/boost/fusion/adapted/std_array.hpp create mode 100644 3party/boost/boost/fusion/adapted/std_array/detail/array_size.hpp create mode 100644 3party/boost/boost/fusion/adapted/std_array/detail/at_impl.hpp create mode 100644 3party/boost/boost/fusion/adapted/std_array/detail/begin_impl.hpp create mode 100644 3party/boost/boost/fusion/adapted/std_array/detail/category_of_impl.hpp create mode 100644 3party/boost/boost/fusion/adapted/std_array/detail/end_impl.hpp create mode 100644 3party/boost/boost/fusion/adapted/std_array/detail/is_sequence_impl.hpp create mode 100644 3party/boost/boost/fusion/adapted/std_array/detail/is_view_impl.hpp create mode 100644 3party/boost/boost/fusion/adapted/std_array/detail/size_impl.hpp create mode 100644 3party/boost/boost/fusion/adapted/std_array/detail/value_at_impl.hpp create mode 100644 3party/boost/boost/fusion/adapted/std_array/std_array_iterator.hpp create mode 100644 3party/boost/boost/fusion/adapted/std_array/tag_of.hpp create mode 100644 3party/boost/boost/fusion/container/vector/detail/config.hpp create mode 100644 3party/boost/boost/fusion/support/detail/and.hpp create mode 100644 3party/boost/boost/fusion/support/detail/is_same_size.hpp delete mode 100644 3party/boost/boost/fusion/support/detail/result_of.hpp delete mode 100644 3party/boost/boost/geometry/algorithms/detail/andoyer_inverse.hpp create mode 100644 3party/boost/boost/geometry/algorithms/detail/direction_code.hpp create mode 100644 3party/boost/boost/geometry/algorithms/detail/expand_by_epsilon.hpp create mode 100644 3party/boost/boost/geometry/algorithms/detail/is_valid/has_invalid_coordinate.hpp create mode 100644 3party/boost/boost/geometry/algorithms/detail/overlay/aggregate_operations.hpp create mode 100644 3party/boost/boost/geometry/algorithms/detail/overlay/cluster_info.hpp create mode 100644 3party/boost/boost/geometry/algorithms/detail/overlay/handle_colocations.hpp delete mode 100644 3party/boost/boost/geometry/algorithms/detail/overlay/handle_tangencies.hpp create mode 100644 3party/boost/boost/geometry/algorithms/detail/overlay/inconsistent_turns_exception.hpp create mode 100644 3party/boost/boost/geometry/algorithms/detail/overlay/less_by_segment_ratio.hpp create mode 100644 3party/boost/boost/geometry/algorithms/detail/overlay/sort_by_side.hpp create mode 100644 3party/boost/boost/geometry/algorithms/detail/overlay/traversal.hpp create mode 100644 3party/boost/boost/geometry/algorithms/detail/overlay/traversal_ring_creator.hpp create mode 100644 3party/boost/boost/geometry/algorithms/detail/overlay/traversal_switch_detector.hpp delete mode 100644 3party/boost/boost/geometry/algorithms/detail/result_inverse.hpp delete mode 100644 3party/boost/boost/geometry/algorithms/detail/thomas_inverse.hpp create mode 100644 3party/boost/boost/geometry/arithmetic/cross_product.hpp create mode 100644 3party/boost/boost/geometry/arithmetic/normalize.hpp create mode 100644 3party/boost/boost/geometry/formulas/andoyer_inverse.hpp create mode 100644 3party/boost/boost/geometry/formulas/area_formulas.hpp create mode 100644 3party/boost/boost/geometry/formulas/differential_quantities.hpp create mode 100644 3party/boost/boost/geometry/formulas/eccentricity_sqr.hpp rename 3party/boost/boost/geometry/{algorithms/detail => formulas}/flattening.hpp (78%) create mode 100644 3party/boost/boost/geometry/formulas/geographic.hpp create mode 100644 3party/boost/boost/geometry/formulas/gnomonic_intersection.hpp create mode 100644 3party/boost/boost/geometry/formulas/gnomonic_spheroid.hpp create mode 100644 3party/boost/boost/geometry/formulas/result_direct.hpp create mode 100644 3party/boost/boost/geometry/formulas/result_inverse.hpp create mode 100644 3party/boost/boost/geometry/formulas/sjoberg_intersection.hpp create mode 100644 3party/boost/boost/geometry/formulas/spherical.hpp create mode 100644 3party/boost/boost/geometry/formulas/thomas_direct.hpp create mode 100644 3party/boost/boost/geometry/formulas/thomas_inverse.hpp create mode 100644 3party/boost/boost/geometry/formulas/vertex_latitude.hpp rename 3party/boost/boost/geometry/{algorithms/detail => formulas}/vincenty_direct.hpp (72%) rename 3party/boost/boost/geometry/{algorithms/detail => formulas}/vincenty_inverse.hpp (64%) create mode 100644 3party/boost/boost/geometry/geometries/adapted/std_array.hpp create mode 100644 3party/boost/boost/geometry/index/detail/algorithms/nth_element.hpp create mode 100644 3party/boost/boost/geometry/index/detail/is_bounding_geometry.hpp create mode 100644 3party/boost/boost/geometry/index/detail/is_indexable.hpp create mode 100644 3party/boost/boost/geometry/io/svg/write.hpp delete mode 100644 3party/boost/boost/geometry/strategies/agnostic/relate.hpp create mode 100644 3party/boost/boost/geometry/strategies/azimuth.hpp create mode 100644 3party/boost/boost/geometry/strategies/cartesian/azimuth.hpp create mode 100644 3party/boost/boost/geometry/strategies/cartesian/disjoint_segment_box.hpp create mode 100644 3party/boost/boost/geometry/strategies/cartesian/envelope_segment.hpp rename 3party/boost/boost/geometry/strategies/cartesian/{cart_intersect.hpp => intersection.hpp} (58%) create mode 100644 3party/boost/boost/geometry/strategies/disjoint.hpp create mode 100644 3party/boost/boost/geometry/strategies/envelope.hpp create mode 100644 3party/boost/boost/geometry/strategies/geographic/area.hpp create mode 100644 3party/boost/boost/geometry/strategies/geographic/azimuth.hpp create mode 100644 3party/boost/boost/geometry/strategies/geographic/distance.hpp create mode 100644 3party/boost/boost/geometry/strategies/geographic/envelope_segment.hpp create mode 100644 3party/boost/boost/geometry/strategies/geographic/intersection.hpp create mode 100644 3party/boost/boost/geometry/strategies/geographic/intersection_elliptic.hpp create mode 100644 3party/boost/boost/geometry/strategies/geographic/parameters.hpp create mode 100644 3party/boost/boost/geometry/strategies/geographic/side.hpp delete mode 100644 3party/boost/boost/geometry/strategies/geographic/side_detail.hpp create mode 100644 3party/boost/boost/geometry/strategies/intersection_strategies.hpp create mode 100644 3party/boost/boost/geometry/strategies/relate.hpp create mode 100644 3party/boost/boost/geometry/strategies/spherical/area.hpp delete mode 100644 3party/boost/boost/geometry/strategies/spherical/area_huiller.hpp create mode 100644 3party/boost/boost/geometry/strategies/spherical/azimuth.hpp create mode 100644 3party/boost/boost/geometry/strategies/spherical/envelope_segment.hpp create mode 100644 3party/boost/boost/geometry/strategies/spherical/intersection.hpp create mode 100644 3party/boost/boost/geometry/util/has_infinite_coordinate.hpp create mode 100644 3party/boost/boost/geometry/util/has_nan_coordinate.hpp create mode 100644 3party/boost/boost/geometry/util/has_non_finite_coordinate.hpp create mode 100644 3party/boost/boost/hana.hpp create mode 100644 3party/boost/boost/hana/accessors.hpp create mode 100644 3party/boost/boost/hana/adapt_adt.hpp create mode 100644 3party/boost/boost/hana/adapt_struct.hpp create mode 100644 3party/boost/boost/hana/adjust.hpp create mode 100644 3party/boost/boost/hana/adjust_if.hpp create mode 100644 3party/boost/boost/hana/all.hpp create mode 100644 3party/boost/boost/hana/all_of.hpp create mode 100644 3party/boost/boost/hana/and.hpp create mode 100644 3party/boost/boost/hana/any.hpp create mode 100644 3party/boost/boost/hana/any_of.hpp create mode 100644 3party/boost/boost/hana/ap.hpp create mode 100644 3party/boost/boost/hana/append.hpp create mode 100644 3party/boost/boost/hana/assert.hpp create mode 100644 3party/boost/boost/hana/at.hpp create mode 100644 3party/boost/boost/hana/at_key.hpp create mode 100644 3party/boost/boost/hana/back.hpp create mode 100644 3party/boost/boost/hana/basic_tuple.hpp create mode 100644 3party/boost/boost/hana/bool.hpp create mode 100644 3party/boost/boost/hana/cartesian_product.hpp create mode 100644 3party/boost/boost/hana/chain.hpp create mode 100644 3party/boost/boost/hana/comparing.hpp create mode 100644 3party/boost/boost/hana/concat.hpp create mode 100644 3party/boost/boost/hana/concept.hpp create mode 100644 3party/boost/boost/hana/concept/applicative.hpp create mode 100644 3party/boost/boost/hana/concept/comonad.hpp create mode 100644 3party/boost/boost/hana/concept/comparable.hpp create mode 100644 3party/boost/boost/hana/concept/constant.hpp create mode 100644 3party/boost/boost/hana/concept/euclidean_ring.hpp create mode 100644 3party/boost/boost/hana/concept/foldable.hpp create mode 100644 3party/boost/boost/hana/concept/functor.hpp create mode 100644 3party/boost/boost/hana/concept/group.hpp create mode 100644 3party/boost/boost/hana/concept/hashable.hpp create mode 100644 3party/boost/boost/hana/concept/integral_constant.hpp create mode 100644 3party/boost/boost/hana/concept/iterable.hpp create mode 100644 3party/boost/boost/hana/concept/logical.hpp create mode 100644 3party/boost/boost/hana/concept/metafunction.hpp create mode 100644 3party/boost/boost/hana/concept/monad.hpp create mode 100644 3party/boost/boost/hana/concept/monad_plus.hpp create mode 100644 3party/boost/boost/hana/concept/monoid.hpp create mode 100644 3party/boost/boost/hana/concept/orderable.hpp create mode 100644 3party/boost/boost/hana/concept/product.hpp create mode 100644 3party/boost/boost/hana/concept/ring.hpp create mode 100644 3party/boost/boost/hana/concept/searchable.hpp create mode 100644 3party/boost/boost/hana/concept/sequence.hpp create mode 100644 3party/boost/boost/hana/concept/struct.hpp create mode 100644 3party/boost/boost/hana/config.hpp create mode 100644 3party/boost/boost/hana/contains.hpp create mode 100644 3party/boost/boost/hana/core.hpp create mode 100644 3party/boost/boost/hana/core/common.hpp create mode 100644 3party/boost/boost/hana/core/default.hpp create mode 100644 3party/boost/boost/hana/core/dispatch.hpp create mode 100644 3party/boost/boost/hana/core/is_a.hpp create mode 100644 3party/boost/boost/hana/core/make.hpp create mode 100644 3party/boost/boost/hana/core/tag_of.hpp create mode 100644 3party/boost/boost/hana/core/to.hpp create mode 100644 3party/boost/boost/hana/core/when.hpp create mode 100644 3party/boost/boost/hana/count.hpp create mode 100644 3party/boost/boost/hana/count_if.hpp create mode 100644 3party/boost/boost/hana/cycle.hpp create mode 100644 3party/boost/boost/hana/define_struct.hpp create mode 100644 3party/boost/boost/hana/detail/algorithm.hpp create mode 100644 3party/boost/boost/hana/detail/any_of.hpp create mode 100644 3party/boost/boost/hana/detail/array.hpp create mode 100644 3party/boost/boost/hana/detail/canonical_constant.hpp create mode 100644 3party/boost/boost/hana/detail/concepts.hpp create mode 100644 3party/boost/boost/hana/detail/create.hpp create mode 100644 3party/boost/boost/hana/detail/decay.hpp create mode 100644 3party/boost/boost/hana/detail/dispatch_if.hpp create mode 100644 3party/boost/boost/hana/detail/ebo.hpp create mode 100644 3party/boost/boost/hana/detail/fast_and.hpp create mode 100644 3party/boost/boost/hana/detail/first_unsatisfied_index.hpp create mode 100644 3party/boost/boost/hana/detail/has_common_embedding.hpp create mode 100644 3party/boost/boost/hana/detail/has_duplicates.hpp create mode 100644 3party/boost/boost/hana/detail/hash_table.hpp create mode 100644 3party/boost/boost/hana/detail/index_if.hpp create mode 100644 3party/boost/boost/hana/detail/integral_constant.hpp create mode 100644 3party/boost/boost/hana/detail/intrinsics.hpp create mode 100644 3party/boost/boost/hana/detail/nested_by.hpp create mode 100644 3party/boost/boost/hana/detail/nested_by_fwd.hpp create mode 100644 3party/boost/boost/hana/detail/nested_than.hpp create mode 100644 3party/boost/boost/hana/detail/nested_than_fwd.hpp create mode 100644 3party/boost/boost/hana/detail/nested_to.hpp create mode 100644 3party/boost/boost/hana/detail/nested_to_fwd.hpp create mode 100644 3party/boost/boost/hana/detail/operators/adl.hpp create mode 100644 3party/boost/boost/hana/detail/operators/arithmetic.hpp create mode 100644 3party/boost/boost/hana/detail/operators/comparable.hpp create mode 100644 3party/boost/boost/hana/detail/operators/iterable.hpp create mode 100644 3party/boost/boost/hana/detail/operators/logical.hpp create mode 100644 3party/boost/boost/hana/detail/operators/monad.hpp create mode 100644 3party/boost/boost/hana/detail/operators/orderable.hpp create mode 100644 3party/boost/boost/hana/detail/operators/searchable.hpp create mode 100644 3party/boost/boost/hana/detail/preprocessor.hpp create mode 100644 3party/boost/boost/hana/detail/std_common_type.hpp create mode 100644 3party/boost/boost/hana/detail/struct_macros.erb.hpp create mode 100644 3party/boost/boost/hana/detail/struct_macros.hpp create mode 100644 3party/boost/boost/hana/detail/type_at.hpp create mode 100644 3party/boost/boost/hana/detail/type_foldl1.hpp create mode 100644 3party/boost/boost/hana/detail/type_foldr1.hpp create mode 100644 3party/boost/boost/hana/detail/unpack_flatten.hpp create mode 100644 3party/boost/boost/hana/detail/variadic/at.hpp create mode 100644 3party/boost/boost/hana/detail/variadic/drop_into.hpp create mode 100644 3party/boost/boost/hana/detail/variadic/foldl1.hpp create mode 100644 3party/boost/boost/hana/detail/variadic/foldr1.hpp create mode 100644 3party/boost/boost/hana/detail/variadic/reverse_apply.hpp create mode 100644 3party/boost/boost/hana/detail/variadic/reverse_apply/flat.hpp create mode 100644 3party/boost/boost/hana/detail/variadic/reverse_apply/unrolled.hpp create mode 100644 3party/boost/boost/hana/detail/variadic/split_at.hpp create mode 100644 3party/boost/boost/hana/detail/variadic/take.hpp create mode 100644 3party/boost/boost/hana/detail/void_t.hpp create mode 100644 3party/boost/boost/hana/detail/wrong.hpp create mode 100644 3party/boost/boost/hana/difference.hpp create mode 100644 3party/boost/boost/hana/div.hpp create mode 100644 3party/boost/boost/hana/drop_back.hpp create mode 100644 3party/boost/boost/hana/drop_front.hpp create mode 100644 3party/boost/boost/hana/drop_front_exactly.hpp create mode 100644 3party/boost/boost/hana/drop_while.hpp create mode 100644 3party/boost/boost/hana/duplicate.hpp create mode 100644 3party/boost/boost/hana/empty.hpp create mode 100644 3party/boost/boost/hana/equal.hpp create mode 100644 3party/boost/boost/hana/erase_key.hpp create mode 100644 3party/boost/boost/hana/eval.hpp create mode 100644 3party/boost/boost/hana/eval_if.hpp create mode 100644 3party/boost/boost/hana/experimental/printable.hpp create mode 100644 3party/boost/boost/hana/experimental/type_name.hpp create mode 100644 3party/boost/boost/hana/experimental/types.hpp create mode 100644 3party/boost/boost/hana/experimental/view.hpp create mode 100644 3party/boost/boost/hana/ext/boost.hpp create mode 100644 3party/boost/boost/hana/ext/boost/fusion.hpp create mode 100644 3party/boost/boost/hana/ext/boost/fusion/deque.hpp create mode 100644 3party/boost/boost/hana/ext/boost/fusion/detail/common.hpp create mode 100644 3party/boost/boost/hana/ext/boost/fusion/list.hpp create mode 100644 3party/boost/boost/hana/ext/boost/fusion/tuple.hpp create mode 100644 3party/boost/boost/hana/ext/boost/fusion/vector.hpp create mode 100644 3party/boost/boost/hana/ext/boost/mpl.hpp create mode 100644 3party/boost/boost/hana/ext/boost/mpl/integral_c.hpp create mode 100644 3party/boost/boost/hana/ext/boost/mpl/list.hpp create mode 100644 3party/boost/boost/hana/ext/boost/mpl/vector.hpp create mode 100644 3party/boost/boost/hana/ext/boost/tuple.hpp create mode 100644 3party/boost/boost/hana/ext/std.hpp create mode 100644 3party/boost/boost/hana/ext/std/array.hpp create mode 100644 3party/boost/boost/hana/ext/std/integer_sequence.hpp create mode 100644 3party/boost/boost/hana/ext/std/integral_constant.hpp create mode 100644 3party/boost/boost/hana/ext/std/pair.hpp create mode 100644 3party/boost/boost/hana/ext/std/ratio.hpp create mode 100644 3party/boost/boost/hana/ext/std/tuple.hpp create mode 100644 3party/boost/boost/hana/ext/std/vector.hpp create mode 100644 3party/boost/boost/hana/extend.hpp create mode 100644 3party/boost/boost/hana/extract.hpp create mode 100644 3party/boost/boost/hana/fill.hpp create mode 100644 3party/boost/boost/hana/filter.hpp create mode 100644 3party/boost/boost/hana/find.hpp create mode 100644 3party/boost/boost/hana/find_if.hpp create mode 100644 3party/boost/boost/hana/first.hpp create mode 100644 3party/boost/boost/hana/flatten.hpp create mode 100644 3party/boost/boost/hana/fold.hpp create mode 100644 3party/boost/boost/hana/fold_left.hpp create mode 100644 3party/boost/boost/hana/fold_right.hpp create mode 100644 3party/boost/boost/hana/for_each.hpp create mode 100644 3party/boost/boost/hana/front.hpp create mode 100644 3party/boost/boost/hana/functional.hpp create mode 100644 3party/boost/boost/hana/functional/always.hpp create mode 100644 3party/boost/boost/hana/functional/apply.hpp create mode 100644 3party/boost/boost/hana/functional/arg.hpp create mode 100644 3party/boost/boost/hana/functional/capture.hpp create mode 100644 3party/boost/boost/hana/functional/compose.hpp create mode 100644 3party/boost/boost/hana/functional/curry.hpp create mode 100644 3party/boost/boost/hana/functional/demux.hpp create mode 100644 3party/boost/boost/hana/functional/fix.hpp create mode 100644 3party/boost/boost/hana/functional/flip.hpp create mode 100644 3party/boost/boost/hana/functional/id.hpp create mode 100644 3party/boost/boost/hana/functional/infix.hpp create mode 100644 3party/boost/boost/hana/functional/iterate.hpp create mode 100644 3party/boost/boost/hana/functional/lockstep.hpp create mode 100644 3party/boost/boost/hana/functional/on.hpp create mode 100644 3party/boost/boost/hana/functional/overload.hpp create mode 100644 3party/boost/boost/hana/functional/overload_linearly.hpp create mode 100644 3party/boost/boost/hana/functional/partial.hpp create mode 100644 3party/boost/boost/hana/functional/placeholder.hpp create mode 100644 3party/boost/boost/hana/functional/reverse_partial.hpp create mode 100644 3party/boost/boost/hana/fuse.hpp create mode 100644 3party/boost/boost/hana/fwd/accessors.hpp create mode 100644 3party/boost/boost/hana/fwd/adapt_adt.hpp create mode 100644 3party/boost/boost/hana/fwd/adapt_struct.hpp create mode 100644 3party/boost/boost/hana/fwd/adjust.hpp create mode 100644 3party/boost/boost/hana/fwd/adjust_if.hpp create mode 100644 3party/boost/boost/hana/fwd/all.hpp create mode 100644 3party/boost/boost/hana/fwd/all_of.hpp create mode 100644 3party/boost/boost/hana/fwd/and.hpp create mode 100644 3party/boost/boost/hana/fwd/any.hpp create mode 100644 3party/boost/boost/hana/fwd/any_of.hpp create mode 100644 3party/boost/boost/hana/fwd/ap.hpp create mode 100644 3party/boost/boost/hana/fwd/append.hpp create mode 100644 3party/boost/boost/hana/fwd/at.hpp create mode 100644 3party/boost/boost/hana/fwd/at_key.hpp create mode 100644 3party/boost/boost/hana/fwd/back.hpp create mode 100644 3party/boost/boost/hana/fwd/basic_tuple.hpp create mode 100644 3party/boost/boost/hana/fwd/bool.hpp create mode 100644 3party/boost/boost/hana/fwd/cartesian_product.hpp create mode 100644 3party/boost/boost/hana/fwd/chain.hpp create mode 100644 3party/boost/boost/hana/fwd/comparing.hpp create mode 100644 3party/boost/boost/hana/fwd/concat.hpp create mode 100644 3party/boost/boost/hana/fwd/concept/applicative.hpp create mode 100644 3party/boost/boost/hana/fwd/concept/comonad.hpp create mode 100644 3party/boost/boost/hana/fwd/concept/comparable.hpp create mode 100644 3party/boost/boost/hana/fwd/concept/constant.hpp create mode 100644 3party/boost/boost/hana/fwd/concept/euclidean_ring.hpp create mode 100644 3party/boost/boost/hana/fwd/concept/foldable.hpp create mode 100644 3party/boost/boost/hana/fwd/concept/functor.hpp create mode 100644 3party/boost/boost/hana/fwd/concept/group.hpp create mode 100644 3party/boost/boost/hana/fwd/concept/hashable.hpp create mode 100644 3party/boost/boost/hana/fwd/concept/integral_constant.hpp create mode 100644 3party/boost/boost/hana/fwd/concept/iterable.hpp create mode 100644 3party/boost/boost/hana/fwd/concept/logical.hpp create mode 100644 3party/boost/boost/hana/fwd/concept/metafunction.hpp create mode 100644 3party/boost/boost/hana/fwd/concept/monad.hpp create mode 100644 3party/boost/boost/hana/fwd/concept/monad_plus.hpp create mode 100644 3party/boost/boost/hana/fwd/concept/monoid.hpp create mode 100644 3party/boost/boost/hana/fwd/concept/orderable.hpp create mode 100644 3party/boost/boost/hana/fwd/concept/product.hpp create mode 100644 3party/boost/boost/hana/fwd/concept/ring.hpp create mode 100644 3party/boost/boost/hana/fwd/concept/searchable.hpp create mode 100644 3party/boost/boost/hana/fwd/concept/sequence.hpp create mode 100644 3party/boost/boost/hana/fwd/concept/struct.hpp create mode 100644 3party/boost/boost/hana/fwd/contains.hpp create mode 100644 3party/boost/boost/hana/fwd/core.hpp create mode 100644 3party/boost/boost/hana/fwd/core/common.hpp create mode 100644 3party/boost/boost/hana/fwd/core/default.hpp create mode 100644 3party/boost/boost/hana/fwd/core/is_a.hpp create mode 100644 3party/boost/boost/hana/fwd/core/make.hpp create mode 100644 3party/boost/boost/hana/fwd/core/tag_of.hpp create mode 100644 3party/boost/boost/hana/fwd/core/to.hpp create mode 100644 3party/boost/boost/hana/fwd/core/when.hpp create mode 100644 3party/boost/boost/hana/fwd/count.hpp create mode 100644 3party/boost/boost/hana/fwd/count_if.hpp create mode 100644 3party/boost/boost/hana/fwd/cycle.hpp create mode 100644 3party/boost/boost/hana/fwd/define_struct.hpp create mode 100644 3party/boost/boost/hana/fwd/difference.hpp create mode 100644 3party/boost/boost/hana/fwd/div.hpp create mode 100644 3party/boost/boost/hana/fwd/drop_back.hpp create mode 100644 3party/boost/boost/hana/fwd/drop_front.hpp create mode 100644 3party/boost/boost/hana/fwd/drop_front_exactly.hpp create mode 100644 3party/boost/boost/hana/fwd/drop_while.hpp create mode 100644 3party/boost/boost/hana/fwd/duplicate.hpp create mode 100644 3party/boost/boost/hana/fwd/empty.hpp create mode 100644 3party/boost/boost/hana/fwd/equal.hpp create mode 100644 3party/boost/boost/hana/fwd/erase_key.hpp create mode 100644 3party/boost/boost/hana/fwd/eval.hpp create mode 100644 3party/boost/boost/hana/fwd/eval_if.hpp create mode 100644 3party/boost/boost/hana/fwd/extend.hpp create mode 100644 3party/boost/boost/hana/fwd/extract.hpp create mode 100644 3party/boost/boost/hana/fwd/fill.hpp create mode 100644 3party/boost/boost/hana/fwd/filter.hpp create mode 100644 3party/boost/boost/hana/fwd/find.hpp create mode 100644 3party/boost/boost/hana/fwd/find_if.hpp create mode 100644 3party/boost/boost/hana/fwd/first.hpp create mode 100644 3party/boost/boost/hana/fwd/flatten.hpp create mode 100644 3party/boost/boost/hana/fwd/fold.hpp create mode 100644 3party/boost/boost/hana/fwd/fold_left.hpp create mode 100644 3party/boost/boost/hana/fwd/fold_right.hpp create mode 100644 3party/boost/boost/hana/fwd/for_each.hpp create mode 100644 3party/boost/boost/hana/fwd/front.hpp create mode 100644 3party/boost/boost/hana/fwd/fuse.hpp create mode 100644 3party/boost/boost/hana/fwd/greater.hpp create mode 100644 3party/boost/boost/hana/fwd/greater_equal.hpp create mode 100644 3party/boost/boost/hana/fwd/group.hpp create mode 100644 3party/boost/boost/hana/fwd/hash.hpp create mode 100644 3party/boost/boost/hana/fwd/if.hpp create mode 100644 3party/boost/boost/hana/fwd/insert.hpp create mode 100644 3party/boost/boost/hana/fwd/insert_range.hpp create mode 100644 3party/boost/boost/hana/fwd/integral_constant.hpp create mode 100644 3party/boost/boost/hana/fwd/intersection.hpp create mode 100644 3party/boost/boost/hana/fwd/intersperse.hpp create mode 100644 3party/boost/boost/hana/fwd/is_disjoint.hpp create mode 100644 3party/boost/boost/hana/fwd/is_empty.hpp create mode 100644 3party/boost/boost/hana/fwd/is_subset.hpp create mode 100644 3party/boost/boost/hana/fwd/keys.hpp create mode 100644 3party/boost/boost/hana/fwd/lazy.hpp create mode 100644 3party/boost/boost/hana/fwd/length.hpp create mode 100644 3party/boost/boost/hana/fwd/less.hpp create mode 100644 3party/boost/boost/hana/fwd/less_equal.hpp create mode 100644 3party/boost/boost/hana/fwd/lexicographical_compare.hpp create mode 100644 3party/boost/boost/hana/fwd/lift.hpp create mode 100644 3party/boost/boost/hana/fwd/map.hpp create mode 100644 3party/boost/boost/hana/fwd/max.hpp create mode 100644 3party/boost/boost/hana/fwd/maximum.hpp create mode 100644 3party/boost/boost/hana/fwd/members.hpp create mode 100644 3party/boost/boost/hana/fwd/min.hpp create mode 100644 3party/boost/boost/hana/fwd/minimum.hpp create mode 100644 3party/boost/boost/hana/fwd/minus.hpp create mode 100644 3party/boost/boost/hana/fwd/mod.hpp create mode 100644 3party/boost/boost/hana/fwd/monadic_compose.hpp create mode 100644 3party/boost/boost/hana/fwd/monadic_fold_left.hpp create mode 100644 3party/boost/boost/hana/fwd/monadic_fold_right.hpp create mode 100644 3party/boost/boost/hana/fwd/mult.hpp create mode 100644 3party/boost/boost/hana/fwd/negate.hpp create mode 100644 3party/boost/boost/hana/fwd/none.hpp create mode 100644 3party/boost/boost/hana/fwd/none_of.hpp create mode 100644 3party/boost/boost/hana/fwd/not.hpp create mode 100644 3party/boost/boost/hana/fwd/not_equal.hpp create mode 100644 3party/boost/boost/hana/fwd/one.hpp create mode 100644 3party/boost/boost/hana/fwd/optional.hpp create mode 100644 3party/boost/boost/hana/fwd/or.hpp create mode 100644 3party/boost/boost/hana/fwd/ordering.hpp create mode 100644 3party/boost/boost/hana/fwd/pair.hpp create mode 100644 3party/boost/boost/hana/fwd/partition.hpp create mode 100644 3party/boost/boost/hana/fwd/permutations.hpp create mode 100644 3party/boost/boost/hana/fwd/plus.hpp create mode 100644 3party/boost/boost/hana/fwd/power.hpp create mode 100644 3party/boost/boost/hana/fwd/prefix.hpp create mode 100644 3party/boost/boost/hana/fwd/prepend.hpp create mode 100644 3party/boost/boost/hana/fwd/product.hpp create mode 100644 3party/boost/boost/hana/fwd/range.hpp create mode 100644 3party/boost/boost/hana/fwd/remove.hpp create mode 100644 3party/boost/boost/hana/fwd/remove_at.hpp create mode 100644 3party/boost/boost/hana/fwd/remove_if.hpp create mode 100644 3party/boost/boost/hana/fwd/remove_range.hpp create mode 100644 3party/boost/boost/hana/fwd/repeat.hpp create mode 100644 3party/boost/boost/hana/fwd/replace.hpp create mode 100644 3party/boost/boost/hana/fwd/replace_if.hpp create mode 100644 3party/boost/boost/hana/fwd/replicate.hpp create mode 100644 3party/boost/boost/hana/fwd/reverse.hpp create mode 100644 3party/boost/boost/hana/fwd/reverse_fold.hpp create mode 100644 3party/boost/boost/hana/fwd/scan_left.hpp create mode 100644 3party/boost/boost/hana/fwd/scan_right.hpp create mode 100644 3party/boost/boost/hana/fwd/second.hpp create mode 100644 3party/boost/boost/hana/fwd/set.hpp create mode 100644 3party/boost/boost/hana/fwd/size.hpp create mode 100644 3party/boost/boost/hana/fwd/slice.hpp create mode 100644 3party/boost/boost/hana/fwd/sort.hpp create mode 100644 3party/boost/boost/hana/fwd/span.hpp create mode 100644 3party/boost/boost/hana/fwd/string.hpp create mode 100644 3party/boost/boost/hana/fwd/suffix.hpp create mode 100644 3party/boost/boost/hana/fwd/sum.hpp create mode 100644 3party/boost/boost/hana/fwd/symmetric_difference.hpp create mode 100644 3party/boost/boost/hana/fwd/take_back.hpp create mode 100644 3party/boost/boost/hana/fwd/take_front.hpp create mode 100644 3party/boost/boost/hana/fwd/take_while.hpp create mode 100644 3party/boost/boost/hana/fwd/tap.hpp create mode 100644 3party/boost/boost/hana/fwd/then.hpp create mode 100644 3party/boost/boost/hana/fwd/transform.hpp create mode 100644 3party/boost/boost/hana/fwd/tuple.hpp create mode 100644 3party/boost/boost/hana/fwd/type.hpp create mode 100644 3party/boost/boost/hana/fwd/unfold_left.hpp create mode 100644 3party/boost/boost/hana/fwd/unfold_right.hpp create mode 100644 3party/boost/boost/hana/fwd/union.hpp create mode 100644 3party/boost/boost/hana/fwd/unique.hpp create mode 100644 3party/boost/boost/hana/fwd/unpack.hpp create mode 100644 3party/boost/boost/hana/fwd/value.hpp create mode 100644 3party/boost/boost/hana/fwd/while.hpp create mode 100644 3party/boost/boost/hana/fwd/zero.hpp create mode 100644 3party/boost/boost/hana/fwd/zip.hpp create mode 100644 3party/boost/boost/hana/fwd/zip_shortest.hpp create mode 100644 3party/boost/boost/hana/fwd/zip_shortest_with.hpp create mode 100644 3party/boost/boost/hana/fwd/zip_with.hpp create mode 100644 3party/boost/boost/hana/greater.hpp create mode 100644 3party/boost/boost/hana/greater_equal.hpp create mode 100644 3party/boost/boost/hana/group.hpp create mode 100644 3party/boost/boost/hana/hash.hpp create mode 100644 3party/boost/boost/hana/if.hpp create mode 100644 3party/boost/boost/hana/insert.hpp create mode 100644 3party/boost/boost/hana/insert_range.hpp create mode 100644 3party/boost/boost/hana/integral_constant.hpp create mode 100644 3party/boost/boost/hana/intersection.hpp create mode 100644 3party/boost/boost/hana/intersperse.hpp create mode 100644 3party/boost/boost/hana/is_disjoint.hpp create mode 100644 3party/boost/boost/hana/is_empty.hpp create mode 100644 3party/boost/boost/hana/is_subset.hpp create mode 100644 3party/boost/boost/hana/keys.hpp create mode 100644 3party/boost/boost/hana/lazy.hpp create mode 100644 3party/boost/boost/hana/length.hpp create mode 100644 3party/boost/boost/hana/less.hpp create mode 100644 3party/boost/boost/hana/less_equal.hpp create mode 100644 3party/boost/boost/hana/lexicographical_compare.hpp create mode 100644 3party/boost/boost/hana/lift.hpp create mode 100644 3party/boost/boost/hana/map.hpp create mode 100644 3party/boost/boost/hana/max.hpp create mode 100644 3party/boost/boost/hana/maximum.hpp create mode 100644 3party/boost/boost/hana/members.hpp create mode 100644 3party/boost/boost/hana/min.hpp create mode 100644 3party/boost/boost/hana/minimum.hpp create mode 100644 3party/boost/boost/hana/minus.hpp create mode 100644 3party/boost/boost/hana/mod.hpp create mode 100644 3party/boost/boost/hana/monadic_compose.hpp create mode 100644 3party/boost/boost/hana/monadic_fold_left.hpp create mode 100644 3party/boost/boost/hana/monadic_fold_right.hpp create mode 100644 3party/boost/boost/hana/mult.hpp create mode 100644 3party/boost/boost/hana/negate.hpp create mode 100644 3party/boost/boost/hana/none.hpp create mode 100644 3party/boost/boost/hana/none_of.hpp create mode 100644 3party/boost/boost/hana/not.hpp create mode 100644 3party/boost/boost/hana/not_equal.hpp create mode 100644 3party/boost/boost/hana/one.hpp create mode 100644 3party/boost/boost/hana/optional.hpp create mode 100644 3party/boost/boost/hana/or.hpp create mode 100644 3party/boost/boost/hana/ordering.hpp create mode 100644 3party/boost/boost/hana/pair.hpp create mode 100644 3party/boost/boost/hana/partition.hpp create mode 100644 3party/boost/boost/hana/permutations.hpp create mode 100644 3party/boost/boost/hana/plus.hpp create mode 100644 3party/boost/boost/hana/power.hpp create mode 100644 3party/boost/boost/hana/prefix.hpp create mode 100644 3party/boost/boost/hana/prepend.hpp create mode 100644 3party/boost/boost/hana/product.hpp create mode 100644 3party/boost/boost/hana/range.hpp create mode 100644 3party/boost/boost/hana/remove.hpp create mode 100644 3party/boost/boost/hana/remove_at.hpp create mode 100644 3party/boost/boost/hana/remove_if.hpp create mode 100644 3party/boost/boost/hana/remove_range.hpp create mode 100644 3party/boost/boost/hana/repeat.hpp create mode 100644 3party/boost/boost/hana/replace.hpp create mode 100644 3party/boost/boost/hana/replace_if.hpp create mode 100644 3party/boost/boost/hana/replicate.hpp create mode 100644 3party/boost/boost/hana/reverse.hpp create mode 100644 3party/boost/boost/hana/reverse_fold.hpp create mode 100644 3party/boost/boost/hana/scan_left.hpp create mode 100644 3party/boost/boost/hana/scan_right.hpp create mode 100644 3party/boost/boost/hana/second.hpp create mode 100644 3party/boost/boost/hana/set.hpp create mode 100644 3party/boost/boost/hana/size.hpp create mode 100644 3party/boost/boost/hana/slice.hpp create mode 100644 3party/boost/boost/hana/sort.hpp create mode 100644 3party/boost/boost/hana/span.hpp create mode 100644 3party/boost/boost/hana/string.hpp create mode 100644 3party/boost/boost/hana/suffix.hpp create mode 100644 3party/boost/boost/hana/sum.hpp create mode 100644 3party/boost/boost/hana/symmetric_difference.hpp create mode 100644 3party/boost/boost/hana/take_back.hpp create mode 100644 3party/boost/boost/hana/take_front.hpp create mode 100644 3party/boost/boost/hana/take_while.hpp create mode 100644 3party/boost/boost/hana/tap.hpp create mode 100644 3party/boost/boost/hana/then.hpp create mode 100644 3party/boost/boost/hana/traits.hpp create mode 100644 3party/boost/boost/hana/transform.hpp create mode 100644 3party/boost/boost/hana/tuple.hpp create mode 100644 3party/boost/boost/hana/type.hpp create mode 100644 3party/boost/boost/hana/unfold_left.hpp create mode 100644 3party/boost/boost/hana/unfold_right.hpp create mode 100644 3party/boost/boost/hana/union.hpp create mode 100644 3party/boost/boost/hana/unique.hpp create mode 100644 3party/boost/boost/hana/unpack.hpp create mode 100644 3party/boost/boost/hana/value.hpp create mode 100644 3party/boost/boost/hana/version.hpp create mode 100644 3party/boost/boost/hana/while.hpp create mode 100644 3party/boost/boost/hana/zero.hpp create mode 100644 3party/boost/boost/hana/zip.hpp create mode 100644 3party/boost/boost/hana/zip_shortest.hpp create mode 100644 3party/boost/boost/hana/zip_shortest_with.hpp create mode 100644 3party/boost/boost/hana/zip_with.hpp mode change 100644 => 100755 3party/boost/boost/interprocess/detail/managed_memory_impl.hpp mode change 100644 => 100755 3party/boost/boost/interprocess/detail/managed_multi_shared_memory.hpp mode change 100644 => 100755 3party/boost/boost/interprocess/detail/managed_open_or_create_impl.hpp mode change 100644 => 100755 3party/boost/boost/interprocess/detail/shared_dir_helpers.hpp mode change 100755 => 100644 3party/boost/boost/iostreams/char_traits.hpp mode change 100755 => 100644 3party/boost/boost/iostreams/concepts.hpp mode change 100755 => 100644 3party/boost/boost/iostreams/constants.hpp mode change 100755 => 100644 3party/boost/boost/iostreams/copy.hpp mode change 100755 => 100644 3party/boost/boost/iostreams/detail/access_control.hpp mode change 100755 => 100644 3party/boost/boost/iostreams/detail/adapter/output_iterator_adapter.hpp mode change 100755 => 100644 3party/boost/boost/iostreams/detail/add_facet.hpp mode change 100755 => 100644 3party/boost/boost/iostreams/detail/call_traits.hpp mode change 100755 => 100644 3party/boost/boost/iostreams/detail/char_traits.hpp mode change 100755 => 100644 3party/boost/boost/iostreams/detail/codecvt_holder.hpp mode change 100755 => 100644 3party/boost/boost/iostreams/detail/config/auto_link.hpp mode change 100755 => 100644 3party/boost/boost/iostreams/detail/config/bzip2.hpp mode change 100755 => 100644 3party/boost/boost/iostreams/detail/config/codecvt.hpp mode change 100755 => 100644 3party/boost/boost/iostreams/detail/config/dyn_link.hpp mode change 100755 => 100644 3party/boost/boost/iostreams/detail/config/overload_resolution.hpp mode change 100755 => 100644 3party/boost/boost/iostreams/detail/config/wide_streams.hpp mode change 100755 => 100644 3party/boost/boost/iostreams/detail/config/zlib.hpp mode change 100755 => 100644 3party/boost/boost/iostreams/detail/default_arg.hpp mode change 100755 => 100644 3party/boost/boost/iostreams/detail/dispatch.hpp mode change 100755 => 100644 3party/boost/boost/iostreams/detail/double_object.hpp mode change 100755 => 100644 3party/boost/boost/iostreams/detail/enable_if_stream.hpp mode change 100755 => 100644 3party/boost/boost/iostreams/detail/error.hpp mode change 100755 => 100644 3party/boost/boost/iostreams/detail/execute.hpp mode change 100755 => 100644 3party/boost/boost/iostreams/detail/fstream.hpp mode change 100755 => 100644 3party/boost/boost/iostreams/detail/functional.hpp mode change 100755 => 100644 3party/boost/boost/iostreams/detail/ios.hpp mode change 100755 => 100644 3party/boost/boost/iostreams/detail/iostream.hpp mode change 100755 => 100644 3party/boost/boost/iostreams/detail/newline.hpp mode change 100755 => 100644 3party/boost/boost/iostreams/detail/param_type.hpp mode change 100755 => 100644 3party/boost/boost/iostreams/detail/push.hpp mode change 100755 => 100644 3party/boost/boost/iostreams/detail/select.hpp mode change 100755 => 100644 3party/boost/boost/iostreams/detail/streambuf.hpp mode change 100755 => 100644 3party/boost/boost/iostreams/detail/streambuf/linked_streambuf.hpp mode change 100755 => 100644 3party/boost/boost/iostreams/detail/translate_int_type.hpp delete mode 100755 3party/boost/boost/iostreams/detail/vc6/close.hpp delete mode 100755 3party/boost/boost/iostreams/detail/vc6/read.hpp delete mode 100755 3party/boost/boost/iostreams/detail/vc6/write.hpp mode change 100755 => 100644 3party/boost/boost/iostreams/detail/wrap_unwrap.hpp mode change 100755 => 100644 3party/boost/boost/iostreams/device/array.hpp mode change 100755 => 100644 3party/boost/boost/iostreams/device/back_inserter.hpp mode change 100755 => 100644 3party/boost/boost/iostreams/device/null.hpp mode change 100755 => 100644 3party/boost/boost/iostreams/filter/regex.hpp mode change 100755 => 100644 3party/boost/boost/iostreams/filter/stdio.hpp mode change 100755 => 100644 3party/boost/boost/iostreams/filtering_stream.hpp mode change 100755 => 100644 3party/boost/boost/iostreams/filtering_streambuf.hpp mode change 100755 => 100644 3party/boost/boost/iostreams/flush.hpp mode change 100755 => 100644 3party/boost/boost/iostreams/get.hpp mode change 100755 => 100644 3party/boost/boost/iostreams/imbue.hpp mode change 100755 => 100644 3party/boost/boost/iostreams/input_sequence.hpp mode change 100755 => 100644 3party/boost/boost/iostreams/operations.hpp mode change 100755 => 100644 3party/boost/boost/iostreams/operations_fwd.hpp mode change 100755 => 100644 3party/boost/boost/iostreams/optimal_buffer_size.hpp mode change 100755 => 100644 3party/boost/boost/iostreams/output_sequence.hpp mode change 100755 => 100644 3party/boost/boost/iostreams/pipeline.hpp mode change 100755 => 100644 3party/boost/boost/iostreams/put.hpp mode change 100755 => 100644 3party/boost/boost/iostreams/putback.hpp mode change 100755 => 100644 3party/boost/boost/iostreams/read.hpp mode change 100755 => 100644 3party/boost/boost/iostreams/seek.hpp mode change 100755 => 100644 3party/boost/boost/iostreams/traits_fwd.hpp create mode 100644 3party/boost/boost/locale/generic_codecvt.hpp create mode 100644 3party/boost/boost/locale/utf8_codecvt.hpp delete mode 100644 3party/boost/boost/lockfree/detail/branch_hints.hpp create mode 100644 3party/boost/boost/lockfree/lockfree_forward.hpp rename 3party/boost/boost/log/detail/{spin_mutex.hpp => adaptive_mutex.hpp} (50%) create mode 100644 3party/boost/boost/log/detail/c_str.hpp create mode 100644 3party/boost/boost/log/detail/pause.hpp create mode 100644 3party/boost/boost/log/detail/sfinae_tools.hpp create mode 100644 3party/boost/boost/log/expressions/formatters/max_size_decorator.hpp create mode 100644 3party/boost/boost/log/keywords/block_size.hpp create mode 100644 3party/boost/boost/log/keywords/capacity.hpp create mode 100644 3party/boost/boost/log/keywords/enable_final_rotation.hpp create mode 100644 3party/boost/boost/log/keywords/max_files.hpp create mode 100644 3party/boost/boost/log/keywords/name.hpp create mode 100644 3party/boost/boost/log/keywords/overflow_policy.hpp create mode 100644 3party/boost/boost/log/keywords/permissions.hpp create mode 100644 3party/boost/boost/log/sinks/text_ipc_message_queue_backend.hpp create mode 100644 3party/boost/boost/log/utility/ipc/object_name.hpp create mode 100644 3party/boost/boost/log/utility/ipc/reliable_message_queue.hpp create mode 100644 3party/boost/boost/log/utility/open_mode.hpp create mode 100644 3party/boost/boost/log/utility/permissions.hpp delete mode 100644 3party/boost/boost/log/utility/type_info_wrapper.hpp create mode 100644 3party/boost/boost/math/special_functions/relative_difference.hpp create mode 100644 3party/boost/boost/math/special_functions/ulp.hpp create mode 100644 3party/boost/boost/math/tools/convert_from_string.hpp create mode 100644 3party/boost/boost/metaparse.hpp create mode 100644 3party/boost/boost/metaparse/accept.hpp create mode 100644 3party/boost/boost/metaparse/accept_tag.hpp create mode 100644 3party/boost/boost/metaparse/accept_when.hpp create mode 100644 3party/boost/boost/metaparse/alphanum.hpp create mode 100644 3party/boost/boost/metaparse/always.hpp create mode 100644 3party/boost/boost/metaparse/always_c.hpp create mode 100644 3party/boost/boost/metaparse/build_parser.hpp create mode 100644 3party/boost/boost/metaparse/change_error_message.hpp create mode 100644 3party/boost/boost/metaparse/config.hpp create mode 100644 3party/boost/boost/metaparse/debug_parsing_error.hpp create mode 100644 3party/boost/boost/metaparse/define_error.hpp create mode 100644 3party/boost/boost/metaparse/digit.hpp create mode 100644 3party/boost/boost/metaparse/digit_val.hpp create mode 100644 3party/boost/boost/metaparse/empty.hpp create mode 100644 3party/boost/boost/metaparse/entire_input.hpp create mode 100644 3party/boost/boost/metaparse/error/digit_expected.hpp create mode 100644 3party/boost/boost/metaparse/error/end_of_input_expected.hpp create mode 100644 3party/boost/boost/metaparse/error/index_out_of_range.hpp create mode 100644 3party/boost/boost/metaparse/error/letter_expected.hpp create mode 100644 3party/boost/boost/metaparse/error/literal_expected.hpp create mode 100644 3party/boost/boost/metaparse/error/none_of_the_expected_cases_found.hpp create mode 100644 3party/boost/boost/metaparse/error/unexpected_character.hpp create mode 100644 3party/boost/boost/metaparse/error/unexpected_end_of_input.hpp create mode 100644 3party/boost/boost/metaparse/error/unpaired.hpp create mode 100644 3party/boost/boost/metaparse/error/whitespace_expected.hpp create mode 100644 3party/boost/boost/metaparse/except.hpp create mode 100644 3party/boost/boost/metaparse/fail.hpp create mode 100644 3party/boost/boost/metaparse/fail_at_first_char_expected.hpp create mode 100644 3party/boost/boost/metaparse/fail_tag.hpp create mode 100644 3party/boost/boost/metaparse/first_of.hpp create mode 100644 3party/boost/boost/metaparse/foldl.hpp create mode 100644 3party/boost/boost/metaparse/foldl1.hpp create mode 100644 3party/boost/boost/metaparse/foldl_reject_incomplete.hpp create mode 100644 3party/boost/boost/metaparse/foldl_reject_incomplete1.hpp create mode 100644 3party/boost/boost/metaparse/foldl_reject_incomplete_start_with_parser.hpp create mode 100644 3party/boost/boost/metaparse/foldl_start_with_parser.hpp create mode 100644 3party/boost/boost/metaparse/foldr.hpp create mode 100644 3party/boost/boost/metaparse/foldr1.hpp create mode 100644 3party/boost/boost/metaparse/foldr_reject_incomplete.hpp create mode 100644 3party/boost/boost/metaparse/foldr_reject_incomplete1.hpp create mode 100644 3party/boost/boost/metaparse/foldr_start_with_parser.hpp create mode 100644 3party/boost/boost/metaparse/get_col.hpp create mode 100644 3party/boost/boost/metaparse/get_line.hpp create mode 100644 3party/boost/boost/metaparse/get_message.hpp create mode 100644 3party/boost/boost/metaparse/get_position.hpp create mode 100644 3party/boost/boost/metaparse/get_prev_char.hpp create mode 100644 3party/boost/boost/metaparse/get_remaining.hpp create mode 100644 3party/boost/boost/metaparse/get_result.hpp create mode 100644 3party/boost/boost/metaparse/grammar.hpp create mode 100644 3party/boost/boost/metaparse/if_.hpp create mode 100644 3party/boost/boost/metaparse/int_.hpp create mode 100644 3party/boost/boost/metaparse/is_error.hpp create mode 100644 3party/boost/boost/metaparse/iterate.hpp create mode 100644 3party/boost/boost/metaparse/iterate_c.hpp create mode 100644 3party/boost/boost/metaparse/keyword.hpp create mode 100644 3party/boost/boost/metaparse/last_of.hpp create mode 100644 3party/boost/boost/metaparse/letter.hpp create mode 100644 3party/boost/boost/metaparse/limit_one_char_except_size.hpp create mode 100644 3party/boost/boost/metaparse/limit_one_of_size.hpp create mode 100644 3party/boost/boost/metaparse/limit_sequence_size.hpp create mode 100644 3party/boost/boost/metaparse/limit_string_size.hpp create mode 100644 3party/boost/boost/metaparse/lit.hpp create mode 100644 3party/boost/boost/metaparse/lit_c.hpp create mode 100644 3party/boost/boost/metaparse/look_ahead.hpp create mode 100644 3party/boost/boost/metaparse/middle_of.hpp create mode 100644 3party/boost/boost/metaparse/next_char.hpp create mode 100644 3party/boost/boost/metaparse/next_line.hpp create mode 100644 3party/boost/boost/metaparse/nth_of.hpp create mode 100644 3party/boost/boost/metaparse/nth_of_c.hpp create mode 100644 3party/boost/boost/metaparse/one_char.hpp create mode 100644 3party/boost/boost/metaparse/one_char_except.hpp create mode 100644 3party/boost/boost/metaparse/one_char_except_c.hpp create mode 100644 3party/boost/boost/metaparse/one_of.hpp create mode 100644 3party/boost/boost/metaparse/one_of_c.hpp create mode 100644 3party/boost/boost/metaparse/optional.hpp create mode 100644 3party/boost/boost/metaparse/range.hpp create mode 100644 3party/boost/boost/metaparse/range_c.hpp create mode 100644 3party/boost/boost/metaparse/reject.hpp create mode 100644 3party/boost/boost/metaparse/repeated.hpp create mode 100644 3party/boost/boost/metaparse/repeated1.hpp create mode 100644 3party/boost/boost/metaparse/repeated_one_of.hpp create mode 100644 3party/boost/boost/metaparse/repeated_one_of1.hpp create mode 100644 3party/boost/boost/metaparse/repeated_reject_incomplete.hpp create mode 100644 3party/boost/boost/metaparse/repeated_reject_incomplete1.hpp create mode 100644 3party/boost/boost/metaparse/return_.hpp create mode 100644 3party/boost/boost/metaparse/sequence.hpp create mode 100644 3party/boost/boost/metaparse/sequence_apply.hpp create mode 100644 3party/boost/boost/metaparse/source_position.hpp create mode 100644 3party/boost/boost/metaparse/source_position_tag.hpp create mode 100644 3party/boost/boost/metaparse/space.hpp create mode 100644 3party/boost/boost/metaparse/spaces.hpp create mode 100644 3party/boost/boost/metaparse/start.hpp create mode 100644 3party/boost/boost/metaparse/string.hpp create mode 100644 3party/boost/boost/metaparse/string_tag.hpp create mode 100644 3party/boost/boost/metaparse/token.hpp create mode 100644 3party/boost/boost/metaparse/transform.hpp create mode 100644 3party/boost/boost/metaparse/transform_error.hpp create mode 100644 3party/boost/boost/metaparse/transform_error_message.hpp create mode 100644 3party/boost/boost/metaparse/unless_error.hpp create mode 100644 3party/boost/boost/metaparse/util/digit_to_int.hpp create mode 100644 3party/boost/boost/metaparse/util/digit_to_int_c.hpp create mode 100644 3party/boost/boost/metaparse/util/in_range.hpp create mode 100644 3party/boost/boost/metaparse/util/in_range_c.hpp create mode 100644 3party/boost/boost/metaparse/util/int_to_digit.hpp create mode 100644 3party/boost/boost/metaparse/util/int_to_digit_c.hpp create mode 100644 3party/boost/boost/metaparse/util/is_digit.hpp create mode 100644 3party/boost/boost/metaparse/util/is_lcase_letter.hpp create mode 100644 3party/boost/boost/metaparse/util/is_letter.hpp create mode 100644 3party/boost/boost/metaparse/util/is_ucase_letter.hpp create mode 100644 3party/boost/boost/metaparse/util/is_whitespace.hpp create mode 100644 3party/boost/boost/metaparse/util/is_whitespace_c.hpp create mode 100644 3party/boost/boost/metaparse/v1/accept.hpp create mode 100644 3party/boost/boost/metaparse/v1/accept_tag.hpp create mode 100644 3party/boost/boost/metaparse/v1/accept_when.hpp create mode 100644 3party/boost/boost/metaparse/v1/alphanum.hpp create mode 100644 3party/boost/boost/metaparse/v1/always.hpp create mode 100644 3party/boost/boost/metaparse/v1/always_c.hpp create mode 100644 3party/boost/boost/metaparse/v1/build_parser.hpp create mode 100644 3party/boost/boost/metaparse/v1/change_error_message.hpp create mode 100644 3party/boost/boost/metaparse/v1/debug_parsing_error.hpp create mode 100644 3party/boost/boost/metaparse/v1/define_error.hpp create mode 100644 3party/boost/boost/metaparse/v1/digit.hpp create mode 100644 3party/boost/boost/metaparse/v1/digit_val.hpp create mode 100644 3party/boost/boost/metaparse/v1/empty.hpp create mode 100644 3party/boost/boost/metaparse/v1/entire_input.hpp create mode 100644 3party/boost/boost/metaparse/v1/error/digit_expected.hpp create mode 100644 3party/boost/boost/metaparse/v1/error/end_of_input_expected.hpp create mode 100644 3party/boost/boost/metaparse/v1/error/expected_to_fail.hpp create mode 100644 3party/boost/boost/metaparse/v1/error/index_out_of_range.hpp create mode 100644 3party/boost/boost/metaparse/v1/error/letter_expected.hpp create mode 100644 3party/boost/boost/metaparse/v1/error/literal_expected.hpp create mode 100644 3party/boost/boost/metaparse/v1/error/none_of_the_expected_cases_found.hpp create mode 100644 3party/boost/boost/metaparse/v1/error/unexpected_character.hpp create mode 100644 3party/boost/boost/metaparse/v1/error/unexpected_end_of_input.hpp create mode 100644 3party/boost/boost/metaparse/v1/error/unpaired.hpp create mode 100644 3party/boost/boost/metaparse/v1/error/whitespace_expected.hpp create mode 100644 3party/boost/boost/metaparse/v1/except.hpp create mode 100644 3party/boost/boost/metaparse/v1/fail.hpp create mode 100644 3party/boost/boost/metaparse/v1/fail_at_first_char_expected.hpp create mode 100644 3party/boost/boost/metaparse/v1/fail_tag.hpp create mode 100644 3party/boost/boost/metaparse/v1/first_of.hpp create mode 100644 3party/boost/boost/metaparse/v1/foldl.hpp create mode 100644 3party/boost/boost/metaparse/v1/foldl1.hpp create mode 100644 3party/boost/boost/metaparse/v1/foldl_reject_incomplete.hpp create mode 100644 3party/boost/boost/metaparse/v1/foldl_reject_incomplete1.hpp create mode 100644 3party/boost/boost/metaparse/v1/foldl_reject_incomplete_start_with_parser.hpp create mode 100644 3party/boost/boost/metaparse/v1/foldl_start_with_parser.hpp create mode 100644 3party/boost/boost/metaparse/v1/foldr.hpp create mode 100644 3party/boost/boost/metaparse/v1/foldr1.hpp create mode 100644 3party/boost/boost/metaparse/v1/foldr_reject_incomplete.hpp create mode 100644 3party/boost/boost/metaparse/v1/foldr_reject_incomplete1.hpp create mode 100644 3party/boost/boost/metaparse/v1/foldr_start_with_parser.hpp create mode 100644 3party/boost/boost/metaparse/v1/fwd/accept.hpp create mode 100644 3party/boost/boost/metaparse/v1/fwd/build_parser.hpp create mode 100644 3party/boost/boost/metaparse/v1/fwd/get_col.hpp create mode 100644 3party/boost/boost/metaparse/v1/fwd/get_line.hpp create mode 100644 3party/boost/boost/metaparse/v1/fwd/get_message.hpp create mode 100644 3party/boost/boost/metaparse/v1/fwd/get_position.hpp create mode 100644 3party/boost/boost/metaparse/v1/fwd/get_prev_char.hpp create mode 100644 3party/boost/boost/metaparse/v1/fwd/get_remaining.hpp create mode 100644 3party/boost/boost/metaparse/v1/fwd/get_result.hpp create mode 100644 3party/boost/boost/metaparse/v1/fwd/next_char.hpp create mode 100644 3party/boost/boost/metaparse/v1/fwd/next_line.hpp create mode 100644 3party/boost/boost/metaparse/v1/fwd/reject.hpp create mode 100644 3party/boost/boost/metaparse/v1/fwd/source_position.hpp create mode 100644 3party/boost/boost/metaparse/v1/fwd/string.hpp create mode 100644 3party/boost/boost/metaparse/v1/get_col.hpp create mode 100644 3party/boost/boost/metaparse/v1/get_line.hpp create mode 100644 3party/boost/boost/metaparse/v1/get_message.hpp create mode 100644 3party/boost/boost/metaparse/v1/get_position.hpp create mode 100644 3party/boost/boost/metaparse/v1/get_prev_char.hpp create mode 100644 3party/boost/boost/metaparse/v1/get_remaining.hpp create mode 100644 3party/boost/boost/metaparse/v1/get_result.hpp create mode 100644 3party/boost/boost/metaparse/v1/grammar.hpp create mode 100644 3party/boost/boost/metaparse/v1/if_.hpp create mode 100644 3party/boost/boost/metaparse/v1/impl/apply_parser.hpp create mode 100644 3party/boost/boost/metaparse/v1/impl/assert_string_length.hpp create mode 100644 3party/boost/boost/metaparse/v1/impl/at_c.hpp create mode 100644 3party/boost/boost/metaparse/v1/impl/back_inserter.hpp create mode 100644 3party/boost/boost/metaparse/v1/impl/concat.hpp create mode 100644 3party/boost/boost/metaparse/v1/impl/empty_string.hpp create mode 100644 3party/boost/boost/metaparse/v1/impl/front_inserter.hpp create mode 100644 3party/boost/boost/metaparse/v1/impl/fwd/iterate_impl.hpp create mode 100644 3party/boost/boost/metaparse/v1/impl/has_type.hpp create mode 100644 3party/boost/boost/metaparse/v1/impl/is_any.hpp create mode 100644 3party/boost/boost/metaparse/v1/impl/is_char_c.hpp create mode 100644 3party/boost/boost/metaparse/v1/impl/iterate_impl.hpp create mode 100644 3party/boost/boost/metaparse/v1/impl/iterate_impl_unchecked.hpp create mode 100644 3party/boost/boost/metaparse/v1/impl/later_result.hpp create mode 100644 3party/boost/boost/metaparse/v1/impl/next_digit.hpp create mode 100644 3party/boost/boost/metaparse/v1/impl/no_char.hpp create mode 100644 3party/boost/boost/metaparse/v1/impl/nth_of_c.hpp create mode 100644 3party/boost/boost/metaparse/v1/impl/nth_of_c_impl.hpp create mode 100644 3party/boost/boost/metaparse/v1/impl/one_char_except_not_used.hpp create mode 100644 3party/boost/boost/metaparse/v1/impl/one_of.hpp create mode 100644 3party/boost/boost/metaparse/v1/impl/one_of_fwd_op.hpp create mode 100644 3party/boost/boost/metaparse/v1/impl/pop_back.hpp create mode 100644 3party/boost/boost/metaparse/v1/impl/pop_front.hpp create mode 100644 3party/boost/boost/metaparse/v1/impl/push_back_c.hpp create mode 100644 3party/boost/boost/metaparse/v1/impl/push_front_c.hpp create mode 100644 3party/boost/boost/metaparse/v1/impl/remove_trailing_no_chars.hpp create mode 100644 3party/boost/boost/metaparse/v1/impl/returns.hpp create mode 100644 3party/boost/boost/metaparse/v1/impl/sequence.hpp create mode 100644 3party/boost/boost/metaparse/v1/impl/sequence_impl.hpp create mode 100644 3party/boost/boost/metaparse/v1/impl/size.hpp create mode 100644 3party/boost/boost/metaparse/v1/impl/skip_seq.hpp create mode 100644 3party/boost/boost/metaparse/v1/impl/split_at_c.hpp create mode 100644 3party/boost/boost/metaparse/v1/impl/string.hpp create mode 100644 3party/boost/boost/metaparse/v1/impl/string_at.hpp create mode 100644 3party/boost/boost/metaparse/v1/impl/string_iterator.hpp create mode 100644 3party/boost/boost/metaparse/v1/impl/string_iterator_tag.hpp create mode 100644 3party/boost/boost/metaparse/v1/impl/update_c.hpp create mode 100644 3party/boost/boost/metaparse/v1/impl/void_.hpp create mode 100644 3party/boost/boost/metaparse/v1/int_.hpp create mode 100644 3party/boost/boost/metaparse/v1/is_error.hpp create mode 100644 3party/boost/boost/metaparse/v1/iterate.hpp create mode 100644 3party/boost/boost/metaparse/v1/iterate_c.hpp create mode 100644 3party/boost/boost/metaparse/v1/keyword.hpp create mode 100644 3party/boost/boost/metaparse/v1/last_of.hpp create mode 100644 3party/boost/boost/metaparse/v1/letter.hpp create mode 100644 3party/boost/boost/metaparse/v1/lit.hpp create mode 100644 3party/boost/boost/metaparse/v1/lit_c.hpp create mode 100644 3party/boost/boost/metaparse/v1/look_ahead.hpp create mode 100644 3party/boost/boost/metaparse/v1/middle_of.hpp create mode 100644 3party/boost/boost/metaparse/v1/next_char.hpp create mode 100644 3party/boost/boost/metaparse/v1/next_line.hpp create mode 100644 3party/boost/boost/metaparse/v1/nth_of.hpp create mode 100644 3party/boost/boost/metaparse/v1/nth_of_c.hpp create mode 100644 3party/boost/boost/metaparse/v1/one_char.hpp create mode 100644 3party/boost/boost/metaparse/v1/one_char_except.hpp create mode 100644 3party/boost/boost/metaparse/v1/one_char_except_c.hpp create mode 100644 3party/boost/boost/metaparse/v1/one_of.hpp create mode 100644 3party/boost/boost/metaparse/v1/one_of_c.hpp create mode 100644 3party/boost/boost/metaparse/v1/optional.hpp create mode 100644 3party/boost/boost/metaparse/v1/range.hpp create mode 100644 3party/boost/boost/metaparse/v1/range_c.hpp create mode 100644 3party/boost/boost/metaparse/v1/reject.hpp create mode 100644 3party/boost/boost/metaparse/v1/repeated.hpp create mode 100644 3party/boost/boost/metaparse/v1/repeated1.hpp create mode 100644 3party/boost/boost/metaparse/v1/repeated_one_of.hpp create mode 100644 3party/boost/boost/metaparse/v1/repeated_one_of1.hpp create mode 100644 3party/boost/boost/metaparse/v1/repeated_reject_incomplete.hpp create mode 100644 3party/boost/boost/metaparse/v1/repeated_reject_incomplete1.hpp create mode 100644 3party/boost/boost/metaparse/v1/return_.hpp create mode 100644 3party/boost/boost/metaparse/v1/sequence.hpp create mode 100644 3party/boost/boost/metaparse/v1/sequence_apply.hpp create mode 100644 3party/boost/boost/metaparse/v1/source_position.hpp create mode 100644 3party/boost/boost/metaparse/v1/source_position_tag.hpp create mode 100644 3party/boost/boost/metaparse/v1/space.hpp create mode 100644 3party/boost/boost/metaparse/v1/spaces.hpp create mode 100644 3party/boost/boost/metaparse/v1/start.hpp create mode 100644 3party/boost/boost/metaparse/v1/string.hpp create mode 100644 3party/boost/boost/metaparse/v1/string_tag.hpp create mode 100644 3party/boost/boost/metaparse/v1/swap.hpp create mode 100644 3party/boost/boost/metaparse/v1/token.hpp create mode 100644 3party/boost/boost/metaparse/v1/transform.hpp create mode 100644 3party/boost/boost/metaparse/v1/transform_error.hpp create mode 100644 3party/boost/boost/metaparse/v1/transform_error_message.hpp create mode 100644 3party/boost/boost/metaparse/v1/unless_error.hpp create mode 100644 3party/boost/boost/metaparse/v1/util/digit_to_int.hpp create mode 100644 3party/boost/boost/metaparse/v1/util/digit_to_int_c.hpp create mode 100644 3party/boost/boost/metaparse/v1/util/in_range.hpp create mode 100644 3party/boost/boost/metaparse/v1/util/in_range_c.hpp create mode 100644 3party/boost/boost/metaparse/v1/util/int_to_digit.hpp create mode 100644 3party/boost/boost/metaparse/v1/util/int_to_digit_c.hpp create mode 100644 3party/boost/boost/metaparse/v1/util/is_digit.hpp create mode 100644 3party/boost/boost/metaparse/v1/util/is_lcase_letter.hpp create mode 100644 3party/boost/boost/metaparse/v1/util/is_letter.hpp create mode 100644 3party/boost/boost/metaparse/v1/util/is_ucase_letter.hpp create mode 100644 3party/boost/boost/metaparse/v1/util/is_whitespace.hpp create mode 100644 3party/boost/boost/metaparse/v1/util/is_whitespace_c.hpp create mode 100644 3party/boost/boost/metaparse/version.hpp create mode 100644 3party/boost/boost/move/algo/adaptive_merge.hpp create mode 100644 3party/boost/boost/move/algo/adaptive_sort.hpp create mode 100644 3party/boost/boost/move/algo/detail/adaptive_sort_merge.hpp create mode 100644 3party/boost/boost/move/algo/detail/basic_op.hpp create mode 100644 3party/boost/boost/move/algo/detail/insertion_sort.hpp create mode 100644 3party/boost/boost/move/algo/detail/merge.hpp create mode 100644 3party/boost/boost/move/algo/detail/merge_sort.hpp create mode 100644 3party/boost/boost/move/algo/move.hpp create mode 100644 3party/boost/boost/move/detail/destruct_n.hpp rename 3party/boost/boost/{container/detail/alloc_lib_auto_link.hpp => move/detail/placement_new.hpp} (51%) create mode 100644 3party/boost/boost/move/detail/reverse_iterator.hpp create mode 100644 3party/boost/boost/move/detail/std_ns_begin.hpp create mode 100644 3party/boost/boost/move/detail/std_ns_end.hpp create mode 100644 3party/boost/boost/multi_index/detail/ignore_wstrict_aliasing.hpp create mode 100644 3party/boost/boost/multi_index/detail/restore_wstrict_aliasing.hpp create mode 100644 3party/boost/boost/multiprecision/cpp_int/import_export.hpp create mode 100644 3party/boost/boost/multiprecision/detail/min_max.hpp create mode 100644 3party/boost/boost/multiprecision/traits/is_byte_container.hpp create mode 100644 3party/boost/boost/numeric/odeint/integrate/check_adapter.hpp create mode 100644 3party/boost/boost/numeric/odeint/integrate/max_step_checker.hpp create mode 100644 3party/boost/boost/numeric/odeint/util/odeint_error.hpp create mode 100644 3party/boost/boost/operators_v1.hpp create mode 100644 3party/boost/boost/optional/detail/old_optional_implementation.hpp create mode 100644 3party/boost/boost/optional/detail/optional_aligned_storage.hpp create mode 100644 3party/boost/boost/optional/detail/optional_config.hpp create mode 100644 3party/boost/boost/optional/detail/optional_factory_support.hpp create mode 100644 3party/boost/boost/optional/detail/optional_reference_spec.hpp create mode 100644 3party/boost/boost/optional/detail/optional_relops.hpp create mode 100644 3party/boost/boost/optional/detail/optional_swap.hpp create mode 100644 3party/boost/boost/phoenix/bind/detail/cpp03/bind_function.hpp create mode 100644 3party/boost/boost/phoenix/bind/detail/cpp03/bind_function_object.hpp create mode 100644 3party/boost/boost/phoenix/bind/detail/cpp03/bind_member_function.hpp rename 3party/boost/boost/phoenix/bind/detail/{ => cpp03}/function_ptr.hpp (94%) rename 3party/boost/boost/phoenix/bind/detail/{ => cpp03}/member_function_ptr.hpp (94%) rename 3party/boost/boost/phoenix/bind/{ => detail/cpp03}/preprocessed/bind_function.hpp (65%) rename 3party/boost/boost/phoenix/bind/{ => detail/cpp03}/preprocessed/bind_function_10.hpp (100%) rename 3party/boost/boost/phoenix/bind/{ => detail/cpp03}/preprocessed/bind_function_20.hpp (100%) rename 3party/boost/boost/phoenix/bind/{ => detail/cpp03}/preprocessed/bind_function_30.hpp (100%) rename 3party/boost/boost/phoenix/bind/{ => detail/cpp03}/preprocessed/bind_function_40.hpp (100%) rename 3party/boost/boost/phoenix/bind/{ => detail/cpp03}/preprocessed/bind_function_50.hpp (100%) rename 3party/boost/boost/phoenix/bind/{ => detail/cpp03}/preprocessed/bind_function_object.hpp (63%) rename 3party/boost/boost/phoenix/bind/{ => detail/cpp03}/preprocessed/bind_function_object_10.hpp (100%) rename 3party/boost/boost/phoenix/bind/{ => detail/cpp03}/preprocessed/bind_function_object_20.hpp (100%) rename 3party/boost/boost/phoenix/bind/{ => detail/cpp03}/preprocessed/bind_function_object_30.hpp (100%) rename 3party/boost/boost/phoenix/bind/{ => detail/cpp03}/preprocessed/bind_function_object_40.hpp (100%) rename 3party/boost/boost/phoenix/bind/{ => detail/cpp03}/preprocessed/bind_function_object_50.hpp (100%) rename 3party/boost/boost/phoenix/bind/{ => detail/cpp03}/preprocessed/bind_member_function.hpp (63%) rename 3party/boost/boost/phoenix/bind/{ => detail/cpp03}/preprocessed/bind_member_function_10.hpp (100%) rename 3party/boost/boost/phoenix/bind/{ => detail/cpp03}/preprocessed/bind_member_function_20.hpp (100%) rename 3party/boost/boost/phoenix/bind/{ => detail/cpp03}/preprocessed/bind_member_function_30.hpp (100%) rename 3party/boost/boost/phoenix/bind/{ => detail/cpp03}/preprocessed/bind_member_function_40.hpp (100%) rename 3party/boost/boost/phoenix/bind/{ => detail/cpp03}/preprocessed/bind_member_function_50.hpp (100%) rename 3party/boost/boost/phoenix/bind/detail/{ => cpp03}/preprocessed/function_ptr.hpp (66%) rename 3party/boost/boost/phoenix/bind/detail/{ => cpp03}/preprocessed/function_ptr_10.hpp (100%) rename 3party/boost/boost/phoenix/bind/detail/{ => cpp03}/preprocessed/function_ptr_20.hpp (100%) rename 3party/boost/boost/phoenix/bind/detail/{ => cpp03}/preprocessed/function_ptr_30.hpp (100%) rename 3party/boost/boost/phoenix/bind/detail/{ => cpp03}/preprocessed/function_ptr_40.hpp (100%) rename 3party/boost/boost/phoenix/bind/detail/{ => cpp03}/preprocessed/function_ptr_50.hpp (100%) rename 3party/boost/boost/phoenix/bind/detail/{ => cpp03}/preprocessed/member_function_ptr.hpp (64%) rename 3party/boost/boost/phoenix/bind/detail/{ => cpp03}/preprocessed/member_function_ptr_10.hpp (100%) rename 3party/boost/boost/phoenix/bind/detail/{ => cpp03}/preprocessed/member_function_ptr_20.hpp (100%) rename 3party/boost/boost/phoenix/bind/detail/{ => cpp03}/preprocessed/member_function_ptr_30.hpp (100%) rename 3party/boost/boost/phoenix/bind/detail/{ => cpp03}/preprocessed/member_function_ptr_40.hpp (100%) rename 3party/boost/boost/phoenix/bind/detail/{ => cpp03}/preprocessed/member_function_ptr_50.hpp (100%) rename 3party/boost/boost/phoenix/core/detail/{ => cpp03}/actor_operator.hpp (98%) rename 3party/boost/boost/phoenix/core/detail/{ => cpp03}/actor_result_of.hpp (82%) create mode 100644 3party/boost/boost/phoenix/core/detail/cpp03/assign.hpp rename 3party/boost/boost/phoenix/core/detail/{ => cpp03}/call.hpp (95%) create mode 100644 3party/boost/boost/phoenix/core/detail/cpp03/expression.hpp create mode 100644 3party/boost/boost/phoenix/core/detail/cpp03/function_equal.hpp create mode 100644 3party/boost/boost/phoenix/core/detail/cpp03/function_eval.hpp create mode 100644 3party/boost/boost/phoenix/core/detail/cpp03/function_eval_expr.hpp create mode 100644 3party/boost/boost/phoenix/core/detail/cpp03/phx2_result.hpp rename 3party/boost/boost/phoenix/core/detail/{ => cpp03}/preprocessed/actor_operator.hpp (64%) rename 3party/boost/boost/phoenix/core/detail/{ => cpp03}/preprocessed/actor_operator_10.hpp (100%) rename 3party/boost/boost/phoenix/core/detail/{ => cpp03}/preprocessed/actor_operator_20.hpp (100%) rename 3party/boost/boost/phoenix/core/detail/{ => cpp03}/preprocessed/actor_operator_30.hpp (100%) rename 3party/boost/boost/phoenix/core/detail/{ => cpp03}/preprocessed/actor_operator_40.hpp (100%) rename 3party/boost/boost/phoenix/core/detail/{ => cpp03}/preprocessed/actor_operator_50.hpp (100%) rename 3party/boost/boost/phoenix/core/detail/{ => cpp03}/preprocessed/actor_result_of.hpp (64%) rename 3party/boost/boost/phoenix/core/detail/{ => cpp03}/preprocessed/actor_result_of_10.hpp (95%) rename 3party/boost/boost/phoenix/core/detail/{ => cpp03}/preprocessed/actor_result_of_20.hpp (97%) rename 3party/boost/boost/phoenix/core/detail/{ => cpp03}/preprocessed/actor_result_of_30.hpp (98%) rename 3party/boost/boost/phoenix/core/detail/{ => cpp03}/preprocessed/actor_result_of_40.hpp (99%) rename 3party/boost/boost/phoenix/core/detail/{ => cpp03}/preprocessed/actor_result_of_50.hpp (99%) rename 3party/boost/boost/phoenix/core/{ => detail/cpp03}/preprocessed/argument.hpp (54%) create mode 100644 3party/boost/boost/phoenix/core/detail/cpp03/preprocessed/argument_no_predefined_10.hpp create mode 100644 3party/boost/boost/phoenix/core/detail/cpp03/preprocessed/argument_no_predefined_20.hpp create mode 100644 3party/boost/boost/phoenix/core/detail/cpp03/preprocessed/argument_no_predefined_30.hpp create mode 100644 3party/boost/boost/phoenix/core/detail/cpp03/preprocessed/argument_no_predefined_40.hpp create mode 100644 3party/boost/boost/phoenix/core/detail/cpp03/preprocessed/argument_no_predefined_50.hpp create mode 100644 3party/boost/boost/phoenix/core/detail/cpp03/preprocessed/argument_predefined_10.hpp create mode 100644 3party/boost/boost/phoenix/core/detail/cpp03/preprocessed/argument_predefined_20.hpp create mode 100644 3party/boost/boost/phoenix/core/detail/cpp03/preprocessed/argument_predefined_30.hpp create mode 100644 3party/boost/boost/phoenix/core/detail/cpp03/preprocessed/argument_predefined_40.hpp create mode 100644 3party/boost/boost/phoenix/core/detail/cpp03/preprocessed/argument_predefined_50.hpp rename 3party/boost/boost/phoenix/core/{preprocessed/actor.hpp => detail/cpp03/preprocessed/assign.hpp} (56%) rename 3party/boost/boost/phoenix/core/{preprocessed/actor_10.hpp => detail/cpp03/preprocessed/assign_10.hpp} (100%) rename 3party/boost/boost/phoenix/core/{preprocessed/actor_20.hpp => detail/cpp03/preprocessed/assign_20.hpp} (100%) rename 3party/boost/boost/phoenix/core/{preprocessed/actor_30.hpp => detail/cpp03/preprocessed/assign_30.hpp} (100%) rename 3party/boost/boost/phoenix/core/{preprocessed/actor_40.hpp => detail/cpp03/preprocessed/assign_40.hpp} (100%) rename 3party/boost/boost/phoenix/core/{preprocessed/actor_50.hpp => detail/cpp03/preprocessed/assign_50.hpp} (100%) rename 3party/boost/boost/phoenix/core/detail/{ => cpp03}/preprocessed/call.hpp (67%) rename 3party/boost/boost/phoenix/core/detail/{ => cpp03}/preprocessed/call_10.hpp (99%) rename 3party/boost/boost/phoenix/core/detail/{ => cpp03}/preprocessed/call_20.hpp (99%) rename 3party/boost/boost/phoenix/core/detail/{ => cpp03}/preprocessed/call_30.hpp (99%) rename 3party/boost/boost/phoenix/core/detail/{ => cpp03}/preprocessed/call_40.hpp (99%) rename 3party/boost/boost/phoenix/core/detail/{ => cpp03}/preprocessed/call_50.hpp (99%) rename 3party/boost/boost/phoenix/core/{ => detail/cpp03}/preprocessed/expression.hpp (65%) rename 3party/boost/boost/phoenix/core/{ => detail/cpp03}/preprocessed/expression_10.hpp (94%) rename 3party/boost/boost/phoenix/core/{ => detail/cpp03}/preprocessed/expression_20.hpp (96%) rename 3party/boost/boost/phoenix/core/{ => detail/cpp03}/preprocessed/expression_30.hpp (97%) rename 3party/boost/boost/phoenix/core/{ => detail/cpp03}/preprocessed/expression_40.hpp (97%) rename 3party/boost/boost/phoenix/core/{ => detail/cpp03}/preprocessed/expression_50.hpp (98%) rename 3party/boost/boost/phoenix/core/{ => detail/cpp03}/preprocessed/function_equal.hpp (65%) rename 3party/boost/boost/phoenix/core/{ => detail/cpp03}/preprocessed/function_equal_10.hpp (100%) rename 3party/boost/boost/phoenix/core/{ => detail/cpp03}/preprocessed/function_equal_20.hpp (100%) rename 3party/boost/boost/phoenix/core/{ => detail/cpp03}/preprocessed/function_equal_30.hpp (100%) rename 3party/boost/boost/phoenix/core/{ => detail/cpp03}/preprocessed/function_equal_40.hpp (100%) rename 3party/boost/boost/phoenix/core/{ => detail/cpp03}/preprocessed/function_equal_50.hpp (100%) rename 3party/boost/boost/phoenix/core/detail/{ => cpp03}/preprocessed/function_eval.hpp (65%) rename 3party/boost/boost/phoenix/core/detail/{ => cpp03}/preprocessed/function_eval_10.hpp (76%) rename 3party/boost/boost/phoenix/core/detail/{ => cpp03}/preprocessed/function_eval_20.hpp (79%) rename 3party/boost/boost/phoenix/core/detail/{ => cpp03}/preprocessed/function_eval_30.hpp (79%) rename 3party/boost/boost/phoenix/core/detail/{ => cpp03}/preprocessed/function_eval_40.hpp (79%) rename 3party/boost/boost/phoenix/core/detail/{ => cpp03}/preprocessed/function_eval_50.hpp (79%) create mode 100644 3party/boost/boost/phoenix/core/detail/cpp03/preprocessed/function_eval_expr.hpp create mode 100644 3party/boost/boost/phoenix/core/detail/cpp03/preprocessed/function_eval_expr_10.hpp create mode 100644 3party/boost/boost/phoenix/core/detail/cpp03/preprocessed/function_eval_expr_20.hpp create mode 100644 3party/boost/boost/phoenix/core/detail/cpp03/preprocessed/function_eval_expr_30.hpp create mode 100644 3party/boost/boost/phoenix/core/detail/cpp03/preprocessed/function_eval_expr_40.hpp create mode 100644 3party/boost/boost/phoenix/core/detail/cpp03/preprocessed/function_eval_expr_50.hpp rename 3party/boost/boost/phoenix/core/detail/{ => cpp03}/preprocessed/phx2_result.hpp (66%) rename 3party/boost/boost/phoenix/core/detail/{ => cpp03}/preprocessed/phx2_result_10.hpp (98%) rename 3party/boost/boost/phoenix/core/detail/{ => cpp03}/preprocessed/phx2_result_20.hpp (99%) rename 3party/boost/boost/phoenix/core/detail/{ => cpp03}/preprocessed/phx2_result_30.hpp (99%) rename 3party/boost/boost/phoenix/core/detail/{ => cpp03}/preprocessed/phx2_result_40.hpp (99%) rename 3party/boost/boost/phoenix/core/detail/{ => cpp03}/preprocessed/phx2_result_50.hpp (99%) create mode 100644 3party/boost/boost/phoenix/core/detail/index_sequence.hpp delete mode 100644 3party/boost/boost/phoenix/core/preprocessed/argument_10.hpp delete mode 100644 3party/boost/boost/phoenix/core/preprocessed/argument_no_predefined_10.hpp delete mode 100644 3party/boost/boost/phoenix/core/preprocessed/argument_no_predefined_20.hpp delete mode 100644 3party/boost/boost/phoenix/core/preprocessed/argument_no_predefined_30.hpp delete mode 100644 3party/boost/boost/phoenix/core/preprocessed/argument_no_predefined_40.hpp delete mode 100644 3party/boost/boost/phoenix/core/preprocessed/argument_no_predefined_50.hpp delete mode 100644 3party/boost/boost/phoenix/core/preprocessed/argument_predefined_10.hpp delete mode 100644 3party/boost/boost/phoenix/core/preprocessed/argument_predefined_20.hpp delete mode 100644 3party/boost/boost/phoenix/core/preprocessed/argument_predefined_30.hpp delete mode 100644 3party/boost/boost/phoenix/core/preprocessed/argument_predefined_40.hpp delete mode 100644 3party/boost/boost/phoenix/core/preprocessed/argument_predefined_50.hpp rename 3party/boost/boost/phoenix/function/detail/{ => cpp03}/function_operator.hpp (92%) rename 3party/boost/boost/phoenix/function/detail/{ => cpp03}/preprocessed/function_operator.hpp (62%) rename 3party/boost/boost/phoenix/function/detail/{ => cpp03}/preprocessed/function_operator_10.hpp (100%) rename 3party/boost/boost/phoenix/function/detail/{ => cpp03}/preprocessed/function_operator_20.hpp (100%) rename 3party/boost/boost/phoenix/function/detail/{ => cpp03}/preprocessed/function_operator_30.hpp (100%) rename 3party/boost/boost/phoenix/function/detail/{ => cpp03}/preprocessed/function_operator_40.hpp (100%) rename 3party/boost/boost/phoenix/function/detail/{ => cpp03}/preprocessed/function_operator_50.hpp (100%) delete mode 100644 3party/boost/boost/phoenix/function/detail/function_result_of.hpp delete mode 100644 3party/boost/boost/phoenix/function/detail/preprocessed/function_result_of.hpp delete mode 100644 3party/boost/boost/phoenix/function/detail/preprocessed/function_result_of_10.hpp delete mode 100644 3party/boost/boost/phoenix/function/detail/preprocessed/function_result_of_20.hpp delete mode 100644 3party/boost/boost/phoenix/function/detail/preprocessed/function_result_of_30.hpp delete mode 100644 3party/boost/boost/phoenix/function/detail/preprocessed/function_result_of_40.hpp delete mode 100644 3party/boost/boost/phoenix/function/detail/preprocessed/function_result_of_50.hpp create mode 100644 3party/boost/boost/phoenix/function/lazy_signature.hpp create mode 100644 3party/boost/boost/phoenix/function/lazy_smart.hpp rename 3party/boost/boost/phoenix/object/detail/{ => cpp03}/construct.hpp (93%) rename 3party/boost/boost/phoenix/object/detail/{ => cpp03}/construct_eval.hpp (94%) create mode 100644 3party/boost/boost/phoenix/object/detail/cpp03/construct_expr.hpp rename 3party/boost/boost/phoenix/object/detail/{ => cpp03}/new.hpp (93%) rename 3party/boost/boost/phoenix/object/detail/{ => cpp03}/new_eval.hpp (95%) create mode 100644 3party/boost/boost/phoenix/object/detail/cpp03/new_expr.hpp rename 3party/boost/boost/phoenix/object/detail/{ => cpp03}/preprocessed/construct.hpp (65%) rename 3party/boost/boost/phoenix/object/detail/{ => cpp03}/preprocessed/construct_10.hpp (100%) rename 3party/boost/boost/phoenix/object/detail/{ => cpp03}/preprocessed/construct_20.hpp (100%) rename 3party/boost/boost/phoenix/object/detail/{ => cpp03}/preprocessed/construct_30.hpp (100%) rename 3party/boost/boost/phoenix/object/detail/{ => cpp03}/preprocessed/construct_40.hpp (100%) rename 3party/boost/boost/phoenix/object/detail/{ => cpp03}/preprocessed/construct_50.hpp (100%) rename 3party/boost/boost/phoenix/object/detail/{ => cpp03}/preprocessed/construct_eval.hpp (63%) rename 3party/boost/boost/phoenix/object/detail/{ => cpp03}/preprocessed/construct_eval_10.hpp (100%) rename 3party/boost/boost/phoenix/object/detail/{ => cpp03}/preprocessed/construct_eval_20.hpp (100%) rename 3party/boost/boost/phoenix/object/detail/{ => cpp03}/preprocessed/construct_eval_30.hpp (100%) rename 3party/boost/boost/phoenix/object/detail/{ => cpp03}/preprocessed/construct_eval_40.hpp (100%) rename 3party/boost/boost/phoenix/object/detail/{ => cpp03}/preprocessed/construct_eval_50.hpp (100%) create mode 100644 3party/boost/boost/phoenix/object/detail/cpp03/preprocessed/construct_expr.hpp create mode 100644 3party/boost/boost/phoenix/object/detail/cpp03/preprocessed/construct_expr_10.hpp create mode 100644 3party/boost/boost/phoenix/object/detail/cpp03/preprocessed/construct_expr_20.hpp create mode 100644 3party/boost/boost/phoenix/object/detail/cpp03/preprocessed/construct_expr_30.hpp create mode 100644 3party/boost/boost/phoenix/object/detail/cpp03/preprocessed/construct_expr_40.hpp create mode 100644 3party/boost/boost/phoenix/object/detail/cpp03/preprocessed/construct_expr_50.hpp rename 3party/boost/boost/phoenix/object/detail/{ => cpp03}/preprocessed/new.hpp (66%) rename 3party/boost/boost/phoenix/object/detail/{ => cpp03}/preprocessed/new_10.hpp (100%) rename 3party/boost/boost/phoenix/object/detail/{ => cpp03}/preprocessed/new_20.hpp (100%) rename 3party/boost/boost/phoenix/object/detail/{ => cpp03}/preprocessed/new_30.hpp (100%) rename 3party/boost/boost/phoenix/object/detail/{ => cpp03}/preprocessed/new_40.hpp (100%) rename 3party/boost/boost/phoenix/object/detail/{ => cpp03}/preprocessed/new_50.hpp (100%) rename 3party/boost/boost/phoenix/object/detail/{ => cpp03}/preprocessed/new_eval.hpp (65%) rename 3party/boost/boost/phoenix/object/detail/{ => cpp03}/preprocessed/new_eval_10.hpp (100%) rename 3party/boost/boost/phoenix/object/detail/{ => cpp03}/preprocessed/new_eval_20.hpp (100%) rename 3party/boost/boost/phoenix/object/detail/{ => cpp03}/preprocessed/new_eval_30.hpp (100%) rename 3party/boost/boost/phoenix/object/detail/{ => cpp03}/preprocessed/new_eval_40.hpp (100%) rename 3party/boost/boost/phoenix/object/detail/{ => cpp03}/preprocessed/new_eval_50.hpp (100%) create mode 100644 3party/boost/boost/phoenix/object/detail/cpp03/preprocessed/new_expr.hpp create mode 100644 3party/boost/boost/phoenix/object/detail/cpp03/preprocessed/new_expr_10.hpp create mode 100644 3party/boost/boost/phoenix/object/detail/cpp03/preprocessed/new_expr_20.hpp create mode 100644 3party/boost/boost/phoenix/object/detail/cpp03/preprocessed/new_expr_30.hpp create mode 100644 3party/boost/boost/phoenix/object/detail/cpp03/preprocessed/new_expr_40.hpp create mode 100644 3party/boost/boost/phoenix/object/detail/cpp03/preprocessed/new_expr_50.hpp create mode 100644 3party/boost/boost/phoenix/operator/detail/cpp03/mem_fun_ptr_eval.hpp rename 3party/boost/boost/phoenix/operator/detail/{ => cpp03}/mem_fun_ptr_eval_result_of.hpp (96%) create mode 100644 3party/boost/boost/phoenix/operator/detail/cpp03/mem_fun_ptr_expr.hpp rename 3party/boost/boost/phoenix/operator/detail/{ => cpp03}/mem_fun_ptr_gen.hpp (83%) create mode 100644 3party/boost/boost/phoenix/operator/detail/cpp03/preprocessed/mem_fun_ptr_eval.hpp rename 3party/boost/boost/phoenix/operator/{preprocessed/member_10.hpp => detail/cpp03/preprocessed/mem_fun_ptr_eval_10.hpp} (53%) rename 3party/boost/boost/phoenix/operator/{preprocessed/member_20.hpp => detail/cpp03/preprocessed/mem_fun_ptr_eval_20.hpp} (54%) create mode 100644 3party/boost/boost/phoenix/operator/detail/cpp03/preprocessed/mem_fun_ptr_eval_30.hpp rename 3party/boost/boost/phoenix/operator/{preprocessed/member_30.hpp => detail/cpp03/preprocessed/mem_fun_ptr_eval_40.hpp} (54%) rename 3party/boost/boost/phoenix/operator/{preprocessed/member_40.hpp => detail/cpp03/preprocessed/mem_fun_ptr_eval_50.hpp} (53%) create mode 100644 3party/boost/boost/phoenix/operator/detail/cpp03/preprocessed/mem_fun_ptr_eval_result_of.hpp create mode 100644 3party/boost/boost/phoenix/operator/detail/cpp03/preprocessed/mem_fun_ptr_expr.hpp rename 3party/boost/boost/phoenix/operator/detail/{preprocessed/mem_fun_ptr_gen_10.hpp => cpp03/preprocessed/mem_fun_ptr_expr_10.hpp} (54%) rename 3party/boost/boost/phoenix/operator/detail/{preprocessed/mem_fun_ptr_gen_20.hpp => cpp03/preprocessed/mem_fun_ptr_expr_20.hpp} (58%) rename 3party/boost/boost/phoenix/operator/detail/{preprocessed/mem_fun_ptr_gen_30.hpp => cpp03/preprocessed/mem_fun_ptr_expr_30.hpp} (60%) rename 3party/boost/boost/phoenix/operator/detail/{preprocessed/mem_fun_ptr_gen_40.hpp => cpp03/preprocessed/mem_fun_ptr_expr_40.hpp} (61%) rename 3party/boost/boost/phoenix/operator/detail/{preprocessed/mem_fun_ptr_gen_50.hpp => cpp03/preprocessed/mem_fun_ptr_expr_50.hpp} (62%) rename 3party/boost/boost/phoenix/operator/detail/{ => cpp03}/preprocessed/mem_fun_ptr_gen.hpp (63%) create mode 100644 3party/boost/boost/phoenix/operator/detail/cpp03/preprocessed/mem_fun_ptr_gen_10.hpp create mode 100644 3party/boost/boost/phoenix/operator/detail/cpp03/preprocessed/mem_fun_ptr_gen_20.hpp create mode 100644 3party/boost/boost/phoenix/operator/detail/cpp03/preprocessed/mem_fun_ptr_gen_30.hpp create mode 100644 3party/boost/boost/phoenix/operator/detail/cpp03/preprocessed/mem_fun_ptr_gen_40.hpp create mode 100644 3party/boost/boost/phoenix/operator/detail/cpp03/preprocessed/mem_fun_ptr_gen_50.hpp delete mode 100644 3party/boost/boost/phoenix/operator/preprocessed/member.hpp delete mode 100644 3party/boost/boost/phoenix/operator/preprocessed/member_50.hpp rename 3party/boost/boost/phoenix/scope/detail/{ => cpp03}/dynamic.hpp (96%) create mode 100644 3party/boost/boost/phoenix/scope/detail/cpp03/lambda.hpp create mode 100644 3party/boost/boost/phoenix/scope/detail/cpp03/local_gen.hpp rename 3party/boost/boost/phoenix/scope/detail/{ => cpp03}/preprocessed/dynamic.hpp (65%) rename 3party/boost/boost/phoenix/scope/detail/{ => cpp03}/preprocessed/dynamic_10.hpp (100%) rename 3party/boost/boost/phoenix/scope/detail/{ => cpp03}/preprocessed/dynamic_20.hpp (100%) rename 3party/boost/boost/phoenix/scope/detail/{ => cpp03}/preprocessed/dynamic_30.hpp (100%) rename 3party/boost/boost/phoenix/scope/detail/{ => cpp03}/preprocessed/dynamic_40.hpp (100%) rename 3party/boost/boost/phoenix/scope/detail/{ => cpp03}/preprocessed/dynamic_50.hpp (100%) rename 3party/boost/boost/phoenix/scope/{ => detail/cpp03}/preprocessed/lambda.hpp (66%) rename 3party/boost/boost/phoenix/scope/{ => detail/cpp03}/preprocessed/lambda_10.hpp (73%) rename 3party/boost/boost/phoenix/scope/{ => detail/cpp03}/preprocessed/lambda_20.hpp (90%) rename 3party/boost/boost/phoenix/scope/{ => detail/cpp03}/preprocessed/lambda_30.hpp (95%) rename 3party/boost/boost/phoenix/scope/{ => detail/cpp03}/preprocessed/lambda_40.hpp (97%) rename 3party/boost/boost/phoenix/scope/{ => detail/cpp03}/preprocessed/lambda_50.hpp (98%) delete mode 100644 3party/boost/boost/phoenix/scope/detail/make_locals.hpp delete mode 100644 3party/boost/boost/phoenix/scope/detail/preprocessed/make_locals.hpp delete mode 100644 3party/boost/boost/phoenix/scope/detail/preprocessed/make_locals_10.hpp delete mode 100644 3party/boost/boost/phoenix/scope/detail/preprocessed/make_locals_20.hpp delete mode 100644 3party/boost/boost/phoenix/scope/detail/preprocessed/make_locals_30.hpp delete mode 100644 3party/boost/boost/phoenix/scope/detail/preprocessed/make_locals_40.hpp delete mode 100644 3party/boost/boost/phoenix/scope/detail/preprocessed/make_locals_50.hpp create mode 100644 3party/boost/boost/phoenix/stl/algorithm/detail/is_unordered_set_or_map.hpp create mode 100644 3party/boost/boost/phoenix/stl/algorithm/detail/std_unordered_set_or_map_fwd.hpp create mode 100644 3party/boost/boost/predef/hardware.h create mode 100644 3party/boost/boost/predef/hardware/simd.h create mode 100644 3party/boost/boost/predef/hardware/simd/arm.h create mode 100644 3party/boost/boost/predef/hardware/simd/arm/versions.h create mode 100644 3party/boost/boost/predef/hardware/simd/ppc.h create mode 100644 3party/boost/boost/predef/hardware/simd/ppc/versions.h create mode 100644 3party/boost/boost/predef/hardware/simd/x86.h create mode 100644 3party/boost/boost/predef/hardware/simd/x86/versions.h create mode 100644 3party/boost/boost/predef/hardware/simd/x86_amd.h create mode 100644 3party/boost/boost/predef/hardware/simd/x86_amd/versions.h create mode 100644 3party/boost/boost/preprocessor/seq/detail/to_list_msvc.hpp create mode 100644 3party/boost/boost/process.hpp create mode 100644 3party/boost/boost/process/args.hpp create mode 100644 3party/boost/boost/process/async.hpp create mode 100644 3party/boost/boost/process/async_pipe.hpp create mode 100644 3party/boost/boost/process/async_system.hpp create mode 100644 3party/boost/boost/process/child.hpp create mode 100644 3party/boost/boost/process/cmd.hpp create mode 100644 3party/boost/boost/process/detail/async_handler.hpp create mode 100644 3party/boost/boost/process/detail/basic_cmd.hpp create mode 100644 3party/boost/boost/process/detail/child_decl.hpp create mode 100644 3party/boost/boost/process/detail/config.hpp create mode 100644 3party/boost/boost/process/detail/execute_impl.hpp create mode 100644 3party/boost/boost/process/detail/handler.hpp create mode 100644 3party/boost/boost/process/detail/handler_base.hpp create mode 100644 3party/boost/boost/process/detail/on_exit.hpp create mode 100644 3party/boost/boost/process/detail/posix/asio_fwd.hpp create mode 100644 3party/boost/boost/process/detail/posix/async_handler.hpp create mode 100644 3party/boost/boost/process/detail/posix/async_in.hpp create mode 100644 3party/boost/boost/process/detail/posix/async_out.hpp create mode 100644 3party/boost/boost/process/detail/posix/async_pipe.hpp create mode 100644 3party/boost/boost/process/detail/posix/basic_cmd.hpp create mode 100644 3party/boost/boost/process/detail/posix/basic_pipe.hpp create mode 100644 3party/boost/boost/process/detail/posix/child_handle.hpp create mode 100644 3party/boost/boost/process/detail/posix/close_in.hpp create mode 100644 3party/boost/boost/process/detail/posix/close_out.hpp create mode 100644 3party/boost/boost/process/detail/posix/cmd.hpp create mode 100644 3party/boost/boost/process/detail/posix/compare_handles.hpp create mode 100644 3party/boost/boost/process/detail/posix/env_init.hpp create mode 100644 3party/boost/boost/process/detail/posix/environment.hpp create mode 100644 3party/boost/boost/process/detail/posix/exe.hpp create mode 100644 3party/boost/boost/process/detail/posix/executor.hpp create mode 100644 3party/boost/boost/process/detail/posix/fd.hpp create mode 100644 3party/boost/boost/process/detail/posix/file_descriptor.hpp create mode 100644 3party/boost/boost/process/detail/posix/file_in.hpp create mode 100644 3party/boost/boost/process/detail/posix/file_out.hpp create mode 100644 3party/boost/boost/process/detail/posix/group_handle.hpp create mode 100644 3party/boost/boost/process/detail/posix/group_ref.hpp create mode 100644 3party/boost/boost/process/detail/posix/handler.hpp create mode 100644 3party/boost/boost/process/detail/posix/io_service_ref.hpp create mode 100644 3party/boost/boost/process/detail/posix/is_running.hpp create mode 100644 3party/boost/boost/process/detail/posix/null_in.hpp create mode 100644 3party/boost/boost/process/detail/posix/null_out.hpp create mode 100644 3party/boost/boost/process/detail/posix/on_exit.hpp create mode 100644 3party/boost/boost/process/detail/posix/pipe_in.hpp create mode 100644 3party/boost/boost/process/detail/posix/pipe_out.hpp create mode 100644 3party/boost/boost/process/detail/posix/search_path.hpp create mode 100644 3party/boost/boost/process/detail/posix/shell_path.hpp create mode 100644 3party/boost/boost/process/detail/posix/signal.hpp create mode 100644 3party/boost/boost/process/detail/posix/start_dir.hpp create mode 100644 3party/boost/boost/process/detail/posix/terminate.hpp create mode 100644 3party/boost/boost/process/detail/posix/use_vfork.hpp create mode 100644 3party/boost/boost/process/detail/posix/wait_for_exit.hpp create mode 100644 3party/boost/boost/process/detail/posix/wait_group.hpp create mode 100644 3party/boost/boost/process/detail/throw_on_error.hpp create mode 100644 3party/boost/boost/process/detail/traits.hpp create mode 100644 3party/boost/boost/process/detail/traits/async.hpp create mode 100644 3party/boost/boost/process/detail/traits/cmd_or_exe.hpp create mode 100644 3party/boost/boost/process/detail/traits/decl.hpp create mode 100644 3party/boost/boost/process/detail/traits/env.hpp create mode 100644 3party/boost/boost/process/detail/traits/error.hpp create mode 100644 3party/boost/boost/process/detail/traits/group.hpp create mode 100644 3party/boost/boost/process/detail/traits/wchar_t.hpp create mode 100644 3party/boost/boost/process/detail/windows/asio_fwd.hpp create mode 100644 3party/boost/boost/process/detail/windows/async_handler.hpp create mode 100644 3party/boost/boost/process/detail/windows/async_in.hpp create mode 100644 3party/boost/boost/process/detail/windows/async_out.hpp create mode 100644 3party/boost/boost/process/detail/windows/async_pipe.hpp create mode 100644 3party/boost/boost/process/detail/windows/basic_cmd.hpp create mode 100644 3party/boost/boost/process/detail/windows/basic_pipe.hpp create mode 100644 3party/boost/boost/process/detail/windows/child_handle.hpp create mode 100644 3party/boost/boost/process/detail/windows/close_in.hpp create mode 100644 3party/boost/boost/process/detail/windows/close_out.hpp create mode 100644 3party/boost/boost/process/detail/windows/cmd.hpp create mode 100644 3party/boost/boost/process/detail/windows/compare_handles.hpp create mode 100644 3party/boost/boost/process/detail/windows/env_init.hpp create mode 100644 3party/boost/boost/process/detail/windows/environment.hpp create mode 100644 3party/boost/boost/process/detail/windows/executor.hpp create mode 100644 3party/boost/boost/process/detail/windows/file_descriptor.hpp create mode 100644 3party/boost/boost/process/detail/windows/file_in.hpp create mode 100644 3party/boost/boost/process/detail/windows/file_out.hpp create mode 100644 3party/boost/boost/process/detail/windows/group_handle.hpp create mode 100644 3party/boost/boost/process/detail/windows/group_ref.hpp create mode 100644 3party/boost/boost/process/detail/windows/handler.hpp create mode 100644 3party/boost/boost/process/detail/windows/io_service_ref.hpp create mode 100644 3party/boost/boost/process/detail/windows/is_running.hpp create mode 100644 3party/boost/boost/process/detail/windows/job_workaround.hpp create mode 100644 3party/boost/boost/process/detail/windows/locale.hpp create mode 100644 3party/boost/boost/process/detail/windows/null_in.hpp create mode 100644 3party/boost/boost/process/detail/windows/null_out.hpp create mode 100644 3party/boost/boost/process/detail/windows/on_exit.hpp create mode 100644 3party/boost/boost/process/detail/windows/pipe_in.hpp create mode 100644 3party/boost/boost/process/detail/windows/pipe_out.hpp create mode 100644 3party/boost/boost/process/detail/windows/search_path.hpp create mode 100644 3party/boost/boost/process/detail/windows/shell_path.hpp create mode 100644 3party/boost/boost/process/detail/windows/show_window.hpp create mode 100644 3party/boost/boost/process/detail/windows/start_dir.hpp create mode 100644 3party/boost/boost/process/detail/windows/terminate.hpp create mode 100644 3party/boost/boost/process/detail/windows/wait_for_exit.hpp create mode 100644 3party/boost/boost/process/detail/windows/wait_group.hpp create mode 100644 3party/boost/boost/process/env.hpp create mode 100644 3party/boost/boost/process/environment.hpp create mode 100644 3party/boost/boost/process/error.hpp create mode 100644 3party/boost/boost/process/exception.hpp create mode 100644 3party/boost/boost/process/exe.hpp create mode 100644 3party/boost/boost/process/extend.hpp create mode 100644 3party/boost/boost/process/group.hpp create mode 100644 3party/boost/boost/process/io.hpp create mode 100644 3party/boost/boost/process/locale.hpp create mode 100644 3party/boost/boost/process/pipe.hpp create mode 100644 3party/boost/boost/process/posix.hpp create mode 100644 3party/boost/boost/process/search_path.hpp create mode 100644 3party/boost/boost/process/shell.hpp create mode 100644 3party/boost/boost/process/spawn.hpp create mode 100644 3party/boost/boost/process/start_dir.hpp create mode 100644 3party/boost/boost/process/system.hpp create mode 100644 3party/boost/boost/process/windows.hpp delete mode 100644 3party/boost/boost/property_tree/detail/json_parser/parser.hpp delete mode 100644 3party/boost/boost/property_tree/detail/json_parser/read.hpp rename 3party/boost/boost/property_tree/{detail/json_parser => json_parser/detail}/narrow_encoding.hpp (93%) create mode 100644 3party/boost/boost/property_tree/json_parser/detail/parser.hpp create mode 100644 3party/boost/boost/property_tree/json_parser/detail/read.hpp rename 3party/boost/boost/property_tree/{detail/json_parser => json_parser/detail}/standard_callbacks.hpp (97%) rename 3party/boost/boost/property_tree/{detail/json_parser => json_parser/detail}/wide_encoding.hpp (92%) rename 3party/boost/boost/property_tree/{detail/json_parser_write.hpp => json_parser/detail/write.hpp} (96%) rename 3party/boost/boost/property_tree/{detail/json_parser_error.hpp => json_parser/error.hpp} (100%) mode change 100755 => 100644 3party/boost/boost/python/detail/wrapper_base.hpp create mode 100644 3party/boost/boost/python/numpy.hpp create mode 100644 3party/boost/boost/python/numpy/config.hpp create mode 100644 3party/boost/boost/python/numpy/dtype.hpp create mode 100644 3party/boost/boost/python/numpy/internal.hpp create mode 100644 3party/boost/boost/python/numpy/invoke_matching.hpp create mode 100644 3party/boost/boost/python/numpy/matrix.hpp create mode 100644 3party/boost/boost/python/numpy/ndarray.hpp create mode 100644 3party/boost/boost/python/numpy/numpy_object_mgr_traits.hpp create mode 100644 3party/boost/boost/python/numpy/scalars.hpp create mode 100644 3party/boost/boost/python/numpy/ufunc.hpp create mode 100644 3party/boost/boost/qvm/all.hpp create mode 100644 3party/boost/boost/qvm/assert.hpp create mode 100644 3party/boost/boost/qvm/deduce_mat.hpp create mode 100644 3party/boost/boost/qvm/deduce_quat.hpp create mode 100644 3party/boost/boost/qvm/deduce_scalar.hpp create mode 100644 3party/boost/boost/qvm/deduce_vec.hpp create mode 100644 3party/boost/boost/qvm/detail/cofactor_impl.hpp create mode 100644 3party/boost/boost/qvm/detail/determinant_impl.hpp create mode 100644 3party/boost/boost/qvm/detail/remove_const.hpp create mode 100644 3party/boost/boost/qvm/detail/swizzle_traits.hpp create mode 100644 3party/boost/boost/qvm/detail/transp_impl.hpp create mode 100644 3party/boost/boost/qvm/enable_if.hpp create mode 100644 3party/boost/boost/qvm/error.hpp create mode 100644 3party/boost/boost/qvm/gen/mat_operations2.hpp create mode 100644 3party/boost/boost/qvm/gen/mat_operations3.hpp create mode 100644 3party/boost/boost/qvm/gen/mat_operations4.hpp create mode 100644 3party/boost/boost/qvm/gen/swizzle2.hpp create mode 100644 3party/boost/boost/qvm/gen/swizzle3.hpp create mode 100644 3party/boost/boost/qvm/gen/swizzle4.hpp create mode 100644 3party/boost/boost/qvm/gen/vec_mat_operations2.hpp create mode 100644 3party/boost/boost/qvm/gen/vec_mat_operations3.hpp create mode 100644 3party/boost/boost/qvm/gen/vec_mat_operations4.hpp create mode 100644 3party/boost/boost/qvm/gen/vec_operations2.hpp create mode 100644 3party/boost/boost/qvm/gen/vec_operations3.hpp create mode 100644 3party/boost/boost/qvm/gen/vec_operations4.hpp create mode 100644 3party/boost/boost/qvm/inline.hpp create mode 100644 3party/boost/boost/qvm/map.hpp create mode 100644 3party/boost/boost/qvm/map_mat_mat.hpp create mode 100644 3party/boost/boost/qvm/map_mat_vec.hpp create mode 100644 3party/boost/boost/qvm/map_vec_mat.hpp create mode 100644 3party/boost/boost/qvm/mat.hpp create mode 100644 3party/boost/boost/qvm/mat_access.hpp create mode 100644 3party/boost/boost/qvm/mat_operations.hpp create mode 100644 3party/boost/boost/qvm/mat_operations2.hpp create mode 100644 3party/boost/boost/qvm/mat_operations3.hpp create mode 100644 3party/boost/boost/qvm/mat_operations4.hpp create mode 100644 3party/boost/boost/qvm/mat_traits.hpp create mode 100644 3party/boost/boost/qvm/mat_traits_array.hpp create mode 100644 3party/boost/boost/qvm/mat_traits_defaults.hpp create mode 100644 3party/boost/boost/qvm/math.hpp create mode 100644 3party/boost/boost/qvm/operations.hpp create mode 100644 3party/boost/boost/qvm/quat.hpp create mode 100644 3party/boost/boost/qvm/quat_access.hpp create mode 100644 3party/boost/boost/qvm/quat_operations.hpp create mode 100644 3party/boost/boost/qvm/quat_traits.hpp create mode 100644 3party/boost/boost/qvm/quat_traits_array.hpp create mode 100644 3party/boost/boost/qvm/quat_traits_defaults.hpp create mode 100644 3party/boost/boost/qvm/quat_vec_operations.hpp create mode 100644 3party/boost/boost/qvm/scalar_traits.hpp create mode 100644 3party/boost/boost/qvm/static_assert.hpp create mode 100644 3party/boost/boost/qvm/swizzle.hpp create mode 100644 3party/boost/boost/qvm/swizzle2.hpp create mode 100644 3party/boost/boost/qvm/swizzle3.hpp create mode 100644 3party/boost/boost/qvm/swizzle4.hpp create mode 100644 3party/boost/boost/qvm/throw_exception.hpp create mode 100644 3party/boost/boost/qvm/to_string.hpp create mode 100644 3party/boost/boost/qvm/vec.hpp create mode 100644 3party/boost/boost/qvm/vec_access.hpp create mode 100644 3party/boost/boost/qvm/vec_mat_operations.hpp create mode 100644 3party/boost/boost/qvm/vec_mat_operations2.hpp create mode 100644 3party/boost/boost/qvm/vec_mat_operations3.hpp create mode 100644 3party/boost/boost/qvm/vec_mat_operations4.hpp create mode 100644 3party/boost/boost/qvm/vec_operations.hpp create mode 100644 3party/boost/boost/qvm/vec_operations2.hpp create mode 100644 3party/boost/boost/qvm/vec_operations3.hpp create mode 100644 3party/boost/boost/qvm/vec_operations4.hpp create mode 100644 3party/boost/boost/qvm/vec_traits.hpp create mode 100644 3party/boost/boost/qvm/vec_traits_array.hpp create mode 100644 3party/boost/boost/qvm/vec_traits_defaults.hpp create mode 100644 3party/boost/boost/random/detail/int_float_pair.hpp create mode 100644 3party/boost/boost/random/hyperexponential_distribution.hpp create mode 100644 3party/boost/boost/random/traits.hpp create mode 100644 3party/boost/boost/serialization/archive_input_unordered_map.hpp create mode 100644 3party/boost/boost/serialization/archive_input_unordered_set.hpp create mode 100644 3party/boost/boost/serialization/array_optimization.hpp create mode 100644 3party/boost/boost/serialization/array_wrapper.hpp create mode 100644 3party/boost/boost/serialization/boost_array.hpp create mode 100644 3party/boost/boost/serialization/boost_unordered_map.hpp create mode 100644 3party/boost/boost/serialization/boost_unordered_set.hpp delete mode 100644 3party/boost/boost/serialization/detail/get_data.hpp delete mode 100644 3party/boost/boost/smart_ptr/detail/array_allocator.hpp delete mode 100644 3party/boost/boost/smart_ptr/detail/array_count_impl.hpp delete mode 100644 3party/boost/boost/smart_ptr/detail/array_traits.hpp delete mode 100644 3party/boost/boost/smart_ptr/detail/array_utility.hpp create mode 100644 3party/boost/boost/smart_ptr/detail/sp_disable_deprecated.hpp delete mode 100644 3party/boost/boost/smart_ptr/detail/sp_if_array.hpp create mode 100644 3party/boost/boost/smart_ptr/detail/sp_noexcept.hpp delete mode 100644 3party/boost/boost/smart_ptr/detail/up_if_array.hpp delete mode 100644 3party/boost/boost/smart_ptr/detail/up_if_not_array.hpp delete mode 100644 3party/boost/boost/smart_ptr/make_unique_array.hpp delete mode 100644 3party/boost/boost/smart_ptr/make_unique_object.hpp create mode 100644 3party/boost/boost/test/data/for_each_sample.hpp create mode 100644 3party/boost/boost/test/data/index_sequence.hpp delete mode 100644 3party/boost/boost/test/data/monomorphic/dataset.hpp create mode 100644 3party/boost/boost/test/data/monomorphic/initializer_list.hpp create mode 100644 3party/boost/boost/test/data/monomorphic/sample_merge.hpp create mode 100644 3party/boost/boost/test/impl/junit_log_formatter.ipp create mode 100644 3party/boost/boost/test/output/junit_log_formatter.hpp delete mode 100644 3party/boost/boost/test/utils/fixed_mapping.hpp delete mode 100644 3party/boost/boost/test/utils/iterator/ifstream_line_iterator.hpp delete mode 100644 3party/boost/boost/test/utils/iterator/istream_line_iterator.hpp create mode 100644 3party/boost/boost/test/utils/runtime/argument_factory.hpp delete mode 100644 3party/boost/boost/test/utils/runtime/cla/argument_factory.hpp delete mode 100644 3party/boost/boost/test/utils/runtime/cla/argv_traverser.cpp delete mode 100644 3party/boost/boost/test/utils/runtime/cla/argv_traverser.ipp delete mode 100644 3party/boost/boost/test/utils/runtime/cla/basic_parameter.hpp delete mode 100644 3party/boost/boost/test/utils/runtime/cla/char_parameter.cpp delete mode 100644 3party/boost/boost/test/utils/runtime/cla/char_parameter.hpp delete mode 100644 3party/boost/boost/test/utils/runtime/cla/char_parameter.ipp delete mode 100644 3party/boost/boost/test/utils/runtime/cla/detail/argument_value_usage.hpp delete mode 100644 3party/boost/boost/test/utils/runtime/cla/dual_name_parameter.cpp delete mode 100644 3party/boost/boost/test/utils/runtime/cla/dual_name_parameter.hpp delete mode 100644 3party/boost/boost/test/utils/runtime/cla/dual_name_parameter.ipp delete mode 100644 3party/boost/boost/test/utils/runtime/cla/fwd.hpp delete mode 100644 3party/boost/boost/test/utils/runtime/cla/id_policy.cpp delete mode 100644 3party/boost/boost/test/utils/runtime/cla/id_policy.hpp delete mode 100644 3party/boost/boost/test/utils/runtime/cla/id_policy.ipp delete mode 100644 3party/boost/boost/test/utils/runtime/cla/iface/argument_factory.hpp delete mode 100644 3party/boost/boost/test/utils/runtime/cla/iface/id_policy.hpp delete mode 100644 3party/boost/boost/test/utils/runtime/cla/modifier.hpp delete mode 100644 3party/boost/boost/test/utils/runtime/cla/named_parameter.cpp delete mode 100644 3party/boost/boost/test/utils/runtime/cla/named_parameter.hpp delete mode 100644 3party/boost/boost/test/utils/runtime/cla/named_parameter.ipp delete mode 100644 3party/boost/boost/test/utils/runtime/cla/parameter.hpp delete mode 100644 3party/boost/boost/test/utils/runtime/cla/parser.cpp delete mode 100644 3party/boost/boost/test/utils/runtime/cla/parser.ipp delete mode 100644 3party/boost/boost/test/utils/runtime/cla/positional_parameter.hpp delete mode 100644 3party/boost/boost/test/utils/runtime/cla/typed_parameter.hpp delete mode 100644 3party/boost/boost/test/utils/runtime/cla/validation.cpp delete mode 100644 3party/boost/boost/test/utils/runtime/cla/validation.hpp delete mode 100644 3party/boost/boost/test/utils/runtime/cla/validation.ipp delete mode 100644 3party/boost/boost/test/utils/runtime/cla/value_generator.hpp delete mode 100644 3party/boost/boost/test/utils/runtime/cla/value_handler.hpp delete mode 100644 3party/boost/boost/test/utils/runtime/config.hpp delete mode 100644 3party/boost/boost/test/utils/runtime/configuration.hpp delete mode 100644 3party/boost/boost/test/utils/runtime/env/environment.cpp delete mode 100644 3party/boost/boost/test/utils/runtime/env/environment.hpp delete mode 100644 3party/boost/boost/test/utils/runtime/env/environment.ipp create mode 100644 3party/boost/boost/test/utils/runtime/env/fetch.hpp delete mode 100644 3party/boost/boost/test/utils/runtime/env/fwd.hpp delete mode 100644 3party/boost/boost/test/utils/runtime/env/modifier.hpp delete mode 100644 3party/boost/boost/test/utils/runtime/env/variable.hpp create mode 100644 3party/boost/boost/test/utils/runtime/errors.hpp delete mode 100644 3party/boost/boost/test/utils/runtime/file/config_file.cpp delete mode 100644 3party/boost/boost/test/utils/runtime/file/config_file.hpp delete mode 100644 3party/boost/boost/test/utils/runtime/file/config_file_iterator.cpp delete mode 100644 3party/boost/boost/test/utils/runtime/file/config_file_iterator.hpp create mode 100644 3party/boost/boost/test/utils/runtime/finalize.hpp delete mode 100644 3party/boost/boost/test/utils/runtime/interpret_argument_value.hpp create mode 100644 3party/boost/boost/test/utils/runtime/modifier.hpp delete mode 100644 3party/boost/boost/test/utils/runtime/trace.hpp delete mode 100644 3party/boost/boost/test/utils/runtime/validation.hpp create mode 100644 3party/boost/boost/test/utils/string_cast.hpp create mode 100644 3party/boost/boost/type_erasure/detail/auto_link.hpp create mode 100644 3party/boost/boost/type_erasure/detail/dynamic_vtable.hpp create mode 100644 3party/boost/boost/type_erasure/dynamic_any_cast.hpp create mode 100644 3party/boost/boost/type_erasure/dynamic_binding.hpp create mode 100644 3party/boost/boost/type_erasure/register_binding.hpp create mode 100644 3party/boost/boost/type_index/runtime_cast.hpp create mode 100644 3party/boost/boost/type_index/runtime_cast/boost_shared_ptr_cast.hpp create mode 100644 3party/boost/boost/type_index/runtime_cast/detail/runtime_cast_impl.hpp create mode 100644 3party/boost/boost/type_index/runtime_cast/pointer_cast.hpp create mode 100644 3party/boost/boost/type_index/runtime_cast/reference_cast.hpp create mode 100644 3party/boost/boost/type_index/runtime_cast/register_runtime_class.hpp create mode 100644 3party/boost/boost/type_index/runtime_cast/std_shared_ptr_cast.hpp mode change 100755 => 100644 3party/boost/boost/type_traits/aligned_storage.hpp create mode 100644 3party/boost/boost/type_traits/copy_cv.hpp mode change 100755 => 100644 3party/boost/boost/type_traits/decay.hpp create mode 100644 3party/boost/boost/type_traits/declval.hpp create mode 100644 3party/boost/boost/type_traits/detail/common_arithmetic_type.hpp delete mode 100644 3party/boost/boost/type_traits/detail/common_type_imp.hpp create mode 100644 3party/boost/boost/type_traits/detail/common_type_impl.hpp create mode 100644 3party/boost/boost/type_traits/detail/composite_member_pointer_type.hpp create mode 100644 3party/boost/boost/type_traits/detail/composite_pointer_type.hpp create mode 100644 3party/boost/boost/type_traits/detail/config.hpp delete mode 100644 3party/boost/boost/type_traits/detail/cv_traits_impl.hpp delete mode 100644 3party/boost/boost/type_traits/detail/false_result.hpp create mode 100644 3party/boost/boost/type_traits/detail/mp_defer.hpp delete mode 100644 3party/boost/boost/type_traits/detail/size_t_trait_def.hpp delete mode 100644 3party/boost/boost/type_traits/detail/size_t_trait_undef.hpp delete mode 100644 3party/boost/boost/type_traits/detail/type_trait_def.hpp delete mode 100644 3party/boost/boost/type_traits/detail/type_trait_undef.hpp delete mode 100644 3party/boost/boost/type_traits/detail/wrap.hpp create mode 100644 3party/boost/boost/type_traits/is_assignable.hpp create mode 100644 3party/boost/boost/type_traits/is_constructible.hpp create mode 100644 3party/boost/boost/type_traits/is_default_constructible.hpp create mode 100644 3party/boost/boost/type_traits/is_destructible.hpp mode change 100755 => 100644 3party/boost/boost/type_traits/is_floating_point.hpp mode change 100755 => 100644 3party/boost/boost/type_traits/is_member_object_pointer.hpp create mode 100644 3party/boost/boost/type_traits/make_void.hpp delete mode 100644 3party/boost/boost/type_traits/transform_traits_spec.hpp create mode 100644 3party/boost/boost/type_traits/type_identity.hpp delete mode 100644 3party/boost/boost/unordered/detail/allocate.hpp delete mode 100644 3party/boost/boost/unordered/detail/buckets.hpp delete mode 100644 3party/boost/boost/unordered/detail/equivalent.hpp delete mode 100644 3party/boost/boost/unordered/detail/extract_key.hpp create mode 100644 3party/boost/boost/unordered/detail/implementation.hpp create mode 100644 3party/boost/boost/unordered/detail/map.hpp create mode 100644 3party/boost/boost/unordered/detail/set.hpp delete mode 100644 3party/boost/boost/unordered/detail/table.hpp delete mode 100644 3party/boost/boost/unordered/detail/unique.hpp delete mode 100644 3party/boost/boost/unordered/detail/util.hpp create mode 100644 3party/boost/boost/utility/string_view.hpp create mode 100644 3party/boost/boost/utility/string_view_fwd.hpp delete mode 100644 3party/boost/boost/variant/detail/bool_trait_def.hpp delete mode 100644 3party/boost/boost/variant/detail/bool_trait_undef.hpp create mode 100644 3party/boost/boost/vmd/array.hpp create mode 100644 3party/boost/boost/vmd/array/to_seq.hpp create mode 100644 3party/boost/boost/vmd/array/to_tuple.hpp create mode 100644 3party/boost/boost/vmd/assert.hpp create mode 100644 3party/boost/boost/vmd/assert_is_array.hpp create mode 100644 3party/boost/boost/vmd/assert_is_empty.hpp create mode 100644 3party/boost/boost/vmd/assert_is_identifier.hpp create mode 100644 3party/boost/boost/vmd/assert_is_list.hpp create mode 100644 3party/boost/boost/vmd/assert_is_number.hpp create mode 100644 3party/boost/boost/vmd/assert_is_seq.hpp create mode 100644 3party/boost/boost/vmd/assert_is_tuple.hpp create mode 100644 3party/boost/boost/vmd/assert_is_type.hpp create mode 100644 3party/boost/boost/vmd/detail/adjust_tuple_type.hpp create mode 100644 3party/boost/boost/vmd/detail/array.hpp create mode 100644 3party/boost/boost/vmd/detail/assert.hpp create mode 100644 3party/boost/boost/vmd/detail/data_equal.hpp create mode 100644 3party/boost/boost/vmd/detail/data_equal_common.hpp create mode 100644 3party/boost/boost/vmd/detail/empty_result.hpp create mode 100644 3party/boost/boost/vmd/detail/equal.hpp create mode 100644 3party/boost/boost/vmd/detail/equal_common.hpp create mode 100644 3party/boost/boost/vmd/detail/equal_type.hpp create mode 100644 3party/boost/boost/vmd/detail/identifier.hpp create mode 100644 3party/boost/boost/vmd/detail/identifier_concat.hpp create mode 100644 3party/boost/boost/vmd/detail/identifier_type.hpp create mode 100644 3party/boost/boost/vmd/detail/idprefix.hpp create mode 100644 3party/boost/boost/vmd/detail/is_array.hpp create mode 100644 3party/boost/boost/vmd/detail/is_array_common.hpp create mode 100644 3party/boost/boost/vmd/detail/is_empty.hpp create mode 100644 3party/boost/boost/vmd/detail/is_empty_array.hpp create mode 100644 3party/boost/boost/vmd/detail/is_empty_tuple.hpp create mode 100644 3party/boost/boost/vmd/detail/is_entire.hpp create mode 100644 3party/boost/boost/vmd/detail/is_identifier.hpp create mode 100644 3party/boost/boost/vmd/detail/is_list.hpp create mode 100644 3party/boost/boost/vmd/detail/is_number.hpp create mode 100644 3party/boost/boost/vmd/detail/is_seq.hpp create mode 100644 3party/boost/boost/vmd/detail/is_tuple.hpp create mode 100644 3party/boost/boost/vmd/detail/is_type.hpp create mode 100644 3party/boost/boost/vmd/detail/is_type_type.hpp create mode 100644 3party/boost/boost/vmd/detail/list.hpp create mode 100644 3party/boost/boost/vmd/detail/match_identifier.hpp create mode 100644 3party/boost/boost/vmd/detail/match_identifier_common.hpp create mode 100644 3party/boost/boost/vmd/detail/match_single_identifier.hpp create mode 100644 3party/boost/boost/vmd/detail/modifiers.hpp create mode 100644 3party/boost/boost/vmd/detail/mods.hpp create mode 100644 3party/boost/boost/vmd/detail/nil_registration.hpp create mode 100644 3party/boost/boost/vmd/detail/not_empty.hpp create mode 100644 3party/boost/boost/vmd/detail/number_registration.hpp create mode 100644 3party/boost/boost/vmd/detail/only_after.hpp create mode 100644 3party/boost/boost/vmd/detail/parens.hpp create mode 100644 3party/boost/boost/vmd/detail/parens_common.hpp create mode 100644 3party/boost/boost/vmd/detail/parens_split.hpp create mode 100644 3party/boost/boost/vmd/detail/recurse/data_equal/data_equal_1.hpp create mode 100644 3party/boost/boost/vmd/detail/recurse/data_equal/data_equal_10.hpp create mode 100644 3party/boost/boost/vmd/detail/recurse/data_equal/data_equal_11.hpp create mode 100644 3party/boost/boost/vmd/detail/recurse/data_equal/data_equal_12.hpp create mode 100644 3party/boost/boost/vmd/detail/recurse/data_equal/data_equal_13.hpp create mode 100644 3party/boost/boost/vmd/detail/recurse/data_equal/data_equal_14.hpp create mode 100644 3party/boost/boost/vmd/detail/recurse/data_equal/data_equal_15.hpp create mode 100644 3party/boost/boost/vmd/detail/recurse/data_equal/data_equal_16.hpp create mode 100644 3party/boost/boost/vmd/detail/recurse/data_equal/data_equal_2.hpp create mode 100644 3party/boost/boost/vmd/detail/recurse/data_equal/data_equal_3.hpp create mode 100644 3party/boost/boost/vmd/detail/recurse/data_equal/data_equal_4.hpp create mode 100644 3party/boost/boost/vmd/detail/recurse/data_equal/data_equal_5.hpp create mode 100644 3party/boost/boost/vmd/detail/recurse/data_equal/data_equal_6.hpp create mode 100644 3party/boost/boost/vmd/detail/recurse/data_equal/data_equal_7.hpp create mode 100644 3party/boost/boost/vmd/detail/recurse/data_equal/data_equal_8.hpp create mode 100644 3party/boost/boost/vmd/detail/recurse/data_equal/data_equal_9.hpp create mode 100644 3party/boost/boost/vmd/detail/recurse/data_equal/data_equal_headers.hpp create mode 100644 3party/boost/boost/vmd/detail/recurse/data_equal/data_equal_specific.hpp create mode 100644 3party/boost/boost/vmd/detail/recurse/equal/equal_1.hpp create mode 100644 3party/boost/boost/vmd/detail/recurse/equal/equal_10.hpp create mode 100644 3party/boost/boost/vmd/detail/recurse/equal/equal_11.hpp create mode 100644 3party/boost/boost/vmd/detail/recurse/equal/equal_12.hpp create mode 100644 3party/boost/boost/vmd/detail/recurse/equal/equal_13.hpp create mode 100644 3party/boost/boost/vmd/detail/recurse/equal/equal_14.hpp create mode 100644 3party/boost/boost/vmd/detail/recurse/equal/equal_15.hpp create mode 100644 3party/boost/boost/vmd/detail/recurse/equal/equal_16.hpp create mode 100644 3party/boost/boost/vmd/detail/recurse/equal/equal_2.hpp create mode 100644 3party/boost/boost/vmd/detail/recurse/equal/equal_3.hpp create mode 100644 3party/boost/boost/vmd/detail/recurse/equal/equal_4.hpp create mode 100644 3party/boost/boost/vmd/detail/recurse/equal/equal_5.hpp create mode 100644 3party/boost/boost/vmd/detail/recurse/equal/equal_6.hpp create mode 100644 3party/boost/boost/vmd/detail/recurse/equal/equal_7.hpp create mode 100644 3party/boost/boost/vmd/detail/recurse/equal/equal_8.hpp create mode 100644 3party/boost/boost/vmd/detail/recurse/equal/equal_9.hpp create mode 100644 3party/boost/boost/vmd/detail/recurse/equal/equal_headers.hpp create mode 100644 3party/boost/boost/vmd/detail/seq.hpp create mode 100644 3party/boost/boost/vmd/detail/sequence_arity.hpp create mode 100644 3party/boost/boost/vmd/detail/sequence_common.hpp create mode 100644 3party/boost/boost/vmd/detail/sequence_elem.hpp create mode 100644 3party/boost/boost/vmd/detail/sequence_enum.hpp create mode 100644 3party/boost/boost/vmd/detail/sequence_size.hpp create mode 100644 3party/boost/boost/vmd/detail/sequence_to_array.hpp create mode 100644 3party/boost/boost/vmd/detail/sequence_to_list.hpp create mode 100644 3party/boost/boost/vmd/detail/sequence_to_seq.hpp create mode 100644 3party/boost/boost/vmd/detail/sequence_to_tuple.hpp create mode 100644 3party/boost/boost/vmd/detail/sequence_type.hpp create mode 100644 3party/boost/boost/vmd/detail/setup.hpp create mode 100644 3party/boost/boost/vmd/detail/tuple.hpp create mode 100644 3party/boost/boost/vmd/detail/type_registration.hpp create mode 100644 3party/boost/boost/vmd/detail/variadic_pop_front.hpp create mode 100644 3party/boost/boost/vmd/elem.hpp create mode 100644 3party/boost/boost/vmd/empty.hpp create mode 100644 3party/boost/boost/vmd/enum.hpp create mode 100644 3party/boost/boost/vmd/equal.hpp create mode 100644 3party/boost/boost/vmd/get_type.hpp create mode 100644 3party/boost/boost/vmd/identity.hpp create mode 100644 3party/boost/boost/vmd/is_array.hpp create mode 100644 3party/boost/boost/vmd/is_empty.hpp create mode 100644 3party/boost/boost/vmd/is_empty_array.hpp create mode 100644 3party/boost/boost/vmd/is_empty_list.hpp create mode 100644 3party/boost/boost/vmd/is_identifier.hpp create mode 100644 3party/boost/boost/vmd/is_list.hpp create mode 100644 3party/boost/boost/vmd/is_multi.hpp create mode 100644 3party/boost/boost/vmd/is_number.hpp create mode 100644 3party/boost/boost/vmd/is_parens_empty.hpp create mode 100644 3party/boost/boost/vmd/is_seq.hpp create mode 100644 3party/boost/boost/vmd/is_tuple.hpp create mode 100644 3party/boost/boost/vmd/is_type.hpp create mode 100644 3party/boost/boost/vmd/is_unary.hpp create mode 100644 3party/boost/boost/vmd/list.hpp create mode 100644 3party/boost/boost/vmd/list/to_seq.hpp create mode 100644 3party/boost/boost/vmd/list/to_tuple.hpp create mode 100644 3party/boost/boost/vmd/not_equal.hpp create mode 100644 3party/boost/boost/vmd/seq.hpp create mode 100644 3party/boost/boost/vmd/seq/is_vmd_seq.hpp create mode 100644 3party/boost/boost/vmd/seq/pop_back.hpp create mode 100644 3party/boost/boost/vmd/seq/pop_front.hpp create mode 100644 3party/boost/boost/vmd/seq/push_back.hpp create mode 100644 3party/boost/boost/vmd/seq/push_front.hpp create mode 100644 3party/boost/boost/vmd/seq/remove.hpp create mode 100644 3party/boost/boost/vmd/seq/size.hpp create mode 100644 3party/boost/boost/vmd/seq/to_array.hpp create mode 100644 3party/boost/boost/vmd/seq/to_list.hpp create mode 100644 3party/boost/boost/vmd/seq/to_tuple.hpp create mode 100644 3party/boost/boost/vmd/size.hpp create mode 100644 3party/boost/boost/vmd/to_array.hpp create mode 100644 3party/boost/boost/vmd/to_list.hpp create mode 100644 3party/boost/boost/vmd/to_seq.hpp create mode 100644 3party/boost/boost/vmd/to_tuple.hpp create mode 100644 3party/boost/boost/vmd/tuple.hpp create mode 100644 3party/boost/boost/vmd/tuple/is_vmd_tuple.hpp create mode 100644 3party/boost/boost/vmd/tuple/pop_back.hpp create mode 100644 3party/boost/boost/vmd/tuple/pop_front.hpp create mode 100644 3party/boost/boost/vmd/tuple/push_back.hpp create mode 100644 3party/boost/boost/vmd/tuple/push_front.hpp create mode 100644 3party/boost/boost/vmd/tuple/remove.hpp create mode 100644 3party/boost/boost/vmd/tuple/size.hpp create mode 100644 3party/boost/boost/vmd/tuple/to_array.hpp create mode 100644 3party/boost/boost/vmd/tuple/to_list.hpp create mode 100644 3party/boost/boost/vmd/tuple/to_seq.hpp create mode 100644 3party/boost/boost/vmd/vmd.hpp diff --git a/3party/boost/TODO_OMIM.txt b/3party/boost/TODO_OMIM.txt deleted file mode 100644 index 78f078542b..0000000000 --- a/3party/boost/TODO_OMIM.txt +++ /dev/null @@ -1,16 +0,0 @@ -Notes for upgrading boost library: - -For the 1.59 version we need to apply a patch to compile it correctly: - -commit 1f43ee7cce43b2b145c8df4b9e088b11d66d1137 -Author: Alex Zolotarev -Date: Fri Oct 16 23:17:29 2015 -0700 - - Boost compilation fixes. These patches are better than those we used previously. - -More details: - -- http://lists.boost.org/Archives/boost/2013/02/200721.php -- https://github.com/mapnik/mapnik/issues/1970 -- https://github.com/bassosimone/boost-core-gabicxx-fix -- http://stackoverflow.com/questions/25836364/stlport-error-cxa-demangle-is-not-a-member-of-abi-for-boost-library diff --git a/3party/boost/boost/algorithm/algorithm.hpp b/3party/boost/boost/algorithm/algorithm.hpp index 7fb0181dbe..ab0d4aff58 100644 --- a/3party/boost/boost/algorithm/algorithm.hpp +++ b/3party/boost/boost/algorithm/algorithm.hpp @@ -1,4 +1,4 @@ -/* +/* Copyright (c) Marshall Clow 2014. Distributed under the Boost Software License, Version 1.0. (See accompanying @@ -6,7 +6,7 @@ Revision history: 2 Dec 2014 mtc First version; power - + */ /// \file algorithm.hpp @@ -17,6 +17,8 @@ #ifndef BOOST_ALGORITHM_HPP #define BOOST_ALGORITHM_HPP +#include // for plus and multiplies + #include // for boost::disable_if #include @@ -31,7 +33,7 @@ T identity_operation ( std::plus ) { return T(0); } /// \fn power ( T x, Integer n ) /// \return the value "x" raised to the power "n" -/// +/// /// \param x The value to be exponentiated /// \param n The exponent (must be >= 0) /// @@ -40,7 +42,7 @@ T identity_operation ( std::plus ) { return T(0); } template typename boost::enable_if, T>::type power (T x, Integer n) { - T y = 1; // Should be "T y{1};" + T y = 1; // Should be "T y{1};" if (n == 0) return y; while (true) { if (n % 2 == 1) { @@ -56,8 +58,8 @@ power (T x, Integer n) { /// \fn power ( T x, Integer n, Operation op ) /// \return the value "x" raised to the power "n" -/// using the operaton "op". -/// +/// using the operation "op". +/// /// \param x The value to be exponentiated /// \param n The exponent (must be >= 0) /// \param op The operation used diff --git a/3party/boost/boost/algorithm/cxx11/all_of.hpp b/3party/boost/boost/algorithm/cxx11/all_of.hpp index 39cab39dd7..8280b18d62 100644 --- a/3party/boost/boost/algorithm/cxx11/all_of.hpp +++ b/3party/boost/boost/algorithm/cxx11/all_of.hpp @@ -12,7 +12,6 @@ #ifndef BOOST_ALGORITHM_ALL_OF_HPP #define BOOST_ALGORITHM_ALL_OF_HPP -#include // for std::all_of, if available #include #include @@ -27,8 +26,6 @@ namespace boost { namespace algorithm { /// \param p A predicate for testing the elements of the sequence /// /// \note This function is part of the C++2011 standard library. -/// We will use the standard one if it is available, -/// otherwise we have our own implementation. template bool all_of ( InputIterator first, InputIterator last, Predicate p ) { diff --git a/3party/boost/boost/algorithm/cxx11/any_of.hpp b/3party/boost/boost/algorithm/cxx11/any_of.hpp index cf69348c08..e68135a2b3 100644 --- a/3party/boost/boost/algorithm/cxx11/any_of.hpp +++ b/3party/boost/boost/algorithm/cxx11/any_of.hpp @@ -14,7 +14,6 @@ #ifndef BOOST_ALGORITHM_ANY_OF_HPP #define BOOST_ALGORITHM_ANY_OF_HPP -#include // for std::any_of, if available #include #include diff --git a/3party/boost/boost/algorithm/cxx11/copy_if.hpp b/3party/boost/boost/algorithm/cxx11/copy_if.hpp index d869cafcd2..73e85d99c6 100644 --- a/3party/boost/boost/algorithm/cxx11/copy_if.hpp +++ b/3party/boost/boost/algorithm/cxx11/copy_if.hpp @@ -12,7 +12,7 @@ #ifndef BOOST_ALGORITHM_COPY_IF_HPP #define BOOST_ALGORITHM_COPY_IF_HPP -#include // for std::copy_if, if available +#include // for std::pair, std::make_pair #include #include @@ -28,8 +28,6 @@ namespace boost { namespace algorithm { /// \param result An output iterator to write the results into /// \param p A predicate for testing the elements of the range /// \note This function is part of the C++2011 standard library. -/// We will use the standard one if it is available, -/// otherwise we have our own implementation. template OutputIterator copy_if ( InputIterator first, InputIterator last, OutputIterator result, Predicate p ) { diff --git a/3party/boost/boost/algorithm/cxx11/copy_n.hpp b/3party/boost/boost/algorithm/cxx11/copy_n.hpp index ebfe889ff5..ac880856db 100644 --- a/3party/boost/boost/algorithm/cxx11/copy_n.hpp +++ b/3party/boost/boost/algorithm/cxx11/copy_n.hpp @@ -12,8 +12,6 @@ #ifndef BOOST_ALGORITHM_COPY_N_HPP #define BOOST_ALGORITHM_COPY_N_HPP -#include // for std::copy_n, if available - namespace boost { namespace algorithm { /// \fn copy_n ( InputIterator first, Size n, OutputIterator result ) @@ -25,8 +23,6 @@ namespace boost { namespace algorithm { /// \param n The number of elements to copy /// \param result An output iterator to write the results into /// \note This function is part of the C++2011 standard library. -/// We will use the standard one if it is available, -/// otherwise we have our own implementation. template OutputIterator copy_n ( InputIterator first, Size n, OutputIterator result ) { diff --git a/3party/boost/boost/algorithm/cxx11/find_if_not.hpp b/3party/boost/boost/algorithm/cxx11/find_if_not.hpp index 414697cdd8..02ff4dce7b 100644 --- a/3party/boost/boost/algorithm/cxx11/find_if_not.hpp +++ b/3party/boost/boost/algorithm/cxx11/find_if_not.hpp @@ -12,8 +12,6 @@ #ifndef BOOST_ALGORITHM_FIND_IF_NOT_HPP #define BOOST_ALGORITHM_FIND_IF_NOT_HPP -#include // for std::find_if_not, if it exists - #include #include @@ -27,8 +25,6 @@ namespace boost { namespace algorithm { /// \param last One past the end of the input sequence /// \param p A predicate for testing the elements of the range /// \note This function is part of the C++2011 standard library. -/// We will use the standard one if it is available, -/// otherwise we have our own implementation. template InputIterator find_if_not ( InputIterator first, InputIterator last, Predicate p ) { diff --git a/3party/boost/boost/algorithm/cxx11/iota.hpp b/3party/boost/boost/algorithm/cxx11/iota.hpp index 2e638ec9e2..675093f02d 100644 --- a/3party/boost/boost/algorithm/cxx11/iota.hpp +++ b/3party/boost/boost/algorithm/cxx11/iota.hpp @@ -12,8 +12,6 @@ #ifndef BOOST_ALGORITHM_IOTA_HPP #define BOOST_ALGORITHM_IOTA_HPP -#include - #include #include @@ -26,8 +24,6 @@ namespace boost { namespace algorithm { /// \param last One past the end of the input sequence /// \param value The initial value of the sequence to be generated /// \note This function is part of the C++2011 standard library. -/// We will use the standard one if it is available, -/// otherwise we have our own implementation. template void iota ( ForwardIterator first, ForwardIterator last, T value ) { diff --git a/3party/boost/boost/algorithm/cxx11/is_partitioned.hpp b/3party/boost/boost/algorithm/cxx11/is_partitioned.hpp index cdabd97505..cb6c71e33b 100644 --- a/3party/boost/boost/algorithm/cxx11/is_partitioned.hpp +++ b/3party/boost/boost/algorithm/cxx11/is_partitioned.hpp @@ -12,8 +12,6 @@ #ifndef BOOST_ALGORITHM_IS_PARTITIONED_HPP #define BOOST_ALGORITHM_IS_PARTITIONED_HPP -#include // for std::is_partitioned, if available - #include #include @@ -26,8 +24,6 @@ namespace boost { namespace algorithm { /// \param last One past the end of the input sequence /// \param p The predicate to test the values with /// \note This function is part of the C++2011 standard library. -/// We will use the standard one if it is available, -/// otherwise we have our own implementation. template bool is_partitioned ( InputIterator first, InputIterator last, UnaryPredicate p ) { diff --git a/3party/boost/boost/algorithm/cxx11/is_permutation.hpp b/3party/boost/boost/algorithm/cxx11/is_permutation.hpp index ec902dc49f..0098cd53fe 100644 --- a/3party/boost/boost/algorithm/cxx11/is_permutation.hpp +++ b/3party/boost/boost/algorithm/cxx11/is_permutation.hpp @@ -12,8 +12,8 @@ #ifndef BOOST_ALGORITHM_IS_PERMUTATION11_HPP #define BOOST_ALGORITHM_IS_PERMUTATION11_HPP -#include // for std::less, tie, mismatch and is_permutation (if available) -#include // for std::make_pair +#include // for std::find_if, count_if, mismatch +#include // for std::pair #include // for std::equal_to #include @@ -108,8 +108,6 @@ namespace detail { /// \param p The predicate to compare elements with /// /// \note This function is part of the C++2011 standard library. -/// We will use the standard one if it is available, -/// otherwise we have our own implementation. template< class ForwardIterator1, class ForwardIterator2, class BinaryPredicate > bool is_permutation ( ForwardIterator1 first1, ForwardIterator1 last1, ForwardIterator2 first2, BinaryPredicate p ) @@ -135,8 +133,6 @@ bool is_permutation ( ForwardIterator1 first1, ForwardIterator1 last1, /// \param last2 One past the end of the input sequence /// \param first2 The start of the second sequence /// \note This function is part of the C++2011 standard library. -/// We will use the standard one if it is available, -/// otherwise we have our own implementation. template< class ForwardIterator1, class ForwardIterator2 > bool is_permutation ( ForwardIterator1 first1, ForwardIterator1 last1, ForwardIterator2 first2 ) { diff --git a/3party/boost/boost/algorithm/cxx11/is_sorted.hpp b/3party/boost/boost/algorithm/cxx11/is_sorted.hpp index f6062da6d3..f4dbb38c08 100644 --- a/3party/boost/boost/algorithm/cxx11/is_sorted.hpp +++ b/3party/boost/boost/algorithm/cxx11/is_sorted.hpp @@ -13,7 +13,6 @@ #ifndef BOOST_ALGORITHM_ORDERED_HPP #define BOOST_ALGORITHM_ORDERED_HPP -#include #include #include diff --git a/3party/boost/boost/algorithm/cxx11/none_of.hpp b/3party/boost/boost/algorithm/cxx11/none_of.hpp index 67be3d1f73..ba13144fb8 100644 --- a/3party/boost/boost/algorithm/cxx11/none_of.hpp +++ b/3party/boost/boost/algorithm/cxx11/none_of.hpp @@ -12,7 +12,6 @@ #ifndef BOOST_ALGORITHM_NONE_OF_HPP #define BOOST_ALGORITHM_NONE_OF_HPP -#include // for std::none_of, if available #include #include @@ -29,9 +28,9 @@ namespace boost { namespace algorithm { template bool none_of ( InputIterator first, InputIterator last, Predicate p ) { -for ( ; first != last; ++first ) - if ( p(*first)) - return false; + for ( ; first != last; ++first ) + if ( p(*first)) + return false; return true; } diff --git a/3party/boost/boost/algorithm/cxx11/partition_copy.hpp b/3party/boost/boost/algorithm/cxx11/partition_copy.hpp index 2d8c3e9bff..f347f2128f 100644 --- a/3party/boost/boost/algorithm/cxx11/partition_copy.hpp +++ b/3party/boost/boost/algorithm/cxx11/partition_copy.hpp @@ -12,8 +12,7 @@ #ifndef BOOST_ALGORITHM_PARTITION_COPY_HPP #define BOOST_ALGORITHM_PARTITION_COPY_HPP -#include // for std::partition_copy, if available -#include // for make_pair +#include // for std::pair #include #include @@ -34,8 +33,6 @@ namespace boost { namespace algorithm { /// \param p A predicate for dividing the elements of the input sequence. /// /// \note This function is part of the C++2011 standard library. -/// We will use the standard one if it is available, -/// otherwise we have our own implementation. template std::pair diff --git a/3party/boost/boost/algorithm/cxx11/partition_point.hpp b/3party/boost/boost/algorithm/cxx11/partition_point.hpp index f1310c38c6..2c2767ae5a 100644 --- a/3party/boost/boost/algorithm/cxx11/partition_point.hpp +++ b/3party/boost/boost/algorithm/cxx11/partition_point.hpp @@ -12,7 +12,7 @@ #ifndef BOOST_ALGORITHM_PARTITION_POINT_HPP #define BOOST_ALGORITHM_PARTITION_POINT_HPP -#include // for std::partition_point, if available +#include // for std::distance, advance #include #include @@ -27,8 +27,6 @@ namespace boost { namespace algorithm { /// \param last One past the end of the input sequence /// \param p The predicate to test the values with /// \note This function is part of the C++2011 standard library. -/// We will use the standard one if it is available, -/// otherwise we have our own implementation. template ForwardIterator partition_point ( ForwardIterator first, ForwardIterator last, Predicate p ) { diff --git a/3party/boost/boost/algorithm/cxx14/equal.hpp b/3party/boost/boost/algorithm/cxx14/equal.hpp index cfc62d5f10..f1539f885c 100644 --- a/3party/boost/boost/algorithm/cxx14/equal.hpp +++ b/3party/boost/boost/algorithm/cxx14/equal.hpp @@ -13,7 +13,8 @@ #define BOOST_ALGORITHM_EQUAL_HPP #include // for std::equal -#include // for std::equal_to +#include // for std::binary_function +#include namespace boost { namespace algorithm { diff --git a/3party/boost/boost/algorithm/cxx14/is_permutation.hpp b/3party/boost/boost/algorithm/cxx14/is_permutation.hpp index 9346881af5..639446bf37 100644 --- a/3party/boost/boost/algorithm/cxx14/is_permutation.hpp +++ b/3party/boost/boost/algorithm/cxx14/is_permutation.hpp @@ -12,8 +12,7 @@ #ifndef BOOST_ALGORITHM_IS_PERMUTATION14_HPP #define BOOST_ALGORITHM_IS_PERMUTATION14_HPP -#include // for std::less, tie, mismatch and is_permutation (if available) -#include // for std::make_pair +#include // for std::pair #include // for std::equal_to #include @@ -31,8 +30,6 @@ namespace boost { namespace algorithm { /// \param first2 The start of the second sequence /// \param last1 One past the end of the second sequence /// \note This function is part of the C++2014 standard library. -/// We will use the standard one if it is available, -/// otherwise we have our own implementation. template< class ForwardIterator1, class ForwardIterator2 > bool is_permutation ( ForwardIterator1 first1, ForwardIterator1 last1, ForwardIterator2 first2, ForwardIterator2 last2 ) @@ -62,8 +59,6 @@ bool is_permutation ( ForwardIterator1 first1, ForwardIterator1 last1, /// \param pred The predicate to compare elements with /// /// \note This function is part of the C++2014 standard library. -/// We will use the standard one if it is available, -/// otherwise we have our own implementation. template< class ForwardIterator1, class ForwardIterator2, class BinaryPredicate > bool is_permutation ( ForwardIterator1 first1, ForwardIterator1 last1, ForwardIterator2 first2, ForwardIterator2 last2, diff --git a/3party/boost/boost/algorithm/cxx14/mismatch.hpp b/3party/boost/boost/algorithm/cxx14/mismatch.hpp index 926ab1944b..c3de418222 100644 --- a/3party/boost/boost/algorithm/cxx14/mismatch.hpp +++ b/3party/boost/boost/algorithm/cxx14/mismatch.hpp @@ -12,7 +12,6 @@ #ifndef BOOST_ALGORITHM_MISMATCH_HPP #define BOOST_ALGORITHM_MISMATCH_HPP -#include // for std::mismatch #include // for std::pair namespace boost { namespace algorithm { diff --git a/3party/boost/boost/algorithm/hex.hpp b/3party/boost/boost/algorithm/hex.hpp index 145a414f00..739e89f2f0 100644 --- a/3party/boost/boost/algorithm/hex.hpp +++ b/3party/boost/boost/algorithm/hex.hpp @@ -1,9 +1,9 @@ -/* +/* Copyright (c) Marshall Clow 2011-2012. 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) - + Thanks to Nevin for his comments/help. */ @@ -13,7 +13,7 @@ */ /// \file hex.hpp -/// \brief Convert sequence of integral types into a sequence of hexadecimal +/// \brief Convert sequence of integral types into a sequence of hexadecimal /// characters and back. Based on the MySQL functions HEX and UNHEX /// \author Marshall Clow @@ -25,7 +25,9 @@ #include #include -#include +#include +#include +#include #include #include @@ -33,17 +35,17 @@ namespace boost { namespace algorithm { -/*! - \struct hex_decode_error - \brief Base exception class for all hex decoding errors +/*! + \struct hex_decode_error + \brief Base exception class for all hex decoding errors */ /*! - \struct non_hex_input + \struct non_hex_input \brief Thrown when a non-hex value (0-9, A-F) encountered when decoding. Contains the offending character -*/ /*! - \struct not_enough_input +*/ /*! + \struct not_enough_input \brief Thrown when the input sequence unexpectedly ends - + */ struct hex_decode_error : virtual boost::exception, virtual std::exception {}; struct not_enough_input : virtual hex_decode_error {}; @@ -54,12 +56,12 @@ namespace detail { /// \cond DOXYGEN_HIDE template - OutputIterator encode_one ( T val, OutputIterator out ) { + OutputIterator encode_one ( T val, OutputIterator out, const char * hexDigits ) { const std::size_t num_hex_digits = 2 * sizeof ( T ); char res [ num_hex_digits ]; char *p = res + num_hex_digits; for ( std::size_t i = 0; i < num_hex_digits; ++i, val >>= 4 ) - *--p = "0123456789ABCDEF" [ val & 0x0F ]; + *--p = hexDigits [ val & 0x0F ]; return std::copy ( res, res + num_hex_digits, out ); } @@ -106,12 +108,12 @@ namespace detail { typedef T value_type; }; - template + template bool iter_end ( Iterator current, Iterator last ) { return current == last; } - + template bool ptr_end ( const T* ptr, const T* /*end*/ ) { return *ptr == '\0'; } - + // What can we assume here about the inputs? // is std::iterator_traits::value_type always 'char' ? // Could it be wchar_t, say? Does it matter? @@ -124,11 +126,11 @@ namespace detail { // Need to make sure that we get can read that many chars here. for ( std::size_t i = 0; i < 2 * sizeof ( T ); ++i, ++first ) { - if ( pred ( first, last )) + if ( pred ( first, last )) BOOST_THROW_EXCEPTION (not_enough_input ()); res = ( 16 * res ) + hex_char_to_int (*first); } - + *out = res; return ++out; } @@ -138,7 +140,7 @@ namespace detail { /// \fn hex ( InputIterator first, InputIterator last, OutputIterator out ) /// \brief Converts a sequence of integral types into a hexadecimal sequence of characters. -/// +/// /// \param first The start of the input sequence /// \param last One past the end of the input sequence /// \param out An output iterator to the results into @@ -148,14 +150,31 @@ template typename boost::enable_if::value_type>, OutputIterator>::type hex ( InputIterator first, InputIterator last, OutputIterator out ) { for ( ; first != last; ++first ) - out = detail::encode_one ( *first, out ); + out = detail::encode_one ( *first, out, "0123456789ABCDEF" ); return out; } - + + +/// \fn hex_lower ( InputIterator first, InputIterator last, OutputIterator out ) +/// \brief Converts a sequence of integral types into a lower case hexadecimal sequence of characters. +/// +/// \param first The start of the input sequence +/// \param last One past the end of the input sequence +/// \param out An output iterator to the results into +/// \return The updated output iterator +/// \note Based on the MySQL function of the same name +template +typename boost::enable_if::value_type>, OutputIterator>::type +hex_lower ( InputIterator first, InputIterator last, OutputIterator out ) { + for ( ; first != last; ++first ) + out = detail::encode_one ( *first, out, "0123456789abcdef" ); + return out; + } + /// \fn hex ( const T *ptr, OutputIterator out ) /// \brief Converts a sequence of integral types into a hexadecimal sequence of characters. -/// +/// /// \param ptr A pointer to a 0-terminated sequence of data. /// \param out An output iterator to the results into /// \return The updated output iterator @@ -164,13 +183,30 @@ template typename boost::enable_if, OutputIterator>::type hex ( const T *ptr, OutputIterator out ) { while ( *ptr ) - out = detail::encode_one ( *ptr++, out ); + out = detail::encode_one ( *ptr++, out, "0123456789ABCDEF" ); return out; } + +/// \fn hex_lower ( const T *ptr, OutputIterator out ) +/// \brief Converts a sequence of integral types into a lower case hexadecimal sequence of characters. +/// +/// \param ptr A pointer to a 0-terminated sequence of data. +/// \param out An output iterator to the results into +/// \return The updated output iterator +/// \note Based on the MySQL function of the same name +template +typename boost::enable_if, OutputIterator>::type +hex_lower ( const T *ptr, OutputIterator out ) { + while ( *ptr ) + out = detail::encode_one ( *ptr++, out, "0123456789abcdef" ); + return out; + } + + /// \fn hex ( const Range &r, OutputIterator out ) /// \brief Converts a sequence of integral types into a hexadecimal sequence of characters. -/// +/// /// \param r The input range /// \param out An output iterator to the results into /// \return The updated output iterator @@ -182,9 +218,23 @@ hex ( const Range &r, OutputIterator out ) { } +/// \fn hex_lower ( const Range &r, OutputIterator out ) +/// \brief Converts a sequence of integral types into a lower case hexadecimal sequence of characters. +/// +/// \param r The input range +/// \param out An output iterator to the results into +/// \return The updated output iterator +/// \note Based on the MySQL function of the same name +template +typename boost::enable_if::value_type>, OutputIterator>::type +hex_lower ( const Range &r, OutputIterator out ) { + return hex_lower (boost::begin(r), boost::end(r), out); +} + + /// \fn unhex ( InputIterator first, InputIterator last, OutputIterator out ) /// \brief Converts a sequence of hexadecimal characters into a sequence of integers. -/// +/// /// \param first The start of the input sequence /// \param last One past the end of the input sequence /// \param out An output iterator to the results into @@ -200,7 +250,7 @@ OutputIterator unhex ( InputIterator first, InputIterator last, OutputIterator o /// \fn unhex ( const T *ptr, OutputIterator out ) /// \brief Converts a sequence of hexadecimal characters into a sequence of integers. -/// +/// /// \param ptr A pointer to a null-terminated input sequence. /// \param out An output iterator to the results into /// \return The updated output iterator @@ -218,7 +268,7 @@ OutputIterator unhex ( const T *ptr, OutputIterator out ) { /// \fn OutputIterator unhex ( const Range &r, OutputIterator out ) /// \brief Converts a sequence of hexadecimal characters into a sequence of integers. -/// +/// /// \param r The input range /// \param out An output iterator to the results into /// \return The updated output iterator @@ -231,7 +281,7 @@ OutputIterator unhex ( const Range &r, OutputIterator out ) { /// \fn String hex ( const String &input ) /// \brief Converts a sequence of integral types into a hexadecimal sequence of characters. -/// +/// /// \param input A container to be converted /// \return A container with the encoded text template @@ -242,9 +292,24 @@ String hex ( const String &input ) { return output; } + +/// \fn String hex_lower ( const String &input ) +/// \brief Converts a sequence of integral types into a lower case hexadecimal sequence of characters. +/// +/// \param input A container to be converted +/// \return A container with the encoded text +template +String hex_lower ( const String &input ) { + String output; + output.reserve (input.size () * (2 * sizeof (typename String::value_type))); + (void) hex_lower (input, std::back_inserter (output)); + return output; + } + + /// \fn String unhex ( const String &input ) /// \brief Converts a sequence of hexadecimal characters into a sequence of characters. -/// +/// /// \param input A container to be converted /// \return A container with the decoded text template diff --git a/3party/boost/boost/algorithm/is_palindrome.hpp b/3party/boost/boost/algorithm/is_palindrome.hpp new file mode 100644 index 0000000000..cc63e18075 --- /dev/null +++ b/3party/boost/boost/algorithm/is_palindrome.hpp @@ -0,0 +1,161 @@ +/* + Copyright (c) Alexander Zaitsev , 2016 + + 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) + + See http://www.boost.org/ for latest version. +*/ + +/// \file is_palindrome.hpp +/// \brief Checks the input sequence on palindrome. +/// \author Alexander Zaitsev + +#ifndef BOOST_ALGORITHM_IS_PALINDROME_HPP +#define BOOST_ALGORITHM_IS_PALINDROME_HPP + +#include +#include +#include + +#include +#include + +namespace boost { namespace algorithm { + +/// \fn is_palindrome ( BidirectionalIterator begin, BidirectionalIterator end, Predicate p ) +/// \return true if the entire sequence is palindrome +/// +/// \param begin The start of the input sequence +/// \param end One past the end of the input sequence +/// \param p A predicate used to compare the values. +/// +/// \note This function will return true for empty sequences and for palindromes. +/// For other sequences function will return false. +/// Complexity: O(N). +template +bool is_palindrome(BidirectionalIterator begin, BidirectionalIterator end, Predicate p ) +{ + if(begin == end) + { + return true; + } + + --end; + while(begin != end) + { + if(!p(*begin, *end)) + { + return false; + } + ++begin; + if(begin == end) + { + break; + } + --end; + } + return true; +} + +/// \fn is_palindrome ( BidirectionalIterator begin, BidirectionalIterator end ) +/// \return true if the entire sequence is palindrome +/// +/// \param begin The start of the input sequence +/// \param end One past the end of the input sequence +/// +/// \note This function will return true for empty sequences and for palindromes. +/// For other sequences function will return false. +/// Complexity: O(N). +template +bool is_palindrome(BidirectionalIterator begin, BidirectionalIterator end) +{ + if(begin == end) + { + return true; + } + + --end; + while(begin != end) + { + if(!(*begin == *end)) + { + return false; + } + ++begin; + if(begin == end) + { + break; + } + --end; + } + return true; +} + +/// \fn is_palindrome ( const R& range ) +/// \return true if the entire sequence is palindrome +/// +/// \param range The range to be tested. +/// +/// \note This function will return true for empty sequences and for palindromes. +/// For other sequences function will return false. +/// Complexity: O(N). +template +bool is_palindrome(const R& range) +{ + return is_palindrome(boost::begin(range), boost::end(range)); +} + +/// \fn is_palindrome ( const R& range, Predicate p ) +/// \return true if the entire sequence is palindrome +/// +/// \param range The range to be tested. +/// \param p A predicate used to compare the values. +/// +/// \note This function will return true for empty sequences and for palindromes. +/// For other sequences function will return false. +/// Complexity: O(N). +template +bool is_palindrome(const R& range, Predicate p) +{ + return is_palindrome(boost::begin(range), boost::end(range), p); +} + + +/// \fn is_palindrome ( const char* str ) +/// \return true if the entire sequence is palindrome +/// +/// \param str C-string to be tested. +/// +/// \note This function will return true for empty sequences and for palindromes. +/// For other sequences function will return false. +/// Complexity: O(N). +bool is_palindrome(const char* str) +{ + if(!str) + return true; + return is_palindrome(str, str + strlen(str)); +} + + +/// \fn is_palindrome ( const char* str, Predicate p ) +/// \return true if the entire sequence is palindrome +/// +/// \param str C-string to be tested. +/// \param p A predicate used to compare the values. +/// +/// \note This function will return true for empty sequences and for palindromes. +/// For other sequences function will return false. +/// Complexity: O(N). +template +bool is_palindrome(const char* str, Predicate p) +{ + if(!str) + return true; + return is_palindrome(str, str + strlen(str), p); +} + +}} + +#endif // BOOST_ALGORITHM_IS_PALINDROME_HPP diff --git a/3party/boost/boost/algorithm/searching/boyer_moore.hpp b/3party/boost/boost/algorithm/searching/boyer_moore.hpp index c5fe9fa255..65a809dd4f 100644 --- a/3party/boost/boost/algorithm/searching/boyer_moore.hpp +++ b/3party/boost/boost/algorithm/searching/boyer_moore.hpp @@ -75,25 +75,27 @@ Requirements: /// \param corpus_last One past the end of the data to search /// template - corpusIter operator () ( corpusIter corpus_first, corpusIter corpus_last ) const { + std::pair + operator () ( corpusIter corpus_first, corpusIter corpus_last ) const { BOOST_STATIC_ASSERT (( boost::is_same< typename std::iterator_traits::value_type, typename std::iterator_traits::value_type>::value )); - if ( corpus_first == corpus_last ) return corpus_last; // if nothing to search, we didn't find it! - if ( pat_first == pat_last ) return corpus_first; // empty pattern matches at start + if ( corpus_first == corpus_last ) return std::make_pair(corpus_last, corpus_last); // if nothing to search, we didn't find it! + if ( pat_first == pat_last ) return std::make_pair(corpus_first, corpus_first); // empty pattern matches at start const difference_type k_corpus_length = std::distance ( corpus_first, corpus_last ); // If the pattern is larger than the corpus, we can't find it! if ( k_corpus_length < k_pattern_length ) - return corpus_last; + return std::make_pair(corpus_last, corpus_last); // Do the search - return this->do_search ( corpus_first, corpus_last ); + return this->do_search ( corpus_first, corpus_last ); } template - typename boost::range_iterator::type operator () ( Range &r ) const { + std::pair::type, typename boost::range_iterator::type> + operator () ( Range &r ) const { return (*this) (boost::begin(r), boost::end(r)); } @@ -112,7 +114,8 @@ Requirements: /// \param p A predicate used for the search comparisons. /// template - corpusIter do_search ( corpusIter corpus_first, corpusIter corpus_last ) const { + std::pair + do_search ( corpusIter corpus_first, corpusIter corpus_last ) const { /* ---- Do the matching ---- */ corpusIter curPos = corpus_first; const corpusIter lastPos = corpus_last - k_pattern_length; @@ -126,7 +129,7 @@ Requirements: j--; // We matched - we're done! if ( j == 0 ) - return curPos; + return std::make_pair(curPos, curPos + k_pattern_length); } // Since we didn't match, figure out how far to skip forward @@ -138,7 +141,7 @@ Requirements: curPos += suffix_ [ j ]; } - return corpus_last; // We didn't find anything + return std::make_pair(corpus_last, corpus_last); // We didn't find anything } @@ -211,7 +214,7 @@ Requirements: /// \param pat_last One past the end of the data to search for /// template - corpusIter boyer_moore_search ( + std::pair boyer_moore_search ( corpusIter corpus_first, corpusIter corpus_last, patIter pat_first, patIter pat_last ) { @@ -220,7 +223,7 @@ Requirements: } template - corpusIter boyer_moore_search ( + std::pair boyer_moore_search ( corpusIter corpus_first, corpusIter corpus_last, const PatternRange &pattern ) { typedef typename boost::range_iterator::type pattern_iterator; @@ -229,8 +232,9 @@ Requirements: } template - typename boost::lazy_disable_if_c< - boost::is_same::value, typename boost::range_iterator > + typename boost::disable_if_c< + boost::is_same::value, + std::pair::type, typename boost::range_iterator::type> > ::type boyer_moore_search ( CorpusRange &corpus, patIter pat_first, patIter pat_last ) { @@ -239,7 +243,7 @@ Requirements: } template - typename boost::range_iterator::type + std::pair::type, typename boost::range_iterator::type> boyer_moore_search ( CorpusRange &corpus, const PatternRange &pattern ) { typedef typename boost::range_iterator::type pattern_iterator; diff --git a/3party/boost/boost/algorithm/searching/boyer_moore_horspool.hpp b/3party/boost/boost/algorithm/searching/boyer_moore_horspool.hpp index 758ded206b..aacb5cb833 100644 --- a/3party/boost/boost/algorithm/searching/boyer_moore_horspool.hpp +++ b/3party/boost/boost/algorithm/searching/boyer_moore_horspool.hpp @@ -64,33 +64,34 @@ http://www-igm.univ-mlv.fr/%7Elecroq/string/node18.html ~boyer_moore_horspool () {} - /// \fn operator ( corpusIter corpus_first, corpusIter corpus_last, Pred p ) + /// \fn operator ( corpusIter corpus_first, corpusIter corpus_last) /// \brief Searches the corpus for the pattern that was passed into the constructor /// /// \param corpus_first The start of the data to search (Random Access Iterator) /// \param corpus_last One past the end of the data to search - /// \param p A predicate used for the search comparisons. /// template - corpusIter operator () ( corpusIter corpus_first, corpusIter corpus_last ) const { + std::pair + operator () ( corpusIter corpus_first, corpusIter corpus_last ) const { BOOST_STATIC_ASSERT (( boost::is_same< typename std::iterator_traits::value_type, typename std::iterator_traits::value_type>::value )); - if ( corpus_first == corpus_last ) return corpus_last; // if nothing to search, we didn't find it! - if ( pat_first == pat_last ) return corpus_first; // empty pattern matches at start + if ( corpus_first == corpus_last ) return std::make_pair(corpus_last, corpus_last); // if nothing to search, we didn't find it! + if ( pat_first == pat_last ) return std::make_pair(corpus_first, corpus_first); // empty pattern matches at start const difference_type k_corpus_length = std::distance ( corpus_first, corpus_last ); // If the pattern is larger than the corpus, we can't find it! if ( k_corpus_length < k_pattern_length ) - return corpus_last; + return std::make_pair(corpus_last, corpus_last); // Do the search return this->do_search ( corpus_first, corpus_last ); } template - typename boost::range_iterator::type operator () ( Range &r ) const { + std::pair::type, typename boost::range_iterator::type> + operator () ( Range &r ) const { return (*this) (boost::begin(r), boost::end(r)); } @@ -108,7 +109,8 @@ http://www-igm.univ-mlv.fr/%7Elecroq/string/node18.html /// \param k_corpus_length The length of the corpus to search /// template - corpusIter do_search ( corpusIter corpus_first, corpusIter corpus_last ) const { + std::pair + do_search ( corpusIter corpus_first, corpusIter corpus_last ) const { corpusIter curPos = corpus_first; const corpusIter lastPos = corpus_last - k_pattern_length; while ( curPos <= lastPos ) { @@ -117,14 +119,14 @@ http://www-igm.univ-mlv.fr/%7Elecroq/string/node18.html while ( pat_first [j] == curPos [j] ) { // We matched - we're done! if ( j == 0 ) - return curPos; + return std::make_pair(curPos, curPos + k_pattern_length); j--; } curPos += skip_ [ curPos [ k_pattern_length - 1 ]]; } - return corpus_last; + return std::make_pair(corpus_last, corpus_last); } // \endcond }; @@ -142,7 +144,7 @@ http://www-igm.univ-mlv.fr/%7Elecroq/string/node18.html /// \param pat_last One past the end of the data to search for /// template - corpusIter boyer_moore_horspool_search ( + std::pair boyer_moore_horspool_search ( corpusIter corpus_first, corpusIter corpus_last, patIter pat_first, patIter pat_last ) { @@ -151,7 +153,7 @@ http://www-igm.univ-mlv.fr/%7Elecroq/string/node18.html } template - corpusIter boyer_moore_horspool_search ( + std::pair boyer_moore_horspool_search ( corpusIter corpus_first, corpusIter corpus_last, const PatternRange &pattern ) { typedef typename boost::range_iterator::type pattern_iterator; @@ -160,8 +162,9 @@ http://www-igm.univ-mlv.fr/%7Elecroq/string/node18.html } template - typename boost::lazy_disable_if_c< - boost::is_same::value, typename boost::range_iterator > + typename boost::disable_if_c< + boost::is_same::value, + std::pair::type, typename boost::range_iterator::type> > ::type boyer_moore_horspool_search ( CorpusRange &corpus, patIter pat_first, patIter pat_last ) { @@ -170,7 +173,7 @@ http://www-igm.univ-mlv.fr/%7Elecroq/string/node18.html } template - typename boost::range_iterator::type + std::pair::type, typename boost::range_iterator::type> boyer_moore_horspool_search ( CorpusRange &corpus, const PatternRange &pattern ) { typedef typename boost::range_iterator::type pattern_iterator; diff --git a/3party/boost/boost/algorithm/searching/detail/bm_traits.hpp b/3party/boost/boost/algorithm/searching/detail/bm_traits.hpp index b39e5391c0..12143636be 100644 --- a/3party/boost/boost/algorithm/searching/detail/bm_traits.hpp +++ b/3party/boost/boost/algorithm/searching/detail/bm_traits.hpp @@ -79,7 +79,7 @@ namespace boost { namespace algorithm { namespace detail { skip_map skip_; const value_type k_default_value; public: - skip_table ( std::size_t patSize, value_type default_value ) : k_default_value ( default_value ) { + skip_table ( std::size_t /*patSize*/, value_type default_value ) : k_default_value ( default_value ) { std::fill_n ( skip_.begin(), skip_.size(), default_value ); } diff --git a/3party/boost/boost/algorithm/searching/knuth_morris_pratt.hpp b/3party/boost/boost/algorithm/searching/knuth_morris_pratt.hpp index aaeeb51ccb..c890c9cac0 100644 --- a/3party/boost/boost/algorithm/searching/knuth_morris_pratt.hpp +++ b/3party/boost/boost/algorithm/searching/knuth_morris_pratt.hpp @@ -69,23 +69,26 @@ namespace boost { namespace algorithm { /// \param p A predicate used for the search comparisons. /// template - corpusIter operator () ( corpusIter corpus_first, corpusIter corpus_last ) const { + std::pair + operator () ( corpusIter corpus_first, corpusIter corpus_last ) const { BOOST_STATIC_ASSERT (( boost::is_same< typename std::iterator_traits::value_type, typename std::iterator_traits::value_type>::value )); - if ( corpus_first == corpus_last ) return corpus_last; // if nothing to search, we didn't find it! - if ( pat_first == pat_last ) return corpus_first; // empty pattern matches at start + + if ( corpus_first == corpus_last ) return std::make_pair(corpus_last, corpus_last); // if nothing to search, we didn't find it! + if ( pat_first == pat_last ) return std::make_pair(corpus_first, corpus_first); // empty pattern matches at start const difference_type k_corpus_length = std::distance ( corpus_first, corpus_last ); // If the pattern is larger than the corpus, we can't find it! if ( k_corpus_length < k_pattern_length ) - return corpus_last; + return std::make_pair(corpus_last, corpus_last); - return do_search ( corpus_first, corpus_last, k_corpus_length ); + return do_search ( corpus_first, corpus_last, k_corpus_length ); } template - typename boost::range_iterator::type operator () ( Range &r ) const { + std::pair::type, typename boost::range_iterator::type> + operator () ( Range &r ) const { return (*this) (boost::begin(r), boost::end(r)); } @@ -103,7 +106,8 @@ namespace boost { namespace algorithm { /// \param p A predicate used for the search comparisons. /// template - corpusIter do_search ( corpusIter corpus_first, corpusIter corpus_last, + std::pair + do_search ( corpusIter corpus_first, corpusIter corpus_last, difference_type k_corpus_length ) const { difference_type match_start = 0; // position in the corpus that we're matching @@ -135,7 +139,7 @@ namespace boost { namespace algorithm { while ( match_start <= last_match ) { while ( pat_first [ idx ] == corpus_first [ match_start + idx ] ) { if ( ++idx == k_pattern_length ) - return corpus_first + match_start; + return std::make_pair(corpus_first + match_start, corpus_first + match_start + k_pattern_length); } // Figure out where to start searching again // assert ( idx - skip_ [ idx ] > 0 ); // we're always moving forward @@ -146,7 +150,7 @@ namespace boost { namespace algorithm { #endif // We didn't find anything - return corpus_last; + return std::make_pair(corpus_last, corpus_last); } @@ -202,7 +206,7 @@ namespace boost { namespace algorithm { /// \param pat_last One past the end of the data to search for /// template - corpusIter knuth_morris_pratt_search ( + std::pair knuth_morris_pratt_search ( corpusIter corpus_first, corpusIter corpus_last, patIter pat_first, patIter pat_last ) { @@ -211,7 +215,7 @@ namespace boost { namespace algorithm { } template - corpusIter knuth_morris_pratt_search ( + std::pair knuth_morris_pratt_search ( corpusIter corpus_first, corpusIter corpus_last, const PatternRange &pattern ) { typedef typename boost::range_iterator::type pattern_iterator; @@ -220,8 +224,9 @@ namespace boost { namespace algorithm { } template - typename boost::lazy_disable_if_c< - boost::is_same::value, typename boost::range_iterator > + typename boost::disable_if_c< + boost::is_same::value, + std::pair::type, typename boost::range_iterator::type> > ::type knuth_morris_pratt_search ( CorpusRange &corpus, patIter pat_first, patIter pat_last ) { @@ -230,7 +235,7 @@ namespace boost { namespace algorithm { } template - typename boost::range_iterator::type + std::pair::type, typename boost::range_iterator::type> knuth_morris_pratt_search ( CorpusRange &corpus, const PatternRange &pattern ) { typedef typename boost::range_iterator::type pattern_iterator; diff --git a/3party/boost/boost/algorithm/sort_subrange.hpp b/3party/boost/boost/algorithm/sort_subrange.hpp new file mode 100644 index 0000000000..7fb2cb55d0 --- /dev/null +++ b/3party/boost/boost/algorithm/sort_subrange.hpp @@ -0,0 +1,109 @@ +/* + Copyright (c) Marshall Clow 2008-2012. + + 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) + + Revision history: + 28 Sep 2015 mtc First version + +*/ + +/// \file sort_subrange.hpp +/// \brief Sort a subrange +/// \author Marshall Clow +/// +/// Suggested by Sean Parent in his CppCon 2015 keynote + +#ifndef BOOST_ALGORITHM_SORT_SUBRANGE_HPP +#define BOOST_ALGORITHM_SORT_SUBRANGE_HPP + +#include // For std::less +#include // For std::iterator_traits +#include // For nth_element and partial_sort + +#include +#include + +namespace boost { namespace algorithm { + +/// \fn sort_subrange ( T const& val, +/// Iterator first, Iterator last, +/// Iterator sub_first, Iterator sub_last, +/// Pred p ) +/// \brief Sort the subrange [sub_first, sub_last) that is inside +/// the range [first, last) as if you had sorted the entire range. +/// +/// \param first The start of the larger range +/// \param last The end of the larger range +/// \param sub_first The start of the sub range +/// \param sub_last The end of the sub range +/// \param p A predicate to use to compare the values. +/// p ( a, b ) returns a boolean. +/// + template + void sort_subrange ( + Iterator first, Iterator last, + Iterator sub_first, Iterator sub_last, + Pred p) + { + if (sub_first == sub_last) return; // the empty sub-range is already sorted. + + if (sub_first != first) { // sub-range is at the start, don't need to partition + (void) std::nth_element(first, sub_first, last, p); + ++sub_first; + } + std::partial_sort(sub_first, sub_last, last, p); + } + + + + template + void sort_subrange (Iterator first, Iterator last, Iterator sub_first, Iterator sub_last) + { + typedef typename std::iterator_traits::value_type value_type; + return sort_subrange(first, last, sub_first, sub_last, std::less()); + } + +/// range versions? + + +/// \fn partition_subrange ( T const& val, +/// Iterator first, Iterator last, +/// Iterator sub_first, Iterator sub_last, +/// Pred p ) +/// \brief Gather the elements of the subrange [sub_first, sub_last) that is +/// inside the range [first, last) as if you had sorted the entire range. +/// +/// \param first The start of the larger range +/// \param last The end of the larger range +/// \param sub_first The start of the sub range +/// \param sub_last The end of the sub range +/// \param p A predicate to use to compare the values. +/// p ( a, b ) returns a boolean. +/// + template + void partition_subrange ( + Iterator first, Iterator last, + Iterator sub_first, Iterator sub_last, + Pred p) + { + if (sub_first != first) { + (void) std::nth_element(first, sub_first, last, p); + ++sub_first; + } + + if (sub_last != last) + (void) std::nth_element(sub_first, sub_last, last, p); + } + + template + void partition_subrange (Iterator first, Iterator last, Iterator sub_first, Iterator sub_last) + { + typedef typename std::iterator_traits::value_type value_type; + return partition_subrange(first, last, sub_first, sub_last, std::less()); + } + +}} + +#endif // BOOST_ALGORITHM_SORT_SUBRANGE_HPP diff --git a/3party/boost/boost/algorithm/string/replace.hpp b/3party/boost/boost/algorithm/string/replace.hpp index 0c04e47e1e..2adb031c59 100644 --- a/3party/boost/boost/algorithm/string/replace.hpp +++ b/3party/boost/boost/algorithm/string/replace.hpp @@ -401,7 +401,6 @@ namespace boost { \param Search A substring to be searched for \param Format A substitute string \param Loc A locale used for case insensitive comparison - \return A reference to the modified input */ template inline void ireplace_last( @@ -643,7 +642,6 @@ namespace boost { \param Input An input string \param Search A substring to be searched for \param Format A substitute string - \return A reference to the modified input */ template inline void replace_all( diff --git a/3party/boost/boost/align.hpp b/3party/boost/boost/align.hpp index 0b3221dffc..45fe36bbcc 100644 --- a/3party/boost/boost/align.hpp +++ b/3party/boost/boost/align.hpp @@ -1,15 +1,16 @@ /* -(c) 2014-2015 Glen Joseph Fernandes -glenjofe at gmail dot com +Copyright 2014-2015 Glen Joseph Fernandes +(glenjofe@gmail.com) -Distributed under the Boost Software -License, Version 1.0. -http://boost.org/LICENSE_1_0.txt +Distributed under the Boost Software License, Version 1.0. +(http://www.boost.org/LICENSE_1_0.txt) */ #ifndef BOOST_ALIGN_HPP #define BOOST_ALIGN_HPP #include +#include +#include #include #include #include diff --git a/3party/boost/boost/align/align.hpp b/3party/boost/boost/align/align.hpp index b95d673bcd..ee4371091c 100644 --- a/3party/boost/boost/align/align.hpp +++ b/3party/boost/boost/align/align.hpp @@ -1,10 +1,9 @@ /* -(c) 2014 Glen Joseph Fernandes -glenjofe at gmail dot com +Copyright 2014-2015 Glen Joseph Fernandes +(glenjofe@gmail.com) -Distributed under the Boost Software -License, Version 1.0. -http://boost.org/LICENSE_1_0.txt +Distributed under the Boost Software License, Version 1.0. +(http://www.boost.org/LICENSE_1_0.txt) */ #ifndef BOOST_ALIGN_ALIGN_HPP #define BOOST_ALIGN_ALIGN_HPP diff --git a/3party/boost/boost/align/align_down.hpp b/3party/boost/boost/align/align_down.hpp new file mode 100644 index 0000000000..355844f8aa --- /dev/null +++ b/3party/boost/boost/align/align_down.hpp @@ -0,0 +1,25 @@ +/* +Copyright 2015 Glen Joseph Fernandes +(glenjofe@gmail.com) + +Distributed under the Boost Software License, Version 1.0. +(http://www.boost.org/LICENSE_1_0.txt) +*/ +#ifndef BOOST_ALIGN_ALIGN_DOWN_HPP +#define BOOST_ALIGN_ALIGN_DOWN_HPP + +#include + +namespace boost { +namespace alignment { + +BOOST_CONSTEXPR inline std::size_t +align_down(std::size_t value, std::size_t alignment) BOOST_NOEXCEPT +{ + return value & ~(alignment - 1); +} + +} /* alignment */ +} /* boost */ + +#endif diff --git a/3party/boost/boost/align/align_up.hpp b/3party/boost/boost/align/align_up.hpp new file mode 100644 index 0000000000..6401ea848a --- /dev/null +++ b/3party/boost/boost/align/align_up.hpp @@ -0,0 +1,25 @@ +/* +Copyright 2015 Glen Joseph Fernandes +(glenjofe@gmail.com) + +Distributed under the Boost Software License, Version 1.0. +(http://www.boost.org/LICENSE_1_0.txt) +*/ +#ifndef BOOST_ALIGN_ALIGN_UP_HPP +#define BOOST_ALIGN_ALIGN_UP_HPP + +#include + +namespace boost { +namespace alignment { + +BOOST_CONSTEXPR inline std::size_t +align_up(std::size_t value, std::size_t alignment) BOOST_NOEXCEPT +{ + return (value + alignment - 1) & ~(alignment - 1); +} + +} /* alignment */ +} /* boost */ + +#endif diff --git a/3party/boost/boost/align/aligned_alloc.hpp b/3party/boost/boost/align/aligned_alloc.hpp index 0e3ba60641..42128f1b24 100644 --- a/3party/boost/boost/align/aligned_alloc.hpp +++ b/3party/boost/boost/align/aligned_alloc.hpp @@ -1,10 +1,9 @@ /* -(c) 2014 Glen Joseph Fernandes -glenjofe at gmail dot com +Copyright 2014-2015 Glen Joseph Fernandes +(glenjofe@gmail.com) -Distributed under the Boost Software -License, Version 1.0. -http://boost.org/LICENSE_1_0.txt +Distributed under the Boost Software License, Version 1.0. +(http://www.boost.org/LICENSE_1_0.txt) */ #ifndef BOOST_ALIGN_ALIGNED_ALLOC_HPP #define BOOST_ALIGN_ALIGNED_ALLOC_HPP @@ -19,7 +18,9 @@ http://boost.org/LICENSE_1_0.txt #include #endif -#if defined(_MSC_VER) +#if defined(BOOST_ALIGN_USE_ALLOCATE) +#include +#elif defined(_MSC_VER) && !defined(UNDER_CE) #include #elif defined(__MINGW32__) && (__MSVCRT_VERSION__ >= 0x0700) #include diff --git a/3party/boost/boost/align/aligned_allocator.hpp b/3party/boost/boost/align/aligned_allocator.hpp index a31dfe599f..6d0f788952 100644 --- a/3party/boost/boost/align/aligned_allocator.hpp +++ b/3party/boost/boost/align/aligned_allocator.hpp @@ -1,24 +1,22 @@ /* -(c) 2014 Glen Joseph Fernandes -glenjofe at gmail dot com +Copyright 2014-2015 Glen Joseph Fernandes +(glenjofe@gmail.com) -Distributed under the Boost Software -License, Version 1.0. -http://boost.org/LICENSE_1_0.txt +Distributed under the Boost Software License, Version 1.0. +(http://www.boost.org/LICENSE_1_0.txt) */ #ifndef BOOST_ALIGN_ALIGNED_ALLOCATOR_HPP #define BOOST_ALIGN_ALIGNED_ALLOCATOR_HPP -#include -#include -#include +#include +#include +#include +#include #include #include #include -#include -#include -#include -#include +#include +#include #include #if !defined(BOOST_NO_CXX11_RVALUE_REFERENCES) @@ -46,7 +44,7 @@ public: private: enum { - min_align = detail::max_align::value>::value }; @@ -57,68 +55,64 @@ public: }; #if !defined(BOOST_NO_CXX11_DEFAULTED_FUNCTIONS) - aligned_allocator() BOOST_NOEXCEPT = default; + aligned_allocator() = default; #else - aligned_allocator() BOOST_NOEXCEPT { - } + aligned_allocator() BOOST_NOEXCEPT { } #endif template aligned_allocator(const aligned_allocator&) - BOOST_NOEXCEPT { - } + BOOST_NOEXCEPT { } pointer address(reference value) const BOOST_NOEXCEPT { return detail::addressof(value); } - const_pointer address(const_reference value) const - BOOST_NOEXCEPT { + const_pointer address(const_reference value) const BOOST_NOEXCEPT { return detail::addressof(value); } pointer allocate(size_type size, const_void_pointer = 0) { + if (size == 0) { + return 0; + } void* p = aligned_alloc(min_align, sizeof(T) * size); - if (!p && size > 0) { + if (!p) { boost::throw_exception(std::bad_alloc()); } return static_cast(p); } void deallocate(pointer ptr, size_type) { - alignment::aligned_free(ptr); + boost::alignment::aligned_free(ptr); } BOOST_CONSTEXPR size_type max_size() const BOOST_NOEXCEPT { - return detail::max_count_of::value; + return detail::max_objects::value; } #if !defined(BOOST_NO_CXX11_RVALUE_REFERENCES) #if !defined(BOOST_NO_CXX11_VARIADIC_TEMPLATES) template void construct(U* ptr, Args&&... args) { - void* p = ptr; - ::new(p) U(std::forward(args)...); + ::new((void*)ptr) U(std::forward(args)...); } #else template void construct(U* ptr, V&& value) { - void* p = ptr; - ::new(p) U(std::forward(value)); + ::new((void*)ptr) U(std::forward(value)); } #endif #else template void construct(U* ptr, const V& value) { - void* p = ptr; - ::new(p) U(value); + ::new((void*)ptr) U(value); } #endif template void construct(U* ptr) { - void* p = ptr; - ::new(p) U(); + ::new((void*)ptr) U(); } template @@ -144,23 +138,23 @@ public: }; }; -template -inline bool operator==(const aligned_allocator&, const aligned_allocator&) BOOST_NOEXCEPT +template +inline bool +operator==(const aligned_allocator&, + const aligned_allocator&) BOOST_NOEXCEPT { return true; } -template -inline bool operator!=(const aligned_allocator&, const aligned_allocator&) BOOST_NOEXCEPT +template +inline bool +operator!=(const aligned_allocator&, + const aligned_allocator&) BOOST_NOEXCEPT { return false; } -} /* :alignment */ -} /* :boost */ +} /* alignment */ +} /* boost */ #endif diff --git a/3party/boost/boost/align/aligned_allocator_adaptor.hpp b/3party/boost/boost/align/aligned_allocator_adaptor.hpp index ac77b4ab9e..8905c215d3 100644 --- a/3party/boost/boost/align/aligned_allocator_adaptor.hpp +++ b/3party/boost/boost/align/aligned_allocator_adaptor.hpp @@ -1,22 +1,21 @@ /* -(c) 2014-2015 Glen Joseph Fernandes -glenjofe at gmail dot com +Copyright 2014-2016 Glen Joseph Fernandes +(glenjofe@gmail.com) -Distributed under the Boost Software -License, Version 1.0. -http://boost.org/LICENSE_1_0.txt +Distributed under the Boost Software License, Version 1.0. +(http://www.boost.org/LICENSE_1_0.txt) */ #ifndef BOOST_ALIGN_ALIGNED_ALLOCATOR_ADAPTOR_HPP #define BOOST_ALIGN_ALIGNED_ALLOCATOR_ADAPTOR_HPP -#include -#include -#include -#include -#include #include #include #include +#include +#include +#include +#include +#include #include #if !defined(BOOST_NO_CXX11_ALLOCATOR) @@ -53,10 +52,6 @@ class aligned_allocator_adaptor typedef typename char_alloc::pointer char_ptr; #endif - enum { - ptr_align = alignment_of::value - }; - public: #if !defined(BOOST_NO_CXX11_ALLOCATOR) typedef typename traits::value_type value_type; @@ -74,9 +69,8 @@ public: private: enum { - min_align = detail::max_align::value, - alignment_of::value>::value>::value + min_align = detail::max_size::value>::value }; public: @@ -95,28 +89,23 @@ public: aligned_allocator_adaptor() = default; #else aligned_allocator_adaptor() - : Allocator() { - } + : Allocator() { } #endif #if !defined(BOOST_NO_CXX11_RVALUE_REFERENCES) template explicit aligned_allocator_adaptor(A&& alloc) BOOST_NOEXCEPT - : Allocator(std::forward(alloc)) { - } + : Allocator(std::forward(alloc)) { } #else template - explicit aligned_allocator_adaptor(const A& alloc) - BOOST_NOEXCEPT - : Allocator(alloc) { - } + explicit aligned_allocator_adaptor(const A& alloc) BOOST_NOEXCEPT + : Allocator(alloc) { } #endif template aligned_allocator_adaptor(const aligned_allocator_adaptor& other) BOOST_NOEXCEPT - : Allocator(other.base()) { - } + : Allocator(other.base()) { } Allocator& base() BOOST_NOEXCEPT { return static_cast(*this); @@ -127,64 +116,64 @@ public: } pointer allocate(size_type size) { - std::size_t n1 = size * sizeof(value_type); - std::size_t n2 = n1 + min_align - ptr_align; + std::size_t s = size * sizeof(value_type); + std::size_t n = s + min_align - 1; char_alloc a(base()); - char_ptr p1 = a.allocate(sizeof p1 + n2); - void* p2 = detail::addressof(*p1) + sizeof p1; - (void)align(min_align, n1, p2, n2); - void* p3 = static_cast(p2) - 1; - ::new(p3) char_ptr(p1); - return static_cast(p2); + char_ptr p = a.allocate(sizeof p + n); + void* r = detail::addressof(*p) + sizeof p; + (void)align(min_align, s, r, n); + ::new(static_cast(static_cast(r) + - 1)) char_ptr(p); + return static_cast(r); } pointer allocate(size_type size, const_void_pointer hint) { - std::size_t n1 = size * sizeof(value_type); - std::size_t n2 = n1 + min_align - ptr_align; + std::size_t s = size * sizeof(value_type); + std::size_t n = s + min_align - 1; char_ptr h = char_ptr(); if (hint) { h = *(static_cast(hint) - 1); } char_alloc a(base()); #if !defined(BOOST_NO_CXX11_ALLOCATOR) - char_ptr p1 = char_traits::allocate(a, sizeof p1 + n2, h); + char_ptr p = char_traits::allocate(a, sizeof p + n, h); #else - char_ptr p1 = a.allocate(sizeof p1 + n2, h); + char_ptr p = a.allocate(sizeof p + n, h); #endif - void* p2 = detail::addressof(*p1) + sizeof p1; - (void)align(min_align, n1, p2, n2); - void* p3 = static_cast(p2) - 1; - ::new(p3) char_ptr(p1); - return static_cast(p2); + void* r = detail::addressof(*p) + sizeof p; + (void)align(min_align, s, r, n); + ::new(static_cast(static_cast(r) + - 1)) char_ptr(p); + return static_cast(r); } void deallocate(pointer ptr, size_type size) { - char_ptr* p1 = reinterpret_cast(ptr) - 1; - char_ptr p2 = *p1; - p1->~char_ptr(); + char_ptr* p = reinterpret_cast(ptr) - 1; + char_ptr r = *p; + p->~char_ptr(); char_alloc a(base()); - a.deallocate(p2, size * sizeof(value_type) + - min_align - ptr_align + sizeof p2); + a.deallocate(r, sizeof r + size * sizeof(value_type) + + min_align - 1); } }; -template -inline bool operator==(const aligned_allocator_adaptor& a, const aligned_allocator_adaptor& b) BOOST_NOEXCEPT +template +inline bool +operator==(const aligned_allocator_adaptor& a, + const aligned_allocator_adaptor& b) BOOST_NOEXCEPT { return a.base() == b.base(); } -template -inline bool operator!=(const aligned_allocator_adaptor& a, const aligned_allocator_adaptor& b) BOOST_NOEXCEPT +template +inline bool +operator!=(const aligned_allocator_adaptor& a, + const aligned_allocator_adaptor& b) BOOST_NOEXCEPT { return !(a == b); } -} /* :alignment */ -} /* :boost */ +} /* alignment */ +} /* boost */ #endif diff --git a/3party/boost/boost/align/aligned_allocator_adaptor_forward.hpp b/3party/boost/boost/align/aligned_allocator_adaptor_forward.hpp index 327d7edbf9..f762cd1c3a 100644 --- a/3party/boost/boost/align/aligned_allocator_adaptor_forward.hpp +++ b/3party/boost/boost/align/aligned_allocator_adaptor_forward.hpp @@ -1,10 +1,9 @@ /* -(c) 2014 Glen Joseph Fernandes -glenjofe at gmail dot com +Copyright 2014 Glen Joseph Fernandes +(glenjofe@gmail.com) -Distributed under the Boost Software -License, Version 1.0. -http://boost.org/LICENSE_1_0.txt +Distributed under the Boost Software License, Version 1.0. +(http://www.boost.org/LICENSE_1_0.txt) */ #ifndef BOOST_ALIGN_ALIGNED_ALLOCATOR_ADAPTOR_FORWARD_HPP #define BOOST_ALIGN_ALIGNED_ALLOCATOR_ADAPTOR_FORWARD_HPP @@ -17,7 +16,7 @@ namespace alignment { template class aligned_allocator_adaptor; -} /* :alignment */ -} /* :boost */ +} /* alignment */ +} /* boost */ #endif diff --git a/3party/boost/boost/align/aligned_allocator_forward.hpp b/3party/boost/boost/align/aligned_allocator_forward.hpp index 9a3f3635db..23add71aaa 100644 --- a/3party/boost/boost/align/aligned_allocator_forward.hpp +++ b/3party/boost/boost/align/aligned_allocator_forward.hpp @@ -1,10 +1,9 @@ /* -(c) 2014 Glen Joseph Fernandes -glenjofe at gmail dot com +Copyright 2014 Glen Joseph Fernandes +(glenjofe@gmail.com) -Distributed under the Boost Software -License, Version 1.0. -http://boost.org/LICENSE_1_0.txt +Distributed under the Boost Software License, Version 1.0. +(http://www.boost.org/LICENSE_1_0.txt) */ #ifndef BOOST_ALIGN_ALIGNED_ALLOCATOR_FORWARD_HPP #define BOOST_ALIGN_ALIGNED_ALLOCATOR_FORWARD_HPP @@ -17,7 +16,7 @@ namespace alignment { template class aligned_allocator; -} /* :alignment */ -} /* :boost */ +} /* alignment */ +} /* boost */ #endif diff --git a/3party/boost/boost/align/aligned_delete.hpp b/3party/boost/boost/align/aligned_delete.hpp index 6d8caed302..385bd557af 100644 --- a/3party/boost/boost/align/aligned_delete.hpp +++ b/3party/boost/boost/align/aligned_delete.hpp @@ -1,34 +1,31 @@ /* -(c) 2014 Glen Joseph Fernandes -glenjofe at gmail dot com +Copyright 2014-2015 Glen Joseph Fernandes +(glenjofe@gmail.com) -Distributed under the Boost Software -License, Version 1.0. -http://boost.org/LICENSE_1_0.txt +Distributed under the Boost Software License, Version 1.0. +(http://www.boost.org/LICENSE_1_0.txt) */ #ifndef BOOST_ALIGN_ALIGNED_DELETE_HPP #define BOOST_ALIGN_ALIGNED_DELETE_HPP -#include #include #include namespace boost { namespace alignment { -class aligned_delete { -public: +struct aligned_delete { template void operator()(T* ptr) const BOOST_NOEXCEPT_IF(BOOST_NOEXCEPT_EXPR(ptr->~T())) { if (ptr) { ptr->~T(); - alignment::aligned_free(ptr); + boost::alignment::aligned_free(ptr); } } }; -} /* :alignment */ -} /* :boost */ +} /* alignment */ +} /* boost */ #endif diff --git a/3party/boost/boost/align/aligned_delete_forward.hpp b/3party/boost/boost/align/aligned_delete_forward.hpp index 530e0970d3..d5b766d7f0 100644 --- a/3party/boost/boost/align/aligned_delete_forward.hpp +++ b/3party/boost/boost/align/aligned_delete_forward.hpp @@ -1,10 +1,9 @@ /* -(c) 2014 Glen Joseph Fernandes -glenjofe at gmail dot com +Copyright 2014-2015 Glen Joseph Fernandes +(glenjofe@gmail.com) -Distributed under the Boost Software -License, Version 1.0. -http://boost.org/LICENSE_1_0.txt +Distributed under the Boost Software License, Version 1.0. +(http://www.boost.org/LICENSE_1_0.txt) */ #ifndef BOOST_ALIGN_ALIGNED_DELETE_FORWARD_HPP #define BOOST_ALIGN_ALIGNED_DELETE_FORWARD_HPP @@ -12,9 +11,9 @@ http://boost.org/LICENSE_1_0.txt namespace boost { namespace alignment { -class aligned_delete; +struct aligned_delete; -} /* :alignment */ -} /* :boost */ +} /* alignment */ +} /* boost */ #endif diff --git a/3party/boost/boost/align/alignment_of.hpp b/3party/boost/boost/align/alignment_of.hpp index 06d22a0259..488df0b9e0 100644 --- a/3party/boost/boost/align/alignment_of.hpp +++ b/3party/boost/boost/align/alignment_of.hpp @@ -1,17 +1,15 @@ /* -(c) 2014-2015 Glen Joseph Fernandes -glenjofe at gmail dot com +Copyright 2014-2016 Glen Joseph Fernandes +(glenjofe@gmail.com) -Distributed under the Boost Software -License, Version 1.0. -http://boost.org/LICENSE_1_0.txt +Distributed under the Boost Software License, Version 1.0. +(http://www.boost.org/LICENSE_1_0.txt) */ #ifndef BOOST_ALIGN_ALIGNMENT_OF_HPP #define BOOST_ALIGN_ALIGNMENT_OF_HPP -#include +#include #include -#include #if defined(BOOST_MSVC) #include @@ -41,13 +39,14 @@ namespace alignment { template struct alignment_of : detail::alignment_of:: - type>::type>::type>::type { -}; + detail::element_type::type>::type { }; -} /* :alignment */ -} /* :boost */ +#if !defined(BOOST_NO_CXX14_VARIABLE_TEMPLATES) +template +constexpr std::size_t alignment_of_v = alignment_of::value; +#endif + +} /* alignment */ +} /* boost */ #endif diff --git a/3party/boost/boost/align/alignment_of_forward.hpp b/3party/boost/boost/align/alignment_of_forward.hpp index 778a9f73b8..31db15f23c 100644 --- a/3party/boost/boost/align/alignment_of_forward.hpp +++ b/3party/boost/boost/align/alignment_of_forward.hpp @@ -1,10 +1,9 @@ /* -(c) 2014 Glen Joseph Fernandes -glenjofe at gmail dot com +Copyright 2014 Glen Joseph Fernandes +(glenjofe@gmail.com) -Distributed under the Boost Software -License, Version 1.0. -http://boost.org/LICENSE_1_0.txt +Distributed under the Boost Software License, Version 1.0. +(http://www.boost.org/LICENSE_1_0.txt) */ #ifndef BOOST_ALIGN_ALIGNMENT_OF_FORWARD_HPP #define BOOST_ALIGN_ALIGNMENT_OF_FORWARD_HPP @@ -15,7 +14,7 @@ namespace alignment { template struct alignment_of; -} /* :alignment */ -} /* :boost */ +} /* alignment */ +} /* boost */ #endif diff --git a/3party/boost/boost/align/assume_aligned.hpp b/3party/boost/boost/align/assume_aligned.hpp index 8d730e6d79..22e5103654 100644 --- a/3party/boost/boost/align/assume_aligned.hpp +++ b/3party/boost/boost/align/assume_aligned.hpp @@ -1,13 +1,12 @@ /* -(c) 2015 NumScale SAS -(c) 2015 LRI UMR 8623 CNRS/University Paris Sud XI +Copyright 2015 NumScale SAS +Copyright 2015 LRI UMR 8623 CNRS/University Paris Sud XI -(c) 2015 Glen Joseph Fernandes -glenjofe at gmail dot com +Copyright 2015 Glen Joseph Fernandes +(glenjofe@gmail.com) -Distributed under the Boost Software -License, Version 1.0. -http://boost.org/LICENSE_1_0.txt +Distributed under the Boost Software License, Version 1.0. +(http://www.boost.org/LICENSE_1_0.txt) */ #ifndef BOOST_ALIGN_ASSUME_ALIGNED_HPP #define BOOST_ALIGN_ASSUME_ALIGNED_HPP @@ -16,7 +15,7 @@ http://boost.org/LICENSE_1_0.txt #if defined(BOOST_MSVC) #include -#elif defined(BOOST_CLANG) +#elif defined(BOOST_CLANG) && defined(__has_builtin) #include #elif BOOST_GCC_VERSION >= 40700 #include diff --git a/3party/boost/boost/align/detail/address.hpp b/3party/boost/boost/align/detail/address.hpp deleted file mode 100644 index 63be1a95d0..0000000000 --- a/3party/boost/boost/align/detail/address.hpp +++ /dev/null @@ -1,29 +0,0 @@ -/* -(c) 2014 Glen Joseph Fernandes -glenjofe at gmail dot com - -Distributed under the Boost Software -License, Version 1.0. -http://boost.org/LICENSE_1_0.txt -*/ -#ifndef BOOST_ALIGN_DETAIL_ADDRESS_HPP -#define BOOST_ALIGN_DETAIL_ADDRESS_HPP - -#include -#include - -namespace boost { -namespace alignment { -namespace detail { - -#if defined(BOOST_HAS_INTPTR_T) -typedef boost::uintptr_t address_t; -#else -typedef std::size_t address_t; -#endif - -} /* :detail */ -} /* :alignment */ -} /* :boost */ - -#endif diff --git a/3party/boost/boost/align/detail/addressof.hpp b/3party/boost/boost/align/detail/addressof.hpp index 8f0c88204e..a314830bed 100644 --- a/3party/boost/boost/align/detail/addressof.hpp +++ b/3party/boost/boost/align/detail/addressof.hpp @@ -1,10 +1,9 @@ /* -(c) 2014 Glen Joseph Fernandes -glenjofe at gmail dot com +Copyright 2014 Glen Joseph Fernandes +(glenjofe@gmail.com) -Distributed under the Boost Software -License, Version 1.0. -http://boost.org/LICENSE_1_0.txt +Distributed under the Boost Software License, Version 1.0. +(http://www.boost.org/LICENSE_1_0.txt) */ #ifndef BOOST_ALIGN_DETAIL_ADDRESSOF_HPP #define BOOST_ALIGN_DETAIL_ADDRESSOF_HPP @@ -27,8 +26,8 @@ using std::addressof; using boost::addressof; #endif -} /* :detail */ -} /* :alignment */ -} /* :boost */ +} /* detail */ +} /* alignment */ +} /* boost */ #endif diff --git a/3party/boost/boost/align/detail/align.hpp b/3party/boost/boost/align/detail/align.hpp index 00be6fd6aa..a58dcea747 100644 --- a/3party/boost/boost/align/detail/align.hpp +++ b/3party/boost/boost/align/detail/align.hpp @@ -1,40 +1,38 @@ /* -(c) 2014 Glen Joseph Fernandes -glenjofe at gmail dot com +Copyright 2014-2016 Glen Joseph Fernandes +(glenjofe@gmail.com) -Distributed under the Boost Software -License, Version 1.0. -http://boost.org/LICENSE_1_0.txt +Distributed under the Boost Software License, Version 1.0. +(http://www.boost.org/LICENSE_1_0.txt) */ #ifndef BOOST_ALIGN_DETAIL_ALIGN_HPP #define BOOST_ALIGN_DETAIL_ALIGN_HPP -#include -#include #include -#include +#include namespace boost { namespace alignment { -inline void* align(std::size_t alignment, std::size_t size, - void*& ptr, std::size_t& space) +inline void* +align(std::size_t alignment, std::size_t size, void*& ptr, + std::size_t& space) { BOOST_ASSERT(detail::is_alignment(alignment)); - std::size_t n = detail::address_t(ptr) & (alignment - 1); - if (n != 0) { - n = alignment - n; + if (size <= space) { + char* p = reinterpret_cast((reinterpret_cast(ptr) + alignment - 1) & ~(alignment - 1)); + std::size_t n = space - (p - static_cast(ptr)); + if (size <= n) { + ptr = p; + space = n; + return p; + } } - void* p = 0; - if (n <= space && size <= space - n) { - p = static_cast(ptr) + n; - ptr = p; - space -= n; - } - return p; + return 0; } -} /* :alignment */ -} /* :boost */ +} /* alignment */ +} /* boost */ #endif diff --git a/3party/boost/boost/align/detail/align_cxx11.hpp b/3party/boost/boost/align/detail/align_cxx11.hpp index 80dc7e36a4..637541ab40 100644 --- a/3party/boost/boost/align/detail/align_cxx11.hpp +++ b/3party/boost/boost/align/detail/align_cxx11.hpp @@ -1,10 +1,9 @@ /* -(c) 2014 Glen Joseph Fernandes -glenjofe at gmail dot com +Copyright 2014 Glen Joseph Fernandes +(glenjofe@gmail.com) -Distributed under the Boost Software -License, Version 1.0. -http://boost.org/LICENSE_1_0.txt +Distributed under the Boost Software License, Version 1.0. +(http://www.boost.org/LICENSE_1_0.txt) */ #ifndef BOOST_ALIGN_DETAIL_ALIGN_CXX11_HPP #define BOOST_ALIGN_DETAIL_ALIGN_CXX11_HPP @@ -16,7 +15,7 @@ namespace alignment { using std::align; -} /* :alignment */ -} /* :boost */ +} /* alignment */ +} /* boost */ #endif diff --git a/3party/boost/boost/align/detail/align_down.hpp b/3party/boost/boost/align/detail/align_down.hpp new file mode 100644 index 0000000000..9a8c358c41 --- /dev/null +++ b/3party/boost/boost/align/detail/align_down.hpp @@ -0,0 +1,28 @@ +/* +Copyright 2015 Glen Joseph Fernandes +(glenjofe@gmail.com) + +Distributed under the Boost Software License, Version 1.0. +(http://www.boost.org/LICENSE_1_0.txt) +*/ +#ifndef BOOST_ALIGN_DETAIL_ALIGN_DOWN_HPP +#define BOOST_ALIGN_DETAIL_ALIGN_DOWN_HPP + +#include +#include + +namespace boost { +namespace alignment { + +inline void* +align_down(void* ptr, std::size_t alignment) BOOST_NOEXCEPT +{ + BOOST_ASSERT(detail::is_alignment(alignment)); + return reinterpret_cast(reinterpret_cast(ptr) & ~(alignment - 1)); +} + +} /* alignment */ +} /* boost */ + +#endif diff --git a/3party/boost/boost/align/detail/align_up.hpp b/3party/boost/boost/align/detail/align_up.hpp new file mode 100644 index 0000000000..86686da6ae --- /dev/null +++ b/3party/boost/boost/align/detail/align_up.hpp @@ -0,0 +1,28 @@ +/* +Copyright 2015 Glen Joseph Fernandes +(glenjofe@gmail.com) + +Distributed under the Boost Software License, Version 1.0. +(http://www.boost.org/LICENSE_1_0.txt) +*/ +#ifndef BOOST_ALIGN_DETAIL_ALIGN_UP_HPP +#define BOOST_ALIGN_DETAIL_ALIGN_UP_HPP + +#include +#include + +namespace boost { +namespace alignment { + +inline void* +align_up(void* ptr, std::size_t alignment) BOOST_NOEXCEPT +{ + BOOST_ASSERT(detail::is_alignment(alignment)); + return reinterpret_cast((reinterpret_cast(ptr) + alignment - 1) & ~(alignment - 1)); +} + +} /* alignment */ +} /* boost */ + +#endif diff --git a/3party/boost/boost/align/detail/aligned_alloc.hpp b/3party/boost/boost/align/detail/aligned_alloc.hpp index 1852ac15a6..69da19659a 100644 --- a/3party/boost/boost/align/detail/aligned_alloc.hpp +++ b/3party/boost/boost/align/detail/aligned_alloc.hpp @@ -1,26 +1,24 @@ /* -(c) 2014-2015 Glen Joseph Fernandes -glenjofe at gmail dot com +Copyright 2014-2015 Glen Joseph Fernandes +(glenjofe@gmail.com) -Distributed under the Boost Software -License, Version 1.0. -http://boost.org/LICENSE_1_0.txt +Distributed under the Boost Software License, Version 1.0. +(http://www.boost.org/LICENSE_1_0.txt) */ #ifndef BOOST_ALIGN_DETAIL_ALIGNED_ALLOC_HPP #define BOOST_ALIGN_DETAIL_ALIGNED_ALLOC_HPP -#include -#include +#include #include #include -#include +#include #include namespace boost { namespace alignment { -inline void* aligned_alloc(std::size_t alignment, std::size_t size) - BOOST_NOEXCEPT +inline void* +aligned_alloc(std::size_t alignment, std::size_t size) BOOST_NOEXCEPT { BOOST_ASSERT(detail::is_alignment(alignment)); enum { @@ -30,25 +28,25 @@ inline void* aligned_alloc(std::size_t alignment, std::size_t size) alignment = N; } std::size_t n = size + alignment - N; - void* p1 = 0; - void* p2 = std::malloc(n + sizeof p1); - if (p2) { - p1 = static_cast(p2) + sizeof p1; - (void)align(alignment, size, p1, n); - *(static_cast(p1) - 1) = p2; + void* p = std::malloc(sizeof(void*) + n); + if (p) { + void* r = static_cast(p) + sizeof(void*); + (void)align(alignment, size, r, n); + *(static_cast(r) - 1) = p; + p = r; } - return p1; + return p; } -inline void aligned_free(void* ptr) BOOST_NOEXCEPT +inline void +aligned_free(void* ptr) BOOST_NOEXCEPT { if (ptr) { - void* p = *(static_cast(ptr) - 1); - std::free(p); + std::free(*(static_cast(ptr) - 1)); } } -} /* :alignment */ -} /* :boost */ +} /* alignment */ +} /* boost */ #endif diff --git a/3party/boost/boost/align/detail/aligned_alloc_android.hpp b/3party/boost/boost/align/detail/aligned_alloc_android.hpp index d97d67989e..4119fbd9bc 100644 --- a/3party/boost/boost/align/detail/aligned_alloc_android.hpp +++ b/3party/boost/boost/align/detail/aligned_alloc_android.hpp @@ -1,36 +1,34 @@ /* -(c) 2014 Glen Joseph Fernandes -glenjofe at gmail dot com +Copyright 2014 Glen Joseph Fernandes +(glenjofe@gmail.com) -Distributed under the Boost Software -License, Version 1.0. -http://boost.org/LICENSE_1_0.txt +Distributed under the Boost Software License, Version 1.0. +(http://www.boost.org/LICENSE_1_0.txt) */ #ifndef BOOST_ALIGN_DETAIL_ALIGNED_ALLOC_ANDROID_HPP #define BOOST_ALIGN_DETAIL_ALIGNED_ALLOC_ANDROID_HPP -#include -#include #include -#include +#include #include namespace boost { namespace alignment { -inline void* aligned_alloc(std::size_t alignment, std::size_t size) - BOOST_NOEXCEPT +inline void* +aligned_alloc(std::size_t alignment, std::size_t size) BOOST_NOEXCEPT { BOOST_ASSERT(detail::is_alignment(alignment)); return ::memalign(alignment, size); } -inline void aligned_free(void* ptr) BOOST_NOEXCEPT +inline void +aligned_free(void* ptr) BOOST_NOEXCEPT { ::free(ptr); } -} /* :alignment */ -} /* :boost */ +} /* alignment */ +} /* boost */ #endif diff --git a/3party/boost/boost/align/detail/aligned_alloc_macos.hpp b/3party/boost/boost/align/detail/aligned_alloc_macos.hpp index 9b6d235133..76366fa5c1 100644 --- a/3party/boost/boost/align/detail/aligned_alloc_macos.hpp +++ b/3party/boost/boost/align/detail/aligned_alloc_macos.hpp @@ -1,28 +1,25 @@ /* -(c) 2014 Glen Joseph Fernandes -glenjofe at gmail dot com +Copyright 2014 Glen Joseph Fernandes +(glenjofe@gmail.com) -Distributed under the Boost Software -License, Version 1.0. -http://boost.org/LICENSE_1_0.txt +Distributed under the Boost Software License, Version 1.0. +(http://www.boost.org/LICENSE_1_0.txt) */ #ifndef BOOST_ALIGN_DETAIL_ALIGNED_ALLOC_MACOS_HPP #define BOOST_ALIGN_DETAIL_ALIGNED_ALLOC_MACOS_HPP -#include -#include #include -#include +#include #include namespace boost { namespace alignment { -inline void* aligned_alloc(std::size_t alignment, std::size_t size) - BOOST_NOEXCEPT +inline void* +aligned_alloc(std::size_t alignment, std::size_t size) BOOST_NOEXCEPT { BOOST_ASSERT(detail::is_alignment(alignment)); - if (!size) { + if (size == 0) { return 0; } if (alignment < sizeof(void*)) { @@ -35,12 +32,13 @@ inline void* aligned_alloc(std::size_t alignment, std::size_t size) return p; } -inline void aligned_free(void* ptr) BOOST_NOEXCEPT +inline void +aligned_free(void* ptr) BOOST_NOEXCEPT { ::free(ptr); } -} /* :alignment */ -} /* :boost */ +} /* alignment */ +} /* boost */ #endif diff --git a/3party/boost/boost/align/detail/aligned_alloc_msvc.hpp b/3party/boost/boost/align/detail/aligned_alloc_msvc.hpp index 1cb7f2a3a1..45c57c9915 100644 --- a/3party/boost/boost/align/detail/aligned_alloc_msvc.hpp +++ b/3party/boost/boost/align/detail/aligned_alloc_msvc.hpp @@ -1,36 +1,34 @@ /* -(c) 2014 Glen Joseph Fernandes -glenjofe at gmail dot com +Copyright 2014 Glen Joseph Fernandes +(glenjofe@gmail.com) -Distributed under the Boost Software -License, Version 1.0. -http://boost.org/LICENSE_1_0.txt +Distributed under the Boost Software License, Version 1.0. +(http://www.boost.org/LICENSE_1_0.txt) */ #ifndef BOOST_ALIGN_DETAIL_ALIGNED_ALLOC_MSVC_HPP #define BOOST_ALIGN_DETAIL_ALIGNED_ALLOC_MSVC_HPP -#include -#include #include -#include +#include #include namespace boost { namespace alignment { -inline void* aligned_alloc(std::size_t alignment, std::size_t size) - BOOST_NOEXCEPT +inline void* +aligned_alloc(std::size_t alignment, std::size_t size) BOOST_NOEXCEPT { BOOST_ASSERT(detail::is_alignment(alignment)); return ::_aligned_malloc(size, alignment); } -inline void aligned_free(void* ptr) BOOST_NOEXCEPT +inline void +aligned_free(void* ptr) BOOST_NOEXCEPT { ::_aligned_free(ptr); } -} /* :alignment */ -} /* :boost */ +} /* alignment */ +} /* boost */ #endif diff --git a/3party/boost/boost/align/detail/aligned_alloc_posix.hpp b/3party/boost/boost/align/detail/aligned_alloc_posix.hpp index 3743652cbd..78fc842d20 100644 --- a/3party/boost/boost/align/detail/aligned_alloc_posix.hpp +++ b/3party/boost/boost/align/detail/aligned_alloc_posix.hpp @@ -1,25 +1,22 @@ /* -(c) 2014 Glen Joseph Fernandes -glenjofe at gmail dot com +Copyright 2014 Glen Joseph Fernandes +(glenjofe@gmail.com) -Distributed under the Boost Software -License, Version 1.0. -http://boost.org/LICENSE_1_0.txt +Distributed under the Boost Software License, Version 1.0. +(http://www.boost.org/LICENSE_1_0.txt) */ #ifndef BOOST_ALIGN_DETAIL_ALIGNED_ALLOC_POSIX_HPP #define BOOST_ALIGN_DETAIL_ALIGNED_ALLOC_POSIX_HPP -#include -#include #include -#include +#include #include namespace boost { namespace alignment { -inline void* aligned_alloc(std::size_t alignment, std::size_t size) - BOOST_NOEXCEPT +inline void* +aligned_alloc(std::size_t alignment, std::size_t size) BOOST_NOEXCEPT { BOOST_ASSERT(detail::is_alignment(alignment)); if (alignment < sizeof(void*)) { @@ -32,12 +29,13 @@ inline void* aligned_alloc(std::size_t alignment, std::size_t size) return p; } -inline void aligned_free(void* ptr) BOOST_NOEXCEPT +inline void +aligned_free(void* ptr) BOOST_NOEXCEPT { ::free(ptr); } -} /* :alignment */ -} /* :boost */ +} /* alignment */ +} /* boost */ #endif diff --git a/3party/boost/boost/align/detail/aligned_alloc_sunos.hpp b/3party/boost/boost/align/detail/aligned_alloc_sunos.hpp index c5778cdd75..0948b40e39 100644 --- a/3party/boost/boost/align/detail/aligned_alloc_sunos.hpp +++ b/3party/boost/boost/align/detail/aligned_alloc_sunos.hpp @@ -1,36 +1,34 @@ /* -(c) 2014 Glen Joseph Fernandes -glenjofe at gmail dot com +Copyright 2014 Glen Joseph Fernandes +(glenjofe@gmail.com) -Distributed under the Boost Software -License, Version 1.0. -http://boost.org/LICENSE_1_0.txt +Distributed under the Boost Software License, Version 1.0. +(http://www.boost.org/LICENSE_1_0.txt) */ #ifndef BOOST_ALIGN_DETAIL_ALIGNED_ALLOC_SUNOS_HPP #define BOOST_ALIGN_DETAIL_ALIGNED_ALLOC_SUNOS_HPP -#include -#include #include -#include +#include #include namespace boost { namespace alignment { -inline void* aligned_alloc(std::size_t alignment, std::size_t size) - BOOST_NOEXCEPT +inline void* +aligned_alloc(std::size_t alignment, std::size_t size) BOOST_NOEXCEPT { BOOST_ASSERT(detail::is_alignment(alignment)); return ::memalign(alignment, size); } -inline void aligned_free(void* ptr) BOOST_NOEXCEPT +inline void +aligned_free(void* ptr) BOOST_NOEXCEPT { ::free(ptr); } -} /* :alignment */ -} /* :boost */ +} /* alignment */ +} /* boost */ #endif diff --git a/3party/boost/boost/align/detail/alignment_of.hpp b/3party/boost/boost/align/detail/alignment_of.hpp index b1d2d56920..b6fc3dcdcf 100644 --- a/3party/boost/boost/align/detail/alignment_of.hpp +++ b/3party/boost/boost/align/detail/alignment_of.hpp @@ -1,29 +1,31 @@ /* -(c) 2014 Glen Joseph Fernandes -glenjofe at gmail dot com +Copyright 2014-2015 Glen Joseph Fernandes +(glenjofe@gmail.com) -Distributed under the Boost Software -License, Version 1.0. -http://boost.org/LICENSE_1_0.txt +Distributed under the Boost Software License, Version 1.0. +(http://www.boost.org/LICENSE_1_0.txt) */ #ifndef BOOST_ALIGN_DETAIL_ALIGNMENT_OF_HPP #define BOOST_ALIGN_DETAIL_ALIGNMENT_OF_HPP #include -#include namespace boost { namespace alignment { namespace detail { template -struct alignment_of - : min_size) - sizeof(T)>::type { +struct offset_value { + char value; + T object; }; -} /* :detail */ -} /* :alignment */ -} /* :boost */ +template +struct alignment_of + : min_size) - sizeof(T)> { }; + +} /* detail */ +} /* alignment */ +} /* boost */ #endif diff --git a/3party/boost/boost/align/detail/alignment_of_clang.hpp b/3party/boost/boost/align/detail/alignment_of_clang.hpp index fa96a37d9d..95773e5ea3 100644 --- a/3party/boost/boost/align/detail/alignment_of_clang.hpp +++ b/3party/boost/boost/align/detail/alignment_of_clang.hpp @@ -1,10 +1,9 @@ /* -(c) 2014 Glen Joseph Fernandes -glenjofe at gmail dot com +Copyright 2014 Glen Joseph Fernandes +(glenjofe@gmail.com) -Distributed under the Boost Software -License, Version 1.0. -http://boost.org/LICENSE_1_0.txt +Distributed under the Boost Software License, Version 1.0. +(http://www.boost.org/LICENSE_1_0.txt) */ #ifndef BOOST_ALIGN_DETAIL_ALIGNMENT_OF_CLANG_HPP #define BOOST_ALIGN_DETAIL_ALIGNMENT_OF_CLANG_HPP @@ -18,11 +17,10 @@ namespace detail { template struct alignment_of - : integral_constant { -}; + : integral_constant { }; -} /* :detail */ -} /* :alignment */ -} /* :boost */ +} /* detail */ +} /* alignment */ +} /* boost */ #endif diff --git a/3party/boost/boost/align/detail/alignment_of_codegear.hpp b/3party/boost/boost/align/detail/alignment_of_codegear.hpp index e8986cef66..ea6f904242 100644 --- a/3party/boost/boost/align/detail/alignment_of_codegear.hpp +++ b/3party/boost/boost/align/detail/alignment_of_codegear.hpp @@ -1,10 +1,9 @@ /* -(c) 2014 Glen Joseph Fernandes -glenjofe at gmail dot com +Copyright 2014 Glen Joseph Fernandes +(glenjofe@gmail.com) -Distributed under the Boost Software -License, Version 1.0. -http://boost.org/LICENSE_1_0.txt +Distributed under the Boost Software License, Version 1.0. +(http://www.boost.org/LICENSE_1_0.txt) */ #ifndef BOOST_ALIGN_DETAIL_ALIGNMENT_OF_CODEGEAR_HPP #define BOOST_ALIGN_DETAIL_ALIGNMENT_OF_CODEGEAR_HPP @@ -18,11 +17,10 @@ namespace detail { template struct alignment_of - : integral_constant { -}; + : integral_constant { }; -} /* :detail */ -} /* :alignment */ -} /* :boost */ +} /* detail */ +} /* alignment */ +} /* boost */ #endif diff --git a/3party/boost/boost/align/detail/alignment_of_cxx11.hpp b/3party/boost/boost/align/detail/alignment_of_cxx11.hpp index 0f66098b67..05c7429385 100644 --- a/3party/boost/boost/align/detail/alignment_of_cxx11.hpp +++ b/3party/boost/boost/align/detail/alignment_of_cxx11.hpp @@ -1,10 +1,9 @@ /* -(c) 2014 Glen Joseph Fernandes -glenjofe at gmail dot com +Copyright 2014 Glen Joseph Fernandes +(glenjofe@gmail.com) -Distributed under the Boost Software -License, Version 1.0. -http://boost.org/LICENSE_1_0.txt +Distributed under the Boost Software License, Version 1.0. +(http://www.boost.org/LICENSE_1_0.txt) */ #ifndef BOOST_ALIGN_DETAIL_ALIGNMENT_OF_CXX11_HPP #define BOOST_ALIGN_DETAIL_ALIGNMENT_OF_CXX11_HPP @@ -17,8 +16,8 @@ namespace detail { using std::alignment_of; -} /* :detail */ -} /* :alignment */ -} /* :boost */ +} /* detail */ +} /* alignment */ +} /* boost */ #endif diff --git a/3party/boost/boost/align/detail/alignment_of_gcc.hpp b/3party/boost/boost/align/detail/alignment_of_gcc.hpp index 615968b477..66a63a50b1 100644 --- a/3party/boost/boost/align/detail/alignment_of_gcc.hpp +++ b/3party/boost/boost/align/detail/alignment_of_gcc.hpp @@ -1,10 +1,9 @@ /* -(c) 2014 Glen Joseph Fernandes -glenjofe at gmail dot com +Copyright 2014 Glen Joseph Fernandes +(glenjofe@gmail.com) -Distributed under the Boost Software -License, Version 1.0. -http://boost.org/LICENSE_1_0.txt +Distributed under the Boost Software License, Version 1.0. +(http://www.boost.org/LICENSE_1_0.txt) */ #ifndef BOOST_ALIGN_DETAIL_ALIGNMENT_OF_GCC_HPP #define BOOST_ALIGN_DETAIL_ALIGNMENT_OF_GCC_HPP @@ -18,11 +17,10 @@ namespace detail { template struct alignment_of - : integral_constant { -}; + : integral_constant { }; -} /* :detail */ -} /* :alignment */ -} /* :boost */ +} /* detail */ +} /* alignment */ +} /* boost */ #endif diff --git a/3party/boost/boost/align/detail/alignment_of_msvc.hpp b/3party/boost/boost/align/detail/alignment_of_msvc.hpp index 87d6ac8e28..1526c7c296 100644 --- a/3party/boost/boost/align/detail/alignment_of_msvc.hpp +++ b/3party/boost/boost/align/detail/alignment_of_msvc.hpp @@ -1,28 +1,33 @@ /* -(c) 2014 Glen Joseph Fernandes -glenjofe at gmail dot com +Copyright 2014-2015 Glen Joseph Fernandes +(glenjofe@gmail.com) -Distributed under the Boost Software -License, Version 1.0. -http://boost.org/LICENSE_1_0.txt +Distributed under the Boost Software License, Version 1.0. +(http://www.boost.org/LICENSE_1_0.txt) */ #ifndef BOOST_ALIGN_DETAIL_ALIGNMENT_OF_MSVC_HPP #define BOOST_ALIGN_DETAIL_ALIGNMENT_OF_MSVC_HPP #include -#include namespace boost { namespace alignment { namespace detail { template -struct alignment_of - : min_size, object)>::type { +struct offset_value { + T first; + char value; + T second; }; -} /* :detail */ -} /* :alignment */ -} /* :boost */ +template +struct alignment_of + : min_size) - (sizeof(T) << 1)> { }; + +} /* detail */ +} /* alignment */ +} /* boost */ #endif diff --git a/3party/boost/boost/align/detail/assume_aligned.hpp b/3party/boost/boost/align/detail/assume_aligned.hpp index 0ecefa1dd0..d218d8c64e 100644 --- a/3party/boost/boost/align/detail/assume_aligned.hpp +++ b/3party/boost/boost/align/detail/assume_aligned.hpp @@ -1,13 +1,12 @@ /* -(c) 2015 NumScale SAS -(c) 2015 LRI UMR 8623 CNRS/University Paris Sud XI +Copyright 2015 NumScale SAS +Copyright 2015 LRI UMR 8623 CNRS/University Paris Sud XI -(c) 2015 Glen Joseph Fernandes -glenjofe at gmail dot com +Copyright 2015 Glen Joseph Fernandes +(glenjofe@gmail.com) -Distributed under the Boost Software -License, Version 1.0. -http://boost.org/LICENSE_1_0.txt +Distributed under the Boost Software License, Version 1.0. +(http://www.boost.org/LICENSE_1_0.txt) */ #ifndef BOOST_ALIGN_DETAIL_ASSUME_ALIGNED_HPP #define BOOST_ALIGN_DETAIL_ASSUME_ALIGNED_HPP diff --git a/3party/boost/boost/align/detail/assume_aligned_clang.hpp b/3party/boost/boost/align/detail/assume_aligned_clang.hpp index d72b4cae86..4c7159fa28 100644 --- a/3party/boost/boost/align/detail/assume_aligned_clang.hpp +++ b/3party/boost/boost/align/detail/assume_aligned_clang.hpp @@ -1,21 +1,18 @@ /* -(c) 2015 Glen Joseph Fernandes -glenjofe at gmail dot com +Copyright 2015 Glen Joseph Fernandes +(glenjofe@gmail.com) -Distributed under the Boost Software -License, Version 1.0. -http://boost.org/LICENSE_1_0.txt +Distributed under the Boost Software License, Version 1.0. +(http://www.boost.org/LICENSE_1_0.txt) */ #ifndef BOOST_ALIGN_DETAIL_ASSUME_ALIGNED_CLANG_HPP #define BOOST_ALIGN_DETAIL_ASSUME_ALIGNED_CLANG_HPP -#include - -#if defined(__has_builtin) && __has_builtin(__builtin_assume) -#define BOOST_ALIGN_ASSUME_ALIGNED(ptr, alignment) \ -__builtin_assume((uintptr_t(ptr) & ((alignment) - 1)) == 0) +#if __has_builtin(__builtin_assume_aligned) +#define BOOST_ALIGN_ASSUME_ALIGNED(p, n) \ +(p) = static_cast<__typeof__(p)>(__builtin_assume_aligned((p), (n))) #else -#define BOOST_ALIGN_ASSUME_ALIGNED(ptr, alignment) +#define BOOST_ALIGN_ASSUME_ALIGNED(p, n) #endif #endif diff --git a/3party/boost/boost/align/detail/assume_aligned_gcc.hpp b/3party/boost/boost/align/detail/assume_aligned_gcc.hpp index a1e6cb0280..117344447a 100644 --- a/3party/boost/boost/align/detail/assume_aligned_gcc.hpp +++ b/3party/boost/boost/align/detail/assume_aligned_gcc.hpp @@ -1,18 +1,17 @@ /* -(c) 2015 NumScale SAS -(c) 2015 LRI UMR 8623 CNRS/University Paris Sud XI +Copyright 2015 NumScale SAS +Copyright 2015 LRI UMR 8623 CNRS/University Paris Sud XI -(c) 2015 Glen Joseph Fernandes -glenjofe at gmail dot com +Copyright 2015 Glen Joseph Fernandes +(glenjofe@gmail.com) -Distributed under the Boost Software -License, Version 1.0. -http://boost.org/LICENSE_1_0.txt +Distributed under the Boost Software License, Version 1.0. +(http://www.boost.org/LICENSE_1_0.txt) */ #ifndef BOOST_ALIGN_DETAIL_ASSUME_ALIGNED_GCC_HPP #define BOOST_ALIGN_DETAIL_ASSUME_ALIGNED_GCC_HPP -#define BOOST_ALIGN_ASSUME_ALIGNED(ptr, alignment) \ -(ptr) = __builtin_assume_aligned((ptr), (alignment)) +#define BOOST_ALIGN_ASSUME_ALIGNED(p, n) \ +(p) = static_cast<__typeof__(p)>(__builtin_assume_aligned((p), (n))) #endif diff --git a/3party/boost/boost/align/detail/assume_aligned_intel.hpp b/3party/boost/boost/align/detail/assume_aligned_intel.hpp index aaaf331802..6792ce005c 100644 --- a/3party/boost/boost/align/detail/assume_aligned_intel.hpp +++ b/3party/boost/boost/align/detail/assume_aligned_intel.hpp @@ -1,13 +1,12 @@ /* -(c) 2015 NumScale SAS -(c) 2015 LRI UMR 8623 CNRS/University Paris Sud XI +Copyright 2015 NumScale SAS +Copyright 2015 LRI UMR 8623 CNRS/University Paris Sud XI -(c) 2015 Glen Joseph Fernandes -glenjofe at gmail dot com +Copyright 2015 Glen Joseph Fernandes +(glenjofe@gmail.com) -Distributed under the Boost Software -License, Version 1.0. -http://boost.org/LICENSE_1_0.txt +Distributed under the Boost Software License, Version 1.0. +(http://www.boost.org/LICENSE_1_0.txt) */ #ifndef BOOST_ALIGN_DETAIL_ASSUME_ALIGNED_INTEL_HPP #define BOOST_ALIGN_DETAIL_ASSUME_ALIGNED_INTEL_HPP diff --git a/3party/boost/boost/align/detail/assume_aligned_msvc.hpp b/3party/boost/boost/align/detail/assume_aligned_msvc.hpp index fdad429b08..75ac7e1242 100644 --- a/3party/boost/boost/align/detail/assume_aligned_msvc.hpp +++ b/3party/boost/boost/align/detail/assume_aligned_msvc.hpp @@ -1,20 +1,19 @@ /* -(c) 2015 NumScale SAS -(c) 2015 LRI UMR 8623 CNRS/University Paris Sud XI +Copyright 2015 NumScale SAS +Copyright 2015 LRI UMR 8623 CNRS/University Paris Sud XI -(c) 2015 Glen Joseph Fernandes -glenjofe at gmail dot com +Copyright 2015 Glen Joseph Fernandes +(glenjofe@gmail.com) -Distributed under the Boost Software -License, Version 1.0. -http://boost.org/LICENSE_1_0.txt +Distributed under the Boost Software License, Version 1.0. +(http://www.boost.org/LICENSE_1_0.txt) */ #ifndef BOOST_ALIGN_DETAIL_ASSUME_ALIGNED_MSVC_HPP #define BOOST_ALIGN_DETAIL_ASSUME_ALIGNED_MSVC_HPP -#include +#include #define BOOST_ALIGN_ASSUME_ALIGNED(ptr, alignment) \ -__assume((uintptr_t(ptr) & ((alignment) - 1)) == 0) +__assume((reinterpret_cast(ptr) & ((alignment) - 1)) == 0) #endif diff --git a/3party/boost/boost/align/detail/remove_traits.hpp b/3party/boost/boost/align/detail/element_type.hpp similarity index 67% rename from 3party/boost/boost/align/detail/remove_traits.hpp rename to 3party/boost/boost/align/detail/element_type.hpp index f59d6bf9e8..5b2b732da0 100644 --- a/3party/boost/boost/align/detail/remove_traits.hpp +++ b/3party/boost/boost/align/detail/element_type.hpp @@ -1,13 +1,12 @@ /* -(c) 2014 Glen Joseph Fernandes -glenjofe at gmail dot com +Copyright 2015 Glen Joseph Fernandes +(glenjofe@gmail.com) -Distributed under the Boost Software -License, Version 1.0. -http://boost.org/LICENSE_1_0.txt +Distributed under the Boost Software License, Version 1.0. +(http://www.boost.org/LICENSE_1_0.txt) */ -#ifndef BOOST_ALIGN_DETAIL_REMOVE_TRAITS_HPP -#define BOOST_ALIGN_DETAIL_REMOVE_TRAITS_HPP +#ifndef BOOST_ALIGN_DETAIL_ELEMENT_TYPE_HPP +#define BOOST_ALIGN_DETAIL_ELEMENT_TYPE_HPP #include @@ -58,35 +57,35 @@ struct remove_all_extents { typedef typename remove_all_extents::type type; }; -template -struct remove_const { - typedef T type; -}; - -template -struct remove_const { - typedef T type; -}; - -template -struct remove_volatile { - typedef T type; -}; - -template -struct remove_volatile { - typedef T type; -}; - template struct remove_cv { - typedef typename remove_volatile::type>::type type; + typedef T type; +}; + +template +struct remove_cv { + typedef T type; +}; + +template +struct remove_cv { + typedef T type; +}; + +template +struct remove_cv { + typedef T type; }; #endif -} /* :detail */ -} /* :alignment */ -} /* :boost */ +template +struct element_type { + typedef typename remove_cv::type>::type>::type type; +}; + +} /* detail */ +} /* alignment */ +} /* boost */ #endif diff --git a/3party/boost/boost/align/detail/integral_constant.hpp b/3party/boost/boost/align/detail/integral_constant.hpp index 6116fea5f5..860096783e 100644 --- a/3party/boost/boost/align/detail/integral_constant.hpp +++ b/3party/boost/boost/align/detail/integral_constant.hpp @@ -1,10 +1,9 @@ /* -(c) 2014 Glen Joseph Fernandes -glenjofe at gmail dot com +Copyright 2014-2016 Glen Joseph Fernandes +(glenjofe@gmail.com) -Distributed under the Boost Software -License, Version 1.0. -http://boost.org/LICENSE_1_0.txt +Distributed under the Boost Software License, Version 1.0. +(http://www.boost.org/LICENSE_1_0.txt) */ #ifndef BOOST_ALIGN_DETAIL_INTEGRAL_CONSTANT_HPP #define BOOST_ALIGN_DETAIL_INTEGRAL_CONSTANT_HPP @@ -25,24 +24,25 @@ using std::integral_constant; template struct integral_constant { typedef T value_type; - typedef integral_constant type; + typedef integral_constant type; -#if !defined(BOOST_NO_CXX11_CONSTEXPR) - constexpr operator value_type() const { + BOOST_CONSTEXPR operator value_type() const BOOST_NOEXCEPT { return Value; } - static constexpr T value = Value; -#else - enum { - value = Value - }; -#endif + BOOST_CONSTEXPR value_type operator()() const BOOST_NOEXCEPT { + return Value; + } + + BOOST_STATIC_CONSTEXPR T value = Value; }; + +template +BOOST_CONSTEXPR_OR_CONST T integral_constant::value; #endif -} /* :detail */ -} /* :alignment */ -} /* :boost */ +} /* detail */ +} /* alignment */ +} /* boost */ #endif diff --git a/3party/boost/boost/align/detail/is_aligned.hpp b/3party/boost/boost/align/detail/is_aligned.hpp index a861e9f4c8..61982c4685 100644 --- a/3party/boost/boost/align/detail/is_aligned.hpp +++ b/3party/boost/boost/align/detail/is_aligned.hpp @@ -1,31 +1,34 @@ /* -(c) 2014 Glen Joseph Fernandes -glenjofe at gmail dot com +Copyright 2014 Glen Joseph Fernandes +(glenjofe@gmail.com) -Distributed under the Boost Software -License, Version 1.0. -http://boost.org/LICENSE_1_0.txt +Distributed under the Boost Software License, Version 1.0. +(http://www.boost.org/LICENSE_1_0.txt) */ #ifndef BOOST_ALIGN_DETAIL_IS_ALIGNED_HPP #define BOOST_ALIGN_DETAIL_IS_ALIGNED_HPP -#include -#include -#include #include -#include +#include namespace boost { namespace alignment { -inline bool is_aligned(std::size_t alignment, const void* ptr) - BOOST_NOEXCEPT +inline bool +is_aligned(const void* ptr, std::size_t alignment) BOOST_NOEXCEPT { BOOST_ASSERT(detail::is_alignment(alignment)); - return (detail::address_t(ptr) & (alignment - 1)) == 0; + return (reinterpret_cast(ptr) & (alignment - 1)) == 0; } -} /* :alignment */ -} /* :boost */ +inline bool +is_aligned(std::size_t alignment, const void* ptr) BOOST_NOEXCEPT +{ + BOOST_ASSERT(detail::is_alignment(alignment)); + return (reinterpret_cast(ptr) & (alignment - 1)) == 0; +} + +} /* alignment */ +} /* boost */ #endif diff --git a/3party/boost/boost/align/detail/is_alignment.hpp b/3party/boost/boost/align/detail/is_alignment.hpp index 7ac0bb3d12..8bedba19c3 100644 --- a/3party/boost/boost/align/detail/is_alignment.hpp +++ b/3party/boost/boost/align/detail/is_alignment.hpp @@ -1,10 +1,10 @@ /* -(c) 2014 Glen Joseph Fernandes -glenjofe at gmail dot com +Copyright 2014 Glen Joseph Fernandes +(glenjofe@gmail.com) + +Distributed under the Boost Software License, Version 1.0. +(http://www.boost.org/LICENSE_1_0.txt) -Distributed under the Boost Software -License, Version 1.0. -http://boost.org/LICENSE_1_0.txt */ #ifndef BOOST_ALIGN_DETAIL_IS_ALIGNMENT_HPP #define BOOST_ALIGN_DETAIL_IS_ALIGNMENT_HPP @@ -16,14 +16,14 @@ namespace boost { namespace alignment { namespace detail { -BOOST_CONSTEXPR inline bool is_alignment(std::size_t value) - BOOST_NOEXCEPT +BOOST_CONSTEXPR inline bool +is_alignment(std::size_t value) BOOST_NOEXCEPT { return (value > 0) && ((value & (value - 1)) == 0); } -} /* :detail */ -} /* :alignment */ -} /* :boost */ +} /* detail */ +} /* alignment */ +} /* boost */ #endif diff --git a/3party/boost/boost/align/detail/is_alignment_constant.hpp b/3party/boost/boost/align/detail/is_alignment_constant.hpp index 4c703cafc0..0ded62857e 100644 --- a/3party/boost/boost/align/detail/is_alignment_constant.hpp +++ b/3party/boost/boost/align/detail/is_alignment_constant.hpp @@ -1,10 +1,9 @@ /* -(c) 2014 Glen Joseph Fernandes -glenjofe at gmail dot com +Copyright 2014 Glen Joseph Fernandes +(glenjofe@gmail.com) -Distributed under the Boost Software -License, Version 1.0. -http://boost.org/LICENSE_1_0.txt +Distributed under the Boost Software License, Version 1.0. +(http://www.boost.org/LICENSE_1_0.txt) */ #ifndef BOOST_ALIGN_DETAIL_IS_ALIGNMENT_CONSTANT_HPP #define BOOST_ALIGN_DETAIL_IS_ALIGNMENT_CONSTANT_HPP @@ -18,11 +17,10 @@ namespace detail { template struct is_alignment_constant - : integral_constant 0) && ((N & (N - 1)) == 0)> { -}; + : integral_constant 0) && ((N & (N - 1)) == 0)> { }; -} /* :detail */ -} /* :alignment */ -} /* :boost */ +} /* detail */ +} /* alignment */ +} /* boost */ #endif diff --git a/3party/boost/boost/align/detail/max_align.hpp b/3party/boost/boost/align/detail/max_align.hpp index 4351a5a2ed..9c09fec9c9 100644 --- a/3party/boost/boost/align/detail/max_align.hpp +++ b/3party/boost/boost/align/detail/max_align.hpp @@ -1,28 +1,26 @@ /* -(c) 2014 Glen Joseph Fernandes -glenjofe at gmail dot com +Copyright 2014-2015 Glen Joseph Fernandes +(glenjofe@gmail.com) -Distributed under the Boost Software -License, Version 1.0. -http://boost.org/LICENSE_1_0.txt +Distributed under the Boost Software License, Version 1.0. +(http://www.boost.org/LICENSE_1_0.txt) */ #ifndef BOOST_ALIGN_DETAIL_MAX_ALIGN_HPP #define BOOST_ALIGN_DETAIL_MAX_ALIGN_HPP -#include -#include +#include +#include namespace boost { namespace alignment { namespace detail { -template +template struct max_align - : integral_constant B) ? A : B> { -}; + : max_size::value, alignment_of::value> { }; -} /* :detail */ -} /* :alignment */ -} /* :boost */ +} /* detail */ +} /* alignment */ +} /* boost */ #endif diff --git a/3party/boost/boost/align/detail/max_count_of.hpp b/3party/boost/boost/align/detail/max_count_of.hpp deleted file mode 100644 index e0ae3bce96..0000000000 --- a/3party/boost/boost/align/detail/max_count_of.hpp +++ /dev/null @@ -1,29 +0,0 @@ -/* -(c) 2014 Glen Joseph Fernandes -glenjofe at gmail dot com - -Distributed under the Boost Software -License, Version 1.0. -http://boost.org/LICENSE_1_0.txt -*/ -#ifndef BOOST_ALIGN_DETAIL_MAX_COUNT_OF_HPP -#define BOOST_ALIGN_DETAIL_MAX_COUNT_OF_HPP - -#include -#include - -namespace boost { -namespace alignment { -namespace detail { - -template -struct max_count_of - : integral_constant(0) / sizeof(T)> { -}; - -} /* :detail */ -} /* :alignment */ -} /* :boost */ - -#endif diff --git a/3party/boost/boost/align/detail/max_objects.hpp b/3party/boost/boost/align/detail/max_objects.hpp new file mode 100644 index 0000000000..9fdd30e118 --- /dev/null +++ b/3party/boost/boost/align/detail/max_objects.hpp @@ -0,0 +1,27 @@ +/* +Copyright 2014 Glen Joseph Fernandes +(glenjofe@gmail.com) + +Distributed under the Boost Software License, Version 1.0. +(http://www.boost.org/LICENSE_1_0.txt) +*/ +#ifndef BOOST_ALIGN_DETAIL_MAX_OBJECTS_HPP +#define BOOST_ALIGN_DETAIL_MAX_OBJECTS_HPP + +#include +#include + +namespace boost { +namespace alignment { +namespace detail { + +template +struct max_objects + : integral_constant(0) / sizeof(T)> { }; + +} /* detail */ +} /* alignment */ +} /* boost */ + +#endif diff --git a/3party/boost/boost/align/detail/max_size.hpp b/3party/boost/boost/align/detail/max_size.hpp new file mode 100644 index 0000000000..22cefdbec5 --- /dev/null +++ b/3party/boost/boost/align/detail/max_size.hpp @@ -0,0 +1,26 @@ +/* +Copyright 2014-2015 Glen Joseph Fernandes +(glenjofe@gmail.com) + +Distributed under the Boost Software License, Version 1.0. +(http://www.boost.org/LICENSE_1_0.txt) +*/ +#ifndef BOOST_ALIGN_DETAIL_MAX_SIZE_HPP +#define BOOST_ALIGN_DETAIL_MAX_SIZE_HPP + +#include +#include + +namespace boost { +namespace alignment { +namespace detail { + +template +struct max_size + : integral_constant B) ? A : B> { }; + +} /* detail */ +} /* alignment */ +} /* boost */ + +#endif diff --git a/3party/boost/boost/align/detail/min_size.hpp b/3party/boost/boost/align/detail/min_size.hpp index 71afe8c686..5b478fdaf0 100644 --- a/3party/boost/boost/align/detail/min_size.hpp +++ b/3party/boost/boost/align/detail/min_size.hpp @@ -1,10 +1,9 @@ /* -(c) 2014 Glen Joseph Fernandes -glenjofe at gmail dot com +Copyright 2014 Glen Joseph Fernandes +(glenjofe@gmail.com) -Distributed under the Boost Software -License, Version 1.0. -http://boost.org/LICENSE_1_0.txt +Distributed under the Boost Software License, Version 1.0. +(http://www.boost.org/LICENSE_1_0.txt) */ #ifndef BOOST_ALIGN_DETAIL_MIN_SIZE_HPP #define BOOST_ALIGN_DETAIL_MIN_SIZE_HPP @@ -18,11 +17,10 @@ namespace detail { template struct min_size - : integral_constant { -}; + : integral_constant { }; -} /* :detail */ -} /* :alignment */ -} /* :boost */ +} /* detail */ +} /* alignment */ +} /* boost */ #endif diff --git a/3party/boost/boost/align/detail/offset_object.hpp b/3party/boost/boost/align/detail/offset_object.hpp deleted file mode 100644 index 2055edfb4a..0000000000 --- a/3party/boost/boost/align/detail/offset_object.hpp +++ /dev/null @@ -1,26 +0,0 @@ -/* -(c) 2014 Glen Joseph Fernandes -glenjofe at gmail dot com - -Distributed under the Boost Software -License, Version 1.0. -http://boost.org/LICENSE_1_0.txt -*/ -#ifndef BOOST_ALIGN_DETAIL_OFFSET_OBJECT_HPP -#define BOOST_ALIGN_DETAIL_OFFSET_OBJECT_HPP - -namespace boost { -namespace alignment { -namespace detail { - -template -struct offset_object { - char offset; - T object; -}; - -} /* :detail */ -} /* :alignment */ -} /* :boost */ - -#endif diff --git a/3party/boost/boost/align/is_aligned.hpp b/3party/boost/boost/align/is_aligned.hpp index 7473864ca7..c8266d0eae 100644 --- a/3party/boost/boost/align/is_aligned.hpp +++ b/3party/boost/boost/align/is_aligned.hpp @@ -1,14 +1,26 @@ /* -(c) 2014 Glen Joseph Fernandes -glenjofe at gmail dot com +Copyright 2014 Glen Joseph Fernandes +(glenjofe@gmail.com) + +Distributed under the Boost Software License, Version 1.0. +(http://www.boost.org/LICENSE_1_0.txt) -Distributed under the Boost Software -License, Version 1.0. -http://boost.org/LICENSE_1_0.txt */ #ifndef BOOST_ALIGN_IS_ALIGNED_HPP #define BOOST_ALIGN_IS_ALIGNED_HPP #include +namespace boost { +namespace alignment { + +BOOST_CONSTEXPR inline bool +is_aligned(std::size_t value, std::size_t alignment) BOOST_NOEXCEPT +{ + return (value & (alignment - 1)) == 0; +} + +} /* alignment */ +} /* boost */ + #endif diff --git a/3party/boost/boost/aligned_storage.hpp b/3party/boost/boost/aligned_storage.hpp index b5455f00b6..f400fa9e75 100644 --- a/3party/boost/boost/aligned_storage.hpp +++ b/3party/boost/boost/aligned_storage.hpp @@ -13,131 +13,6 @@ #ifndef BOOST_ALIGNED_STORAGE_HPP #define BOOST_ALIGNED_STORAGE_HPP -#include // for std::size_t - -#include "boost/config.hpp" -#include "boost/detail/workaround.hpp" -#include "boost/type_traits/alignment_of.hpp" -#include "boost/type_traits/type_with_alignment.hpp" -#include "boost/type_traits/is_pod.hpp" - -#include "boost/mpl/eval_if.hpp" -#include "boost/mpl/identity.hpp" - -#include "boost/type_traits/detail/bool_trait_def.hpp" - -namespace boost { - -namespace detail { namespace aligned_storage { - -BOOST_STATIC_CONSTANT( - std::size_t - , alignment_of_max_align = ::boost::alignment_of::value - ); - -// -// To be TR1 conforming this must be a POD type: -// -template < - std::size_t size_ - , std::size_t alignment_ -> -struct aligned_storage_imp -{ - union data_t - { - char buf[size_]; - - typename ::boost::mpl::eval_if_c< - alignment_ == std::size_t(-1) - , ::boost::mpl::identity< ::boost::detail::max_align > - , ::boost::type_with_alignment - >::type align_; - } data_; - void* address() const { return const_cast(this); } -}; - -template< std::size_t alignment_ > -struct aligned_storage_imp<0u,alignment_> -{ - /* intentionally empty */ - void* address() const { return 0; } -}; - -}} // namespace detail::aligned_storage - -template < - std::size_t size_ - , std::size_t alignment_ = std::size_t(-1) -> -class aligned_storage : -#ifndef __BORLANDC__ - private -#else - public -#endif - ::boost::detail::aligned_storage::aligned_storage_imp -{ - -public: // constants - - typedef ::boost::detail::aligned_storage::aligned_storage_imp type; - - BOOST_STATIC_CONSTANT( - std::size_t - , size = size_ - ); - BOOST_STATIC_CONSTANT( - std::size_t - , alignment = ( - alignment_ == std::size_t(-1) - ? ::boost::detail::aligned_storage::alignment_of_max_align - : alignment_ - ) - ); - -private: // noncopyable - - aligned_storage(const aligned_storage&); - aligned_storage& operator=(const aligned_storage&); - -public: // structors - - aligned_storage() - { - } - - ~aligned_storage() - { - } - -public: // accessors - - void* address() - { - return static_cast(this)->address(); - } - - const void* address() const - { - return static_cast(this)->address(); - } -}; - -// -// Make sure that is_pod recognises aligned_storage<>::type -// as a POD (Note that aligned_storage<> itself is not a POD): -// -template -struct is_pod< ::boost::detail::aligned_storage::aligned_storage_imp > - BOOST_TT_AUX_BOOL_C_BASE(true) -{ - BOOST_TT_AUX_BOOL_TRAIT_VALUE_DECL(true) -}; - - -} // namespace boost - -#include "boost/type_traits/detail/bool_trait_undef.hpp" +#include #endif // BOOST_ALIGNED_STORAGE_HPP diff --git a/3party/boost/boost/any.hpp b/3party/boost/boost/any.hpp index 437de2c023..9f6b313274 100644 --- a/3party/boost/boost/any.hpp +++ b/3party/boost/boost/any.hpp @@ -16,7 +16,7 @@ #include -#include "boost/config.hpp" +#include #include #include #include @@ -27,6 +27,7 @@ #include #include #include +#include #include #include #include @@ -244,7 +245,9 @@ namespace boost ValueType * any_cast(any * operand) BOOST_NOEXCEPT { return operand && operand->type() == boost::typeindex::type_id() - ? &static_cast::type> *>(operand->content)->held + ? boost::addressof( + static_cast::type> *>(operand->content)->held + ) : 0; } @@ -260,7 +263,7 @@ namespace boost typedef BOOST_DEDUCED_TYPENAME remove_reference::type nonref; - nonref * result = any_cast(&operand); + nonref * result = any_cast(boost::addressof(operand)); if(!result) boost::throw_exception(bad_any_cast()); @@ -274,7 +277,14 @@ namespace boost BOOST_DEDUCED_TYPENAME boost::add_reference::type >::type ref_type; +#ifdef BOOST_MSVC +# pragma warning(push) +# pragma warning(disable: 4172) // "returning address of local variable or temporary" but *result is not local! +#endif return static_cast(*result); +#ifdef BOOST_MSVC +# pragma warning(pop) +#endif } template @@ -306,7 +316,9 @@ namespace boost template inline ValueType * unsafe_any_cast(any * operand) BOOST_NOEXCEPT { - return &static_cast *>(operand->content)->held; + return boost::addressof( + static_cast *>(operand->content)->held + ); } template diff --git a/3party/boost/boost/archive/add_facet.hpp b/3party/boost/boost/archive/add_facet.hpp deleted file mode 100644 index 242bdd9001..0000000000 --- a/3party/boost/boost/archive/add_facet.hpp +++ /dev/null @@ -1,55 +0,0 @@ -#ifndef BOOST_ARCHIVE_ADD_FACET_HPP -#define BOOST_ARCHIVE_ADD_FACET_HPP - -// MS compatible compilers support #pragma once -#if defined(_MSC_VER) -# pragma once -#endif - -/////////1/////////2/////////3/////////4/////////5/////////6/////////7/////////8 -// add_facet.hpp - -// (C) Copyright 2003 Robert Ramey - http://www.rrsd.com . -// Use, modification and distribution is subject to the Boost Software -// License, Version 1.0. (See accompanying file LICENSE_1_0.txt or copy at -// http://www.boost.org/LICENSE_1_0.txt) - -// See http://www.boost.org for updates, documentation, and revision history. - -#include -#include -#include - -// does STLport uses native STL for locales? -#if (defined(__SGI_STL_PORT)&& defined(_STLP_NO_OWN_IOSTREAMS)) -// and this native STL lib is old Dinkumware (has not defined _CPPLIB_VER) -# if (defined(_YVALS) && !defined(__IBMCPP__)) || !defined(_CPPLIB_VER) -# define BOOST_ARCHIVE_OLD_DINKUMWARE_BENEATH_STLPORT -# endif -#endif - -namespace boost { -namespace archive { - -template -inline std::locale * -add_facet(const std::locale &l, Facet * f){ - return - #if defined BOOST_ARCHIVE_OLD_DINKUMWARE_BENEATH_STLPORT - // std namespace used for native locale - new std::locale(std::_Addfac(l, f)); - #elif BOOST_WORKAROUND(BOOST_DINKUMWARE_STDLIB, == 1) // old Dinkumwar - // std namespace used for native locale - new std::locale(std::_Addfac(l, f)); - #else - // standard compatible - new std::locale(l, f); - #endif -} - -} // namespace archive -} // namespace boost - -#undef BOOST_ARCHIVE_OLD_DINKUMWARE_BENEATH_STLPORT - -#endif // BOOST_ARCHIVE_ADD_FACET_HPP diff --git a/3party/boost/boost/archive/archive_exception.hpp b/3party/boost/boost/archive/archive_exception.hpp index 9cb7c14b0c..fabcdb5fa7 100644 --- a/3party/boost/boost/archive/archive_exception.hpp +++ b/3party/boost/boost/archive/archive_exception.hpp @@ -39,7 +39,7 @@ namespace archive { ////////////////////////////////////////////////////////////////////// // exceptions thrown by archives // -class BOOST_SYMBOL_VISIBLE archive_exception : +class BOOST_SYMBOL_VISIBLE archive_exception : public virtual std::exception { private: @@ -87,6 +87,7 @@ public: const char * e1 = NULL, const char * e2 = NULL ) BOOST_NOEXCEPT; + BOOST_ARCHIVE_DECL archive_exception(archive_exception const &) BOOST_NOEXCEPT ; virtual BOOST_ARCHIVE_DECL ~archive_exception() BOOST_NOEXCEPT_OR_NOTHROW ; virtual BOOST_ARCHIVE_DECL const char * what() const BOOST_NOEXCEPT_OR_NOTHROW ; }; diff --git a/3party/boost/boost/archive/basic_binary_iarchive.hpp b/3party/boost/boost/archive/basic_binary_iarchive.hpp index d8fe0e0c67..c0cc655c99 100644 --- a/3party/boost/boost/archive/basic_binary_iarchive.hpp +++ b/3party/boost/boost/archive/basic_binary_iarchive.hpp @@ -50,7 +50,7 @@ namespace detail { ///////////////////////////////////////////////////////////////////////// // class basic_binary_iarchive - read serialized objects from a input binary stream template -class BOOST_SYMBOL_VISIBLE basic_binary_iarchive : +class BOOST_SYMBOL_VISIBLE basic_binary_iarchive : public detail::common_iarchive { #ifdef BOOST_NO_MEMBER_TEMPLATE_FRIENDS diff --git a/3party/boost/boost/archive/basic_binary_iprimitive.hpp b/3party/boost/boost/archive/basic_binary_iprimitive.hpp index c0448b466b..665d3e81e1 100644 --- a/3party/boost/boost/archive/basic_binary_iprimitive.hpp +++ b/3party/boost/boost/archive/basic_binary_iprimitive.hpp @@ -44,16 +44,16 @@ namespace std{ #endif #include -#include #include #include #include -#include +//#include #include -#include +#include #include +#include #include #include #include // must be the last header @@ -61,9 +61,6 @@ namespace std{ namespace boost { namespace archive { -template -class codecvt_null; - ///////////////////////////////////////////////////////////////////////////// // class binary_iarchive - read serialized objects from a input binary stream template @@ -81,9 +78,16 @@ public: } #ifndef BOOST_NO_STD_LOCALE - boost::scoped_ptr > codecvt_facet; - boost::scoped_ptr archive_locale; + // note order! - if you change this, libstd++ will fail! + // a) create new locale with new codecvt facet + // b) save current locale + // c) change locale to new one + // d) use stream buffer + // e) change locale back to original + // f) destroy new codecvt facet + boost::archive::codecvt_null codecvt_null_facet; basic_streambuf_locale_saver locale_saver; + std::locale archive_locale; #endif // main template for serilization of primitive types @@ -115,12 +119,12 @@ public: BOOST_ARCHIVE_OR_WARCHIVE_DECL void init(); - BOOST_ARCHIVE_OR_WARCHIVE_DECL + BOOST_ARCHIVE_OR_WARCHIVE_DECL basic_binary_iprimitive( std::basic_streambuf & sb, bool no_codecvt ); - BOOST_ARCHIVE_OR_WARCHIVE_DECL + BOOST_ARCHIVE_OR_WARCHIVE_DECL ~basic_binary_iprimitive(); public: // we provide an optimized load for all fundamental types @@ -139,7 +143,7 @@ public: // the optimized load_array dispatches to load_binary template - void load_array(serialization::array& a, unsigned int) + void load_array(serialization::array_wrapper& a, unsigned int) { load_binary(a.address(),a.count()*sizeof(ValueType)); } diff --git a/3party/boost/boost/archive/basic_binary_oarchive.hpp b/3party/boost/boost/archive/basic_binary_oarchive.hpp index 6cffea4854..f05f2f86d5 100644 --- a/3party/boost/boost/archive/basic_binary_oarchive.hpp +++ b/3party/boost/boost/archive/basic_binary_oarchive.hpp @@ -58,7 +58,7 @@ namespace detail { // does have the virtue of buiding the smalles archive in the minimum amount // of time. So under some circumstances it may be he right choice. template -class BOOST_SYMBOL_VISIBLE basic_binary_oarchive : +class BOOST_SYMBOL_VISIBLE basic_binary_oarchive : public detail::common_oarchive { #ifdef BOOST_NO_MEMBER_TEMPLATE_FRIENDS diff --git a/3party/boost/boost/archive/basic_binary_oprimitive.hpp b/3party/boost/boost/archive/basic_binary_oprimitive.hpp index 87b70c9a9e..6dc770c60e 100644 --- a/3party/boost/boost/archive/basic_binary_oprimitive.hpp +++ b/3party/boost/boost/archive/basic_binary_oprimitive.hpp @@ -43,20 +43,19 @@ namespace std{ #include #include -#include -#include +//#include #include -#include -#include +#include + +#include +#include +#include #include #include // must be the last header namespace boost { namespace archive { -template -class codecvt_null; - ///////////////////////////////////////////////////////////////////////// // class basic_binary_oprimitive - binary output of prmitives @@ -74,9 +73,16 @@ public: return static_cast(this); } #ifndef BOOST_NO_STD_LOCALE - boost::scoped_ptr > codecvt_facet; - boost::scoped_ptr archive_locale; + // note order! - if you change this, libstd++ will fail! + // a) create new locale with new codecvt facet + // b) save current locale + // c) change locale to new one + // d) use stream buffer + // e) change locale back to original + // f) destroy new codecvt facet + boost::archive::codecvt_null codecvt_null_facet; basic_streambuf_locale_saver locale_saver; + std::locale archive_locale; #endif // default saving of primitives. template @@ -108,12 +114,12 @@ public: BOOST_ARCHIVE_OR_WARCHIVE_DECL void init(); - BOOST_ARCHIVE_OR_WARCHIVE_DECL + BOOST_ARCHIVE_OR_WARCHIVE_DECL basic_binary_oprimitive( std::basic_streambuf & sb, bool no_codecvt ); - BOOST_ARCHIVE_OR_WARCHIVE_DECL + BOOST_ARCHIVE_OR_WARCHIVE_DECL ~basic_binary_oprimitive(); public: @@ -131,11 +137,10 @@ public: struct apply : public boost::serialization::is_bitwise_serializable< T > {}; #endif }; - // the optimized save_array dispatches to save_binary template - void save_array(boost::serialization::array const& a, unsigned int) + void save_array(boost::serialization::array_wrapper const& a, unsigned int) { save_binary(a.address(),a.count()*sizeof(ValueType)); } @@ -149,9 +154,7 @@ basic_binary_oprimitive::save_binary( const void *address, std::size_t count ){ - //BOOST_ASSERT( - // static_cast((std::numeric_limits::max)()) >= count - //); + // BOOST_ASSERT(count <= std::size_t(boost::integer_traits::const_max)); // note: if the following assertions fail // a likely cause is that the output stream is set to "text" // mode where by cr characters recieve special treatment. @@ -161,9 +164,7 @@ basic_binary_oprimitive::save_binary( // archive_exception(archive_exception::output_stream_error) // ); // figure number of elements to output - round up - count = ( count + sizeof(Elem) - 1) - / sizeof(Elem); - BOOST_ASSERT(count <= std::size_t(boost::integer_traits::const_max)); + count = ( count + sizeof(Elem) - 1) / sizeof(Elem); std::streamsize scount = m_sb.sputn( static_cast(address), static_cast(count) diff --git a/3party/boost/boost/archive/basic_streambuf_locale_saver.hpp b/3party/boost/boost/archive/basic_streambuf_locale_saver.hpp index 64c8e5d314..5cd4b36f08 100644 --- a/3party/boost/boost/archive/basic_streambuf_locale_saver.hpp +++ b/3party/boost/boost/archive/basic_streambuf_locale_saver.hpp @@ -27,6 +27,7 @@ #ifndef BOOST_NO_STD_LOCALE #include // for std::locale +#include #include // for std::basic_streambuf #include @@ -45,25 +46,57 @@ class basic_streambuf_locale_saver : private boost::noncopyable { public: - typedef ::std::basic_streambuf state_type; - typedef ::std::locale aspect_type; - explicit basic_streambuf_locale_saver( state_type &s ) - : s_save_( s ), a_save_( s.getloc() ) - {} - explicit basic_streambuf_locale_saver( state_type &s, aspect_type const &a ) - : s_save_( s ), a_save_( s.pubimbue(a) ) - {} - ~basic_streambuf_locale_saver() - { this->restore(); } - void restore(){ - s_save_.pubsync(); - s_save_.pubimbue( a_save_ ); + explicit basic_streambuf_locale_saver(std::basic_streambuf &s) : + m_streambuf(s), + m_locale(s.getloc()) + {} + ~basic_streambuf_locale_saver(){ + m_streambuf.pubsync(); + m_streambuf.pubimbue(m_locale); } private: - state_type & s_save_; - aspect_type const a_save_; + std::basic_streambuf & m_streambuf; + std::locale const m_locale; }; +template < typename Ch, class Tr > +class basic_istream_locale_saver : + private boost::noncopyable +{ +public: + explicit basic_istream_locale_saver(std::basic_istream &s) : + m_istream(s), + m_locale(s.getloc()) + {} + ~basic_istream_locale_saver(){ + // libstdc++ crashes without this + m_istream.sync(); + m_istream.imbue(m_locale); + } +private: + std::basic_istream & m_istream; + std::locale const m_locale; +}; + +template < typename Ch, class Tr > +class basic_ostream_locale_saver : + private boost::noncopyable +{ +public: + explicit basic_ostream_locale_saver(std::basic_ostream &s) : + m_ostream(s), + m_locale(s.getloc()) + {} + ~basic_ostream_locale_saver(){ + m_ostream.flush(); + m_ostream.imbue(m_locale); + } +private: + std::basic_ostream & m_ostream; + std::locale const m_locale; +}; + + } // archive } // boost diff --git a/3party/boost/boost/archive/basic_text_iarchive.hpp b/3party/boost/boost/archive/basic_text_iarchive.hpp index 74e086ec2e..583041d8b4 100644 --- a/3party/boost/boost/archive/basic_text_iarchive.hpp +++ b/3party/boost/boost/archive/basic_text_iarchive.hpp @@ -46,7 +46,7 @@ namespace detail { ///////////////////////////////////////////////////////////////////////// // class basic_text_iarchive - read serialized objects from a input text stream template -class BOOST_SYMBOL_VISIBLE basic_text_iarchive : +class BOOST_SYMBOL_VISIBLE basic_text_iarchive : public detail::common_iarchive { #ifdef BOOST_NO_MEMBER_TEMPLATE_FRIENDS diff --git a/3party/boost/boost/archive/basic_text_iprimitive.hpp b/3party/boost/boost/archive/basic_text_iprimitive.hpp index ca988fe177..bf936b5554 100644 --- a/3party/boost/boost/archive/basic_text_iprimitive.hpp +++ b/3party/boost/boost/archive/basic_text_iprimitive.hpp @@ -24,7 +24,6 @@ // in such cases. So we can't use basic_ostream but rather // use two template parameters -#include #include #include // size_t @@ -38,17 +37,15 @@ namespace std{ } // namespace std #endif +#include +#include + #include #if BOOST_WORKAROUND(BOOST_DINKUMWARE_STDLIB, == 1) #include #endif - -#include -#include -#include -#include - #include +#include #include #include #include // must be the last header @@ -71,9 +68,17 @@ protected: io::ios_precision_saver precision_saver; #ifndef BOOST_NO_STD_LOCALE - boost::scoped_ptr archive_locale; - basic_streambuf_locale_saver< - typename IStream::char_type, + // note order! - if you change this, libstd++ will fail! + // a) create new locale with new codecvt facet + // b) save current locale + // c) change locale to new one + // d) use stream buffer + // e) change locale back to original + // f) destroy new codecvt facet + boost::archive::codecvt_null codecvt_null_facet; + std::locale archive_locale; + basic_istream_locale_saver< + typename IStream::char_type, typename IStream::traits_type > locale_saver; #endif @@ -116,9 +121,9 @@ protected: t = i; } #endif - BOOST_ARCHIVE_OR_WARCHIVE_DECL + BOOST_ARCHIVE_OR_WARCHIVE_DECL basic_text_iprimitive(IStream &is, bool no_codecvt); - BOOST_ARCHIVE_OR_WARCHIVE_DECL + BOOST_ARCHIVE_OR_WARCHIVE_DECL ~basic_text_iprimitive(); public: BOOST_ARCHIVE_OR_WARCHIVE_DECL void diff --git a/3party/boost/boost/archive/basic_text_oarchive.hpp b/3party/boost/boost/archive/basic_text_oarchive.hpp index 9b9129e510..6f7f8fb167 100644 --- a/3party/boost/boost/archive/basic_text_oarchive.hpp +++ b/3party/boost/boost/archive/basic_text_oarchive.hpp @@ -46,7 +46,7 @@ namespace detail { ///////////////////////////////////////////////////////////////////////// // class basic_text_oarchive template -class BOOST_SYMBOL_VISIBLE basic_text_oarchive : +class BOOST_SYMBOL_VISIBLE basic_text_oarchive : public detail::common_oarchive { #ifdef BOOST_NO_MEMBER_TEMPLATE_FRIENDS diff --git a/3party/boost/boost/archive/basic_text_oprimitive.hpp b/3party/boost/boost/archive/basic_text_oprimitive.hpp index 10598edb68..45f09358ec 100644 --- a/3party/boost/boost/archive/basic_text_oprimitive.hpp +++ b/3party/boost/boost/archive/basic_text_oprimitive.hpp @@ -26,14 +26,13 @@ #include #include -#include #include // size_t #include #include -#include #include +#include #if BOOST_WORKAROUND(BOOST_DINKUMWARE_STDLIB, == 1) #include #endif @@ -52,10 +51,10 @@ namespace std{ #include #include #include -#include #include -#include #include +#include +#include #include // must be the last header namespace boost { @@ -72,9 +71,17 @@ protected: io::ios_precision_saver precision_saver; #ifndef BOOST_NO_STD_LOCALE - boost::scoped_ptr archive_locale; - basic_streambuf_locale_saver< - typename OStream::char_type, + // note order! - if you change this, libstd++ will fail! + // a) create new locale with new codecvt facet + // b) save current locale + // c) change locale to new one + // d) use stream buffer + // e) change locale back to original + // f) destroy new codecvt facet + boost::archive::codecvt_null codecvt_null_facet; + std::locale archive_locale; + basic_ostream_locale_saver< + typename OStream::char_type, typename OStream::traits_type > locale_saver; #endif @@ -168,15 +175,13 @@ protected: template void save(const T & t){ - boost::io::ios_flags_saver fs(os); - boost::io::ios_precision_saver ps(os); typename is_float::type tf; save_impl(t, tf); } BOOST_ARCHIVE_OR_WARCHIVE_DECL basic_text_oprimitive(OStream & os, bool no_codecvt); - BOOST_ARCHIVE_OR_WARCHIVE_DECL + BOOST_ARCHIVE_OR_WARCHIVE_DECL ~basic_text_oprimitive(); public: // unformatted append of one character @@ -192,7 +197,7 @@ public: while('\0' != *s) os.put(*s++); } - BOOST_ARCHIVE_OR_WARCHIVE_DECL void + BOOST_ARCHIVE_OR_WARCHIVE_DECL void save_binary(const void *address, std::size_t count); }; diff --git a/3party/boost/boost/archive/basic_xml_iarchive.hpp b/3party/boost/boost/archive/basic_xml_iarchive.hpp index 7834d8a100..e9f7482f74 100644 --- a/3party/boost/boost/archive/basic_xml_iarchive.hpp +++ b/3party/boost/boost/archive/basic_xml_iarchive.hpp @@ -17,15 +17,12 @@ // See http://www.boost.org for updates, documentation, and revision history. #include -#include +#include #include - #include #include -#include - #include // must be the last header #ifdef BOOST_MSVC @@ -41,24 +38,18 @@ namespace detail { } // namespace detail ///////////////////////////////////////////////////////////////////////// -// class xml_iarchive - read serialized objects from a input text stream +// class basic_xml_iarchive - read serialized objects from a input text stream template class BOOST_SYMBOL_VISIBLE basic_xml_iarchive : public detail::common_iarchive { + unsigned int depth; #ifdef BOOST_NO_MEMBER_TEMPLATE_FRIENDS public: #else protected: - #if BOOST_WORKAROUND(BOOST_MSVC, < 1500) - // for some inexplicable reason insertion of "class" generates compile erro - // on msvc 7.1 - friend detail::interface_iarchive; - #else - friend class detail::interface_iarchive; - #endif + friend class detail::interface_iarchive; #endif - unsigned int depth; BOOST_ARCHIVE_OR_WARCHIVE_DECL void load_start(const char *name); BOOST_ARCHIVE_OR_WARCHIVE_DECL void @@ -96,14 +87,14 @@ protected: // an xml archive. So we can skip it here. Note: we MUST override // it otherwise it will be loaded as a normal primitive w/o tag and // leaving the archive in an undetermined state + BOOST_ARCHIVE_OR_WARCHIVE_DECL void + load_override(class_id_type & t); void load_override(class_id_optional_type & /* t */){} BOOST_ARCHIVE_OR_WARCHIVE_DECL void load_override(object_id_type & t); BOOST_ARCHIVE_OR_WARCHIVE_DECL void load_override(version_type & t); BOOST_ARCHIVE_OR_WARCHIVE_DECL void - load_override(class_id_type & t); - BOOST_ARCHIVE_OR_WARCHIVE_DECL void load_override(tracking_type & t); // class_name_type can't be handled here as it depends upon the // char type used by the stream. So require the derived implementation diff --git a/3party/boost/boost/archive/basic_xml_oarchive.hpp b/3party/boost/boost/archive/basic_xml_oarchive.hpp index 0325eee653..107fca4ec6 100644 --- a/3party/boost/boost/archive/basic_xml_oarchive.hpp +++ b/3party/boost/boost/archive/basic_xml_oarchive.hpp @@ -18,15 +18,11 @@ #include #include -#include #include - #include -#include #include - #include // must be the last header #ifdef BOOST_MSVC @@ -47,28 +43,23 @@ template class BOOST_SYMBOL_VISIBLE basic_xml_oarchive : public detail::common_oarchive { + // special stuff for xml output + unsigned int depth; + bool pending_preamble; #ifdef BOOST_NO_MEMBER_TEMPLATE_FRIENDS public: #else protected: -#endif -#if BOOST_WORKAROUND(BOOST_MSVC, < 1500) - // for some inexplicable reason insertion of "class" generates compile erro - // on msvc 7.1 - friend detail::interface_oarchive; -#else friend class detail::interface_oarchive; #endif - friend class save_access; - // special stuff for xml output - unsigned int depth; bool indent_next; - bool pending_preamble; BOOST_ARCHIVE_OR_WARCHIVE_DECL void indent(); BOOST_ARCHIVE_OR_WARCHIVE_DECL void init(); BOOST_ARCHIVE_OR_WARCHIVE_DECL void + windup(); + BOOST_ARCHIVE_OR_WARCHIVE_DECL void write_attribute( const char *attribute_name, int t, @@ -113,18 +104,18 @@ protected: // specific overrides for attributes - not name value pairs so we // want to trap them before the above "fall through" BOOST_ARCHIVE_OR_WARCHIVE_DECL void - save_override(const object_id_type & t); - BOOST_ARCHIVE_OR_WARCHIVE_DECL void - save_override(const object_reference_type & t); - BOOST_ARCHIVE_OR_WARCHIVE_DECL void - save_override(const version_type & t); - BOOST_ARCHIVE_OR_WARCHIVE_DECL void save_override(const class_id_type & t); BOOST_ARCHIVE_OR_WARCHIVE_DECL void save_override(const class_id_optional_type & t); BOOST_ARCHIVE_OR_WARCHIVE_DECL void save_override(const class_id_reference_type & t); BOOST_ARCHIVE_OR_WARCHIVE_DECL void + save_override(const object_id_type & t); + BOOST_ARCHIVE_OR_WARCHIVE_DECL void + save_override(const object_reference_type & t); + BOOST_ARCHIVE_OR_WARCHIVE_DECL void + save_override(const version_type & t); + BOOST_ARCHIVE_OR_WARCHIVE_DECL void save_override(const class_name_type & t); BOOST_ARCHIVE_OR_WARCHIVE_DECL void save_override(const tracking_type & t); diff --git a/3party/boost/boost/archive/binary_iarchive_impl.hpp b/3party/boost/boost/archive/binary_iarchive_impl.hpp index 3ff994ad83..b4747c98ec 100644 --- a/3party/boost/boost/archive/binary_iarchive_impl.hpp +++ b/3party/boost/boost/archive/binary_iarchive_impl.hpp @@ -33,7 +33,7 @@ namespace detail { } // namespace detail template -class binary_iarchive_impl : +class BOOST_SYMBOL_VISIBLE binary_iarchive_impl : public basic_binary_iprimitive, public basic_binary_iarchive { @@ -58,8 +58,9 @@ protected: this->basic_binary_iarchive::load_override(t); } void init(unsigned int flags){ - if(0 != (flags & no_header)) + if(0 != (flags & no_header)){ return; + } #if ! defined(__MWERKS__) this->basic_binary_iarchive::init(); this->basic_binary_iprimitive::init(); diff --git a/3party/boost/boost/archive/binary_oarchive.hpp b/3party/boost/boost/archive/binary_oarchive.hpp index 7711fbb6f8..e8313fd7c9 100644 --- a/3party/boost/boost/archive/binary_oarchive.hpp +++ b/3party/boost/boost/archive/binary_oarchive.hpp @@ -32,7 +32,7 @@ namespace archive { // do not derive from this class. If you want to extend this functionality // via inhertance, derived from binary_oarchive_impl instead. This will // preserve correct static polymorphism. -class BOOST_SYMBOL_VISIBLE binary_oarchive : +class BOOST_SYMBOL_VISIBLE binary_oarchive : public binary_oarchive_impl< binary_oarchive, std::ostream::char_type, std::ostream::traits_type > diff --git a/3party/boost/boost/archive/binary_oarchive_impl.hpp b/3party/boost/boost/archive/binary_oarchive_impl.hpp index 76e3a6565b..6b4d018a56 100644 --- a/3party/boost/boost/archive/binary_oarchive_impl.hpp +++ b/3party/boost/boost/archive/binary_oarchive_impl.hpp @@ -34,7 +34,7 @@ namespace detail { } // namespace detail template -class binary_oarchive_impl : +class BOOST_SYMBOL_VISIBLE binary_oarchive_impl : public basic_binary_oprimitive, public basic_binary_oarchive { @@ -59,8 +59,9 @@ protected: this->basic_binary_oarchive::save_override(t); } void init(unsigned int flags) { - if(0 != (flags & no_header)) + if(0 != (flags & no_header)){ return; + } #if ! defined(__MWERKS__) this->basic_binary_oarchive::init(); this->basic_binary_oprimitive::init(); diff --git a/3party/boost/boost/archive/codecvt_null.hpp b/3party/boost/boost/archive/codecvt_null.hpp index 324122b78a..9cc9e5729d 100644 --- a/3party/boost/boost/archive/codecvt_null.hpp +++ b/3party/boost/boost/archive/codecvt_null.hpp @@ -56,10 +56,11 @@ public: explicit codecvt_null(std::size_t no_locale_manage = 0) : std::codecvt(no_locale_manage) {} + virtual ~codecvt_null(){}; }; template<> -class codecvt_null : public std::codecvt +class BOOST_SYMBOL_VISIBLE codecvt_null : public std::codecvt { virtual BOOST_WARCHIVE_DECL std::codecvt_base::result do_out( @@ -91,6 +92,7 @@ public: explicit codecvt_null(std::size_t no_locale_manage = 0) : std::codecvt(no_locale_manage) {} + virtual ~codecvt_null(){}; }; } // namespace archive diff --git a/3party/boost/boost/archive/detail/basic_iarchive.hpp b/3party/boost/boost/archive/detail/basic_iarchive.hpp index 5db461c186..1f5a8bf63b 100644 --- a/3party/boost/boost/archive/detail/basic_iarchive.hpp +++ b/3party/boost/boost/archive/detail/basic_iarchive.hpp @@ -65,11 +65,7 @@ protected: public: // some msvc versions require that the following function be public // otherwise it should really protected. - // account for bogus gcc warning - #if defined(__GNUC__) - virtual - #endif - BOOST_ARCHIVE_DECL ~basic_iarchive(); + virtual BOOST_ARCHIVE_DECL ~basic_iarchive(); // note: NOT part of the public API. BOOST_ARCHIVE_DECL void next_object_pointer(void *t); BOOST_ARCHIVE_DECL void register_basic_serializer( @@ -79,7 +75,7 @@ public: void *t, const basic_iserializer & bis ); - BOOST_ARCHIVE_DECL const basic_pointer_iserializer * + BOOST_ARCHIVE_DECL const basic_pointer_iserializer * load_pointer( void * & t, const basic_pointer_iserializer * bpis_ptr, @@ -88,15 +84,15 @@ public: ) ); // real public API starts here - BOOST_ARCHIVE_DECL void + BOOST_ARCHIVE_DECL void set_library_version(library_version_type archive_library_version); - BOOST_ARCHIVE_DECL library_version_type + BOOST_ARCHIVE_DECL library_version_type get_library_version() const; BOOST_ARCHIVE_DECL unsigned int get_flags() const; - BOOST_ARCHIVE_DECL void + BOOST_ARCHIVE_DECL void reset_object_address(const void * new_address, const void * old_address); - BOOST_ARCHIVE_DECL void + BOOST_ARCHIVE_DECL void delete_created_pointers(); }; diff --git a/3party/boost/boost/archive/detail/basic_iserializer.hpp b/3party/boost/boost/archive/detail/basic_iserializer.hpp index 61d288fe4e..0d66674c34 100644 --- a/3party/boost/boost/archive/detail/basic_iserializer.hpp +++ b/3party/boost/boost/archive/detail/basic_iserializer.hpp @@ -42,7 +42,7 @@ namespace detail { class basic_iarchive; class basic_pointer_iserializer; -class BOOST_SYMBOL_VISIBLE basic_iserializer : +class BOOST_SYMBOL_VISIBLE basic_iserializer : public basic_serializer { private: @@ -51,11 +51,7 @@ protected: explicit BOOST_ARCHIVE_DECL basic_iserializer( const boost::serialization::extended_type_info & type ); - // account for bogus gcc warning - #if defined(__GNUC__) - virtual - #endif - BOOST_ARCHIVE_DECL ~basic_iserializer(); + virtual BOOST_ARCHIVE_DECL ~basic_iserializer(); public: bool serialized_as_pointer() const { return m_bpis != NULL; diff --git a/3party/boost/boost/archive/detail/basic_oarchive.hpp b/3party/boost/boost/archive/detail/basic_oarchive.hpp index 702c5604bc..c379108d58 100644 --- a/3party/boost/boost/archive/detail/basic_oarchive.hpp +++ b/3party/boost/boost/archive/detail/basic_oarchive.hpp @@ -61,14 +61,8 @@ class BOOST_SYMBOL_VISIBLE basic_oarchive : protected: BOOST_ARCHIVE_DECL basic_oarchive(unsigned int flags = 0); BOOST_ARCHIVE_DECL boost::archive::detail::helper_collection & - get_helper_collection(){ - return *this; - } - // account for bogus gcc warning - #if defined(__GNUC__) - virtual - #endif - BOOST_ARCHIVE_DECL ~basic_oarchive(); + get_helper_collection(); + virtual BOOST_ARCHIVE_DECL ~basic_oarchive(); public: // note: NOT part of the public interface BOOST_ARCHIVE_DECL void register_basic_serializer( diff --git a/3party/boost/boost/archive/detail/basic_oserializer.hpp b/3party/boost/boost/archive/detail/basic_oserializer.hpp index 7a710ba6bc..94247e9005 100644 --- a/3party/boost/boost/archive/detail/basic_oserializer.hpp +++ b/3party/boost/boost/archive/detail/basic_oserializer.hpp @@ -52,11 +52,7 @@ protected: explicit BOOST_ARCHIVE_DECL basic_oserializer( const boost::serialization::extended_type_info & type_ ); - // account for bogus gcc warning - #if defined(__GNUC__) - virtual - #endif - BOOST_ARCHIVE_DECL ~basic_oserializer(); + virtual BOOST_ARCHIVE_DECL ~basic_oserializer(); public: bool serialized_as_pointer() const { return m_bpos != NULL; diff --git a/3party/boost/boost/archive/detail/basic_pointer_iserializer.hpp b/3party/boost/boost/archive/detail/basic_pointer_iserializer.hpp index 23b9f906dc..1fc4b14d6e 100644 --- a/3party/boost/boost/archive/detail/basic_pointer_iserializer.hpp +++ b/3party/boost/boost/archive/detail/basic_pointer_iserializer.hpp @@ -46,11 +46,7 @@ protected: explicit BOOST_ARCHIVE_DECL basic_pointer_iserializer( const boost::serialization::extended_type_info & type_ ); - // account for bogus gcc warning - #if defined(__GNUC__) - virtual - #endif - BOOST_ARCHIVE_DECL ~basic_pointer_iserializer(); + virtual BOOST_ARCHIVE_DECL ~basic_pointer_iserializer(); public: virtual void * heap_allocation() const = 0; virtual const basic_iserializer & get_basic_serializer() const = 0; diff --git a/3party/boost/boost/archive/detail/basic_pointer_oserializer.hpp b/3party/boost/boost/archive/detail/basic_pointer_oserializer.hpp index d09ec1ae8e..1a5d9549ea 100644 --- a/3party/boost/boost/archive/detail/basic_pointer_oserializer.hpp +++ b/3party/boost/boost/archive/detail/basic_pointer_oserializer.hpp @@ -39,7 +39,7 @@ namespace detail { class basic_oarchive; class basic_oserializer; -class BOOST_SYMBOL_VISIBLE basic_pointer_oserializer : +class BOOST_SYMBOL_VISIBLE basic_pointer_oserializer : public basic_serializer { protected: @@ -47,11 +47,7 @@ protected: const boost::serialization::extended_type_info & type_ ); public: - // account for bogus gcc warning - #if defined(__GNUC__) - virtual - #endif - BOOST_ARCHIVE_DECL ~basic_pointer_oserializer(); + virtual BOOST_ARCHIVE_DECL ~basic_pointer_oserializer(); virtual const basic_oserializer & get_basic_serializer() const = 0; virtual void save_object_ptr( basic_oarchive & ar, diff --git a/3party/boost/boost/archive/detail/basic_serializer.hpp b/3party/boost/boost/archive/detail/basic_serializer.hpp index c7d3b4befc..f9c4203f86 100644 --- a/3party/boost/boost/archive/detail/basic_serializer.hpp +++ b/3party/boost/boost/archive/detail/basic_serializer.hpp @@ -41,9 +41,7 @@ protected: const boost::serialization::extended_type_info & eti ) : m_eti(& eti) - { - BOOST_ASSERT(NULL != & eti); - } + {} public: inline bool operator<(const basic_serializer & rhs) const { diff --git a/3party/boost/boost/archive/detail/common_iarchive.hpp b/3party/boost/boost/archive/detail/common_iarchive.hpp index b4c44d2767..82304f1e5a 100644 --- a/3party/boost/boost/archive/detail/common_iarchive.hpp +++ b/3party/boost/boost/archive/detail/common_iarchive.hpp @@ -35,7 +35,7 @@ class extended_type_info; // note: referred to as Curiously Recurring Template Patter (CRTP) template -class common_iarchive : +class BOOST_SYMBOL_VISIBLE common_iarchive : public basic_iarchive, public interface_iarchive { diff --git a/3party/boost/boost/archive/detail/common_oarchive.hpp b/3party/boost/boost/archive/detail/common_oarchive.hpp index 13c71bc5a8..ee42bbe597 100644 --- a/3party/boost/boost/archive/detail/common_oarchive.hpp +++ b/3party/boost/boost/archive/detail/common_oarchive.hpp @@ -32,7 +32,8 @@ namespace detail { // note: referred to as Curiously Recurring Template Patter (CRTP) template -class common_oarchive : + +class BOOST_SYMBOL_VISIBLE common_oarchive : public basic_oarchive, public interface_oarchive { diff --git a/3party/boost/boost/archive/detail/decl.hpp b/3party/boost/boost/archive/detail/decl.hpp index bb386d86f8..4f731cded3 100644 --- a/3party/boost/boost/archive/detail/decl.hpp +++ b/3party/boost/boost/archive/detail/decl.hpp @@ -29,14 +29,12 @@ #else #define BOOST_ARCHIVE_DECL BOOST_SYMBOL_IMPORT #endif + #if defined(BOOST_WARCHIVE_SOURCE) #define BOOST_WARCHIVE_DECL BOOST_SYMBOL_EXPORT #else #define BOOST_WARCHIVE_DECL BOOST_SYMBOL_IMPORT #endif - #if !defined(BOOST_WARCHIVE_SOURCE) && !defined(BOOST_ARCHIVE_SOURCE) - #define BOOST_ARCHIVE_OR_WARCHIVE_DECL BOOST_SYMBOL_IMPORT - #endif #if defined(BOOST_WARCHIVE_SOURCE) || defined(BOOST_ARCHIVE_SOURCE) #define BOOST_ARCHIVE_OR_WARCHIVE_DECL BOOST_SYMBOL_EXPORT diff --git a/3party/boost/boost/archive/detail/interface_iarchive.hpp b/3party/boost/boost/archive/detail/interface_iarchive.hpp index 3c658af5ef..4a99e28b59 100644 --- a/3party/boost/boost/archive/detail/interface_iarchive.hpp +++ b/3party/boost/boost/archive/detail/interface_iarchive.hpp @@ -62,7 +62,7 @@ public: helper_collection & hc = this->This()->get_helper_collection(); return hc.template find_helper(id); } - + template Archive & operator>>(T & t){ this->This()->load_override(t); diff --git a/3party/boost/boost/archive/detail/interface_oarchive.hpp b/3party/boost/boost/archive/detail/interface_oarchive.hpp index 16ea49c112..359463ed9d 100644 --- a/3party/boost/boost/archive/detail/interface_oarchive.hpp +++ b/3party/boost/boost/archive/detail/interface_oarchive.hpp @@ -29,7 +29,7 @@ namespace boost { namespace archive { namespace detail { -class BOOST_ARCHIVE_OR_WARCHIVE_DECL basic_pointer_oserializer; +class basic_pointer_oserializer; template class interface_oarchive @@ -57,7 +57,7 @@ public: this->This()->register_basic_serializer(bpos.get_basic_serializer()); return & bpos; } - + template Helper & get_helper(void * const id = 0){ @@ -75,7 +75,7 @@ public: template Archive & operator&(const T & t){ return * this ->This() << t; - }; + } }; } // namespace detail diff --git a/3party/boost/boost/archive/detail/iserializer.hpp b/3party/boost/boost/archive/detail/iserializer.hpp index d6d3f42f6e..6e02eec7c4 100644 --- a/3party/boost/boost/archive/detail/iserializer.hpp +++ b/3party/boost/boost/archive/detail/iserializer.hpp @@ -39,7 +39,6 @@ namespace std{ #include #include #include -#include #include #ifndef BOOST_SERIALIZATION_DEFAULT_TYPE_INFO @@ -57,10 +56,16 @@ namespace std{ #include #include -#define DONT_USE_HAS_NEW_OPERATOR ( \ - BOOST_WORKAROUND(__IBMCPP__, < 1210) \ - || defined(__SUNPRO_CC) && (__SUNPRO_CC < 0x590) \ -) + +#ifndef BOOST_MSVC + #define DONT_USE_HAS_NEW_OPERATOR ( \ + BOOST_WORKAROUND(__IBMCPP__, < 1210) \ + || defined(__SUNPRO_CC) && (__SUNPRO_CC < 0x590) \ + ) +#else + #define DONT_USE_HAS_NEW_OPERATOR 0 +#endif + #if ! DONT_USE_HAS_NEW_OPERATOR #include #endif @@ -72,10 +77,10 @@ namespace std{ #include #include #include -#include #include #include #include +#include // the following is need only for dynamic cast of polymorphic pointers #include @@ -223,17 +228,13 @@ struct heap_allocation { static void invoke_delete(T * t) { // if compilation fails here, the likely cause that the class // T has a class specific new operator but no class specific - // delete operator which matches the following signature. Fix - // your program to have this. Note that adding operator delete - // with only one parameter doesn't seem correct to me since - // the standard(3.7.4.2) says " - // "If a class T has a member deallocation function named - // 'operator delete' with exactly one parameter, then that function - // is a usual (non-placement) deallocation function" which I take - // to mean that it will call the destructor of type T which we don't - // want to do here. - // Note: reliance upon automatic conversion from T * to void * here - (T::operator delete)(t, sizeof(T)); + // delete operator which matches the following signature. + // note that this solution addresses the issue that two + // possible signatures. But it doesn't address the possibility + // that the class might have class specific new with NO + // class specific delete at all. Patches (compatible with + // C++03) welcome! + delete t; } }; struct doesnt_have_new_operator { @@ -242,7 +243,7 @@ struct heap_allocation { } static void invoke_delete(T * t) { // Note: I'm reliance upon automatic conversion from T * to void * here - (operator delete)(t); + delete t; } }; static T * invoke_new() { @@ -587,7 +588,14 @@ struct load_array_type { boost::archive::archive_exception::array_size_too_short ) ); - ar >> serialization::make_array(static_cast(&t[0]),count); + // explict template arguments to pass intel C++ compiler + ar >> serialization::make_array< + value_type, + boost::serialization::collection_size_type + >( + static_cast(&t[0]), + count + ); } }; diff --git a/3party/boost/boost/archive/detail/oserializer.hpp b/3party/boost/boost/archive/detail/oserializer.hpp index 7a7e239376..c120ec5507 100644 --- a/3party/boost/boost/archive/detail/oserializer.hpp +++ b/3party/boost/boost/archive/detail/oserializer.hpp @@ -33,6 +33,7 @@ #include #include #include +#include #ifndef BOOST_SERIALIZATION_DEFAULT_TYPE_INFO #include @@ -55,8 +56,9 @@ #include #include #include -#include #include +#include + #include #include @@ -500,7 +502,14 @@ struct save_array_type ); boost::serialization::collection_size_type count(c); ar << BOOST_SERIALIZATION_NVP(count); - ar << serialization::make_array(static_cast(&t[0]),count); + // explict template arguments to pass intel C++ compiler + ar << serialization::make_array< + const value_type, + boost::serialization::collection_size_type + >( + static_cast(&t[0]), + count + ); } }; diff --git a/3party/boost/boost/archive/detail/polymorphic_iarchive_route.hpp b/3party/boost/boost/archive/detail/polymorphic_iarchive_route.hpp index 2c57a3f51c..105685ebbd 100644 --- a/3party/boost/boost/archive/detail/polymorphic_iarchive_route.hpp +++ b/3party/boost/boost/archive/detail/polymorphic_iarchive_route.hpp @@ -39,8 +39,8 @@ namespace serialization { namespace archive { namespace detail{ -class BOOST_ARCHIVE_DECL basic_iserializer; -class BOOST_ARCHIVE_DECL basic_pointer_iserializer; +class basic_iserializer; +class basic_pointer_iserializer; #ifdef BOOST_MSVC # pragma warning(push) diff --git a/3party/boost/boost/archive/detail/polymorphic_oarchive_route.hpp b/3party/boost/boost/archive/detail/polymorphic_oarchive_route.hpp index ae750133a8..b23fd6bf39 100644 --- a/3party/boost/boost/archive/detail/polymorphic_oarchive_route.hpp +++ b/3party/boost/boost/archive/detail/polymorphic_oarchive_route.hpp @@ -39,8 +39,8 @@ namespace serialization { namespace archive { namespace detail{ -class BOOST_ARCHIVE_DECL basic_oserializer; -class BOOST_ARCHIVE_DECL basic_pointer_oserializer; +class basic_oserializer; +class basic_pointer_oserializer; #ifdef BOOST_MSVC # pragma warning(push) diff --git a/3party/boost/boost/archive/detail/utf8_codecvt_facet.hpp b/3party/boost/boost/archive/detail/utf8_codecvt_facet.hpp index b2430d5a43..a40104abea 100644 --- a/3party/boost/boost/archive/detail/utf8_codecvt_facet.hpp +++ b/3party/boost/boost/archive/detail/utf8_codecvt_facet.hpp @@ -7,10 +7,20 @@ #ifndef BOOST_ARCHIVE_DETAIL_UTF8_CODECVT_FACET_HPP #define BOOST_ARCHIVE_DETAIL_UTF8_CODECVT_FACET_HPP -#ifdef BOOST_NO_CXX11_HDR_CODECVT +#include + +#ifdef BOOST_NO_STD_WSTREAMBUF +#error "wide char i/o not supported on this platform" +#endif + +// std::codecvt_utf8 doesn't seem to work for any versions of msvc + +#if defined(_MSC_VER) || defined(BOOST_NO_CXX11_HDR_CODECVT) + // use boost's utf8 codecvt facet + #include #define BOOST_UTF8_BEGIN_NAMESPACE \ namespace boost { namespace archive { namespace detail { - #define BOOST_UTF8_DECL + #define BOOST_UTF8_DECL BOOST_ARCHIVE_DECL #define BOOST_UTF8_END_NAMESPACE }}} #include @@ -18,6 +28,12 @@ #undef BOOST_UTF8_END_NAMESPACE #undef BOOST_UTF8_DECL #undef BOOST_UTF8_BEGIN_NAMESPACE -#endif // BOOST_NO_CXX11_HDR_CODECVT -#endif // BOOST_ARCHIVE_DETAIL_UTF8_CODECVT_FACET_HPP +#else + // use the standard vendor supplied facet + #include + namespace boost { namespace archive { namespace detail { + typedef std::codecvt_utf8 utf8_codecvt_facet; + } } } +#endif +#endif // BOOST_ARCHIVE_DETAIL_UTF8_CODECVT_FACET_HPP diff --git a/3party/boost/boost/archive/impl/basic_binary_iprimitive.ipp b/3party/boost/boost/archive/impl/basic_binary_iprimitive.ipp index bee7bafea9..7082b003e7 100644 --- a/3party/boost/boost/archive/impl/basic_binary_iprimitive.ipp +++ b/3party/boost/boost/archive/impl/basic_binary_iprimitive.ipp @@ -20,14 +20,9 @@ namespace std{ } // namespace std #endif -#include // fixup for RogueWave - #include - #include #include -#include -#include #include namespace boost { @@ -152,16 +147,13 @@ basic_binary_iprimitive::basic_binary_iprimitive( ) : #ifndef BOOST_NO_STD_LOCALE m_sb(sb), - locale_saver(m_sb) + codecvt_null_facet(1), + locale_saver(m_sb), + archive_locale(sb.getloc(), & codecvt_null_facet) { if(! no_codecvt){ - archive_locale.reset( - add_facet( - std::locale::classic(), - new codecvt_null - ) - ); - //m_sb.pubimbue(* archive_locale); + m_sb.pubsync(); + m_sb.pubimbue(archive_locale); } } #else @@ -169,42 +161,11 @@ basic_binary_iprimitive::basic_binary_iprimitive( {} #endif -// some libraries including stl and libcomo fail if the -// buffer isn't flushed before the code_cvt facet is changed. -// I think this is a bug. We explicity invoke sync to when -// we're done with the streambuf to work around this problem. -// Note that sync is a protected member of stream buff so we -// have to invoke it through a contrived derived class. -namespace detail { -// note: use "using" to get past msvc bug -using namespace std; -template -class input_streambuf_access : public std::basic_streambuf { - public: - virtual int sync(){ -#if BOOST_WORKAROUND(__MWERKS__, BOOST_TESTED_AT(0x3206)) - return this->basic_streambuf::sync(); -#else - return this->basic_streambuf::sync(); -#endif - } -}; -} // detail - -// scoped_ptr requires that archive_locale be a complete type at time of +// scoped_ptr requires that g be a complete type at time of // destruction so define destructor here rather than in the header template BOOST_ARCHIVE_OR_WARCHIVE_DECL -basic_binary_iprimitive::~basic_binary_iprimitive(){ - // push back unread characters - //destructor can't throw ! - BOOST_TRY{ - static_cast &>(m_sb).sync(); - } - BOOST_CATCH(...){ - } - BOOST_CATCH_END -} +basic_binary_iprimitive::~basic_binary_iprimitive(){} } // namespace archive } // namespace boost diff --git a/3party/boost/boost/archive/impl/basic_binary_oprimitive.ipp b/3party/boost/boost/archive/impl/basic_binary_oprimitive.ipp index 88cc12433c..130831e4fb 100644 --- a/3party/boost/boost/archive/impl/basic_binary_oprimitive.ipp +++ b/3party/boost/boost/archive/impl/basic_binary_oprimitive.ipp @@ -27,10 +27,6 @@ namespace std{ using ::wcslen; } #endif #endif -#include - -#include -#include #include #include @@ -104,16 +100,13 @@ basic_binary_oprimitive::basic_binary_oprimitive( ) : #ifndef BOOST_NO_STD_LOCALE m_sb(sb), - locale_saver(m_sb) + codecvt_null_facet(1), + locale_saver(m_sb), + archive_locale(sb.getloc(), & codecvt_null_facet) { if(! no_codecvt){ - archive_locale.reset( - add_facet( - std::locale::classic(), - new codecvt_null - ) - ); - //m_sb.pubimbue(* archive_locale); + m_sb.pubsync(); + m_sb.pubimbue(archive_locale); } } #else @@ -121,42 +114,11 @@ basic_binary_oprimitive::basic_binary_oprimitive( {} #endif -// some libraries including stl and libcomo fail if the -// buffer isn't flushed before the code_cvt facet is changed. -// I think this is a bug. We explicity invoke sync to when -// we're done with the streambuf to work around this problem. -// Note that sync is a protected member of stream buff so we -// have to invoke it through a contrived derived class. -namespace detail { -// note: use "using" to get past msvc bug -using namespace std; -template -class output_streambuf_access : public std::basic_streambuf { - public: - virtual int sync(){ -#if BOOST_WORKAROUND(__MWERKS__, BOOST_TESTED_AT(0x3206)) - return this->basic_streambuf::sync(); -#else - return this->basic_streambuf::sync(); -#endif - } -}; -} // detail - // scoped_ptr requires that g be a complete type at time of // destruction so define destructor here rather than in the header template BOOST_ARCHIVE_OR_WARCHIVE_DECL -basic_binary_oprimitive::~basic_binary_oprimitive(){ - // flush buffer - //destructor can't throw - BOOST_TRY{ - static_cast &>(m_sb).sync(); - } - BOOST_CATCH(...){ - } - BOOST_CATCH_END -} +basic_binary_oprimitive::~basic_binary_oprimitive(){} } // namespace archive } // namespace boost diff --git a/3party/boost/boost/archive/impl/basic_text_iprimitive.ipp b/3party/boost/boost/archive/impl/basic_text_iprimitive.ipp index e245dc540f..4e44728068 100644 --- a/3party/boost/boost/archive/impl/basic_text_iprimitive.ipp +++ b/3party/boost/boost/archive/impl/basic_text_iprimitive.ipp @@ -8,8 +8,8 @@ // See http://www.boost.org for updates, documentation, and revision history. -#include // size_t -#include // NULL +#include // size_t, NULL +#include // NULL #include #if defined(BOOST_NO_STDC_NAMESPACE) @@ -21,8 +21,6 @@ namespace std{ #include #include -#include -#include #include #include @@ -78,7 +76,7 @@ basic_text_iprimitive::load_binary( iterators::remove_whitespace< iterators::istream_iterator > - ,CharType + ,typename IStream::int_type > ,8 ,6 @@ -112,34 +110,27 @@ basic_text_iprimitive::basic_text_iprimitive( IStream &is_, bool no_codecvt ) : -#ifndef BOOST_NO_STD_LOCALE is(is_), flags_saver(is_), precision_saver(is_), - locale_saver(* is_.rdbuf()) +#ifndef BOOST_NO_STD_LOCALE + codecvt_null_facet(1), + archive_locale(is.getloc(), & codecvt_null_facet), + locale_saver(is) { if(! no_codecvt){ - archive_locale.reset( - add_facet( - std::locale::classic(), - new boost::archive::codecvt_null - ) - ); - //is.imbue(* archive_locale); + is_.sync(); + is_.imbue(archive_locale); } - is >> std::noboolalpha; + is_ >> std::noboolalpha; } #else - is(is_), - flags_saver(is_), - precision_saver(is_) {} #endif template BOOST_ARCHIVE_OR_WARCHIVE_DECL basic_text_iprimitive::~basic_text_iprimitive(){ - is.sync(); } } // namespace archive diff --git a/3party/boost/boost/archive/impl/basic_text_oprimitive.ipp b/3party/boost/boost/archive/impl/basic_text_oprimitive.ipp index f2b0a10a60..6030fd44c5 100644 --- a/3party/boost/boost/archive/impl/basic_text_oprimitive.ipp +++ b/3party/boost/boost/archive/impl/basic_text_oprimitive.ipp @@ -10,10 +10,15 @@ #include // NULL #include // std::copy +#include // std::uncaught_exception +#include +#if defined(BOOST_NO_STDC_NAMESPACE) +namespace std{ + using ::size_t; +} // namespace std +#endif #include -#include -#include #include #include @@ -79,33 +84,30 @@ basic_text_oprimitive::basic_text_oprimitive( OStream & os_, bool no_codecvt ) : -#ifndef BOOST_NO_STD_LOCALE os(os_), flags_saver(os_), precision_saver(os_), - locale_saver(* os_.rdbuf()) +#ifndef BOOST_NO_STD_LOCALE + codecvt_null_facet(1), + archive_locale(os.getloc(), & codecvt_null_facet), + locale_saver(os) { if(! no_codecvt){ - archive_locale.reset( - add_facet( - std::locale::classic(), - new boost::archive::codecvt_null - ) - ); - //os.imbue(* archive_locale); + os_.flush(); + os_.imbue(archive_locale); } - os << std::noboolalpha; + os_ << std::noboolalpha; } #else - os(os_), - flags_saver(os_), - precision_saver(os_) {} #endif + template BOOST_ARCHIVE_OR_WARCHIVE_DECL basic_text_oprimitive::~basic_text_oprimitive(){ + if(std::uncaught_exception()) + return; os << std::endl; } diff --git a/3party/boost/boost/archive/impl/basic_xml_grammar.hpp b/3party/boost/boost/archive/impl/basic_xml_grammar.hpp index 70a6013abc..6d4e4683f6 100644 --- a/3party/boost/boost/archive/impl/basic_xml_grammar.hpp +++ b/3party/boost/boost/archive/impl/basic_xml_grammar.hpp @@ -163,7 +163,7 @@ public: bool parse_end_tag(IStream & is) const; bool parse_string(IStream & is, StringType & s) /*const*/; void init(IStream & is); - void windup(IStream & is); + bool windup(IStream & is); basic_xml_grammar(); }; diff --git a/3party/boost/boost/archive/impl/basic_xml_iarchive.ipp b/3party/boost/boost/archive/impl/basic_xml_iarchive.ipp index 9e670120f0..625458b9eb 100644 --- a/3party/boost/boost/archive/impl/basic_xml_iarchive.ipp +++ b/3party/boost/boost/archive/impl/basic_xml_iarchive.ipp @@ -108,7 +108,8 @@ basic_xml_iarchive::basic_xml_iarchive(unsigned int flags) : {} template BOOST_ARCHIVE_OR_WARCHIVE_DECL -basic_xml_iarchive::~basic_xml_iarchive(){} +basic_xml_iarchive::~basic_xml_iarchive(){ +} } // namespace archive } // namespace boost diff --git a/3party/boost/boost/archive/impl/basic_xml_oarchive.ipp b/3party/boost/boost/archive/impl/basic_xml_oarchive.ipp index 5db1e13096..3184413f38 100644 --- a/3party/boost/boost/archive/impl/basic_xml_oarchive.ipp +++ b/3party/boost/boost/archive/impl/basic_xml_oarchive.ipp @@ -246,26 +246,26 @@ basic_xml_oarchive::init(){ this->This()->put(">\n"); } +template +BOOST_ARCHIVE_OR_WARCHIVE_DECL void +basic_xml_oarchive::windup(){ + // xml_trailer + this->This()->put("\n"); +} + template BOOST_ARCHIVE_OR_WARCHIVE_DECL basic_xml_oarchive::basic_xml_oarchive(unsigned int flags) : detail::common_oarchive(flags), depth(0), - indent_next(false), - pending_preamble(false) + pending_preamble(false), + indent_next(false) { } template BOOST_ARCHIVE_OR_WARCHIVE_DECL basic_xml_oarchive::~basic_xml_oarchive(){ - if(0 == (this->get_flags() & no_header)){ - BOOST_TRY{ - this->This()->put("\n"); - } - BOOST_CATCH(...){} - BOOST_CATCH_END - } } } // namespace archive diff --git a/3party/boost/boost/archive/impl/text_iarchive_impl.ipp b/3party/boost/boost/archive/impl/text_iarchive_impl.ipp index 50c7c051b0..ae4e2750ce 100644 --- a/3party/boost/boost/archive/impl/text_iarchive_impl.ipp +++ b/3party/boost/boost/archive/impl/text_iarchive_impl.ipp @@ -105,7 +105,7 @@ text_iarchive_impl::init(){ } template -BOOST_ARCHIVE_DECL +BOOST_ARCHIVE_DECL text_iarchive_impl::text_iarchive_impl( std::istream & is, unsigned int flags diff --git a/3party/boost/boost/archive/impl/text_oarchive_impl.ipp b/3party/boost/boost/archive/impl/text_oarchive_impl.ipp index 54bd2e04ff..37d8664a98 100644 --- a/3party/boost/boost/archive/impl/text_oarchive_impl.ipp +++ b/3party/boost/boost/archive/impl/text_oarchive_impl.ipp @@ -10,7 +10,6 @@ #include #include -#include #include // size_t #include @@ -27,7 +26,6 @@ namespace std{ using ::wcslen; } #endif #endif -#include #include namespace boost { @@ -84,7 +82,7 @@ text_oarchive_impl::save(const std::wstring &ws) #endif // BOOST_NO_CWCHAR template -BOOST_ARCHIVE_DECL +BOOST_ARCHIVE_DECL text_oarchive_impl::text_oarchive_impl( std::ostream & os, unsigned int flags diff --git a/3party/boost/boost/archive/impl/text_wiarchive_impl.ipp b/3party/boost/boost/archive/impl/text_wiarchive_impl.ipp index 57c18bc17d..12af2b9f12 100644 --- a/3party/boost/boost/archive/impl/text_wiarchive_impl.ipp +++ b/3party/boost/boost/archive/impl/text_wiarchive_impl.ipp @@ -97,7 +97,7 @@ text_wiarchive_impl::load(std::wstring &ws) #endif template -BOOST_WARCHIVE_DECL +BOOST_WARCHIVE_DECL text_wiarchive_impl::text_wiarchive_impl( std::wistream & is, unsigned int flags diff --git a/3party/boost/boost/archive/impl/xml_iarchive_impl.ipp b/3party/boost/boost/archive/impl/xml_iarchive_impl.ipp index 7639ecb3b1..efc32e0163 100644 --- a/3party/boost/boost/archive/impl/xml_iarchive_impl.ipp +++ b/3party/boost/boost/archive/impl/xml_iarchive_impl.ipp @@ -11,6 +11,8 @@ #include #include // memcpy #include // NULL +#include + #if defined(BOOST_NO_STDC_NAMESPACE) namespace std{ using ::memcpy; @@ -18,10 +20,11 @@ namespace std{ #endif #ifndef BOOST_NO_CWCHAR -#include // mbtowc +#include // mbstate_t and mbrtowc #if defined(BOOST_NO_STDC_NAMESPACE) namespace std{ - using ::mbtowc; + using ::mbstate_t; + using ::mbrtowc; } // namespace std #endif #endif // BOOST_NO_CWCHAR @@ -63,22 +66,23 @@ xml_iarchive_impl::load(std::wstring &ws){ #if BOOST_WORKAROUND(_RWSTD_VER, BOOST_TESTED_AT(20101)) if(NULL != ws.data()) #endif - ws.resize(0); + ws.resize(0); + std::mbstate_t mbs = std::mbstate_t(); const char * start = s.data(); const char * end = start + s.size(); while(start < end){ wchar_t wc; - int resultx = std::mbtowc(&wc, start, end - start); - if(0 < resultx){ - start += resultx; - ws += wc; + std::size_t count = std::mbrtowc(&wc, start, end - start, &mbs); + if(count == static_cast(-1)) + boost::serialization::throw_exception( + iterators::dataflow_exception( + iterators::dataflow_exception::invalid_conversion + ) + ); + if(count == static_cast(-2)) continue; - } - boost::serialization::throw_exception( - iterators::dataflow_exception( - iterators::dataflow_exception::invalid_conversion - ) - ); + start += count; + ws += wc; } } #endif // BOOST_NO_STD_WSTRING @@ -91,24 +95,28 @@ xml_iarchive_impl::load(wchar_t * ws){ bool result = gimpl->parse_string(is, s); if(! result) boost::serialization::throw_exception( - xml_archive_exception(xml_archive_exception::xml_archive_parsing_error) + xml_archive_exception( + xml_archive_exception::xml_archive_parsing_error + ) ); + std::mbstate_t mbs = std::mbstate_t(); const char * start = s.data(); const char * end = start + s.size(); while(start < end){ wchar_t wc; - int length = std::mbtowc(&wc, start, end - start); - if(0 < length){ - start += length; - *ws++ = wc; + std::size_t length = std::mbrtowc(&wc, start, end - start, &mbs); + if(static_cast(-1) == length) + boost::serialization::throw_exception( + iterators::dataflow_exception( + iterators::dataflow_exception::invalid_conversion + ) + ); + if(static_cast(-2) == length) continue; - } - boost::serialization::throw_exception( - iterators::dataflow_exception( - iterators::dataflow_exception::invalid_conversion - ) - ); + + start += length; + *ws++ = wc; } *ws = L'\0'; } @@ -181,12 +189,10 @@ xml_iarchive_impl::xml_iarchive_impl( template BOOST_ARCHIVE_DECL xml_iarchive_impl::~xml_iarchive_impl(){ + if(std::uncaught_exception()) + return; if(0 == (this->get_flags() & no_header)){ - BOOST_TRY{ - gimpl->windup(is); - } - BOOST_CATCH(...){} - BOOST_CATCH_END + gimpl->windup(is); } } } // namespace archive diff --git a/3party/boost/boost/archive/impl/xml_oarchive_impl.ipp b/3party/boost/boost/archive/impl/xml_oarchive_impl.ipp index 9e714f3ca6..5ebd454e72 100644 --- a/3party/boost/boost/archive/impl/xml_oarchive_impl.ipp +++ b/3party/boost/boost/archive/impl/xml_oarchive_impl.ipp @@ -10,6 +10,7 @@ #include #include // std::copy #include +#include #include // strlen #include // msvc 6.0 needs this to suppress warnings @@ -113,5 +114,29 @@ xml_oarchive_impl::xml_oarchive_impl( this->init(); } +template +BOOST_ARCHIVE_DECL void +xml_oarchive_impl::save_binary(const void *address, std::size_t count){ + this->end_preamble(); + #if ! defined(__MWERKS__) + this->basic_text_oprimitive::save_binary( + #else + this->basic_text_oprimitive::save_binary( + #endif + address, + count + ); + this->indent_next = true; +} + +template +BOOST_ARCHIVE_DECL +xml_oarchive_impl::~xml_oarchive_impl(){ + if(std::uncaught_exception()) + return; + if(0 == (this->get_flags() & no_header)) + this->windup(); +} + } // namespace archive } // namespace boost diff --git a/3party/boost/boost/archive/impl/xml_wiarchive_impl.ipp b/3party/boost/boost/archive/impl/xml_wiarchive_impl.ipp index a837347edb..ee66c1263e 100644 --- a/3party/boost/boost/archive/impl/xml_wiarchive_impl.ipp +++ b/3party/boost/boost/archive/impl/xml_wiarchive_impl.ipp @@ -20,7 +20,7 @@ namespace std{ #include #include // std::copy - +#include // uncaught exception #include // Dinkumware and RogueWave #if BOOST_WORKAROUND(BOOST_DINKUMWARE_STDLIB, == 1) #include @@ -33,11 +33,11 @@ namespace std{ #include #include -#include - #include #include +#include + #include "basic_xml_grammar.hpp" namespace boost { @@ -161,15 +161,13 @@ xml_wiarchive_impl::xml_wiarchive_impl( gimpl(new xml_wgrammar()) { if(0 == (flags & no_codecvt)){ - // note usage of argument "1" so that the locale isn't - // automatically delete the facet - archive_locale.reset( - add_facet( - is_.getloc(), - new boost::archive::detail::utf8_codecvt_facet - ) + std::locale l = std::locale( + is_.getloc(), + new boost::archive::detail::utf8_codecvt_facet ); - //is.imbue(* archive_locale); + // libstdc++ crashes without this + is_.sync(); + is_.imbue(l); } if(0 == (flags & no_header)) init(); @@ -178,12 +176,10 @@ xml_wiarchive_impl::xml_wiarchive_impl( template BOOST_WARCHIVE_DECL xml_wiarchive_impl::~xml_wiarchive_impl(){ + if(std::uncaught_exception()) + return; if(0 == (this->get_flags() & no_header)){ - BOOST_TRY{ - gimpl->windup(is); - } - BOOST_CATCH(...){} - BOOST_CATCH_END + gimpl->windup(is); } } diff --git a/3party/boost/boost/archive/impl/xml_woarchive_impl.ipp b/3party/boost/boost/archive/impl/xml_woarchive_impl.ipp index d5586d51ae..58f92c9d92 100644 --- a/3party/boost/boost/archive/impl/xml_woarchive_impl.ipp +++ b/3party/boost/boost/archive/impl/xml_woarchive_impl.ipp @@ -13,6 +13,7 @@ #include #include // std::copy #include +#include #include // strlen #include // mbtowc @@ -30,6 +31,8 @@ namespace std{ #endif #include +#include + #include #include @@ -37,8 +40,6 @@ namespace std{ #include #include -#include - namespace boost { namespace archive { @@ -122,19 +123,13 @@ xml_woarchive_impl::xml_woarchive_impl( ), basic_xml_oarchive(flags) { - // Standard behavior is that imbue can be called - // a) before output is invoked or - // b) after flush has been called. This prevents one-to-many - // transforms (such as one to many transforms from getting - // mixed up. if(0 == (flags & no_codecvt)){ - archive_locale.reset( - add_facet( - os_.getloc(), - new boost::archive::detail::utf8_codecvt_facet - ) + std::locale l = std::locale( + os_.getloc(), + new boost::archive::detail::utf8_codecvt_facet ); - //os.imbue(* archive_locale); + os_.flush(); + os_.imbue(l); } if(0 == (flags & no_header)) this->init(); @@ -143,6 +138,29 @@ xml_woarchive_impl::xml_woarchive_impl( template BOOST_WARCHIVE_DECL xml_woarchive_impl::~xml_woarchive_impl(){ + if(std::uncaught_exception()) + return; + if(0 == (this->get_flags() & no_header)){ + save(L"\n"); + } +} + +template +BOOST_WARCHIVE_DECL void +xml_woarchive_impl::save_binary( + const void *address, + std::size_t count +){ + this->end_preamble(); + #if ! defined(__MWERKS__) + this->basic_text_oprimitive::save_binary( + #else + this->basic_text_oprimitive::save_binary( + #endif + address, + count + ); + this->indent_next = true; } } // namespace archive diff --git a/3party/boost/boost/archive/iterators/dataflow.hpp b/3party/boost/boost/archive/iterators/dataflow.hpp index 6f8001d3ce..07733d5fd6 100644 --- a/3party/boost/boost/archive/iterators/dataflow.hpp +++ b/3party/boost/boost/archive/iterators/dataflow.hpp @@ -20,7 +20,6 @@ #include #include -#include #include #include #include diff --git a/3party/boost/boost/archive/iterators/head_iterator.hpp b/3party/boost/boost/archive/iterators/head_iterator.hpp deleted file mode 100644 index 6ad7d6b32b..0000000000 --- a/3party/boost/boost/archive/iterators/head_iterator.hpp +++ /dev/null @@ -1,80 +0,0 @@ -#ifndef BOOST_ARCHIVE_ITERATORS_HEAD_ITERATOR_HPP -#define BOOST_ARCHIVE_ITERATORS_HEAD_ITERATOR_HPP - -// MS compatible compilers support #pragma once -#if defined(_MSC_VER) -# pragma once -#endif - -/////////1/////////2/////////3/////////4/////////5/////////6/////////7/////////8 -// head_iterator.hpp - -// (C) Copyright 2002 Robert Ramey - http://www.rrsd.com . -// Use, modification and distribution is subject to the Boost Software -// License, Version 1.0. (See accompanying file LICENSE_1_0.txt or copy at -// http://www.boost.org/LICENSE_1_0.txt) - -// See http://www.boost.org for updates, documentation, and revision history. - -#include -#include - -namespace boost { -namespace archive { -namespace iterators { - -template -class head_iterator - : public boost::iterator_adaptor< - head_iterator, - Base, - use_default, - single_pass_traversal_tag - > -{ -private: - friend class iterator_core_access; - typedef boost::iterator_adaptor< - head_iterator, - Base, - use_default, - single_pass_traversal_tag - > super_t; - - typedef head_iterator this_t; - typedef super_t::value_type value_type; - typedef super_t::reference reference_type; - - reference_type dereference_impl(){ - if(! m_end){ - while(! m_predicate(* this->base_reference())) - ++ this->base_reference(); - m_end = true; - } - return * this->base_reference(); - } - - reference_type dereference() const { - return const_cast(this)->dereference_impl(); - } - - void increment(){ - ++base_reference(); - } - Predicate m_predicate; - bool m_end; -public: - template - head_iterator(Predicate f, T start) : - super_t(Base(start)), - m_predicate(f), - m_end(false) - {} - -}; - -} // namespace iterators -} // namespace archive -} // namespace boost - -#endif // BOOST_ARCHIVE_ITERATORS_HEAD_ITERATOR_HPP diff --git a/3party/boost/boost/archive/iterators/istream_iterator.hpp b/3party/boost/boost/archive/iterators/istream_iterator.hpp index 41aa0be37b..9a1d555c10 100644 --- a/3party/boost/boost/archive/iterators/istream_iterator.hpp +++ b/3party/boost/boost/archive/iterators/istream_iterator.hpp @@ -54,21 +54,6 @@ class istream_iterator : return m_istream == rhs.m_istream; } -/* - //Access the value referred to - Elem dereference() const { - return m_current_value; - } - - void increment(){ - if(NULL != m_istream){ - m_current_value = static_cast(m_istream->get()); - if(! m_istream->good()){ - const_cast(this)->m_istream = NULL; - } - } - } -*/ //Access the value referred to Elem dereference() const { return m_istream->peek(); diff --git a/3party/boost/boost/archive/iterators/mb_from_wchar.hpp b/3party/boost/boost/archive/iterators/mb_from_wchar.hpp index deb798f623..b6dc9b2151 100644 --- a/3party/boost/boost/archive/iterators/mb_from_wchar.hpp +++ b/3party/boost/boost/archive/iterators/mb_from_wchar.hpp @@ -18,16 +18,16 @@ #include #include // size_t -#include // for wctomb() +#include // mbstate_t #include #if defined(BOOST_NO_STDC_NAMESPACE) namespace std{ - using ::size_t; - using ::wctomb; + using ::mbstate_t; } // namespace std #endif +#include #include namespace boost { @@ -66,10 +66,10 @@ class mb_from_wchar } return m_buffer[m_bnext]; } + char dereference() const { return (const_cast(this))->dereference_impl(); } - // test for iterator equality bool equal(const mb_from_wchar & rhs) const { // once the value is filled, the base_reference has been incremented @@ -83,16 +83,16 @@ class mb_from_wchar void fill(){ wchar_t value = * this->base_reference(); - #if (defined(__MINGW32__) && ((__MINGW32_MAJOR_VERSION > 3) \ - || ((__MINGW32_MAJOR_VERSION == 3) && (__MINGW32_MINOR_VERSION >= 8)))) - m_bend = std::wcrtomb(m_buffer, value,0); - #else - m_bend = std::wctomb(m_buffer, value); - #endif - BOOST_ASSERT(-1 != m_bend); - BOOST_ASSERT((std::size_t)m_bend <= sizeof(m_buffer)); - BOOST_ASSERT(m_bend > 0); + const wchar_t *wend; + char *bend; + std::codecvt_base::result r = m_codecvt_facet.out( + m_mbs, + & value, & value + 1, wend, + m_buffer, m_buffer + sizeof(m_buffer), bend + ); + BOOST_ASSERT(std::codecvt_base::ok == r); m_bnext = 0; + m_bend = bend - m_buffer; } void increment(){ @@ -104,10 +104,12 @@ class mb_from_wchar m_full = false; } + boost::archive::detail::utf8_codecvt_facet m_codecvt_facet; + std::mbstate_t m_mbs; // buffer to handle pending characters - int m_bend; - int m_bnext; - char m_buffer[9]; + char m_buffer[9 /* MB_CUR_MAX */]; + std::size_t m_bend; + std::size_t m_bnext; bool m_full; public: @@ -115,6 +117,7 @@ public: template mb_from_wchar(T start) : super_t(Base(static_cast< T >(start))), + m_mbs(std::mbstate_t()), m_bend(0), m_bnext(0), m_full(false) diff --git a/3party/boost/boost/archive/iterators/transform_width.hpp b/3party/boost/boost/archive/iterators/transform_width.hpp index de1b4be7cb..d042560e29 100644 --- a/3party/boost/boost/archive/iterators/transform_width.hpp +++ b/3party/boost/boost/archive/iterators/transform_width.hpp @@ -108,7 +108,7 @@ class transform_width : public: // make composible buy using templated constructor template - transform_width(T start) : + transform_width(T start) : super_t(Base(static_cast< T >(start))), m_buffer_out_full(false), // To disable GCC warning, but not truly necessary diff --git a/3party/boost/boost/archive/iterators/wchar_from_mb.hpp b/3party/boost/boost/archive/iterators/wchar_from_mb.hpp index b05db49e33..52a44bdc79 100644 --- a/3party/boost/boost/archive/iterators/wchar_from_mb.hpp +++ b/3party/boost/boost/archive/iterators/wchar_from_mb.hpp @@ -19,20 +19,22 @@ #include #include #include // size_t -#include // mblen +#include // mbstate_t +#include // copy #include #if defined(BOOST_NO_STDC_NAMESPACE) namespace std{ - using ::mblen; - using ::mbtowc; + using ::mbstate_t; } // namespace std #endif - +#include +#include +#include +#include #include -#include -#include +#include namespace boost { namespace archive { @@ -62,63 +64,125 @@ class wchar_from_mb typedef wchar_from_mb this_t; - wchar_t drain(); - - wchar_t dereference_impl() { - if(! m_full){ - m_current_value = drain(); - m_full = true; - } - return m_current_value; - } + void drain(); wchar_t dereference() const { - return const_cast(this)->dereference_impl(); + if(m_output.m_next == m_output.m_next_available) + return static_cast(0); + return * m_output.m_next; } void increment(){ - dereference_impl(); - m_full = false; - ++(this->base_reference()); + if(m_output.m_next == m_output.m_next_available) + return; + if(++m_output.m_next == m_output.m_next_available){ + if(m_input.m_done) + return; + drain(); + } + } + + bool equal(this_t const & rhs) const { + return dereference() == rhs.dereference(); + } + + boost::archive::detail::utf8_codecvt_facet m_codecvt_facet; + std::mbstate_t m_mbs; + + template + struct sliding_buffer { + boost::array m_buffer; + typename boost::array::const_iterator m_next_available; + typename boost::array::iterator m_next; + bool m_done; + // default ctor + sliding_buffer() : + m_next_available(m_buffer.begin()), + m_next(m_buffer.begin()), + m_done(false) + {} + // copy ctor + sliding_buffer(const sliding_buffer & rhs) : + m_next_available( + std::copy( + rhs.m_buffer.begin(), + rhs.m_next_available, + m_buffer.begin() + ) + ), + m_next( + m_buffer.begin() + (rhs.m_next - rhs.m_buffer.begin()) + ), + m_done(rhs.m_done) + {} }; - wchar_t m_current_value; - bool m_full; + sliding_buffer::type> m_input; + sliding_buffer::type> m_output; public: // make composible buy using templated constructor template - wchar_from_mb(T start) : + wchar_from_mb(T start) : super_t(Base(static_cast< T >(start))), - m_full(false) - {} - // intel 7.1 doesn't like default copy constructor - wchar_from_mb(const wchar_from_mb & rhs) : + m_mbs(std::mbstate_t()) + { + BOOST_ASSERT(std::mbsinit(&m_mbs)); + drain(); + } + // default constructor used as an end iterator + wchar_from_mb(){} + + // copy ctor + wchar_from_mb(const wchar_from_mb & rhs) : super_t(rhs.base_reference()), - m_full(rhs.m_full) + m_mbs(rhs.m_mbs), + m_input(rhs.m_input), + m_output(rhs.m_output) {} }; template -wchar_t wchar_from_mb::drain(){ - char buffer[9]; - char * bptr = buffer; - char val; - for(std::size_t i = 0; i++ < (unsigned)MB_CUR_MAX;){ - val = * this->base_reference(); - *bptr++ = val; - int result = std::mblen(buffer, i); - if(-1 != result) +void wchar_from_mb::drain(){ + BOOST_ASSERT(! m_input.m_done); + for(;;){ + typename boost::iterators::iterator_reference::type c = *(this->base_reference()); + // a null character in a multibyte stream is takes as end of string + if(0 == c){ + m_input.m_done = true; break; + } ++(this->base_reference()); + * const_cast::type *>( + (m_input.m_next_available++) + ) = c; + // if input buffer is full - we're done for now + if(m_input.m_buffer.end() == m_input.m_next_available) + break; } - wchar_t retval; - int result = std::mbtowc(& retval, buffer, MB_CUR_MAX); - if(0 >= result) - boost::serialization::throw_exception(iterators::dataflow_exception( - iterators::dataflow_exception::invalid_conversion - )); - return retval; + const typename boost::iterators::iterator_value::type * input_new_start; + typename iterator_value::type * next_available; + + std::codecvt_base::result r = m_codecvt_facet.in( + m_mbs, + m_input.m_buffer.begin(), + m_input.m_next_available, + input_new_start, + m_output.m_buffer.begin(), + m_output.m_buffer.end(), + next_available + ); + BOOST_ASSERT(std::codecvt_base::ok == r); + m_output.m_next_available = next_available; + m_output.m_next = m_output.m_buffer.begin(); + + // we're done with some of the input so shift left. + m_input.m_next_available = std::copy( + input_new_start, + m_input.m_next_available, + m_input.m_buffer.begin() + ); + m_input.m_next = m_input.m_buffer.begin(); } } // namespace iterators diff --git a/3party/boost/boost/archive/iterators/xml_unescape.hpp b/3party/boost/boost/archive/iterators/xml_unescape.hpp index 944c987515..6997740456 100644 --- a/3party/boost/boost/archive/iterators/xml_unescape.hpp +++ b/3party/boost/boost/archive/iterators/xml_unescape.hpp @@ -53,7 +53,7 @@ public: value_type drain(); template - xml_unescape(T start) : + xml_unescape(T start) : super_t(Base(static_cast< T >(start))) {} // intel 7.1 doesn't like default copy constructor diff --git a/3party/boost/boost/archive/polymorphic_iarchive.hpp b/3party/boost/boost/archive/polymorphic_iarchive.hpp index 7f19410dd8..d3c59a9f0f 100644 --- a/3party/boost/boost/archive/polymorphic_iarchive.hpp +++ b/3party/boost/boost/archive/polymorphic_iarchive.hpp @@ -43,8 +43,8 @@ namespace serialization { } // namespace serialization namespace archive { namespace detail { - class BOOST_ARCHIVE_DECL basic_iarchive; - class BOOST_ARCHIVE_DECL basic_iarchive; + class basic_iarchive; + class basic_iserializer; } class polymorphic_iarchive; diff --git a/3party/boost/boost/archive/polymorphic_oarchive.hpp b/3party/boost/boost/archive/polymorphic_oarchive.hpp index 35a2a89562..edac4edb1e 100644 --- a/3party/boost/boost/archive/polymorphic_oarchive.hpp +++ b/3party/boost/boost/archive/polymorphic_oarchive.hpp @@ -42,8 +42,8 @@ namespace serialization { } // namespace serialization namespace archive { namespace detail { - class BOOST_ARCHIVE_DECL basic_oarchive; - class BOOST_ARCHIVE_DECL basic_oserializer; + class basic_oarchive; + class basic_oserializer; } class polymorphic_oarchive; @@ -136,7 +136,7 @@ public: }; // note: preserve naming symmetry -class BOOST_SYMBOL_VISIBLE polymorphic_oarchive : +class BOOST_SYMBOL_VISIBLE polymorphic_oarchive : public polymorphic_oarchive_impl { public: diff --git a/3party/boost/boost/archive/text_iarchive.hpp b/3party/boost/boost/archive/text_iarchive.hpp index 207c5d212c..d9d60adf0b 100644 --- a/3party/boost/boost/archive/text_iarchive.hpp +++ b/3party/boost/boost/archive/text_iarchive.hpp @@ -48,15 +48,8 @@ class BOOST_SYMBOL_VISIBLE text_iarchive_impl : public: #else protected: - #if BOOST_WORKAROUND(BOOST_MSVC, < 1500) - // for some inexplicable reason insertion of "class" generates compile erro - // on msvc 7.1 - friend detail::interface_iarchive; - friend load_access; - #else - friend class detail::interface_iarchive; - friend class load_access; - #endif + friend class detail::interface_iarchive; + friend class load_access; #endif template void load(T & t){ @@ -72,16 +65,16 @@ protected: load(v); t = boost::serialization::item_version_type(v); } - BOOST_ARCHIVE_DECL void + BOOST_ARCHIVE_DECL void load(char * t); #ifndef BOOST_NO_INTRINSIC_WCHAR_T - BOOST_ARCHIVE_DECL void + BOOST_ARCHIVE_DECL void load(wchar_t * t); #endif - BOOST_ARCHIVE_DECL void + BOOST_ARCHIVE_DECL void load(std::string &s); #ifndef BOOST_NO_STD_WSTRING - BOOST_ARCHIVE_DECL void + BOOST_ARCHIVE_DECL void load(std::wstring &ws); #endif template @@ -92,10 +85,10 @@ protected: load_override(class_name_type & t); BOOST_ARCHIVE_DECL void init(); - BOOST_ARCHIVE_DECL + BOOST_ARCHIVE_DECL text_iarchive_impl(std::istream & is, unsigned int flags); // don't import inline definitions! leave this as a reminder. - //BOOST_ARCHIVE_DECL + //BOOST_ARCHIVE_DECL ~text_iarchive_impl(){}; }; @@ -116,7 +109,7 @@ protected: namespace boost { namespace archive { -class BOOST_SYMBOL_VISIBLE text_iarchive : +class BOOST_SYMBOL_VISIBLE text_iarchive : public text_iarchive_impl{ public: text_iarchive(std::istream & is_, unsigned int flags = 0) : diff --git a/3party/boost/boost/archive/text_oarchive.hpp b/3party/boost/boost/archive/text_oarchive.hpp index af1a19d14d..9ba0dafffb 100644 --- a/3party/boost/boost/archive/text_oarchive.hpp +++ b/3party/boost/boost/archive/text_oarchive.hpp @@ -55,17 +55,9 @@ class BOOST_SYMBOL_VISIBLE text_oarchive_impl : public: #else protected: - #if BOOST_WORKAROUND(BOOST_MSVC, < 1500) - // for some inexplicable reason insertion of "class" generates compile erro - // on msvc 7.1 - friend detail::interface_oarchive; - friend basic_text_oarchive; - friend save_access; - #else - friend class detail::interface_oarchive; - friend class basic_text_oarchive; - friend class save_access; - #endif + friend class detail::interface_oarchive; + friend class basic_text_oarchive; + friend class save_access; #endif template void save(const T & t){ @@ -78,32 +70,32 @@ protected: void save(const boost::serialization::item_version_type & t){ save(static_cast(t)); } - BOOST_ARCHIVE_DECL void + BOOST_ARCHIVE_DECL void save(const char * t); #ifndef BOOST_NO_INTRINSIC_WCHAR_T - BOOST_ARCHIVE_DECL void + BOOST_ARCHIVE_DECL void save(const wchar_t * t); #endif - BOOST_ARCHIVE_DECL void + BOOST_ARCHIVE_DECL void save(const std::string &s); #ifndef BOOST_NO_STD_WSTRING - BOOST_ARCHIVE_DECL void + BOOST_ARCHIVE_DECL void save(const std::wstring &ws); #endif - BOOST_ARCHIVE_DECL + BOOST_ARCHIVE_DECL text_oarchive_impl(std::ostream & os, unsigned int flags); // don't import inline definitions! leave this as a reminder. - //BOOST_ARCHIVE_DECL + //BOOST_ARCHIVE_DECL ~text_oarchive_impl(){}; public: - BOOST_ARCHIVE_DECL void + BOOST_ARCHIVE_DECL void save_binary(const void *address, std::size_t count); }; // do not derive from this class. If you want to extend this functionality // via inhertance, derived from text_oarchive_impl instead. This will // preserve correct static polymorphism. -class BOOST_SYMBOL_VISIBLE text_oarchive : +class BOOST_SYMBOL_VISIBLE text_oarchive : public text_oarchive_impl { public: diff --git a/3party/boost/boost/archive/text_wiarchive.hpp b/3party/boost/boost/archive/text_wiarchive.hpp index a78548370c..3adf068a51 100644 --- a/3party/boost/boost/archive/text_wiarchive.hpp +++ b/3party/boost/boost/archive/text_wiarchive.hpp @@ -92,7 +92,7 @@ protected: void load_override(T & t){ basic_text_iarchive::load_override(t); } - BOOST_WARCHIVE_DECL + BOOST_WARCHIVE_DECL text_wiarchive_impl(std::wistream & is, unsigned int flags); ~text_wiarchive_impl(){}; }; @@ -114,7 +114,7 @@ protected: namespace boost { namespace archive { -class BOOST_SYMBOL_VISIBLE text_wiarchive : +class BOOST_SYMBOL_VISIBLE text_wiarchive : public text_wiarchive_impl{ public: text_wiarchive(std::wistream & is, unsigned int flags = 0) : diff --git a/3party/boost/boost/archive/text_woarchive.hpp b/3party/boost/boost/archive/text_woarchive.hpp index 70f847d6b0..b6b4f8ed59 100644 --- a/3party/boost/boost/archive/text_woarchive.hpp +++ b/3party/boost/boost/archive/text_woarchive.hpp @@ -129,7 +129,7 @@ public: // do not derive from this class. If you want to extend this functionality // via inhertance, derived from text_oarchive_impl instead. This will // preserve correct static polymorphism. -class BOOST_SYMBOL_VISIBLE text_woarchive : +class BOOST_SYMBOL_VISIBLE text_woarchive : public text_woarchive_impl { public: diff --git a/3party/boost/boost/archive/xml_archive_exception.hpp b/3party/boost/boost/archive/xml_archive_exception.hpp index c782cf1027..82c53ef5d3 100644 --- a/3party/boost/boost/archive/xml_archive_exception.hpp +++ b/3party/boost/boost/archive/xml_archive_exception.hpp @@ -31,7 +31,7 @@ namespace archive { ////////////////////////////////////////////////////////////////////// // exceptions thrown by xml archives // -class BOOST_SYMBOL_VISIBLE xml_archive_exception : +class BOOST_SYMBOL_VISIBLE xml_archive_exception : public virtual boost::archive::archive_exception { public: @@ -45,6 +45,8 @@ public: const char * e1 = NULL, const char * e2 = NULL ); + BOOST_ARCHIVE_DECL xml_archive_exception(xml_archive_exception const &) ; + virtual BOOST_ARCHIVE_DECL ~xml_archive_exception() BOOST_NOEXCEPT_OR_NOTHROW ; }; }// namespace archive diff --git a/3party/boost/boost/archive/xml_iarchive.hpp b/3party/boost/boost/archive/xml_iarchive.hpp index 4ce1e86ca6..abd2f9fc4e 100644 --- a/3party/boost/boost/archive/xml_iarchive.hpp +++ b/3party/boost/boost/archive/xml_iarchive.hpp @@ -44,7 +44,7 @@ class basic_xml_grammar; typedef basic_xml_grammar xml_grammar; template -class BOOST_SYMBOL_VISIBLE xml_iarchive_impl : +class BOOST_SYMBOL_VISIBLE xml_iarchive_impl : public basic_text_iprimitive, public basic_xml_iarchive { @@ -52,17 +52,9 @@ class BOOST_SYMBOL_VISIBLE xml_iarchive_impl : public: #else protected: - #if BOOST_WORKAROUND(BOOST_MSVC, < 1500) - // for some inexplicable reason insertion of "class" generates compile erro - // on msvc 7.1 - friend detail::interface_iarchive; - friend basic_xml_iarchive; - friend load_access; - #else - friend class detail::interface_iarchive; - friend class basic_xml_iarchive; - friend class load_access; - #endif + friend class detail::interface_iarchive; + friend class basic_xml_iarchive; + friend class load_access; #endif // use boost:scoped_ptr to implement automatic deletion; boost::scoped_ptr gimpl; @@ -106,7 +98,7 @@ protected: load_override(class_name_type & t); BOOST_ARCHIVE_DECL void init(); - BOOST_ARCHIVE_DECL + BOOST_ARCHIVE_DECL xml_iarchive_impl(std::istream & is, unsigned int flags); BOOST_ARCHIVE_DECL ~xml_iarchive_impl(); @@ -128,7 +120,7 @@ protected: namespace boost { namespace archive { -class BOOST_SYMBOL_VISIBLE xml_iarchive : +class BOOST_SYMBOL_VISIBLE xml_iarchive : public xml_iarchive_impl{ public: xml_iarchive(std::istream & is, unsigned int flags = 0) : diff --git a/3party/boost/boost/archive/xml_oarchive.hpp b/3party/boost/boost/archive/xml_oarchive.hpp index b4bdd0fa01..eea1268037 100644 --- a/3party/boost/boost/archive/xml_oarchive.hpp +++ b/3party/boost/boost/archive/xml_oarchive.hpp @@ -47,7 +47,7 @@ namespace detail { } // namespace detail template -class BOOST_SYMBOL_VISIBLE xml_oarchive_impl : +class BOOST_SYMBOL_VISIBLE xml_oarchive_impl : public basic_text_oprimitive, public basic_xml_oarchive { @@ -55,21 +55,10 @@ class BOOST_SYMBOL_VISIBLE xml_oarchive_impl : public: #else protected: - #if BOOST_WORKAROUND(BOOST_MSVC, < 1500) - // for some inexplicable reason insertion of "class" generates compile erro - // on msvc 7.1 - friend detail::interface_oarchive; - friend basic_xml_oarchive; - friend save_access; - #else - friend class detail::interface_oarchive; - friend class basic_xml_oarchive; - friend class save_access; - #endif + friend class detail::interface_oarchive; + friend class basic_xml_oarchive; + friend class save_access; #endif - //void end_preamble(){ - // basic_xml_oarchive::end_preamble(); - //} template void save(const T & t){ basic_text_oprimitive::save(t); @@ -82,7 +71,7 @@ protected: save(const boost::serialization::item_version_type & t){ save(static_cast(t)); } - BOOST_ARCHIVE_DECL void + BOOST_ARCHIVE_DECL void save(const char * t); #ifndef BOOST_NO_INTRINSIC_WCHAR_T BOOST_ARCHIVE_DECL void @@ -94,31 +83,38 @@ protected: BOOST_ARCHIVE_DECL void save(const std::wstring &ws); #endif - BOOST_ARCHIVE_DECL + BOOST_ARCHIVE_DECL xml_oarchive_impl(std::ostream & os, unsigned int flags); - ~xml_oarchive_impl(){} + BOOST_ARCHIVE_DECL + ~xml_oarchive_impl(); public: - void save_binary(const void *address, std::size_t count){ - this->end_preamble(); - #if ! defined(__MWERKS__) - this->basic_text_oprimitive::save_binary( - #else - this->basic_text_oprimitive::save_binary( - #endif - address, - count - ); - this->indent_next = true; - } + BOOST_ARCHIVE_DECL + void save_binary(const void *address, std::size_t count); }; +} // namespace archive +} // namespace boost + +#ifdef BOOST_MSVC +#pragma warning(pop) +#endif + +#include // pops abi_suffix.hpp pragmas +#ifdef BOOST_MSVC +# pragma warning(push) +# pragma warning(disable : 4511 4512) +#endif + +namespace boost { +namespace archive { + // we use the following because we can't use // typedef xml_oarchive_impl > xml_oarchive; // do not derive from this class. If you want to extend this functionality // via inhertance, derived from xml_oarchive_impl instead. This will // preserve correct static polymorphism. -class BOOST_SYMBOL_VISIBLE xml_oarchive : +class BOOST_SYMBOL_VISIBLE xml_oarchive : public xml_oarchive_impl { public: @@ -138,6 +134,4 @@ BOOST_SERIALIZATION_REGISTER_ARCHIVE(boost::archive::xml_oarchive) #pragma warning(pop) #endif -#include // pops abi_suffix.hpp pragmas - #endif // BOOST_ARCHIVE_XML_OARCHIVE_HPP diff --git a/3party/boost/boost/archive/xml_wiarchive.hpp b/3party/boost/boost/archive/xml_wiarchive.hpp index 9fa66bb56a..ac24289ac1 100644 --- a/3party/boost/boost/archive/xml_wiarchive.hpp +++ b/3party/boost/boost/archive/xml_wiarchive.hpp @@ -29,15 +29,7 @@ #include #include #include - -#ifdef BOOST_NO_CXX11_HDR_CODECVT - #include -#else - #include - namespace boost { namespace archive { namespace detail { - typedef std::codecvt_utf8 utf8_codecvt_facet; - } } } -#endif +// #include #include // must be the last header @@ -58,7 +50,7 @@ class basic_xml_grammar; typedef basic_xml_grammar xml_wgrammar; template -class BOOST_SYMBOL_VISIBLE xml_wiarchive_impl : +class BOOST_SYMBOL_VISIBLE xml_wiarchive_impl : public basic_text_iprimitive, public basic_xml_iarchive { @@ -66,17 +58,9 @@ class BOOST_SYMBOL_VISIBLE xml_wiarchive_impl : public: #else protected: - #if BOOST_WORKAROUND(BOOST_MSVC, < 1500) - // for some inexplicable reason insertion of "class" generates compile erro - // on msvc 7.1 - friend detail::interface_iarchive; - friend basic_xml_iarchive; - friend load_access; - #else - friend class detail::interface_iarchive; - friend class basic_xml_iarchive; - friend class load_access; - #endif + friend class detail::interface_iarchive; + friend class basic_xml_iarchive; + friend class load_access; #endif boost::scoped_ptr gimpl; std::wistream & get_is(){ @@ -117,11 +101,11 @@ protected: } BOOST_WARCHIVE_DECL void load_override(class_name_type & t); - BOOST_WARCHIVE_DECL void + BOOST_WARCHIVE_DECL void init(); - BOOST_WARCHIVE_DECL + BOOST_WARCHIVE_DECL xml_wiarchive_impl(std::wistream & is, unsigned int flags) ; - BOOST_WARCHIVE_DECL + BOOST_WARCHIVE_DECL ~xml_wiarchive_impl(); }; diff --git a/3party/boost/boost/archive/xml_woarchive.hpp b/3party/boost/boost/archive/xml_woarchive.hpp index 8f8b974283..cb7ce68cb6 100644 --- a/3party/boost/boost/archive/xml_woarchive.hpp +++ b/3party/boost/boost/archive/xml_woarchive.hpp @@ -20,7 +20,6 @@ #ifdef BOOST_NO_STD_WSTREAMBUF #error "wide char i/o not supported on this platform" #else - #include // size_t #if defined(BOOST_NO_STDC_NAMESPACE) namespace std{ @@ -30,21 +29,13 @@ namespace std{ #include -#include +//#include #include #include #include #include #include - -#ifdef BOOST_NO_CXX11_HDR_CODECVT - #include -#else - #include - namespace boost { namespace archive { namespace detail { - typedef std::codecvt_utf8 utf8_codecvt_facet; - } } } -#endif +//#include #include // must be the last header @@ -69,27 +60,19 @@ class BOOST_SYMBOL_VISIBLE xml_woarchive_impl : public: #else protected: - #if BOOST_WORKAROUND(BOOST_MSVC, < 1500) - // for some inexplicable reason insertion of "class" generates compile erro - // on msvc 7.1 - friend detail::interface_oarchive; - friend basic_xml_oarchive; - friend save_access; - #else - friend class detail::interface_oarchive; - friend class basic_xml_oarchive; - friend class save_access; - #endif + friend class detail::interface_oarchive; + friend class basic_xml_oarchive; + friend class save_access; #endif //void end_preamble(){ // basic_xml_oarchive::end_preamble(); //} template - void + void save(const T & t){ basic_text_oprimitive::save(t); } - void + void save(const version_type & t){ save(static_cast(t)); } @@ -100,33 +83,23 @@ protected: BOOST_WARCHIVE_DECL void save(const char * t); #ifndef BOOST_NO_INTRINSIC_WCHAR_T - BOOST_WARCHIVE_DECL void + BOOST_WARCHIVE_DECL void save(const wchar_t * t); #endif - BOOST_WARCHIVE_DECL void + BOOST_WARCHIVE_DECL void save(const std::string &s); #ifndef BOOST_NO_STD_WSTRING BOOST_WARCHIVE_DECL void save(const std::wstring &ws); #endif - BOOST_WARCHIVE_DECL + BOOST_WARCHIVE_DECL xml_woarchive_impl(std::wostream & os, unsigned int flags); BOOST_WARCHIVE_DECL ~xml_woarchive_impl(); public: - void - save_binary(const void *address, std::size_t count){ - this->end_preamble(); - #if ! defined(__MWERKS__) - this->basic_text_oprimitive::save_binary( - #else - this->basic_text_oprimitive::save_binary( - #endif - address, - count - ); - this->indent_next = true; - } + BOOST_WARCHIVE_DECL void + save_binary(const void *address, std::size_t count); + }; // we use the following because we can't use diff --git a/3party/boost/boost/array.hpp b/3party/boost/boost/array.hpp index fa06fa9a5f..210c072125 100644 --- a/3party/boost/boost/array.hpp +++ b/3party/boost/boost/array.hpp @@ -13,6 +13,7 @@ * accompanying file LICENSE_1_0.txt or copy at * http://www.boost.org/LICENSE_1_0.txt) * + * 9 Jan 2013 - (mtc) Added constexpr * 14 Apr 2012 - (mtc) Added support for boost::hash * 28 Dec 2010 - (mtc) Added cbegin and cend (and crbegin and crend) for C++Ox compatibility. * 10 Mar 2010 - (mtc) fill method added, matching resolution of the standard library working group. @@ -42,12 +43,12 @@ #include #include #include +#include #include // Handles broken standard libraries better than #include #include -#include #include // FIXES for broken compilers @@ -81,15 +82,9 @@ namespace boost { const_iterator cend() const { return elems+N; } // reverse iterator support -#if !defined(BOOST_NO_TEMPLATE_PARTIAL_SPECIALIZATION) && !defined(BOOST_MSVC_STD_ITERATOR) && !defined(BOOST_NO_STD_ITERATOR_TRAITS) +#if !defined(BOOST_MSVC_STD_ITERATOR) && !defined(BOOST_NO_STD_ITERATOR_TRAITS) typedef std::reverse_iterator reverse_iterator; typedef std::reverse_iterator const_reverse_iterator; -#elif defined(_MSC_VER) && (_MSC_VER == 1300) && defined(BOOST_DINKUMWARE_STDLIB) && (BOOST_DINKUMWARE_STDLIB == 310) - // workaround for broken reverse_iterator in VC7 - typedef std::reverse_iterator > reverse_iterator; - typedef std::reverse_iterator > const_reverse_iterator; #elif defined(_RWSTD_NO_CLASS_PARTIAL_SPEC) typedef std::reverse_iterator reverse_iterator; @@ -120,19 +115,17 @@ namespace boost { // operator[] reference operator[](size_type i) { - BOOST_ASSERT_MSG( i < N, "out of range" ); - return elems[i]; + return BOOST_ASSERT_MSG( i < N, "out of range" ), elems[i]; } - const_reference operator[](size_type i) const + /*BOOST_CONSTEXPR*/ const_reference operator[](size_type i) const { - BOOST_ASSERT_MSG( i < N, "out of range" ); - return elems[i]; + return BOOST_ASSERT_MSG( i < N, "out of range" ), elems[i]; } // at() with range check - reference at(size_type i) { rangecheck(i); return elems[i]; } - const_reference at(size_type i) const { rangecheck(i); return elems[i]; } + reference at(size_type i) { return rangecheck(i), elems[i]; } + /*BOOST_CONSTEXPR*/ const_reference at(size_type i) const { return rangecheck(i), elems[i]; } // front() and back() reference front() @@ -140,7 +133,7 @@ namespace boost { return elems[0]; } - const_reference front() const + BOOST_CONSTEXPR const_reference front() const { return elems[0]; } @@ -150,15 +143,15 @@ namespace boost { return elems[N-1]; } - const_reference back() const + BOOST_CONSTEXPR const_reference back() const { return elems[N-1]; } // size is constant - static size_type size() { return N; } - static bool empty() { return false; } - static size_type max_size() { return N; } + static BOOST_CONSTEXPR size_type size() { return N; } + static BOOST_CONSTEXPR bool empty() { return false; } + static BOOST_CONSTEXPR size_type max_size() { return N; } enum { static_size = N }; // swap (note: linear complexity) @@ -189,16 +182,12 @@ namespace boost { } // check range (may be private because it is static) - static void rangecheck (size_type i) { - if (i >= size()) { - std::out_of_range e("array<>: index out of range"); - boost::throw_exception(e); - } + static BOOST_CONSTEXPR bool rangecheck (size_type i) { + return i > size() ? boost::throw_exception(std::out_of_range ("array<>: index out of range")), true : true; } }; -#if !defined(BOOST_NO_TEMPLATE_PARTIAL_SPECIALIZATION) template< class T > class array< T, 0 > { @@ -222,15 +211,9 @@ namespace boost { const_iterator cend() const { return cbegin(); } // reverse iterator support -#if !defined(BOOST_NO_TEMPLATE_PARTIAL_SPECIALIZATION) && !defined(BOOST_MSVC_STD_ITERATOR) && !defined(BOOST_NO_STD_ITERATOR_TRAITS) +#if !defined(BOOST_MSVC_STD_ITERATOR) && !defined(BOOST_NO_STD_ITERATOR_TRAITS) typedef std::reverse_iterator reverse_iterator; typedef std::reverse_iterator const_reverse_iterator; -#elif defined(_MSC_VER) && (_MSC_VER == 1300) && defined(BOOST_DINKUMWARE_STDLIB) && (BOOST_DINKUMWARE_STDLIB == 310) - // workaround for broken reverse_iterator in VC7 - typedef std::reverse_iterator > reverse_iterator; - typedef std::reverse_iterator > const_reverse_iterator; #elif defined(_RWSTD_NO_CLASS_PARTIAL_SPEC) typedef std::reverse_iterator reverse_iterator; @@ -264,14 +247,14 @@ namespace boost { return failed_rangecheck(); } - const_reference operator[](size_type /*i*/) const + /*BOOST_CONSTEXPR*/ const_reference operator[](size_type /*i*/) const { return failed_rangecheck(); } // at() with range check reference at(size_type /*i*/) { return failed_rangecheck(); } - const_reference at(size_type /*i*/) const { return failed_rangecheck(); } + /*BOOST_CONSTEXPR*/ const_reference at(size_type /*i*/) const { return failed_rangecheck(); } // front() and back() reference front() @@ -279,7 +262,7 @@ namespace boost { return failed_rangecheck(); } - const_reference front() const + BOOST_CONSTEXPR const_reference front() const { return failed_rangecheck(); } @@ -289,15 +272,15 @@ namespace boost { return failed_rangecheck(); } - const_reference back() const + BOOST_CONSTEXPR const_reference back() const { return failed_rangecheck(); } // size is constant - static size_type size() { return 0; } - static bool empty() { return true; } - static size_type max_size() { return 0; } + static BOOST_CONSTEXPR size_type size() { return 0; } + static BOOST_CONSTEXPR bool empty() { return true; } + static BOOST_CONSTEXPR size_type max_size() { return 0; } enum { static_size = 0 }; void swap (array& /*y*/) { @@ -335,7 +318,6 @@ namespace boost { #endif } }; -#endif // comparisons template @@ -391,7 +373,7 @@ namespace boost { // Specific for boost::array: simply returns its elems data member. template - typename const detail::c_array::type& get_c_array(const boost::array& arg) + typename detail::c_array::type const& get_c_array(const boost::array& arg) { return arg.elems; } @@ -429,6 +411,7 @@ namespace boost { } #endif + template std::size_t hash_range(It, It); template std::size_t hash_value(const array& arr) @@ -436,8 +419,36 @@ namespace boost { return boost::hash_range(arr.begin(), arr.end()); } + template + T &get(boost::array &arr) BOOST_NOEXCEPT { + BOOST_STATIC_ASSERT_MSG ( Idx < N, "boost::get<>(boost::array &) index out of range" ); + return arr[Idx]; + } + + template + const T &get(const boost::array &arr) BOOST_NOEXCEPT { + BOOST_STATIC_ASSERT_MSG ( Idx < N, "boost::get<>(const boost::array &) index out of range" ); + return arr[Idx]; + } + } /* namespace boost */ +#ifndef BOOST_NO_CXX11_HDR_ARRAY +// If we don't have std::array, I'm assuming that we don't have std::get +namespace std { + template + T &get(boost::array &arr) BOOST_NOEXCEPT { + BOOST_STATIC_ASSERT_MSG ( Idx < N, "std::get<>(boost::array &) index out of range" ); + return arr[Idx]; + } + + template + const T &get(const boost::array &arr) BOOST_NOEXCEPT { + BOOST_STATIC_ASSERT_MSG ( Idx < N, "std::get<>(const boost::array &) index out of range" ); + return arr[Idx]; + } +} +#endif #if BOOST_WORKAROUND(BOOST_MSVC, >= 1400) # pragma warning(pop) diff --git a/3party/boost/boost/asio.hpp b/3party/boost/boost/asio.hpp index 67658a827c..114d871c0c 100644 --- a/3party/boost/boost/asio.hpp +++ b/3party/boost/boost/asio.hpp @@ -2,7 +2,7 @@ // asio.hpp // ~~~~~~~~ // -// Copyright (c) 2003-2015 Christopher M. Kohlhoff (chris at kohlhoff dot com) +// Copyright (c) 2003-2017 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) diff --git a/3party/boost/boost/asio/async_result.hpp b/3party/boost/boost/asio/async_result.hpp index 013fd9e162..6290b8462a 100644 --- a/3party/boost/boost/asio/async_result.hpp +++ b/3party/boost/boost/asio/async_result.hpp @@ -2,7 +2,7 @@ // async_result.hpp // ~~~~~~~~~~~~~~~~ // -// Copyright (c) 2003-2015 Christopher M. Kohlhoff (chris at kohlhoff dot com) +// Copyright (c) 2003-2017 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) diff --git a/3party/boost/boost/asio/basic_datagram_socket.hpp b/3party/boost/boost/asio/basic_datagram_socket.hpp index f0ffe15e24..22801ee081 100644 --- a/3party/boost/boost/asio/basic_datagram_socket.hpp +++ b/3party/boost/boost/asio/basic_datagram_socket.hpp @@ -2,7 +2,7 @@ // basic_datagram_socket.hpp // ~~~~~~~~~~~~~~~~~~~~~~~~~ // -// Copyright (c) 2003-2015 Christopher M. Kohlhoff (chris at kohlhoff dot com) +// Copyright (c) 2003-2017 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) diff --git a/3party/boost/boost/asio/basic_deadline_timer.hpp b/3party/boost/boost/asio/basic_deadline_timer.hpp index 27a75f3b64..930370046b 100644 --- a/3party/boost/boost/asio/basic_deadline_timer.hpp +++ b/3party/boost/boost/asio/basic_deadline_timer.hpp @@ -2,7 +2,7 @@ // basic_deadline_timer.hpp // ~~~~~~~~~~~~~~~~~~~~~~~~ // -// Copyright (c) 2003-2015 Christopher M. Kohlhoff (chris at kohlhoff dot com) +// Copyright (c) 2003-2017 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) diff --git a/3party/boost/boost/asio/basic_io_object.hpp b/3party/boost/boost/asio/basic_io_object.hpp index 568ec6a726..d490a161f6 100644 --- a/3party/boost/boost/asio/basic_io_object.hpp +++ b/3party/boost/boost/asio/basic_io_object.hpp @@ -2,7 +2,7 @@ // basic_io_object.hpp // ~~~~~~~~~~~~~~~~~~~ // -// Copyright (c) 2003-2015 Christopher M. Kohlhoff (chris at kohlhoff dot com) +// Copyright (c) 2003-2017 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) @@ -35,12 +35,13 @@ namespace detail typedef typename service_type::implementation_type implementation_type; template - static auto eval(T* t, U* u) -> decltype(t->move_construct(*u, *u), char()); - static char (&eval(...))[2]; + static auto asio_service_has_move_eval(T* t, U* u) + -> decltype(t->move_construct(*u, *u), char()); + static char (&asio_service_has_move_eval(...))[2]; public: static const bool value = - sizeof(service_has_move::eval( + sizeof(asio_service_has_move_eval( static_cast(0), static_cast(0))) == 1; }; @@ -112,6 +113,11 @@ protected: * @note Available only for services that support movability, */ basic_io_object& operator=(basic_io_object&& other); + + /// Perform a converting move-construction of a basic_io_object. + template + basic_io_object(IoObjectService1& other_service, + typename IoObjectService1::implementation_type& other_implementation); #endif // defined(GENERATING_DOCUMENTATION) /// Protected destructor to prevent deletion through this type. @@ -191,6 +197,16 @@ protected: service_->move_construct(implementation, other.implementation); } + template + basic_io_object(IoObjectService1& other_service, + typename IoObjectService1::implementation_type& other_implementation) + : service_(&boost::asio::use_service( + other_service.get_io_service())) + { + service_->converting_move_construct(implementation, + other_service, other_implementation); + } + ~basic_io_object() { service_->destroy(implementation); diff --git a/3party/boost/boost/asio/basic_raw_socket.hpp b/3party/boost/boost/asio/basic_raw_socket.hpp index 1f12827367..85f8f42642 100644 --- a/3party/boost/boost/asio/basic_raw_socket.hpp +++ b/3party/boost/boost/asio/basic_raw_socket.hpp @@ -2,7 +2,7 @@ // basic_raw_socket.hpp // ~~~~~~~~~~~~~~~~~~~~ // -// Copyright (c) 2003-2015 Christopher M. Kohlhoff (chris at kohlhoff dot com) +// Copyright (c) 2003-2017 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) diff --git a/3party/boost/boost/asio/basic_seq_packet_socket.hpp b/3party/boost/boost/asio/basic_seq_packet_socket.hpp index 5a7d920e11..c8e43f77d6 100644 --- a/3party/boost/boost/asio/basic_seq_packet_socket.hpp +++ b/3party/boost/boost/asio/basic_seq_packet_socket.hpp @@ -2,7 +2,7 @@ // basic_seq_packet_socket.hpp // ~~~~~~~~~~~~~~~~~~~~~~~~~~~ // -// Copyright (c) 2003-2015 Christopher M. Kohlhoff (chris at kohlhoff dot com) +// Copyright (c) 2003-2017 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) diff --git a/3party/boost/boost/asio/basic_serial_port.hpp b/3party/boost/boost/asio/basic_serial_port.hpp index e0f83b0a5b..bfc78afaf6 100644 --- a/3party/boost/boost/asio/basic_serial_port.hpp +++ b/3party/boost/boost/asio/basic_serial_port.hpp @@ -2,7 +2,7 @@ // basic_serial_port.hpp // ~~~~~~~~~~~~~~~~~~~~~ // -// Copyright (c) 2003-2015 Christopher M. Kohlhoff (chris at kohlhoff dot com) +// Copyright (c) 2003-2017 Christopher M. Kohlhoff (chris at kohlhoff dot com) // Copyright (c) 2008 Rep Invariant Systems, Inc. (info@repinvariant.com) // // Distributed under the Boost Software License, Version 1.0. (See accompanying @@ -445,7 +445,7 @@ public: * * @param option The option value to be obtained from the serial port. * - * @param ec Set to indicate what error occured, if any. + * @param ec Set to indicate what error occurred, if any. * * @sa GettableSerialPortOption @n * boost::asio::serial_port_base::baud_rate @n diff --git a/3party/boost/boost/asio/basic_signal_set.hpp b/3party/boost/boost/asio/basic_signal_set.hpp index 48e28caa16..608bc0a6d8 100644 --- a/3party/boost/boost/asio/basic_signal_set.hpp +++ b/3party/boost/boost/asio/basic_signal_set.hpp @@ -2,7 +2,7 @@ // basic_signal_set.hpp // ~~~~~~~~~~~~~~~~~~~~ // -// Copyright (c) 2003-2015 Christopher M. Kohlhoff (chris at kohlhoff dot com) +// Copyright (c) 2003-2017 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) diff --git a/3party/boost/boost/asio/basic_socket.hpp b/3party/boost/boost/asio/basic_socket.hpp index 7b6ac08560..777f6a9ce1 100644 --- a/3party/boost/boost/asio/basic_socket.hpp +++ b/3party/boost/boost/asio/basic_socket.hpp @@ -2,7 +2,7 @@ // basic_socket.hpp // ~~~~~~~~~~~~~~~~ // -// Copyright (c) 2003-2015 Christopher M. Kohlhoff (chris at kohlhoff dot com) +// Copyright (c) 2003-2017 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) @@ -193,10 +193,9 @@ public: template basic_socket(basic_socket&& other, typename enable_if::value>::type* = 0) - : basic_io_object(other.get_io_service()) + : basic_io_object( + other.get_service(), other.get_implementation()) { - this->get_service().template converting_move_construct( - this->get_implementation(), other.get_implementation()); } /// Move-assign a basic_socket from a socket of another protocol type. diff --git a/3party/boost/boost/asio/basic_socket_acceptor.hpp b/3party/boost/boost/asio/basic_socket_acceptor.hpp index a1a1f8a350..f1d2b8e7a6 100644 --- a/3party/boost/boost/asio/basic_socket_acceptor.hpp +++ b/3party/boost/boost/asio/basic_socket_acceptor.hpp @@ -2,7 +2,7 @@ // basic_socket_acceptor.hpp // ~~~~~~~~~~~~~~~~~~~~~~~~~ // -// Copyright (c) 2003-2015 Christopher M. Kohlhoff (chris at kohlhoff dot com) +// Copyright (c) 2003-2017 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) @@ -232,10 +232,9 @@ public: basic_socket_acceptor( basic_socket_acceptor&& other, typename enable_if::value>::type* = 0) - : basic_io_object(other.get_io_service()) + : basic_io_object( + other.get_service(), other.get_implementation()) { - this->get_service().template converting_move_construct( - this->get_implementation(), other.get_implementation()); } /// Move-assign a basic_socket_acceptor from an acceptor of another protocol diff --git a/3party/boost/boost/asio/basic_socket_iostream.hpp b/3party/boost/boost/asio/basic_socket_iostream.hpp index a0031cbf39..6ed71f7b68 100644 --- a/3party/boost/boost/asio/basic_socket_iostream.hpp +++ b/3party/boost/boost/asio/basic_socket_iostream.hpp @@ -2,7 +2,7 @@ // basic_socket_iostream.hpp // ~~~~~~~~~~~~~~~~~~~~~~~~~ // -// Copyright (c) 2003-2015 Christopher M. Kohlhoff (chris at kohlhoff dot com) +// Copyright (c) 2003-2017 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) diff --git a/3party/boost/boost/asio/basic_socket_streambuf.hpp b/3party/boost/boost/asio/basic_socket_streambuf.hpp index 5595e99cf7..922b005d88 100644 --- a/3party/boost/boost/asio/basic_socket_streambuf.hpp +++ b/3party/boost/boost/asio/basic_socket_streambuf.hpp @@ -2,7 +2,7 @@ // basic_socket_streambuf.hpp // ~~~~~~~~~~~~~~~~~~~~~~~~~~ // -// Copyright (c) 2003-2015 Christopher M. Kohlhoff (chris at kohlhoff dot com) +// Copyright (c) 2003-2017 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) diff --git a/3party/boost/boost/asio/basic_stream_socket.hpp b/3party/boost/boost/asio/basic_stream_socket.hpp index 44ce016ca1..5b959d7db8 100644 --- a/3party/boost/boost/asio/basic_stream_socket.hpp +++ b/3party/boost/boost/asio/basic_stream_socket.hpp @@ -2,7 +2,7 @@ // basic_stream_socket.hpp // ~~~~~~~~~~~~~~~~~~~~~~~ // -// Copyright (c) 2003-2015 Christopher M. Kohlhoff (chris at kohlhoff dot com) +// Copyright (c) 2003-2017 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) diff --git a/3party/boost/boost/asio/basic_streambuf.hpp b/3party/boost/boost/asio/basic_streambuf.hpp index d8cb477be8..1392596dc5 100644 --- a/3party/boost/boost/asio/basic_streambuf.hpp +++ b/3party/boost/boost/asio/basic_streambuf.hpp @@ -2,7 +2,7 @@ // basic_streambuf.hpp // ~~~~~~~~~~~~~~~~~~~ // -// Copyright (c) 2003-2015 Christopher M. Kohlhoff (chris at kohlhoff dot com) +// Copyright (c) 2003-2017 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) diff --git a/3party/boost/boost/asio/basic_streambuf_fwd.hpp b/3party/boost/boost/asio/basic_streambuf_fwd.hpp index 5026aba851..f3e006bf11 100644 --- a/3party/boost/boost/asio/basic_streambuf_fwd.hpp +++ b/3party/boost/boost/asio/basic_streambuf_fwd.hpp @@ -2,7 +2,7 @@ // basic_streambuf_fwd.hpp // ~~~~~~~~~~~~~~~~~~~~~~~ // -// Copyright (c) 2003-2015 Christopher M. Kohlhoff (chris at kohlhoff dot com) +// Copyright (c) 2003-2017 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) diff --git a/3party/boost/boost/asio/basic_waitable_timer.hpp b/3party/boost/boost/asio/basic_waitable_timer.hpp index 3f63c78008..e4aeb0b7d8 100644 --- a/3party/boost/boost/asio/basic_waitable_timer.hpp +++ b/3party/boost/boost/asio/basic_waitable_timer.hpp @@ -2,7 +2,7 @@ // basic_waitable_timer.hpp // ~~~~~~~~~~~~~~~~~~~~~~~~ // -// Copyright (c) 2003-2015 Christopher M. Kohlhoff (chris at kohlhoff dot com) +// Copyright (c) 2003-2017 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) diff --git a/3party/boost/boost/asio/buffer.hpp b/3party/boost/boost/asio/buffer.hpp index 729a31b906..700654d21d 100644 --- a/3party/boost/boost/asio/buffer.hpp +++ b/3party/boost/boost/asio/buffer.hpp @@ -2,7 +2,7 @@ // buffer.hpp // ~~~~~~~~~~ // -// Copyright (c) 2003-2015 Christopher M. Kohlhoff (chris at kohlhoff dot com) +// Copyright (c) 2003-2017 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) diff --git a/3party/boost/boost/asio/buffered_read_stream.hpp b/3party/boost/boost/asio/buffered_read_stream.hpp index dea896d999..ece138b599 100644 --- a/3party/boost/boost/asio/buffered_read_stream.hpp +++ b/3party/boost/boost/asio/buffered_read_stream.hpp @@ -2,7 +2,7 @@ // buffered_read_stream.hpp // ~~~~~~~~~~~~~~~~~~~~~~~~ // -// Copyright (c) 2003-2015 Christopher M. Kohlhoff (chris at kohlhoff dot com) +// Copyright (c) 2003-2017 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) diff --git a/3party/boost/boost/asio/buffered_read_stream_fwd.hpp b/3party/boost/boost/asio/buffered_read_stream_fwd.hpp index 9c2a742c21..3ffac04419 100644 --- a/3party/boost/boost/asio/buffered_read_stream_fwd.hpp +++ b/3party/boost/boost/asio/buffered_read_stream_fwd.hpp @@ -2,7 +2,7 @@ // buffered_read_stream_fwd.hpp // ~~~~~~~~~~~~~~~~~~~~~~~~~~~~ // -// Copyright (c) 2003-2015 Christopher M. Kohlhoff (chris at kohlhoff dot com) +// Copyright (c) 2003-2017 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) diff --git a/3party/boost/boost/asio/buffered_stream.hpp b/3party/boost/boost/asio/buffered_stream.hpp index d28620f3ad..fae7c27113 100644 --- a/3party/boost/boost/asio/buffered_stream.hpp +++ b/3party/boost/boost/asio/buffered_stream.hpp @@ -2,7 +2,7 @@ // buffered_stream.hpp // ~~~~~~~~~~~~~~~~~~~ // -// Copyright (c) 2003-2015 Christopher M. Kohlhoff (chris at kohlhoff dot com) +// Copyright (c) 2003-2017 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) diff --git a/3party/boost/boost/asio/buffered_stream_fwd.hpp b/3party/boost/boost/asio/buffered_stream_fwd.hpp index d3754db588..a1e965b25e 100644 --- a/3party/boost/boost/asio/buffered_stream_fwd.hpp +++ b/3party/boost/boost/asio/buffered_stream_fwd.hpp @@ -2,7 +2,7 @@ // buffered_stream_fwd.hpp // ~~~~~~~~~~~~~~~~~~~~~~~ // -// Copyright (c) 2003-2015 Christopher M. Kohlhoff (chris at kohlhoff dot com) +// Copyright (c) 2003-2017 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) diff --git a/3party/boost/boost/asio/buffered_write_stream.hpp b/3party/boost/boost/asio/buffered_write_stream.hpp index 4b6c620292..5b8f31378d 100644 --- a/3party/boost/boost/asio/buffered_write_stream.hpp +++ b/3party/boost/boost/asio/buffered_write_stream.hpp @@ -2,7 +2,7 @@ // buffered_write_stream.hpp // ~~~~~~~~~~~~~~~~~~~~~~~~~ // -// Copyright (c) 2003-2015 Christopher M. Kohlhoff (chris at kohlhoff dot com) +// Copyright (c) 2003-2017 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) diff --git a/3party/boost/boost/asio/buffered_write_stream_fwd.hpp b/3party/boost/boost/asio/buffered_write_stream_fwd.hpp index 7f57107880..4759cf283c 100644 --- a/3party/boost/boost/asio/buffered_write_stream_fwd.hpp +++ b/3party/boost/boost/asio/buffered_write_stream_fwd.hpp @@ -2,7 +2,7 @@ // buffered_write_stream_fwd.hpp // ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ // -// Copyright (c) 2003-2015 Christopher M. Kohlhoff (chris at kohlhoff dot com) +// Copyright (c) 2003-2017 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) diff --git a/3party/boost/boost/asio/buffers_iterator.hpp b/3party/boost/boost/asio/buffers_iterator.hpp index bdf835e3c5..c64b341b5b 100644 --- a/3party/boost/boost/asio/buffers_iterator.hpp +++ b/3party/boost/boost/asio/buffers_iterator.hpp @@ -2,7 +2,7 @@ // buffers_iterator.hpp // ~~~~~~~~~~~~~~~~~~~~ // -// Copyright (c) 2003-2015 Christopher M. Kohlhoff (chris at kohlhoff dot com) +// Copyright (c) 2003-2017 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) diff --git a/3party/boost/boost/asio/completion_condition.hpp b/3party/boost/boost/asio/completion_condition.hpp index 58c7d95bec..d64efffe1e 100644 --- a/3party/boost/boost/asio/completion_condition.hpp +++ b/3party/boost/boost/asio/completion_condition.hpp @@ -2,7 +2,7 @@ // completion_condition.hpp // ~~~~~~~~~~~~~~~~~~~~~~~~ // -// Copyright (c) 2003-2015 Christopher M. Kohlhoff (chris at kohlhoff dot com) +// Copyright (c) 2003-2017 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) diff --git a/3party/boost/boost/asio/connect.hpp b/3party/boost/boost/asio/connect.hpp index 8557cc0884..635a8ad9bd 100644 --- a/3party/boost/boost/asio/connect.hpp +++ b/3party/boost/boost/asio/connect.hpp @@ -2,7 +2,7 @@ // connect.hpp // ~~~~~~~~~~~ // -// Copyright (c) 2003-2015 Christopher M. Kohlhoff (chris at kohlhoff dot com) +// Copyright (c) 2003-2017 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) diff --git a/3party/boost/boost/asio/coroutine.hpp b/3party/boost/boost/asio/coroutine.hpp index cc760ad5f7..c4763f8524 100644 --- a/3party/boost/boost/asio/coroutine.hpp +++ b/3party/boost/boost/asio/coroutine.hpp @@ -2,7 +2,7 @@ // coroutine.hpp // ~~~~~~~~~~~~~ // -// Copyright (c) 2003-2015 Christopher M. Kohlhoff (chris at kohlhoff dot com) +// Copyright (c) 2003-2017 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) diff --git a/3party/boost/boost/asio/datagram_socket_service.hpp b/3party/boost/boost/asio/datagram_socket_service.hpp index 3c7bb08bc8..95f179acfd 100644 --- a/3party/boost/boost/asio/datagram_socket_service.hpp +++ b/3party/boost/boost/asio/datagram_socket_service.hpp @@ -2,7 +2,7 @@ // datagram_socket_service.hpp // ~~~~~~~~~~~~~~~~~~~~~~~~~~~ // -// Copyright (c) 2003-2015 Christopher M. Kohlhoff (chris at kohlhoff dot com) +// Copyright (c) 2003-2017 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) @@ -118,17 +118,21 @@ public: service_impl_.move_assign(impl, other_service.service_impl_, other_impl); } + // All socket services have access to each other's implementations. + template friend class datagram_socket_service; + /// Move-construct a new datagram socket implementation from another protocol /// type. template void converting_move_construct(implementation_type& impl, + datagram_socket_service& other_service, typename datagram_socket_service< Protocol1>::implementation_type& other_impl, typename enable_if::value>::type* = 0) { service_impl_.template converting_move_construct( - impl, other_impl); + impl, other_service.service_impl_, other_impl); } #endif // defined(BOOST_ASIO_HAS_MOVE) || defined(GENERATING_DOCUMENTATION) diff --git a/3party/boost/boost/asio/deadline_timer.hpp b/3party/boost/boost/asio/deadline_timer.hpp index 91bc2fb4aa..f7be6be943 100644 --- a/3party/boost/boost/asio/deadline_timer.hpp +++ b/3party/boost/boost/asio/deadline_timer.hpp @@ -2,7 +2,7 @@ // deadline_timer.hpp // ~~~~~~~~~~~~~~~~~~ // -// Copyright (c) 2003-2015 Christopher M. Kohlhoff (chris at kohlhoff dot com) +// Copyright (c) 2003-2017 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) diff --git a/3party/boost/boost/asio/deadline_timer_service.hpp b/3party/boost/boost/asio/deadline_timer_service.hpp index 142d625145..26dcb42e4c 100644 --- a/3party/boost/boost/asio/deadline_timer_service.hpp +++ b/3party/boost/boost/asio/deadline_timer_service.hpp @@ -2,7 +2,7 @@ // deadline_timer_service.hpp // ~~~~~~~~~~~~~~~~~~~~~~~~~~ // -// Copyright (c) 2003-2015 Christopher M. Kohlhoff (chris at kohlhoff dot com) +// Copyright (c) 2003-2017 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) diff --git a/3party/boost/boost/asio/detail/addressof.hpp b/3party/boost/boost/asio/detail/addressof.hpp index 2791c56f74..cc1099764d 100644 --- a/3party/boost/boost/asio/detail/addressof.hpp +++ b/3party/boost/boost/asio/detail/addressof.hpp @@ -2,7 +2,7 @@ // detail/addressof.hpp // ~~~~~~~~~~~~~~~~~~~~ // -// Copyright (c) 2003-2015 Christopher M. Kohlhoff (chris at kohlhoff dot com) +// Copyright (c) 2003-2017 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) diff --git a/3party/boost/boost/asio/detail/array.hpp b/3party/boost/boost/asio/detail/array.hpp index 5a58413de8..29e5077412 100644 --- a/3party/boost/boost/asio/detail/array.hpp +++ b/3party/boost/boost/asio/detail/array.hpp @@ -2,7 +2,7 @@ // detail/array.hpp // ~~~~~~~~~~~~~~~~ // -// Copyright (c) 2003-2015 Christopher M. Kohlhoff (chris at kohlhoff dot com) +// Copyright (c) 2003-2017 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) diff --git a/3party/boost/boost/asio/detail/array_fwd.hpp b/3party/boost/boost/asio/detail/array_fwd.hpp index 7f6c6128c6..aefe467119 100644 --- a/3party/boost/boost/asio/detail/array_fwd.hpp +++ b/3party/boost/boost/asio/detail/array_fwd.hpp @@ -2,7 +2,7 @@ // detail/array_fwd.hpp // ~~~~~~~~~~~~~~~~~~~~ // -// Copyright (c) 2003-2015 Christopher M. Kohlhoff (chris at kohlhoff dot com) +// Copyright (c) 2003-2017 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) diff --git a/3party/boost/boost/asio/detail/assert.hpp b/3party/boost/boost/asio/detail/assert.hpp index 8847ea1ac9..b522552387 100644 --- a/3party/boost/boost/asio/detail/assert.hpp +++ b/3party/boost/boost/asio/detail/assert.hpp @@ -2,7 +2,7 @@ // detail/assert.hpp // ~~~~~~~~~~~~~~~~~ // -// Copyright (c) 2003-2015 Christopher M. Kohlhoff (chris at kohlhoff dot com) +// Copyright (c) 2003-2017 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) diff --git a/3party/boost/boost/asio/detail/atomic_count.hpp b/3party/boost/boost/asio/detail/atomic_count.hpp index ce0ef73e36..416ed9d097 100644 --- a/3party/boost/boost/asio/detail/atomic_count.hpp +++ b/3party/boost/boost/asio/detail/atomic_count.hpp @@ -2,7 +2,7 @@ // detail/atomic_count.hpp // ~~~~~~~~~~~~~~~~~~~~~~~ // -// Copyright (c) 2003-2015 Christopher M. Kohlhoff (chris at kohlhoff dot com) +// Copyright (c) 2003-2017 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) diff --git a/3party/boost/boost/asio/detail/base_from_completion_cond.hpp b/3party/boost/boost/asio/detail/base_from_completion_cond.hpp index 3570899022..61315ca0fb 100644 --- a/3party/boost/boost/asio/detail/base_from_completion_cond.hpp +++ b/3party/boost/boost/asio/detail/base_from_completion_cond.hpp @@ -2,7 +2,7 @@ // detail/base_from_completion_cond.hpp // ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ // -// Copyright (c) 2003-2015 Christopher M. Kohlhoff (chris at kohlhoff dot com) +// Copyright (c) 2003-2017 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) diff --git a/3party/boost/boost/asio/detail/bind_handler.hpp b/3party/boost/boost/asio/detail/bind_handler.hpp index 9219910edb..0f3672edab 100644 --- a/3party/boost/boost/asio/detail/bind_handler.hpp +++ b/3party/boost/boost/asio/detail/bind_handler.hpp @@ -2,7 +2,7 @@ // detail/bind_handler.hpp // ~~~~~~~~~~~~~~~~~~~~~~~ // -// Copyright (c) 2003-2015 Christopher M. Kohlhoff (chris at kohlhoff dot com) +// Copyright (c) 2003-2017 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) diff --git a/3party/boost/boost/asio/detail/buffer_resize_guard.hpp b/3party/boost/boost/asio/detail/buffer_resize_guard.hpp index 8bb0e73952..849defbec1 100644 --- a/3party/boost/boost/asio/detail/buffer_resize_guard.hpp +++ b/3party/boost/boost/asio/detail/buffer_resize_guard.hpp @@ -2,7 +2,7 @@ // detail/buffer_resize_guard.hpp // ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ // -// Copyright (c) 2003-2015 Christopher M. Kohlhoff (chris at kohlhoff dot com) +// Copyright (c) 2003-2017 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) diff --git a/3party/boost/boost/asio/detail/buffer_sequence_adapter.hpp b/3party/boost/boost/asio/detail/buffer_sequence_adapter.hpp index 8cf8980455..20c529e0a2 100644 --- a/3party/boost/boost/asio/detail/buffer_sequence_adapter.hpp +++ b/3party/boost/boost/asio/detail/buffer_sequence_adapter.hpp @@ -2,7 +2,7 @@ // detail/buffer_sequence_adapter.hpp // ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ // -// Copyright (c) 2003-2015 Christopher M. Kohlhoff (chris at kohlhoff dot com) +// Copyright (c) 2003-2017 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) diff --git a/3party/boost/boost/asio/detail/buffered_stream_storage.hpp b/3party/boost/boost/asio/detail/buffered_stream_storage.hpp index f4fc5ccc74..0ac5749eeb 100644 --- a/3party/boost/boost/asio/detail/buffered_stream_storage.hpp +++ b/3party/boost/boost/asio/detail/buffered_stream_storage.hpp @@ -2,7 +2,7 @@ // detail/buffered_stream_storage.hpp // ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ // -// Copyright (c) 2003-2015 Christopher M. Kohlhoff (chris at kohlhoff dot com) +// Copyright (c) 2003-2017 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) diff --git a/3party/boost/boost/asio/detail/call_stack.hpp b/3party/boost/boost/asio/detail/call_stack.hpp index 65f71221b9..5253e3b153 100644 --- a/3party/boost/boost/asio/detail/call_stack.hpp +++ b/3party/boost/boost/asio/detail/call_stack.hpp @@ -2,7 +2,7 @@ // detail/call_stack.hpp // ~~~~~~~~~~~~~~~~~~~~~ // -// Copyright (c) 2003-2015 Christopher M. Kohlhoff (chris at kohlhoff dot com) +// Copyright (c) 2003-2017 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) diff --git a/3party/boost/boost/asio/detail/chrono_time_traits.hpp b/3party/boost/boost/asio/detail/chrono_time_traits.hpp index c0e073b00e..421163a154 100644 --- a/3party/boost/boost/asio/detail/chrono_time_traits.hpp +++ b/3party/boost/boost/asio/detail/chrono_time_traits.hpp @@ -2,7 +2,7 @@ // detail/chrono_time_traits.hpp // ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ // -// Copyright (c) 2003-2015 Christopher M. Kohlhoff (chris at kohlhoff dot com) +// Copyright (c) 2003-2017 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) diff --git a/3party/boost/boost/asio/detail/completion_handler.hpp b/3party/boost/boost/asio/detail/completion_handler.hpp index 3ad0ae8041..6333dce569 100644 --- a/3party/boost/boost/asio/detail/completion_handler.hpp +++ b/3party/boost/boost/asio/detail/completion_handler.hpp @@ -2,7 +2,7 @@ // detail/completion_handler.hpp // ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ // -// Copyright (c) 2003-2015 Christopher M. Kohlhoff (chris at kohlhoff dot com) +// Copyright (c) 2003-2017 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) diff --git a/3party/boost/boost/asio/detail/config.hpp b/3party/boost/boost/asio/detail/config.hpp index 0f9e52d593..baeb86d78e 100644 --- a/3party/boost/boost/asio/detail/config.hpp +++ b/3party/boost/boost/asio/detail/config.hpp @@ -2,7 +2,7 @@ // detail/config.hpp // ~~~~~~~~~~~~~~~~~ // -// Copyright (c) 2003-2015 Christopher M. Kohlhoff (chris at kohlhoff dot com) +// Copyright (c) 2003-2017 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) @@ -221,8 +221,7 @@ # define BOOST_ASIO_ERROR_CATEGORY_NOEXCEPT noexcept(true) # endif // defined(__GXX_EXPERIMENTAL_CXX0X__) # endif // ((__GNUC__ == 4) && (__GNUC_MINOR__ >= 7)) || (__GNUC__ > 4) -# endif // defined(__GNUC__) -# if defined(BOOST_ASIO_MSVC) +# elif defined(BOOST_ASIO_MSVC) # if (_MSC_VER >= 1900) # define BOOST_ASIO_ERROR_CATEGORY_NOEXCEPT noexcept(true) # endif // (_MSC_VER >= 1900) @@ -436,6 +435,30 @@ # endif // !defined(BOOST_ASIO_DISABLE_STD_TYPE_TRAITS) #endif // !defined(BOOST_ASIO_HAS_STD_TYPE_TRAITS) +// Standard library support for the C++11 allocator additions. +#if !defined(BOOST_ASIO_HAS_CXX11_ALLOCATORS) +# if !defined(BOOST_ASIO_DISABLE_CXX11_ALLOCATORS) +# if defined(__clang__) +# if defined(BOOST_ASIO_HAS_CLANG_LIBCXX) +# define BOOST_ASIO_HAS_CXX11_ALLOCATORS 1 +# elif (__cplusplus >= 201103) +# define BOOST_ASIO_HAS_CXX11_ALLOCATORS 1 +# endif // (__cplusplus >= 201103) +# elif defined(__GNUC__) +# if ((__GNUC__ == 4) && (__GNUC_MINOR__ >= 6)) || (__GNUC__ > 4) +# if defined(__GXX_EXPERIMENTAL_CXX0X__) +# define BOOST_ASIO_HAS_CXX11_ALLOCATORS 1 +# endif // defined(__GXX_EXPERIMENTAL_CXX0X__) +# endif // ((__GNUC__ == 4) && (__GNUC_MINOR__ >= 6)) || (__GNUC__ > 4) +# endif // defined(__GNUC__) +# if defined(BOOST_ASIO_MSVC) +# if (_MSC_VER >= 1700) +# define BOOST_ASIO_HAS_CXX11_ALLOCATORS 1 +# endif // (_MSC_VER >= 1700) +# endif // defined(BOOST_ASIO_MSVC) +# endif // !defined(BOOST_ASIO_DISABLE_CXX11_ALLOCATORS) +#endif // !defined(BOOST_ASIO_HAS_CXX11_ALLOCATORS) + // Standard library support for the cstdint header. #if !defined(BOOST_ASIO_HAS_CSTDINT) # if !defined(BOOST_ASIO_DISABLE_CSTDINT) @@ -515,25 +538,41 @@ # endif // !defined(BOOST_ASIO_DISABLE_STD_MUTEX_AND_CONDVAR) #endif // !defined(BOOST_ASIO_HAS_STD_MUTEX_AND_CONDVAR) -// WinRT target. -#if !defined(BOOST_ASIO_WINDOWS_RUNTIME) -# if defined(__cplusplus_winrt) +// Windows App target. Windows but with a limited API. +#if !defined(BOOST_ASIO_WINDOWS_APP) +# if defined(_WIN32_WINNT) && (_WIN32_WINNT >= 0x0603) # include # if WINAPI_FAMILY_PARTITION(WINAPI_PARTITION_APP) \ && !WINAPI_FAMILY_PARTITION(WINAPI_PARTITION_DESKTOP) -# define BOOST_ASIO_WINDOWS_RUNTIME 1 +# define BOOST_ASIO_WINDOWS_APP 1 # endif // WINAPI_FAMILY_PARTITION(WINAPI_PARTITION_APP) // && !WINAPI_FAMILY_PARTITION(WINAPI_PARTITION_DESKTOP) -# endif // defined(__cplusplus_winrt) +# endif // defined(_WIN32_WINNT) && (_WIN32_WINNT >= 0x0603) +#endif // !defined(BOOST_ASIO_WINDOWS_APP) + +// Legacy WinRT target. Windows App is preferred. +#if !defined(BOOST_ASIO_WINDOWS_RUNTIME) +# if !defined(BOOST_ASIO_WINDOWS_APP) +# if defined(__cplusplus_winrt) +# include +# if WINAPI_FAMILY_PARTITION(WINAPI_PARTITION_APP) \ + && !WINAPI_FAMILY_PARTITION(WINAPI_PARTITION_DESKTOP) +# define BOOST_ASIO_WINDOWS_RUNTIME 1 +# endif // WINAPI_FAMILY_PARTITION(WINAPI_PARTITION_APP) + // && !WINAPI_FAMILY_PARTITION(WINAPI_PARTITION_DESKTOP) +# endif // defined(__cplusplus_winrt) +# endif // !defined(BOOST_ASIO_WINDOWS_APP) #endif // !defined(BOOST_ASIO_WINDOWS_RUNTIME) -// Windows target. Excludes WinRT. +// Windows target. Excludes WinRT but includes Windows App targets. #if !defined(BOOST_ASIO_WINDOWS) # if !defined(BOOST_ASIO_WINDOWS_RUNTIME) # if defined(BOOST_ASIO_HAS_BOOST_CONFIG) && defined(BOOST_WINDOWS) # define BOOST_ASIO_WINDOWS 1 # elif defined(WIN32) || defined(_WIN32) || defined(__WIN32__) # define BOOST_ASIO_WINDOWS 1 +# elif defined(BOOST_ASIO_WINDOWS_APP) +# define BOOST_ASIO_WINDOWS 1 # endif // defined(BOOST_ASIO_HAS_BOOST_CONFIG) && defined(BOOST_WINDOWS) # endif // !defined(BOOST_ASIO_WINDOWS_RUNTIME) #endif // !defined(BOOST_ASIO_WINDOWS) @@ -601,11 +640,11 @@ #if !defined(BOOST_ASIO_HAS_IOCP) # if defined(BOOST_ASIO_WINDOWS) || defined(__CYGWIN__) # if defined(_WIN32_WINNT) && (_WIN32_WINNT >= 0x0400) -# if !defined(UNDER_CE) +# if !defined(UNDER_CE) && !defined(BOOST_ASIO_WINDOWS_APP) # if !defined(BOOST_ASIO_DISABLE_IOCP) # define BOOST_ASIO_HAS_IOCP 1 # endif // !defined(BOOST_ASIO_DISABLE_IOCP) -# endif // !defined(UNDER_CE) +# endif // !defined(UNDER_CE) && !defined(BOOST_ASIO_WINDOWS_APP) # endif // defined(_WIN32_WINNT) && (_WIN32_WINNT >= 0x0400) # endif // defined(BOOST_ASIO_WINDOWS) || defined(__CYGWIN__) #endif // !defined(BOOST_ASIO_HAS_IOCP) @@ -721,9 +760,9 @@ #if !defined(BOOST_ASIO_HAS_WINDOWS_OBJECT_HANDLE) # if !defined(BOOST_ASIO_DISABLE_WINDOWS_OBJECT_HANDLE) # if defined(BOOST_ASIO_WINDOWS) || defined(__CYGWIN__) -# if !defined(UNDER_CE) +# if !defined(UNDER_CE) && !defined(BOOST_ASIO_WINDOWS_APP) # define BOOST_ASIO_HAS_WINDOWS_OBJECT_HANDLE 1 -# endif // !defined(UNDER_CE) +# endif // !defined(UNDER_CE) && !defined(BOOST_ASIO_WINDOWS_APP) # endif // defined(BOOST_ASIO_WINDOWS) || defined(__CYGWIN__) # endif // !defined(BOOST_ASIO_DISABLE_WINDOWS_OBJECT_HANDLE) #endif // !defined(BOOST_ASIO_HAS_WINDOWS_OBJECT_HANDLE) @@ -787,15 +826,25 @@ // Can use getaddrinfo() and getnameinfo(). #if !defined(BOOST_ASIO_HAS_GETADDRINFO) -# if defined(BOOST_ASIO_WINDOWS) || defined(__CYGWIN__) -# if defined(_WIN32_WINNT) && (_WIN32_WINNT >= 0x0501) +# if !defined(BOOST_ASIO_DISABLE_GETADDRINFO) +# if defined(BOOST_ASIO_WINDOWS) || defined(__CYGWIN__) +# if defined(_WIN32_WINNT) && (_WIN32_WINNT >= 0x0501) +# define BOOST_ASIO_HAS_GETADDRINFO 1 +# elif defined(UNDER_CE) +# define BOOST_ASIO_HAS_GETADDRINFO 1 +# endif // defined(UNDER_CE) +# elif defined(__MACH__) && defined(__APPLE__) +# if defined(__MAC_OS_X_VERSION_MIN_REQUIRED) +# if (__MAC_OS_X_VERSION_MIN_REQUIRED >= 1050) +# define BOOST_ASIO_HAS_GETADDRINFO 1 +# endif // (__MAC_OS_X_VERSION_MIN_REQUIRED >= 1050) +# else // defined(__MAC_OS_X_VERSION_MIN_REQUIRED) +# define BOOST_ASIO_HAS_GETADDRINFO 1 +# endif // defined(__MAC_OS_X_VERSION_MIN_REQUIRED) +# else // defined(__MACH__) && defined(__APPLE__) # define BOOST_ASIO_HAS_GETADDRINFO 1 -# elif defined(UNDER_CE) -# define BOOST_ASIO_HAS_GETADDRINFO 1 -# endif // defined(UNDER_CE) -# elif !(defined(__MACH__) && defined(__APPLE__)) -# define BOOST_ASIO_HAS_GETADDRINFO 1 -# endif // !(defined(__MACH__) && defined(__APPLE__)) +# endif // defined(__MACH__) && defined(__APPLE__) +# endif // !defined(BOOST_ASIO_DISABLE_GETADDRINFO) #endif // !defined(BOOST_ASIO_HAS_GETADDRINFO) // Whether standard iostreams are disabled. @@ -968,4 +1017,34 @@ // || (defined(__MACH__) && defined(__APPLE__)) #endif // !defined(BOOST_ASIO_DISABLE_SSIZE_T) +// Newer gcc, clang need special treatment to suppress unused typedef warnings. +#if defined(__clang__) +# if defined(__apple_build_version__) +# if (__clang_major__ >= 7) +# define BOOST_ASIO_UNUSED_TYPEDEF __attribute__((__unused__)) +# endif // (__clang_major__ >= 7) +# elif ((__clang_major__ == 3) && (__clang_minor__ >= 6)) \ + || (__clang_major__ > 3) +# define BOOST_ASIO_UNUSED_TYPEDEF __attribute__((__unused__)) +# endif // ((__clang_major__ == 3) && (__clang_minor__ >= 6)) + // || (__clang_major__ > 3) +#elif defined(__GNUC__) +# if ((__GNUC__ == 4) && (__GNUC_MINOR__ >= 8)) || (__GNUC__ > 4) +# define BOOST_ASIO_UNUSED_TYPEDEF __attribute__((__unused__)) +# endif // ((__GNUC__ == 4) && (__GNUC_MINOR__ >= 8)) || (__GNUC__ > 4) +#endif // defined(__GNUC__) +#if !defined(BOOST_ASIO_UNUSED_TYPEDEF) +# define BOOST_ASIO_UNUSED_TYPEDEF +#endif // !defined(BOOST_ASIO_UNUSED_TYPEDEF) + +// Some versions of gcc generate spurious warnings about unused variables. +#if defined(__GNUC__) +# if (__GNUC__ >= 4) +# define BOOST_ASIO_UNUSED_VARIABLE __attribute__((__unused__)) +# endif // (__GNUC__ >= 4) +#endif // defined(__GNUC__) +#if !defined(BOOST_ASIO_UNUSED_VARIABLE) +# define BOOST_ASIO_UNUSED_VARIABLE +#endif // !defined(BOOST_ASIO_UNUSED_VARIABLE) + #endif // BOOST_ASIO_DETAIL_CONFIG_HPP diff --git a/3party/boost/boost/asio/detail/consuming_buffers.hpp b/3party/boost/boost/asio/detail/consuming_buffers.hpp index 7a022713ae..f0978b54d3 100644 --- a/3party/boost/boost/asio/detail/consuming_buffers.hpp +++ b/3party/boost/boost/asio/detail/consuming_buffers.hpp @@ -2,7 +2,7 @@ // detail/consuming_buffers.hpp // ~~~~~~~~~~~~~~~~~~~~~~~~~~~~ // -// Copyright (c) 2003-2015 Christopher M. Kohlhoff (chris at kohlhoff dot com) +// Copyright (c) 2003-2017 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) diff --git a/3party/boost/boost/asio/detail/cstdint.hpp b/3party/boost/boost/asio/detail/cstdint.hpp index 1dfa6e0181..a1be0dced0 100644 --- a/3party/boost/boost/asio/detail/cstdint.hpp +++ b/3party/boost/boost/asio/detail/cstdint.hpp @@ -2,7 +2,7 @@ // detail/cstdint.hpp // ~~~~~~~~~~~~~~~~~~ // -// Copyright (c) 2003-2015 Christopher M. Kohlhoff (chris at kohlhoff dot com) +// Copyright (c) 2003-2017 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) diff --git a/3party/boost/boost/asio/detail/date_time_fwd.hpp b/3party/boost/boost/asio/detail/date_time_fwd.hpp index 9c8a515dbc..33191bfa71 100644 --- a/3party/boost/boost/asio/detail/date_time_fwd.hpp +++ b/3party/boost/boost/asio/detail/date_time_fwd.hpp @@ -2,7 +2,7 @@ // detail/date_time_fwd.hpp // ~~~~~~~~~~~~~~~~~~~~~~~~ // -// Copyright (c) 2003-2015 Christopher M. Kohlhoff (chris at kohlhoff dot com) +// Copyright (c) 2003-2017 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) diff --git a/3party/boost/boost/asio/detail/deadline_timer_service.hpp b/3party/boost/boost/asio/detail/deadline_timer_service.hpp index 74a322655f..bbd5358425 100644 --- a/3party/boost/boost/asio/detail/deadline_timer_service.hpp +++ b/3party/boost/boost/asio/detail/deadline_timer_service.hpp @@ -2,7 +2,7 @@ // detail/deadline_timer_service.hpp // ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ // -// Copyright (c) 2003-2015 Christopher M. Kohlhoff (chris at kohlhoff dot com) +// Copyright (c) 2003-2017 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) diff --git a/3party/boost/boost/asio/detail/dependent_type.hpp b/3party/boost/boost/asio/detail/dependent_type.hpp index fb697d2b71..138d0cc3d4 100644 --- a/3party/boost/boost/asio/detail/dependent_type.hpp +++ b/3party/boost/boost/asio/detail/dependent_type.hpp @@ -2,7 +2,7 @@ // detail/dependent_type.hpp // ~~~~~~~~~~~~~~~~~~~~~~~~~ // -// Copyright (c) 2003-2015 Christopher M. Kohlhoff (chris at kohlhoff dot com) +// Copyright (c) 2003-2017 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) diff --git a/3party/boost/boost/asio/detail/descriptor_ops.hpp b/3party/boost/boost/asio/detail/descriptor_ops.hpp index 7ea2f07168..62100392da 100644 --- a/3party/boost/boost/asio/detail/descriptor_ops.hpp +++ b/3party/boost/boost/asio/detail/descriptor_ops.hpp @@ -2,7 +2,7 @@ // detail/descriptor_ops.hpp // ~~~~~~~~~~~~~~~~~~~~~~~~~ // -// Copyright (c) 2003-2015 Christopher M. Kohlhoff (chris at kohlhoff dot com) +// Copyright (c) 2003-2017 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) diff --git a/3party/boost/boost/asio/detail/descriptor_read_op.hpp b/3party/boost/boost/asio/detail/descriptor_read_op.hpp index eaff8a2536..ddbdf7d3e5 100644 --- a/3party/boost/boost/asio/detail/descriptor_read_op.hpp +++ b/3party/boost/boost/asio/detail/descriptor_read_op.hpp @@ -2,7 +2,7 @@ // detail/descriptor_read_op.hpp // ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ // -// Copyright (c) 2003-2015 Christopher M. Kohlhoff (chris at kohlhoff dot com) +// Copyright (c) 2003-2017 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) diff --git a/3party/boost/boost/asio/detail/descriptor_write_op.hpp b/3party/boost/boost/asio/detail/descriptor_write_op.hpp index 5e6a776494..f635feb122 100644 --- a/3party/boost/boost/asio/detail/descriptor_write_op.hpp +++ b/3party/boost/boost/asio/detail/descriptor_write_op.hpp @@ -2,7 +2,7 @@ // detail/descriptor_write_op.hpp // ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ // -// Copyright (c) 2003-2015 Christopher M. Kohlhoff (chris at kohlhoff dot com) +// Copyright (c) 2003-2017 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) diff --git a/3party/boost/boost/asio/detail/dev_poll_reactor.hpp b/3party/boost/boost/asio/detail/dev_poll_reactor.hpp index 1b4d071986..db6f3d1b8f 100644 --- a/3party/boost/boost/asio/detail/dev_poll_reactor.hpp +++ b/3party/boost/boost/asio/detail/dev_poll_reactor.hpp @@ -2,7 +2,7 @@ // detail/dev_poll_reactor.hpp // ~~~~~~~~~~~~~~~~~~~~~~~~~~~ // -// Copyright (c) 2003-2015 Christopher M. Kohlhoff (chris at kohlhoff dot com) +// Copyright (c) 2003-2017 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) diff --git a/3party/boost/boost/asio/detail/epoll_reactor.hpp b/3party/boost/boost/asio/detail/epoll_reactor.hpp index 5b80cd9f62..64c5b2704c 100644 --- a/3party/boost/boost/asio/detail/epoll_reactor.hpp +++ b/3party/boost/boost/asio/detail/epoll_reactor.hpp @@ -2,7 +2,7 @@ // detail/epoll_reactor.hpp // ~~~~~~~~~~~~~~~~~~~~~~~~ // -// Copyright (c) 2003-2015 Christopher M. Kohlhoff (chris at kohlhoff dot com) +// Copyright (c) 2003-2017 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) diff --git a/3party/boost/boost/asio/detail/event.hpp b/3party/boost/boost/asio/detail/event.hpp index e6cf2c3543..45367bb257 100644 --- a/3party/boost/boost/asio/detail/event.hpp +++ b/3party/boost/boost/asio/detail/event.hpp @@ -2,7 +2,7 @@ // detail/event.hpp // ~~~~~~~~~~~~~~~~ // -// Copyright (c) 2003-2015 Christopher M. Kohlhoff (chris at kohlhoff dot com) +// Copyright (c) 2003-2017 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) diff --git a/3party/boost/boost/asio/detail/eventfd_select_interrupter.hpp b/3party/boost/boost/asio/detail/eventfd_select_interrupter.hpp index d0d38b620c..c5b0b39206 100644 --- a/3party/boost/boost/asio/detail/eventfd_select_interrupter.hpp +++ b/3party/boost/boost/asio/detail/eventfd_select_interrupter.hpp @@ -2,7 +2,7 @@ // detail/eventfd_select_interrupter.hpp // ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ // -// Copyright (c) 2003-2015 Christopher M. Kohlhoff (chris at kohlhoff dot com) +// Copyright (c) 2003-2017 Christopher M. Kohlhoff (chris at kohlhoff dot com) // Copyright (c) 2008 Roelof Naude (roelof.naude at gmail dot com) // // Distributed under the Boost Software License, Version 1.0. (See accompanying diff --git a/3party/boost/boost/asio/detail/fd_set_adapter.hpp b/3party/boost/boost/asio/detail/fd_set_adapter.hpp index 0a28dc42a0..6916db5f25 100644 --- a/3party/boost/boost/asio/detail/fd_set_adapter.hpp +++ b/3party/boost/boost/asio/detail/fd_set_adapter.hpp @@ -2,7 +2,7 @@ // detail/fd_set_adapter.hpp // ~~~~~~~~~~~~~~~~~~~~~~~~~ // -// Copyright (c) 2003-2015 Christopher M. Kohlhoff (chris at kohlhoff dot com) +// Copyright (c) 2003-2017 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) diff --git a/3party/boost/boost/asio/detail/fenced_block.hpp b/3party/boost/boost/asio/detail/fenced_block.hpp index ea30c65e5f..628ca75f1c 100644 --- a/3party/boost/boost/asio/detail/fenced_block.hpp +++ b/3party/boost/boost/asio/detail/fenced_block.hpp @@ -2,7 +2,7 @@ // detail/fenced_block.hpp // ~~~~~~~~~~~~~~~~~~~~~~~ // -// Copyright (c) 2003-2015 Christopher M. Kohlhoff (chris at kohlhoff dot com) +// Copyright (c) 2003-2017 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) @@ -20,6 +20,8 @@ #if !defined(BOOST_ASIO_HAS_THREADS) \ || defined(BOOST_ASIO_DISABLE_FENCED_BLOCK) # include +#elif defined(BOOST_ASIO_HAS_STD_ATOMIC) +# include #elif defined(__MACH__) && defined(__APPLE__) # include #elif defined(__sun) @@ -49,6 +51,8 @@ namespace detail { #if !defined(BOOST_ASIO_HAS_THREADS) \ || defined(BOOST_ASIO_DISABLE_FENCED_BLOCK) typedef null_fenced_block fenced_block; +#elif defined(BOOST_ASIO_HAS_STD_ATOMIC) +typedef std_fenced_block fenced_block; #elif defined(__MACH__) && defined(__APPLE__) typedef macos_fenced_block fenced_block; #elif defined(__sun) diff --git a/3party/boost/boost/asio/detail/function.hpp b/3party/boost/boost/asio/detail/function.hpp index 191615b59a..db26144c5f 100644 --- a/3party/boost/boost/asio/detail/function.hpp +++ b/3party/boost/boost/asio/detail/function.hpp @@ -2,7 +2,7 @@ // detail/function.hpp // ~~~~~~~~~~~~~~~~~~~ // -// Copyright (c) 2003-2015 Christopher M. Kohlhoff (chris at kohlhoff dot com) +// Copyright (c) 2003-2017 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) diff --git a/3party/boost/boost/asio/detail/gcc_arm_fenced_block.hpp b/3party/boost/boost/asio/detail/gcc_arm_fenced_block.hpp index c1b3348b8a..b4805c35cd 100644 --- a/3party/boost/boost/asio/detail/gcc_arm_fenced_block.hpp +++ b/3party/boost/boost/asio/detail/gcc_arm_fenced_block.hpp @@ -2,7 +2,7 @@ // detail/gcc_arm_fenced_block.hpp // ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ // -// Copyright (c) 2003-2015 Christopher M. Kohlhoff (chris at kohlhoff dot com) +// Copyright (c) 2003-2017 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) diff --git a/3party/boost/boost/asio/detail/gcc_hppa_fenced_block.hpp b/3party/boost/boost/asio/detail/gcc_hppa_fenced_block.hpp index 9f3a0bbc30..b9aa9e2ca4 100644 --- a/3party/boost/boost/asio/detail/gcc_hppa_fenced_block.hpp +++ b/3party/boost/boost/asio/detail/gcc_hppa_fenced_block.hpp @@ -2,7 +2,7 @@ // detail/gcc_hppa_fenced_block.hpp // ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ // -// Copyright (c) 2003-2015 Christopher M. Kohlhoff (chris at kohlhoff dot com) +// Copyright (c) 2003-2017 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) diff --git a/3party/boost/boost/asio/detail/gcc_sync_fenced_block.hpp b/3party/boost/boost/asio/detail/gcc_sync_fenced_block.hpp index 570f7eaa65..e8e6c54643 100644 --- a/3party/boost/boost/asio/detail/gcc_sync_fenced_block.hpp +++ b/3party/boost/boost/asio/detail/gcc_sync_fenced_block.hpp @@ -2,7 +2,7 @@ // detail/gcc_sync_fenced_block.hpp // ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ // -// Copyright (c) 2003-2015 Christopher M. Kohlhoff (chris at kohlhoff dot com) +// Copyright (c) 2003-2017 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) diff --git a/3party/boost/boost/asio/detail/gcc_x86_fenced_block.hpp b/3party/boost/boost/asio/detail/gcc_x86_fenced_block.hpp index 81d517909c..fe0ce8a316 100644 --- a/3party/boost/boost/asio/detail/gcc_x86_fenced_block.hpp +++ b/3party/boost/boost/asio/detail/gcc_x86_fenced_block.hpp @@ -2,7 +2,7 @@ // detail/gcc_x86_fenced_block.hpp // ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ // -// Copyright (c) 2003-2015 Christopher M. Kohlhoff (chris at kohlhoff dot com) +// Copyright (c) 2003-2017 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) diff --git a/3party/boost/boost/asio/detail/handler_alloc_helpers.hpp b/3party/boost/boost/asio/detail/handler_alloc_helpers.hpp index a602d8e315..a03cb41976 100644 --- a/3party/boost/boost/asio/detail/handler_alloc_helpers.hpp +++ b/3party/boost/boost/asio/detail/handler_alloc_helpers.hpp @@ -2,7 +2,7 @@ // detail/handler_alloc_helpers.hpp // ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ // -// Copyright (c) 2003-2015 Christopher M. Kohlhoff (chris at kohlhoff dot com) +// Copyright (c) 2003-2017 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) diff --git a/3party/boost/boost/asio/detail/handler_cont_helpers.hpp b/3party/boost/boost/asio/detail/handler_cont_helpers.hpp index ec3abb78b5..9a361a9ca4 100644 --- a/3party/boost/boost/asio/detail/handler_cont_helpers.hpp +++ b/3party/boost/boost/asio/detail/handler_cont_helpers.hpp @@ -2,7 +2,7 @@ // detail/handler_cont_helpers.hpp // ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ // -// Copyright (c) 2003-2015 Christopher M. Kohlhoff (chris at kohlhoff dot com) +// Copyright (c) 2003-2017 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) diff --git a/3party/boost/boost/asio/detail/handler_invoke_helpers.hpp b/3party/boost/boost/asio/detail/handler_invoke_helpers.hpp index fed4c4eef6..43f74f3272 100644 --- a/3party/boost/boost/asio/detail/handler_invoke_helpers.hpp +++ b/3party/boost/boost/asio/detail/handler_invoke_helpers.hpp @@ -2,7 +2,7 @@ // detail/handler_invoke_helpers.hpp // ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ // -// Copyright (c) 2003-2015 Christopher M. Kohlhoff (chris at kohlhoff dot com) +// Copyright (c) 2003-2017 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) diff --git a/3party/boost/boost/asio/detail/handler_tracking.hpp b/3party/boost/boost/asio/detail/handler_tracking.hpp index f1a89fe91f..fd69bdd5b6 100644 --- a/3party/boost/boost/asio/detail/handler_tracking.hpp +++ b/3party/boost/boost/asio/detail/handler_tracking.hpp @@ -2,7 +2,7 @@ // detail/handler_tracking.hpp // ~~~~~~~~~~~~~~~~~~~~~~~~~~~ // -// Copyright (c) 2003-2015 Christopher M. Kohlhoff (chris at kohlhoff dot com) +// Copyright (c) 2003-2017 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) diff --git a/3party/boost/boost/asio/detail/handler_type_requirements.hpp b/3party/boost/boost/asio/detail/handler_type_requirements.hpp index a2d3fd1f20..bc2fbce0ce 100644 --- a/3party/boost/boost/asio/detail/handler_type_requirements.hpp +++ b/3party/boost/boost/asio/detail/handler_type_requirements.hpp @@ -2,7 +2,7 @@ // detail/handler_type_requirements.hpp // ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ // -// Copyright (c) 2003-2015 Christopher M. Kohlhoff (chris at kohlhoff dot com) +// Copyright (c) 2003-2017 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) @@ -53,16 +53,6 @@ # include #endif // defined(BOOST_ASIO_ENABLE_HANDLER_TYPE_REQUIREMENTS) -// Newer gcc needs special treatment to suppress unused typedef warnings. -#if defined(__GNUC__) -# if ((__GNUC__ == 4) && (__GNUC_MINOR__ >= 8)) || (__GNUC__ > 4) -# define BOOST_ASIO_UNUSED_TYPEDEF __attribute__((__unused__)) -# endif // ((__GNUC__ == 4) && (__GNUC_MINOR__ >= 8)) || (__GNUC__ > 4) -#endif // defined(__GNUC__) -#if !defined(BOOST_ASIO_UNUSED_TYPEDEF) -# define BOOST_ASIO_UNUSED_TYPEDEF -#endif // !defined(BOOST_ASIO_UNUSED_TYPEDEF) - namespace boost { namespace asio { namespace detail { diff --git a/3party/boost/boost/asio/detail/hash_map.hpp b/3party/boost/boost/asio/detail/hash_map.hpp index 20b3332602..0c3b53bc39 100644 --- a/3party/boost/boost/asio/detail/hash_map.hpp +++ b/3party/boost/boost/asio/detail/hash_map.hpp @@ -2,7 +2,7 @@ // detail/hash_map.hpp // ~~~~~~~~~~~~~~~~~~~ // -// Copyright (c) 2003-2015 Christopher M. Kohlhoff (chris at kohlhoff dot com) +// Copyright (c) 2003-2017 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) @@ -244,15 +244,15 @@ private: { if (num_buckets == num_buckets_) return; - num_buckets_ = num_buckets; - BOOST_ASIO_ASSERT(num_buckets_ != 0); + BOOST_ASIO_ASSERT(num_buckets != 0); iterator end_iter = values_.end(); // Update number of buckets and initialise all buckets to empty. - bucket_type* tmp = new bucket_type[num_buckets_]; + bucket_type* tmp = new bucket_type[num_buckets]; delete[] buckets_; buckets_ = tmp; + num_buckets_ = num_buckets; for (std::size_t i = 0; i < num_buckets_; ++i) buckets_[i].first = buckets_[i].last = end_iter; diff --git a/3party/boost/boost/asio/detail/impl/buffer_sequence_adapter.ipp b/3party/boost/boost/asio/detail/impl/buffer_sequence_adapter.ipp index c5a1f3d67d..f471863e1a 100644 --- a/3party/boost/boost/asio/detail/impl/buffer_sequence_adapter.ipp +++ b/3party/boost/boost/asio/detail/impl/buffer_sequence_adapter.ipp @@ -2,7 +2,7 @@ // detail/impl/buffer_sequence_adapter.ipp // ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ // -// Copyright (c) 2003-2015 Christopher M. Kohlhoff (chris at kohlhoff dot com) +// Copyright (c) 2003-2017 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) diff --git a/3party/boost/boost/asio/detail/impl/descriptor_ops.ipp b/3party/boost/boost/asio/detail/impl/descriptor_ops.ipp index d700b22b8b..00f6b4796e 100644 --- a/3party/boost/boost/asio/detail/impl/descriptor_ops.ipp +++ b/3party/boost/boost/asio/detail/impl/descriptor_ops.ipp @@ -2,7 +2,7 @@ // detail/impl/descriptor_ops.ipp // ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ // -// Copyright (c) 2003-2015 Christopher M. Kohlhoff (chris at kohlhoff dot com) +// Copyright (c) 2003-2017 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) diff --git a/3party/boost/boost/asio/detail/impl/dev_poll_reactor.hpp b/3party/boost/boost/asio/detail/impl/dev_poll_reactor.hpp index 5ca682244e..623346edd5 100644 --- a/3party/boost/boost/asio/detail/impl/dev_poll_reactor.hpp +++ b/3party/boost/boost/asio/detail/impl/dev_poll_reactor.hpp @@ -2,7 +2,7 @@ // detail/impl/dev_poll_reactor.hpp // ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ // -// Copyright (c) 2003-2015 Christopher M. Kohlhoff (chris at kohlhoff dot com) +// Copyright (c) 2003-2017 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) diff --git a/3party/boost/boost/asio/detail/impl/dev_poll_reactor.ipp b/3party/boost/boost/asio/detail/impl/dev_poll_reactor.ipp index aa276d3daf..efe2ba7086 100644 --- a/3party/boost/boost/asio/detail/impl/dev_poll_reactor.ipp +++ b/3party/boost/boost/asio/detail/impl/dev_poll_reactor.ipp @@ -2,7 +2,7 @@ // detail/impl/dev_poll_reactor.ipp // ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ // -// Copyright (c) 2003-2015 Christopher M. Kohlhoff (chris at kohlhoff dot com) +// Copyright (c) 2003-2017 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) diff --git a/3party/boost/boost/asio/detail/impl/epoll_reactor.hpp b/3party/boost/boost/asio/detail/impl/epoll_reactor.hpp index dea5225b3e..ea5c6bfc69 100644 --- a/3party/boost/boost/asio/detail/impl/epoll_reactor.hpp +++ b/3party/boost/boost/asio/detail/impl/epoll_reactor.hpp @@ -2,7 +2,7 @@ // detail/impl/epoll_reactor.hpp // ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ // -// Copyright (c) 2003-2015 Christopher M. Kohlhoff (chris at kohlhoff dot com) +// Copyright (c) 2003-2017 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) diff --git a/3party/boost/boost/asio/detail/impl/epoll_reactor.ipp b/3party/boost/boost/asio/detail/impl/epoll_reactor.ipp index accb0dac27..610ce31ce5 100644 --- a/3party/boost/boost/asio/detail/impl/epoll_reactor.ipp +++ b/3party/boost/boost/asio/detail/impl/epoll_reactor.ipp @@ -2,7 +2,7 @@ // detail/impl/epoll_reactor.ipp // ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ // -// Copyright (c) 2003-2015 Christopher M. Kohlhoff (chris at kohlhoff dot com) +// Copyright (c) 2003-2017 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) @@ -164,7 +164,18 @@ int epoll_reactor::register_descriptor(socket_type descriptor, ev.data.ptr = descriptor_data; int result = epoll_ctl(epoll_fd_, EPOLL_CTL_ADD, descriptor, &ev); if (result != 0) + { + if (errno == EPERM) + { + // This file descriptor type is not supported by epoll. However, if it is + // a regular file then operations on it will not block. We will allow + // this descriptor to be used and fail later if an operation on it would + // otherwise require a trip through the reactor. + descriptor_data->registered_events_ = 0; + return 0; + } return errno; + } return 0; } @@ -235,6 +246,13 @@ void epoll_reactor::start_op(int op_type, socket_type descriptor, return; } + if (descriptor_data->registered_events_ == 0) + { + op->ec_ = boost::asio::error::operation_not_supported; + io_service_.post_immediate_completion(op, is_continuation); + return; + } + if (op_type == write_op) { if ((descriptor_data->registered_events_ & EPOLLOUT) == 0) @@ -256,6 +274,12 @@ void epoll_reactor::start_op(int op_type, socket_type descriptor, } } } + else if (descriptor_data->registered_events_ == 0) + { + op->ec_ = boost::asio::error::operation_not_supported; + io_service_.post_immediate_completion(op, is_continuation); + return; + } else { if (op_type == write_op) @@ -313,7 +337,7 @@ void epoll_reactor::deregister_descriptor(socket_type descriptor, // The descriptor will be automatically removed from the epoll set when // it is closed. } - else + else if (descriptor_data->registered_events_ != 0) { epoll_event ev = { 0, { 0 } }; epoll_ctl(epoll_fd_, EPOLL_CTL_DEL, descriptor, &ev); diff --git a/3party/boost/boost/asio/detail/impl/eventfd_select_interrupter.ipp b/3party/boost/boost/asio/detail/impl/eventfd_select_interrupter.ipp index cde54b9a02..2ce1f6d674 100644 --- a/3party/boost/boost/asio/detail/impl/eventfd_select_interrupter.ipp +++ b/3party/boost/boost/asio/detail/impl/eventfd_select_interrupter.ipp @@ -2,7 +2,7 @@ // detail/impl/eventfd_select_interrupter.ipp // ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ // -// Copyright (c) 2003-2015 Christopher M. Kohlhoff (chris at kohlhoff dot com) +// Copyright (c) 2003-2017 Christopher M. Kohlhoff (chris at kohlhoff dot com) // Copyright (c) 2008 Roelof Naude (roelof.naude at gmail dot com) // // Distributed under the Boost Software License, Version 1.0. (See accompanying diff --git a/3party/boost/boost/asio/detail/impl/handler_tracking.ipp b/3party/boost/boost/asio/detail/impl/handler_tracking.ipp index 4a07911c82..259b5ab62b 100644 --- a/3party/boost/boost/asio/detail/impl/handler_tracking.ipp +++ b/3party/boost/boost/asio/detail/impl/handler_tracking.ipp @@ -2,7 +2,7 @@ // detail/impl/handler_tracking.ipp // ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ // -// Copyright (c) 2003-2015 Christopher M. Kohlhoff (chris at kohlhoff dot com) +// Copyright (c) 2003-2017 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) diff --git a/3party/boost/boost/asio/detail/impl/kqueue_reactor.hpp b/3party/boost/boost/asio/detail/impl/kqueue_reactor.hpp index 807c121f70..93cbca26a2 100644 --- a/3party/boost/boost/asio/detail/impl/kqueue_reactor.hpp +++ b/3party/boost/boost/asio/detail/impl/kqueue_reactor.hpp @@ -2,7 +2,7 @@ // detail/impl/kqueue_reactor.hpp // ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ // -// Copyright (c) 2003-2015 Christopher M. Kohlhoff (chris at kohlhoff dot com) +// Copyright (c) 2003-2017 Christopher M. Kohlhoff (chris at kohlhoff dot com) // Copyright (c) 2005 Stefan Arentz (stefan at soze dot com) // // Distributed under the Boost Software License, Version 1.0. (See accompanying diff --git a/3party/boost/boost/asio/detail/impl/kqueue_reactor.ipp b/3party/boost/boost/asio/detail/impl/kqueue_reactor.ipp index 70aeb38b88..b4a7a10b71 100644 --- a/3party/boost/boost/asio/detail/impl/kqueue_reactor.ipp +++ b/3party/boost/boost/asio/detail/impl/kqueue_reactor.ipp @@ -2,7 +2,7 @@ // detail/impl/kqueue_reactor.ipp // ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ // -// Copyright (c) 2003-2015 Christopher M. Kohlhoff (chris at kohlhoff dot com) +// Copyright (c) 2003-2017 Christopher M. Kohlhoff (chris at kohlhoff dot com) // Copyright (c) 2005 Stefan Arentz (stefan at soze dot com) // // Distributed under the Boost Software License, Version 1.0. (See accompanying diff --git a/3party/boost/boost/asio/detail/impl/pipe_select_interrupter.ipp b/3party/boost/boost/asio/detail/impl/pipe_select_interrupter.ipp index c48e61d7ec..4f8923fa36 100644 --- a/3party/boost/boost/asio/detail/impl/pipe_select_interrupter.ipp +++ b/3party/boost/boost/asio/detail/impl/pipe_select_interrupter.ipp @@ -2,7 +2,7 @@ // detail/impl/pipe_select_interrupter.ipp // ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ // -// Copyright (c) 2003-2015 Christopher M. Kohlhoff (chris at kohlhoff dot com) +// Copyright (c) 2003-2017 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) diff --git a/3party/boost/boost/asio/detail/impl/posix_event.ipp b/3party/boost/boost/asio/detail/impl/posix_event.ipp index 9514972c5a..3b465ca3cd 100644 --- a/3party/boost/boost/asio/detail/impl/posix_event.ipp +++ b/3party/boost/boost/asio/detail/impl/posix_event.ipp @@ -2,7 +2,7 @@ // detail/impl/posix_event.ipp // ~~~~~~~~~~~~~~~~~~~~~~~~~~~ // -// Copyright (c) 2003-2015 Christopher M. Kohlhoff (chris at kohlhoff dot com) +// Copyright (c) 2003-2017 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) diff --git a/3party/boost/boost/asio/detail/impl/posix_mutex.ipp b/3party/boost/boost/asio/detail/impl/posix_mutex.ipp index e470cfa89c..7153023ad3 100644 --- a/3party/boost/boost/asio/detail/impl/posix_mutex.ipp +++ b/3party/boost/boost/asio/detail/impl/posix_mutex.ipp @@ -2,7 +2,7 @@ // detail/impl/posix_mutex.ipp // ~~~~~~~~~~~~~~~~~~~~~~~~~~~ // -// Copyright (c) 2003-2015 Christopher M. Kohlhoff (chris at kohlhoff dot com) +// Copyright (c) 2003-2017 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) diff --git a/3party/boost/boost/asio/detail/impl/posix_thread.ipp b/3party/boost/boost/asio/detail/impl/posix_thread.ipp index 5253cd965d..66cb18da33 100644 --- a/3party/boost/boost/asio/detail/impl/posix_thread.ipp +++ b/3party/boost/boost/asio/detail/impl/posix_thread.ipp @@ -2,7 +2,7 @@ // detail/impl/posix_thread.ipp // ~~~~~~~~~~~~~~~~~~~~~~~~~~~~ // -// Copyright (c) 2003-2015 Christopher M. Kohlhoff (chris at kohlhoff dot com) +// Copyright (c) 2003-2017 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) diff --git a/3party/boost/boost/asio/detail/impl/posix_tss_ptr.ipp b/3party/boost/boost/asio/detail/impl/posix_tss_ptr.ipp index 042b014cb6..21b522c1da 100644 --- a/3party/boost/boost/asio/detail/impl/posix_tss_ptr.ipp +++ b/3party/boost/boost/asio/detail/impl/posix_tss_ptr.ipp @@ -2,7 +2,7 @@ // detail/impl/posix_tss_ptr.ipp // ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ // -// Copyright (c) 2003-2015 Christopher M. Kohlhoff (chris at kohlhoff dot com) +// Copyright (c) 2003-2017 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) diff --git a/3party/boost/boost/asio/detail/impl/reactive_descriptor_service.ipp b/3party/boost/boost/asio/detail/impl/reactive_descriptor_service.ipp index cf6547fddd..56caec9fd3 100644 --- a/3party/boost/boost/asio/detail/impl/reactive_descriptor_service.ipp +++ b/3party/boost/boost/asio/detail/impl/reactive_descriptor_service.ipp @@ -2,7 +2,7 @@ // detail/impl/reactive_descriptor_service.ipp // ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ // -// Copyright (c) 2003-2015 Christopher M. Kohlhoff (chris at kohlhoff dot com) +// Copyright (c) 2003-2017 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) diff --git a/3party/boost/boost/asio/detail/impl/reactive_serial_port_service.ipp b/3party/boost/boost/asio/detail/impl/reactive_serial_port_service.ipp index d4f615714a..ffa8857ab6 100644 --- a/3party/boost/boost/asio/detail/impl/reactive_serial_port_service.ipp +++ b/3party/boost/boost/asio/detail/impl/reactive_serial_port_service.ipp @@ -2,7 +2,7 @@ // detail/impl/reactive_serial_port_service.ipp // ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ // -// Copyright (c) 2003-2015 Christopher M. Kohlhoff (chris at kohlhoff dot com) +// Copyright (c) 2003-2017 Christopher M. Kohlhoff (chris at kohlhoff dot com) // Copyright (c) 2008 Rep Invariant Systems, Inc. (info@repinvariant.com) // // Distributed under the Boost Software License, Version 1.0. (See accompanying diff --git a/3party/boost/boost/asio/detail/impl/reactive_socket_service_base.ipp b/3party/boost/boost/asio/detail/impl/reactive_socket_service_base.ipp index 2ef23a17be..21e77e9f93 100644 --- a/3party/boost/boost/asio/detail/impl/reactive_socket_service_base.ipp +++ b/3party/boost/boost/asio/detail/impl/reactive_socket_service_base.ipp @@ -2,7 +2,7 @@ // detail/reactive_socket_service_base.ipp // ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ // -// Copyright (c) 2003-2015 Christopher M. Kohlhoff (chris at kohlhoff dot com) +// Copyright (c) 2003-2017 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) diff --git a/3party/boost/boost/asio/detail/impl/resolver_service_base.ipp b/3party/boost/boost/asio/detail/impl/resolver_service_base.ipp index 484aeadf61..4ef66cde15 100644 --- a/3party/boost/boost/asio/detail/impl/resolver_service_base.ipp +++ b/3party/boost/boost/asio/detail/impl/resolver_service_base.ipp @@ -2,7 +2,7 @@ // detail/impl/resolver_service_base.ipp // ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ // -// Copyright (c) 2003-2015 Christopher M. Kohlhoff (chris at kohlhoff dot com) +// Copyright (c) 2003-2017 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) diff --git a/3party/boost/boost/asio/detail/impl/select_reactor.hpp b/3party/boost/boost/asio/detail/impl/select_reactor.hpp index 4461681f7a..d3f28f5e61 100644 --- a/3party/boost/boost/asio/detail/impl/select_reactor.hpp +++ b/3party/boost/boost/asio/detail/impl/select_reactor.hpp @@ -2,7 +2,7 @@ // detail/impl/select_reactor.hpp // ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ // -// Copyright (c) 2003-2015 Christopher M. Kohlhoff (chris at kohlhoff dot com) +// Copyright (c) 2003-2017 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) diff --git a/3party/boost/boost/asio/detail/impl/select_reactor.ipp b/3party/boost/boost/asio/detail/impl/select_reactor.ipp index 9269f94568..80686eaf97 100644 --- a/3party/boost/boost/asio/detail/impl/select_reactor.ipp +++ b/3party/boost/boost/asio/detail/impl/select_reactor.ipp @@ -2,7 +2,7 @@ // detail/impl/select_reactor.ipp // ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ // -// Copyright (c) 2003-2015 Christopher M. Kohlhoff (chris at kohlhoff dot com) +// Copyright (c) 2003-2017 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) diff --git a/3party/boost/boost/asio/detail/impl/service_registry.hpp b/3party/boost/boost/asio/detail/impl/service_registry.hpp index 9e0a8b484f..7ffdd029f7 100644 --- a/3party/boost/boost/asio/detail/impl/service_registry.hpp +++ b/3party/boost/boost/asio/detail/impl/service_registry.hpp @@ -2,7 +2,7 @@ // detail/impl/service_registry.hpp // ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ // -// Copyright (c) 2003-2015 Christopher M. Kohlhoff (chris at kohlhoff dot com) +// Copyright (c) 2003-2017 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) diff --git a/3party/boost/boost/asio/detail/impl/service_registry.ipp b/3party/boost/boost/asio/detail/impl/service_registry.ipp index 00deec9dc2..25ac8eccc6 100644 --- a/3party/boost/boost/asio/detail/impl/service_registry.ipp +++ b/3party/boost/boost/asio/detail/impl/service_registry.ipp @@ -2,7 +2,7 @@ // detail/impl/service_registry.ipp // ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ // -// Copyright (c) 2003-2015 Christopher M. Kohlhoff (chris at kohlhoff dot com) +// Copyright (c) 2003-2017 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) diff --git a/3party/boost/boost/asio/detail/impl/signal_set_service.ipp b/3party/boost/boost/asio/detail/impl/signal_set_service.ipp index 8fde0a8637..56313e0923 100644 --- a/3party/boost/boost/asio/detail/impl/signal_set_service.ipp +++ b/3party/boost/boost/asio/detail/impl/signal_set_service.ipp @@ -2,7 +2,7 @@ // detail/impl/signal_set_service.ipp // ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ // -// Copyright (c) 2003-2015 Christopher M. Kohlhoff (chris at kohlhoff dot com) +// Copyright (c) 2003-2017 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) diff --git a/3party/boost/boost/asio/detail/impl/socket_ops.ipp b/3party/boost/boost/asio/detail/impl/socket_ops.ipp index dc068e0e03..c9683f4a09 100644 --- a/3party/boost/boost/asio/detail/impl/socket_ops.ipp +++ b/3party/boost/boost/asio/detail/impl/socket_ops.ipp @@ -2,7 +2,7 @@ // detail/impl/socket_ops.ipp // ~~~~~~~~~~~~~~~~~~~~~~~~~~ // -// Copyright (c) 2003-2015 Christopher M. Kohlhoff (chris at kohlhoff dot com) +// Copyright (c) 2003-2017 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) @@ -1634,7 +1634,8 @@ int getpeername(socket_type s, socket_addr_type* addr, return socket_error_retval; } -#if defined(BOOST_ASIO_WINDOWS) || defined(__CYGWIN__) +#if defined(BOOST_ASIO_WINDOWS) && !defined(BOOST_ASIO_WINDOWS_APP) \ + || defined(__CYGWIN__) if (cached) { // Check if socket is still connected. @@ -1655,9 +1656,11 @@ int getpeername(socket_type s, socket_addr_type* addr, ec = boost::system::error_code(); return 0; } -#else // defined(BOOST_ASIO_WINDOWS) || defined(__CYGWIN__) +#else // defined(BOOST_ASIO_WINDOWS) && !defined(BOOST_ASIO_WINDOWS_APP) + // || defined(__CYGWIN__) (void)cached; -#endif // defined(BOOST_ASIO_WINDOWS) || defined(__CYGWIN__) +#endif // defined(BOOST_ASIO_WINDOWS) && !defined(BOOST_ASIO_WINDOWS_APP) + // || defined(__CYGWIN__) clear_last_error(); int result = error_wrapper(call_getpeername( @@ -2581,7 +2584,8 @@ inline void gai_strcpy(char* target, const char* source, std::size_t max_size) strcpy_s(target, max_size, source); #else // defined(BOOST_ASIO_HAS_SECURE_RTL) *target = 0; - strncat(target, source, max_size); + if (max_size > 0) + strncat(target, source, max_size - 1); #endif // defined(BOOST_ASIO_HAS_SECURE_RTL) } @@ -3234,6 +3238,37 @@ boost::system::error_code getaddrinfo(const char* host, return ec = translate_addrinfo_error(error); #else int error = ::getaddrinfo(host, service, &hints, result); +#if defined(__MACH__) && defined(__APPLE__) + using namespace std; // For isdigit and atoi. + if (error == 0 && service && isdigit(static_cast(service[0]))) + { + u_short_type port = host_to_network_short(atoi(service)); + for (addrinfo_type* ai = *result; ai; ai = ai->ai_next) + { + switch (ai->ai_family) + { + case BOOST_ASIO_OS_DEF(AF_INET): + { + sockaddr_in4_type* sinptr = + reinterpret_cast(ai->ai_addr); + if (sinptr->sin_port == 0) + sinptr->sin_port = port; + break; + } + case BOOST_ASIO_OS_DEF(AF_INET6): + { + sockaddr_in6_type* sin6ptr = + reinterpret_cast(ai->ai_addr); + if (sin6ptr->sin6_port == 0) + sin6ptr->sin6_port = port; + break; + } + default: + break; + } + } + } +#endif return ec = translate_addrinfo_error(error); #endif } diff --git a/3party/boost/boost/asio/detail/impl/socket_select_interrupter.ipp b/3party/boost/boost/asio/detail/impl/socket_select_interrupter.ipp index 83c2208dab..409996c59e 100644 --- a/3party/boost/boost/asio/detail/impl/socket_select_interrupter.ipp +++ b/3party/boost/boost/asio/detail/impl/socket_select_interrupter.ipp @@ -2,7 +2,7 @@ // detail/impl/socket_select_interrupter.ipp // ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ // -// Copyright (c) 2003-2015 Christopher M. Kohlhoff (chris at kohlhoff dot com) +// Copyright (c) 2003-2017 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) @@ -72,7 +72,8 @@ void socket_select_interrupter::open_descriptors() // Some broken firewalls on Windows will intermittently cause getsockname to // return 0.0.0.0 when the socket is actually bound to 127.0.0.1. We // explicitly specify the target address here to work around this problem. - addr.sin_addr.s_addr = socket_ops::host_to_network_long(INADDR_LOOPBACK); + if (addr.sin_addr.s_addr == socket_ops::host_to_network_long(INADDR_ANY)) + addr.sin_addr.s_addr = socket_ops::host_to_network_long(INADDR_LOOPBACK); if (socket_ops::listen(acceptor.get(), SOMAXCONN, ec) == socket_error_retval) diff --git a/3party/boost/boost/asio/detail/impl/strand_service.hpp b/3party/boost/boost/asio/detail/impl/strand_service.hpp index 824e296b13..4167f686d1 100644 --- a/3party/boost/boost/asio/detail/impl/strand_service.hpp +++ b/3party/boost/boost/asio/detail/impl/strand_service.hpp @@ -2,7 +2,7 @@ // detail/impl/strand_service.hpp // ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ // -// Copyright (c) 2003-2015 Christopher M. Kohlhoff (chris at kohlhoff dot com) +// Copyright (c) 2003-2017 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) diff --git a/3party/boost/boost/asio/detail/impl/strand_service.ipp b/3party/boost/boost/asio/detail/impl/strand_service.ipp index 9281714433..54ecde2cc7 100644 --- a/3party/boost/boost/asio/detail/impl/strand_service.ipp +++ b/3party/boost/boost/asio/detail/impl/strand_service.ipp @@ -2,7 +2,7 @@ // detail/impl/strand_service.ipp // ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ // -// Copyright (c) 2003-2015 Christopher M. Kohlhoff (chris at kohlhoff dot com) +// Copyright (c) 2003-2017 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) diff --git a/3party/boost/boost/asio/detail/impl/task_io_service.hpp b/3party/boost/boost/asio/detail/impl/task_io_service.hpp index cecdb6d441..09b4ba6985 100644 --- a/3party/boost/boost/asio/detail/impl/task_io_service.hpp +++ b/3party/boost/boost/asio/detail/impl/task_io_service.hpp @@ -2,7 +2,7 @@ // detail/impl/task_io_service.hpp // ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ // -// Copyright (c) 2003-2015 Christopher M. Kohlhoff (chris at kohlhoff dot com) +// Copyright (c) 2003-2017 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) diff --git a/3party/boost/boost/asio/detail/impl/task_io_service.ipp b/3party/boost/boost/asio/detail/impl/task_io_service.ipp index 129dd64d34..bc83fd4757 100644 --- a/3party/boost/boost/asio/detail/impl/task_io_service.ipp +++ b/3party/boost/boost/asio/detail/impl/task_io_service.ipp @@ -2,7 +2,7 @@ // detail/impl/task_io_service.ipp // ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ // -// Copyright (c) 2003-2015 Christopher M. Kohlhoff (chris at kohlhoff dot com) +// Copyright (c) 2003-2017 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) diff --git a/3party/boost/boost/asio/detail/impl/throw_error.ipp b/3party/boost/boost/asio/detail/impl/throw_error.ipp index fa3b4e2e68..a1c31498c2 100644 --- a/3party/boost/boost/asio/detail/impl/throw_error.ipp +++ b/3party/boost/boost/asio/detail/impl/throw_error.ipp @@ -2,7 +2,7 @@ // detail/impl/throw_error.ipp // ~~~~~~~~~~~~~~~~~~~~~~~~~~~ // -// Copyright (c) 2003-2015 Christopher M. Kohlhoff (chris at kohlhoff dot com) +// Copyright (c) 2003-2017 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) diff --git a/3party/boost/boost/asio/detail/impl/timer_queue_ptime.ipp b/3party/boost/boost/asio/detail/impl/timer_queue_ptime.ipp index a2c52786b2..0216d20ba5 100644 --- a/3party/boost/boost/asio/detail/impl/timer_queue_ptime.ipp +++ b/3party/boost/boost/asio/detail/impl/timer_queue_ptime.ipp @@ -2,7 +2,7 @@ // detail/impl/timer_queue_ptime.ipp // ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ // -// Copyright (c) 2003-2015 Christopher M. Kohlhoff (chris at kohlhoff dot com) +// Copyright (c) 2003-2017 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) diff --git a/3party/boost/boost/asio/detail/impl/timer_queue_set.ipp b/3party/boost/boost/asio/detail/impl/timer_queue_set.ipp index 5a84926e91..25c845c11b 100644 --- a/3party/boost/boost/asio/detail/impl/timer_queue_set.ipp +++ b/3party/boost/boost/asio/detail/impl/timer_queue_set.ipp @@ -2,7 +2,7 @@ // detail/impl/timer_queue_set.ipp // ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ // -// Copyright (c) 2003-2015 Christopher M. Kohlhoff (chris at kohlhoff dot com) +// Copyright (c) 2003-2017 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) diff --git a/3party/boost/boost/asio/detail/impl/win_event.ipp b/3party/boost/boost/asio/detail/impl/win_event.ipp index 0fffbce9cd..2519d3165d 100644 --- a/3party/boost/boost/asio/detail/impl/win_event.ipp +++ b/3party/boost/boost/asio/detail/impl/win_event.ipp @@ -2,7 +2,7 @@ // detail/win_event.ipp // ~~~~~~~~~~~~~~~~~~~~ // -// Copyright (c) 2003-2015 Christopher M. Kohlhoff (chris at kohlhoff dot com) +// Copyright (c) 2003-2017 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) @@ -32,7 +32,11 @@ namespace detail { win_event::win_event() : state_(0) { - events_[0] = ::CreateEvent(0, true, false, 0); +#if defined(BOOST_ASIO_WINDOWS_APP) + events_[0] = ::CreateEventExW(0, 0, CREATE_EVENT_MANUAL_RESET, 0); +#else // defined(BOOST_ASIO_WINDOWS_APP) + events_[0] = ::CreateEventW(0, true, false, 0); +#endif // defined(BOOST_ASIO_WINDOWS_APP) if (!events_[0]) { DWORD last_error = ::GetLastError(); @@ -41,7 +45,11 @@ win_event::win_event() boost::asio::detail::throw_error(ec, "event"); } - events_[1] = ::CreateEvent(0, false, false, 0); +#if defined(BOOST_ASIO_WINDOWS_APP) + events_[1] = ::CreateEventExW(0, 0, 0, 0); +#else // defined(BOOST_ASIO_WINDOWS_APP) + events_[1] = ::CreateEventW(0, false, false, 0); +#endif // defined(BOOST_ASIO_WINDOWS_APP) if (!events_[1]) { DWORD last_error = ::GetLastError(); diff --git a/3party/boost/boost/asio/detail/impl/win_iocp_handle_service.ipp b/3party/boost/boost/asio/detail/impl/win_iocp_handle_service.ipp index b0c784e556..ea513bc1dd 100644 --- a/3party/boost/boost/asio/detail/impl/win_iocp_handle_service.ipp +++ b/3party/boost/boost/asio/detail/impl/win_iocp_handle_service.ipp @@ -2,7 +2,7 @@ // detail/impl/win_iocp_handle_service.ipp // ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ // -// Copyright (c) 2003-2015 Christopher M. Kohlhoff (chris at kohlhoff dot com) +// Copyright (c) 2003-2017 Christopher M. Kohlhoff (chris at kohlhoff dot com) // Copyright (c) 2008 Rep Invariant Systems, Inc. (info@repinvariant.com) // // Distributed under the Boost Software License, Version 1.0. (See accompanying @@ -40,7 +40,7 @@ public: OffsetHigh = 0; // Create a non-signalled manual-reset event, for GetOverlappedResult. - hEvent = ::CreateEvent(0, TRUE, FALSE, 0); + hEvent = ::CreateEventW(0, TRUE, FALSE, 0); if (hEvent) { // As documented in GetQueuedCompletionStatus, setting the low order diff --git a/3party/boost/boost/asio/detail/impl/win_iocp_io_service.hpp b/3party/boost/boost/asio/detail/impl/win_iocp_io_service.hpp index ac53cbed89..e3505cb852 100644 --- a/3party/boost/boost/asio/detail/impl/win_iocp_io_service.hpp +++ b/3party/boost/boost/asio/detail/impl/win_iocp_io_service.hpp @@ -2,7 +2,7 @@ // detail/impl/win_iocp_io_service.hpp // ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ // -// Copyright (c) 2003-2015 Christopher M. Kohlhoff (chris at kohlhoff dot com) +// Copyright (c) 2003-2017 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) diff --git a/3party/boost/boost/asio/detail/impl/win_iocp_io_service.ipp b/3party/boost/boost/asio/detail/impl/win_iocp_io_service.ipp index ca7848b75c..a5bfcbbdea 100644 --- a/3party/boost/boost/asio/detail/impl/win_iocp_io_service.ipp +++ b/3party/boost/boost/asio/detail/impl/win_iocp_io_service.ipp @@ -2,7 +2,7 @@ // detail/impl/win_iocp_io_service.ipp // ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ // -// Copyright (c) 2003-2015 Christopher M. Kohlhoff (chris at kohlhoff dot com) +// Copyright (c) 2003-2017 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) diff --git a/3party/boost/boost/asio/detail/impl/win_iocp_serial_port_service.ipp b/3party/boost/boost/asio/detail/impl/win_iocp_serial_port_service.ipp index cb8a64ebc2..32ba34684b 100644 --- a/3party/boost/boost/asio/detail/impl/win_iocp_serial_port_service.ipp +++ b/3party/boost/boost/asio/detail/impl/win_iocp_serial_port_service.ipp @@ -2,7 +2,7 @@ // detail/impl/win_iocp_serial_port_service.ipp // ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ // -// Copyright (c) 2003-2015 Christopher M. Kohlhoff (chris at kohlhoff dot com) +// Copyright (c) 2003-2017 Christopher M. Kohlhoff (chris at kohlhoff dot com) // Copyright (c) 2008 Rep Invariant Systems, Inc. (info@repinvariant.com) // // Distributed under the Boost Software License, Version 1.0. (See accompanying diff --git a/3party/boost/boost/asio/detail/impl/win_iocp_socket_service_base.ipp b/3party/boost/boost/asio/detail/impl/win_iocp_socket_service_base.ipp index a9361cc1d3..22818f7e92 100644 --- a/3party/boost/boost/asio/detail/impl/win_iocp_socket_service_base.ipp +++ b/3party/boost/boost/asio/detail/impl/win_iocp_socket_service_base.ipp @@ -2,7 +2,7 @@ // detail/impl/win_iocp_socket_service_base.ipp // ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ // -// Copyright (c) 2003-2015 Christopher M. Kohlhoff (chris at kohlhoff dot com) +// Copyright (c) 2003-2017 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) diff --git a/3party/boost/boost/asio/detail/impl/win_mutex.ipp b/3party/boost/boost/asio/detail/impl/win_mutex.ipp index 60ce9dd598..c4be08c5e9 100644 --- a/3party/boost/boost/asio/detail/impl/win_mutex.ipp +++ b/3party/boost/boost/asio/detail/impl/win_mutex.ipp @@ -2,7 +2,7 @@ // detail/impl/win_mutex.ipp // ~~~~~~~~~~~~~~~~~~~~~~~~~ // -// Copyright (c) 2003-2015 Christopher M. Kohlhoff (chris at kohlhoff dot com) +// Copyright (c) 2003-2017 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) @@ -44,6 +44,9 @@ int win_mutex::do_init() // we'll just call the Windows API and hope. # if defined(UNDER_CE) ::InitializeCriticalSection(&crit_section_); +# elif defined(BOOST_ASIO_WINDOWS_APP) + if (!::InitializeCriticalSectionEx(&crit_section_, 0, 0)) + return ::GetLastError(); # else if (!::InitializeCriticalSectionAndSpinCount(&crit_section_, 0x80000000)) return ::GetLastError(); @@ -54,6 +57,9 @@ int win_mutex::do_init() { # if defined(UNDER_CE) ::InitializeCriticalSection(&crit_section_); +# elif defined(BOOST_ASIO_WINDOWS_APP) + if (!::InitializeCriticalSectionEx(&crit_section_, 0, 0)) + return ::GetLastError(); # else if (!::InitializeCriticalSectionAndSpinCount(&crit_section_, 0x80000000)) return ::GetLastError(); diff --git a/3party/boost/boost/asio/detail/impl/win_object_handle_service.ipp b/3party/boost/boost/asio/detail/impl/win_object_handle_service.ipp index 58eefe5fe7..a940161cba 100644 --- a/3party/boost/boost/asio/detail/impl/win_object_handle_service.ipp +++ b/3party/boost/boost/asio/detail/impl/win_object_handle_service.ipp @@ -2,7 +2,7 @@ // detail/impl/win_object_handle_service.ipp // ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ // -// Copyright (c) 2003-2015 Christopher M. Kohlhoff (chris at kohlhoff dot com) +// Copyright (c) 2003-2017 Christopher M. Kohlhoff (chris at kohlhoff dot com) // Copyright (c) 2011 Boris Schaeling (boris@highscore.de) // // Distributed under the Boost Software License, Version 1.0. (See accompanying diff --git a/3party/boost/boost/asio/detail/impl/win_static_mutex.ipp b/3party/boost/boost/asio/detail/impl/win_static_mutex.ipp index 02b44b5d37..9b29da0d93 100644 --- a/3party/boost/boost/asio/detail/impl/win_static_mutex.ipp +++ b/3party/boost/boost/asio/detail/impl/win_static_mutex.ipp @@ -2,7 +2,7 @@ // detail/impl/win_static_mutex.ipp // ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ // -// Copyright (c) 2003-2015 Christopher M. Kohlhoff (chris at kohlhoff dot com) +// Copyright (c) 2003-2017 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) @@ -50,13 +50,23 @@ int win_static_mutex::do_init() mutex_name, 128, L"asio-58CCDC44-6264-4842-90C2-F3C545CB8AA7-%u-%p", static_cast(::GetCurrentProcessId()), this); +#if defined(BOOST_ASIO_WINDOWS_APP) + HANDLE mutex = ::CreateMutexExW(0, mutex_name, CREATE_MUTEX_INITIAL_OWNER, 0); +#else // defined(BOOST_ASIO_WINDOWS_APP) HANDLE mutex = ::CreateMutexW(0, TRUE, mutex_name); +#endif // defined(BOOST_ASIO_WINDOWS_APP) DWORD last_error = ::GetLastError(); if (mutex == 0) return ::GetLastError(); if (last_error == ERROR_ALREADY_EXISTS) + { +#if defined(BOOST_ASIO_WINDOWS_APP) + ::WaitForSingleObjectEx(mutex, INFINITE, false); +#else // defined(BOOST_ASIO_WINDOWS_APP) ::WaitForSingleObject(mutex, INFINITE); +#endif // defined(BOOST_ASIO_WINDOWS_APP) + } if (initialised_) { @@ -84,6 +94,14 @@ int win_static_mutex::do_init() { # if defined(UNDER_CE) ::InitializeCriticalSection(&crit_section_); +# elif defined(BOOST_ASIO_WINDOWS_APP) + if (!::InitializeCriticalSectionEx(&crit_section_, 0, 0)) + { + last_error = ::GetLastError(); + ::ReleaseMutex(mutex); + ::CloseHandle(mutex); + return last_error; + } # else if (!::InitializeCriticalSectionAndSpinCount(&crit_section_, 0x80000000)) { diff --git a/3party/boost/boost/asio/detail/impl/win_thread.ipp b/3party/boost/boost/asio/detail/impl/win_thread.ipp index 727c122e95..e2d9384007 100644 --- a/3party/boost/boost/asio/detail/impl/win_thread.ipp +++ b/3party/boost/boost/asio/detail/impl/win_thread.ipp @@ -2,7 +2,7 @@ // detail/impl/win_thread.ipp // ~~~~~~~~~~~~~~~~~~~~~~~~~~ // -// Copyright (c) 2003-2015 Christopher M. Kohlhoff (chris at kohlhoff dot com) +// Copyright (c) 2003-2017 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) @@ -17,7 +17,9 @@ #include -#if defined(BOOST_ASIO_WINDOWS) && !defined(UNDER_CE) +#if defined(BOOST_ASIO_WINDOWS) \ + && !defined(BOOST_ASIO_WINDOWS_APP) \ + && !defined(UNDER_CE) #include #include @@ -57,7 +59,7 @@ void win_thread::join() void win_thread::start_thread(func_base* arg, unsigned int stack_size) { ::HANDLE entry_event = 0; - arg->entry_event_ = entry_event = ::CreateEvent(0, true, false, 0); + arg->entry_event_ = entry_event = ::CreateEventW(0, true, false, 0); if (!entry_event) { DWORD last_error = ::GetLastError(); @@ -67,7 +69,7 @@ void win_thread::start_thread(func_base* arg, unsigned int stack_size) boost::asio::detail::throw_error(ec, "thread.entry_event"); } - arg->exit_event_ = exit_event_ = ::CreateEvent(0, true, false, 0); + arg->exit_event_ = exit_event_ = ::CreateEventW(0, true, false, 0); if (!exit_event_) { DWORD last_error = ::GetLastError(); @@ -136,6 +138,8 @@ void __stdcall apc_function(ULONG_PTR) {} #include -#endif // defined(BOOST_ASIO_WINDOWS) && !defined(UNDER_CE) +#endif // defined(BOOST_ASIO_WINDOWS) + // && !defined(BOOST_ASIO_WINDOWS_APP) + // && !defined(UNDER_CE) #endif // BOOST_ASIO_DETAIL_IMPL_WIN_THREAD_IPP diff --git a/3party/boost/boost/asio/detail/impl/win_tss_ptr.ipp b/3party/boost/boost/asio/detail/impl/win_tss_ptr.ipp index bd4dc23771..3390066695 100644 --- a/3party/boost/boost/asio/detail/impl/win_tss_ptr.ipp +++ b/3party/boost/boost/asio/detail/impl/win_tss_ptr.ipp @@ -2,7 +2,7 @@ // detail/impl/win_tss_ptr.ipp // ~~~~~~~~~~~~~~~~~~~~~~~~~~~ // -// Copyright (c) 2003-2015 Christopher M. Kohlhoff (chris at kohlhoff dot com) +// Copyright (c) 2003-2017 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) diff --git a/3party/boost/boost/asio/detail/impl/winrt_ssocket_service_base.ipp b/3party/boost/boost/asio/detail/impl/winrt_ssocket_service_base.ipp index b578f90e39..f5990a97ad 100644 --- a/3party/boost/boost/asio/detail/impl/winrt_ssocket_service_base.ipp +++ b/3party/boost/boost/asio/detail/impl/winrt_ssocket_service_base.ipp @@ -2,7 +2,7 @@ // detail/impl/winrt_ssocket_service_base.ipp // ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ // -// Copyright (c) 2003-2015 Christopher M. Kohlhoff (chris at kohlhoff dot com) +// Copyright (c) 2003-2017 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) diff --git a/3party/boost/boost/asio/detail/impl/winrt_timer_scheduler.hpp b/3party/boost/boost/asio/detail/impl/winrt_timer_scheduler.hpp index 2de1566988..8d93e57962 100644 --- a/3party/boost/boost/asio/detail/impl/winrt_timer_scheduler.hpp +++ b/3party/boost/boost/asio/detail/impl/winrt_timer_scheduler.hpp @@ -2,7 +2,7 @@ // detail/impl/winrt_timer_scheduler.hpp // ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ // -// Copyright (c) 2003-2015 Christopher M. Kohlhoff (chris at kohlhoff dot com) +// Copyright (c) 2003-2017 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) diff --git a/3party/boost/boost/asio/detail/impl/winrt_timer_scheduler.ipp b/3party/boost/boost/asio/detail/impl/winrt_timer_scheduler.ipp index dc65bdcd2e..914849d822 100644 --- a/3party/boost/boost/asio/detail/impl/winrt_timer_scheduler.ipp +++ b/3party/boost/boost/asio/detail/impl/winrt_timer_scheduler.ipp @@ -2,7 +2,7 @@ // detail/impl/winrt_timer_scheduler.ipp // ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ // -// Copyright (c) 2003-2015 Christopher M. Kohlhoff (chris at kohlhoff dot com) +// Copyright (c) 2003-2017 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) diff --git a/3party/boost/boost/asio/detail/impl/winsock_init.ipp b/3party/boost/boost/asio/detail/impl/winsock_init.ipp index af6294041a..57ef612547 100644 --- a/3party/boost/boost/asio/detail/impl/winsock_init.ipp +++ b/3party/boost/boost/asio/detail/impl/winsock_init.ipp @@ -2,7 +2,7 @@ // detail/impl/winsock_init.ipp // ~~~~~~~~~~~~~~~~~~~~~~~~~~~~ // -// Copyright (c) 2003-2015 Christopher M. Kohlhoff (chris at kohlhoff dot com) +// Copyright (c) 2003-2017 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) diff --git a/3party/boost/boost/asio/detail/io_control.hpp b/3party/boost/boost/asio/detail/io_control.hpp index e7b70dd3f3..6c7527d1cf 100644 --- a/3party/boost/boost/asio/detail/io_control.hpp +++ b/3party/boost/boost/asio/detail/io_control.hpp @@ -2,7 +2,7 @@ // detail/io_control.hpp // ~~~~~~~~~~~~~~~~~~~~~ // -// Copyright (c) 2003-2015 Christopher M. Kohlhoff (chris at kohlhoff dot com) +// Copyright (c) 2003-2017 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) diff --git a/3party/boost/boost/asio/detail/keyword_tss_ptr.hpp b/3party/boost/boost/asio/detail/keyword_tss_ptr.hpp index dd36d31ac1..8a93adea1e 100644 --- a/3party/boost/boost/asio/detail/keyword_tss_ptr.hpp +++ b/3party/boost/boost/asio/detail/keyword_tss_ptr.hpp @@ -2,7 +2,7 @@ // detail/keyword_tss_ptr.hpp // ~~~~~~~~~~~~~~~~~~~~~~~~~~ // -// Copyright (c) 2003-2015 Christopher M. Kohlhoff (chris at kohlhoff dot com) +// Copyright (c) 2003-2017 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) diff --git a/3party/boost/boost/asio/detail/kqueue_reactor.hpp b/3party/boost/boost/asio/detail/kqueue_reactor.hpp index 7addc4ae46..6aba2b264f 100644 --- a/3party/boost/boost/asio/detail/kqueue_reactor.hpp +++ b/3party/boost/boost/asio/detail/kqueue_reactor.hpp @@ -2,7 +2,7 @@ // detail/kqueue_reactor.hpp // ~~~~~~~~~~~~~~~~~~~~~~~~~ // -// Copyright (c) 2003-2015 Christopher M. Kohlhoff (chris at kohlhoff dot com) +// Copyright (c) 2003-2017 Christopher M. Kohlhoff (chris at kohlhoff dot com) // Copyright (c) 2005 Stefan Arentz (stefan at soze dot com) // // Distributed under the Boost Software License, Version 1.0. (See accompanying diff --git a/3party/boost/boost/asio/detail/local_free_on_block_exit.hpp b/3party/boost/boost/asio/detail/local_free_on_block_exit.hpp index 47b5dafc46..a51221676f 100644 --- a/3party/boost/boost/asio/detail/local_free_on_block_exit.hpp +++ b/3party/boost/boost/asio/detail/local_free_on_block_exit.hpp @@ -2,7 +2,7 @@ // detail/local_free_on_block_exit.hpp // ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ // -// Copyright (c) 2003-2015 Christopher M. Kohlhoff (chris at kohlhoff dot com) +// Copyright (c) 2003-2017 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) @@ -18,6 +18,7 @@ #include #if defined(BOOST_ASIO_WINDOWS) || defined(__CYGWIN__) +#if !defined(BOOST_ASIO_WINDOWS_APP) #include #include @@ -54,6 +55,7 @@ private: #include +#endif // !defined(BOOST_ASIO_WINDOWS_APP) #endif // defined(BOOST_ASIO_WINDOWS) || defined(__CYGWIN__) #endif // BOOST_ASIO_DETAIL_LOCAL_FREE_ON_BLOCK_EXIT_HPP diff --git a/3party/boost/boost/asio/detail/macos_fenced_block.hpp b/3party/boost/boost/asio/detail/macos_fenced_block.hpp index 69849b5e08..5ab7f91c5e 100644 --- a/3party/boost/boost/asio/detail/macos_fenced_block.hpp +++ b/3party/boost/boost/asio/detail/macos_fenced_block.hpp @@ -2,7 +2,7 @@ // detail/macos_fenced_block.hpp // ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ // -// Copyright (c) 2003-2015 Christopher M. Kohlhoff (chris at kohlhoff dot com) +// Copyright (c) 2003-2017 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) diff --git a/3party/boost/boost/asio/detail/memory.hpp b/3party/boost/boost/asio/detail/memory.hpp new file mode 100644 index 0000000000..479b57a3d1 --- /dev/null +++ b/3party/boost/boost/asio/detail/memory.hpp @@ -0,0 +1,31 @@ +// +// detail/memory.hpp +// ~~~~~~~~~~~~~~~~~ +// +// Copyright (c) 2003-2017 Christopher M. Kohlhoff (chris at kohlhoff dot com) +// +// Distributed under the Boost Software License, Version 1.0. (See accompanying +// file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt) +// + +#ifndef BOOST_ASIO_DETAIL_MEMORY_HPP +#define BOOST_ASIO_DETAIL_MEMORY_HPP + +#if defined(_MSC_VER) && (_MSC_VER >= 1200) +# pragma once +#endif // defined(_MSC_VER) && (_MSC_VER >= 1200) + +#include +#include + +#if defined(BOOST_ASIO_HAS_CXX11_ALLOCATORS) +# define BOOST_ASIO_REBIND_ALLOC(alloc, t) \ + typename std::allocator_traits::template rebind_alloc + /**/ +#else // defined(BOOST_ASIO_HAS_CXX11_ALLOCATORS) +# define BOOST_ASIO_REBIND_ALLOC(alloc, t) \ + typename alloc::template rebind::other + /**/ +#endif // defined(BOOST_ASIO_HAS_CXX11_ALLOCATORS) + +#endif // BOOST_ASIO_DETAIL_MEMORY_HPP diff --git a/3party/boost/boost/asio/detail/mutex.hpp b/3party/boost/boost/asio/detail/mutex.hpp index e8ce002629..7c6917d83f 100644 --- a/3party/boost/boost/asio/detail/mutex.hpp +++ b/3party/boost/boost/asio/detail/mutex.hpp @@ -2,7 +2,7 @@ // detail/mutex.hpp // ~~~~~~~~~~~~~~~~ // -// Copyright (c) 2003-2015 Christopher M. Kohlhoff (chris at kohlhoff dot com) +// Copyright (c) 2003-2017 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) diff --git a/3party/boost/boost/asio/detail/noncopyable.hpp b/3party/boost/boost/asio/detail/noncopyable.hpp index 0214bffa6d..5f946c3f78 100644 --- a/3party/boost/boost/asio/detail/noncopyable.hpp +++ b/3party/boost/boost/asio/detail/noncopyable.hpp @@ -2,7 +2,7 @@ // detail/noncopyable.hpp // ~~~~~~~~~~~~~~~~~~~~~~ // -// Copyright (c) 2003-2015 Christopher M. Kohlhoff (chris at kohlhoff dot com) +// Copyright (c) 2003-2017 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) diff --git a/3party/boost/boost/asio/detail/null_event.hpp b/3party/boost/boost/asio/detail/null_event.hpp index 310cd52f24..28ba5ede55 100644 --- a/3party/boost/boost/asio/detail/null_event.hpp +++ b/3party/boost/boost/asio/detail/null_event.hpp @@ -2,7 +2,7 @@ // detail/null_event.hpp // ~~~~~~~~~~~~~~~~~~~~~ // -// Copyright (c) 2003-2015 Christopher M. Kohlhoff (chris at kohlhoff dot com) +// Copyright (c) 2003-2017 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) diff --git a/3party/boost/boost/asio/detail/null_fenced_block.hpp b/3party/boost/boost/asio/detail/null_fenced_block.hpp index a975b86c82..27029b9e31 100644 --- a/3party/boost/boost/asio/detail/null_fenced_block.hpp +++ b/3party/boost/boost/asio/detail/null_fenced_block.hpp @@ -2,7 +2,7 @@ // detail/null_fenced_block.hpp // ~~~~~~~~~~~~~~~~~~~~~~~~~~~~ // -// Copyright (c) 2003-2015 Christopher M. Kohlhoff (chris at kohlhoff dot com) +// Copyright (c) 2003-2017 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) diff --git a/3party/boost/boost/asio/detail/null_mutex.hpp b/3party/boost/boost/asio/detail/null_mutex.hpp index f00bd66b5a..b3f032b72d 100644 --- a/3party/boost/boost/asio/detail/null_mutex.hpp +++ b/3party/boost/boost/asio/detail/null_mutex.hpp @@ -2,7 +2,7 @@ // detail/null_mutex.hpp // ~~~~~~~~~~~~~~~~~~~~~ // -// Copyright (c) 2003-2015 Christopher M. Kohlhoff (chris at kohlhoff dot com) +// Copyright (c) 2003-2017 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) diff --git a/3party/boost/boost/asio/detail/null_reactor.hpp b/3party/boost/boost/asio/detail/null_reactor.hpp index 59a48de0ab..2cfce63a4c 100644 --- a/3party/boost/boost/asio/detail/null_reactor.hpp +++ b/3party/boost/boost/asio/detail/null_reactor.hpp @@ -2,7 +2,7 @@ // detail/null_reactor.hpp // ~~~~~~~~~~~~~~~~~~~~~~~ // -// Copyright (c) 2003-2015 Christopher M. Kohlhoff (chris at kohlhoff dot com) +// Copyright (c) 2003-2017 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) diff --git a/3party/boost/boost/asio/detail/null_signal_blocker.hpp b/3party/boost/boost/asio/detail/null_signal_blocker.hpp index f3af24d8d8..4c00ec80c3 100644 --- a/3party/boost/boost/asio/detail/null_signal_blocker.hpp +++ b/3party/boost/boost/asio/detail/null_signal_blocker.hpp @@ -2,7 +2,7 @@ // detail/null_signal_blocker.hpp // ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ // -// Copyright (c) 2003-2015 Christopher M. Kohlhoff (chris at kohlhoff dot com) +// Copyright (c) 2003-2017 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) diff --git a/3party/boost/boost/asio/detail/null_socket_service.hpp b/3party/boost/boost/asio/detail/null_socket_service.hpp index 942eb82821..bf06ebb545 100644 --- a/3party/boost/boost/asio/detail/null_socket_service.hpp +++ b/3party/boost/boost/asio/detail/null_socket_service.hpp @@ -2,7 +2,7 @@ // detail/null_socket_service.hpp // ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ // -// Copyright (c) 2003-2015 Christopher M. Kohlhoff (chris at kohlhoff dot com) +// Copyright (c) 2003-2017 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) @@ -79,6 +79,7 @@ public: // Move-construct a new socket implementation from another protocol type. template void converting_move_construct(implementation_type&, + null_socket_service&, typename null_socket_service::implementation_type&) { } diff --git a/3party/boost/boost/asio/detail/null_static_mutex.hpp b/3party/boost/boost/asio/detail/null_static_mutex.hpp index c13f9bcf85..ba644719fc 100644 --- a/3party/boost/boost/asio/detail/null_static_mutex.hpp +++ b/3party/boost/boost/asio/detail/null_static_mutex.hpp @@ -2,7 +2,7 @@ // detail/null_static_mutex.hpp // ~~~~~~~~~~~~~~~~~~~~~~~~~~~~ // -// Copyright (c) 2003-2015 Christopher M. Kohlhoff (chris at kohlhoff dot com) +// Copyright (c) 2003-2017 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) diff --git a/3party/boost/boost/asio/detail/null_thread.hpp b/3party/boost/boost/asio/detail/null_thread.hpp index e87917a0e8..5e9b458638 100644 --- a/3party/boost/boost/asio/detail/null_thread.hpp +++ b/3party/boost/boost/asio/detail/null_thread.hpp @@ -2,7 +2,7 @@ // detail/null_thread.hpp // ~~~~~~~~~~~~~~~~~~~~~~ // -// Copyright (c) 2003-2015 Christopher M. Kohlhoff (chris at kohlhoff dot com) +// Copyright (c) 2003-2017 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) diff --git a/3party/boost/boost/asio/detail/null_tss_ptr.hpp b/3party/boost/boost/asio/detail/null_tss_ptr.hpp index 016c17d450..30306770f4 100644 --- a/3party/boost/boost/asio/detail/null_tss_ptr.hpp +++ b/3party/boost/boost/asio/detail/null_tss_ptr.hpp @@ -2,7 +2,7 @@ // detail/null_tss_ptr.hpp // ~~~~~~~~~~~~~~~~~~~~~~~ // -// Copyright (c) 2003-2015 Christopher M. Kohlhoff (chris at kohlhoff dot com) +// Copyright (c) 2003-2017 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) diff --git a/3party/boost/boost/asio/detail/object_pool.hpp b/3party/boost/boost/asio/detail/object_pool.hpp index 188a81477f..692efed09d 100644 --- a/3party/boost/boost/asio/detail/object_pool.hpp +++ b/3party/boost/boost/asio/detail/object_pool.hpp @@ -2,7 +2,7 @@ // detail/object_pool.hpp // ~~~~~~~~~~~~~~~~~~~~~~ // -// Copyright (c) 2003-2015 Christopher M. Kohlhoff (chris at kohlhoff dot com) +// Copyright (c) 2003-2017 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) diff --git a/3party/boost/boost/asio/detail/old_win_sdk_compat.hpp b/3party/boost/boost/asio/detail/old_win_sdk_compat.hpp index 216cd891af..403ff75837 100644 --- a/3party/boost/boost/asio/detail/old_win_sdk_compat.hpp +++ b/3party/boost/boost/asio/detail/old_win_sdk_compat.hpp @@ -2,7 +2,7 @@ // detail/old_win_sdk_compat.hpp // ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ // -// Copyright (c) 2003-2015 Christopher M. Kohlhoff (chris at kohlhoff dot com) +// Copyright (c) 2003-2017 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) diff --git a/3party/boost/boost/asio/detail/op_queue.hpp b/3party/boost/boost/asio/detail/op_queue.hpp index be54b9a2f2..9605248567 100644 --- a/3party/boost/boost/asio/detail/op_queue.hpp +++ b/3party/boost/boost/asio/detail/op_queue.hpp @@ -2,7 +2,7 @@ // detail/op_queue.hpp // ~~~~~~~~~~~~~~~~~~~ // -// Copyright (c) 2003-2015 Christopher M. Kohlhoff (chris at kohlhoff dot com) +// Copyright (c) 2003-2017 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) diff --git a/3party/boost/boost/asio/detail/operation.hpp b/3party/boost/boost/asio/detail/operation.hpp index dac89f9907..a186a1f4d8 100644 --- a/3party/boost/boost/asio/detail/operation.hpp +++ b/3party/boost/boost/asio/detail/operation.hpp @@ -2,7 +2,7 @@ // detail/operation.hpp // ~~~~~~~~~~~~~~~~~~~~ // -// Copyright (c) 2003-2015 Christopher M. Kohlhoff (chris at kohlhoff dot com) +// Copyright (c) 2003-2017 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) diff --git a/3party/boost/boost/asio/detail/pipe_select_interrupter.hpp b/3party/boost/boost/asio/detail/pipe_select_interrupter.hpp index b5efdfc286..3a51baa78d 100644 --- a/3party/boost/boost/asio/detail/pipe_select_interrupter.hpp +++ b/3party/boost/boost/asio/detail/pipe_select_interrupter.hpp @@ -2,7 +2,7 @@ // detail/pipe_select_interrupter.hpp // ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ // -// Copyright (c) 2003-2015 Christopher M. Kohlhoff (chris at kohlhoff dot com) +// Copyright (c) 2003-2017 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) diff --git a/3party/boost/boost/asio/detail/pop_options.hpp b/3party/boost/boost/asio/detail/pop_options.hpp index 4f56152904..29213ede7b 100644 --- a/3party/boost/boost/asio/detail/pop_options.hpp +++ b/3party/boost/boost/asio/detail/pop_options.hpp @@ -2,7 +2,7 @@ // detail/pop_options.hpp // ~~~~~~~~~~~~~~~~~~~~~~ // -// Copyright (c) 2003-2015 Christopher M. Kohlhoff (chris at kohlhoff dot com) +// Copyright (c) 2003-2017 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) diff --git a/3party/boost/boost/asio/detail/posix_event.hpp b/3party/boost/boost/asio/detail/posix_event.hpp index 3b905ba5ad..4eae96e2a8 100644 --- a/3party/boost/boost/asio/detail/posix_event.hpp +++ b/3party/boost/boost/asio/detail/posix_event.hpp @@ -2,7 +2,7 @@ // detail/posix_event.hpp // ~~~~~~~~~~~~~~~~~~~~~~ // -// Copyright (c) 2003-2015 Christopher M. Kohlhoff (chris at kohlhoff dot com) +// Copyright (c) 2003-2017 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) diff --git a/3party/boost/boost/asio/detail/posix_fd_set_adapter.hpp b/3party/boost/boost/asio/detail/posix_fd_set_adapter.hpp index cf580da666..964f11ff88 100644 --- a/3party/boost/boost/asio/detail/posix_fd_set_adapter.hpp +++ b/3party/boost/boost/asio/detail/posix_fd_set_adapter.hpp @@ -2,7 +2,7 @@ // detail/posix_fd_set_adapter.hpp // ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ // -// Copyright (c) 2003-2015 Christopher M. Kohlhoff (chris at kohlhoff dot com) +// Copyright (c) 2003-2017 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) diff --git a/3party/boost/boost/asio/detail/posix_mutex.hpp b/3party/boost/boost/asio/detail/posix_mutex.hpp index 7ce1cc2755..3179281a8f 100644 --- a/3party/boost/boost/asio/detail/posix_mutex.hpp +++ b/3party/boost/boost/asio/detail/posix_mutex.hpp @@ -2,7 +2,7 @@ // detail/posix_mutex.hpp // ~~~~~~~~~~~~~~~~~~~~~~ // -// Copyright (c) 2003-2015 Christopher M. Kohlhoff (chris at kohlhoff dot com) +// Copyright (c) 2003-2017 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) diff --git a/3party/boost/boost/asio/detail/posix_signal_blocker.hpp b/3party/boost/boost/asio/detail/posix_signal_blocker.hpp index b27dd1c621..b774727497 100644 --- a/3party/boost/boost/asio/detail/posix_signal_blocker.hpp +++ b/3party/boost/boost/asio/detail/posix_signal_blocker.hpp @@ -2,7 +2,7 @@ // detail/posix_signal_blocker.hpp // ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ // -// Copyright (c) 2003-2015 Christopher M. Kohlhoff (chris at kohlhoff dot com) +// Copyright (c) 2003-2017 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) diff --git a/3party/boost/boost/asio/detail/posix_static_mutex.hpp b/3party/boost/boost/asio/detail/posix_static_mutex.hpp index 7077bf31cf..3895bfc60b 100644 --- a/3party/boost/boost/asio/detail/posix_static_mutex.hpp +++ b/3party/boost/boost/asio/detail/posix_static_mutex.hpp @@ -2,7 +2,7 @@ // detail/posix_static_mutex.hpp // ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ // -// Copyright (c) 2003-2015 Christopher M. Kohlhoff (chris at kohlhoff dot com) +// Copyright (c) 2003-2017 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) diff --git a/3party/boost/boost/asio/detail/posix_thread.hpp b/3party/boost/boost/asio/detail/posix_thread.hpp index f862162355..ddf5ba46f3 100644 --- a/3party/boost/boost/asio/detail/posix_thread.hpp +++ b/3party/boost/boost/asio/detail/posix_thread.hpp @@ -2,7 +2,7 @@ // detail/posix_thread.hpp // ~~~~~~~~~~~~~~~~~~~~~~~ // -// Copyright (c) 2003-2015 Christopher M. Kohlhoff (chris at kohlhoff dot com) +// Copyright (c) 2003-2017 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) diff --git a/3party/boost/boost/asio/detail/posix_tss_ptr.hpp b/3party/boost/boost/asio/detail/posix_tss_ptr.hpp index 95d56f0697..64b7d12021 100644 --- a/3party/boost/boost/asio/detail/posix_tss_ptr.hpp +++ b/3party/boost/boost/asio/detail/posix_tss_ptr.hpp @@ -2,7 +2,7 @@ // detail/posix_tss_ptr.hpp // ~~~~~~~~~~~~~~~~~~~~~~~~ // -// Copyright (c) 2003-2015 Christopher M. Kohlhoff (chris at kohlhoff dot com) +// Copyright (c) 2003-2017 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) diff --git a/3party/boost/boost/asio/detail/push_options.hpp b/3party/boost/boost/asio/detail/push_options.hpp index f8e9f32345..ae189c0519 100644 --- a/3party/boost/boost/asio/detail/push_options.hpp +++ b/3party/boost/boost/asio/detail/push_options.hpp @@ -2,7 +2,7 @@ // detail/push_options.hpp // ~~~~~~~~~~~~~~~~~~~~~~~ // -// Copyright (c) 2003-2015 Christopher M. Kohlhoff (chris at kohlhoff dot com) +// Copyright (c) 2003-2017 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) diff --git a/3party/boost/boost/asio/detail/reactive_descriptor_service.hpp b/3party/boost/boost/asio/detail/reactive_descriptor_service.hpp index 6bf4af7039..3d6d1e98c8 100644 --- a/3party/boost/boost/asio/detail/reactive_descriptor_service.hpp +++ b/3party/boost/boost/asio/detail/reactive_descriptor_service.hpp @@ -2,7 +2,7 @@ // detail/reactive_descriptor_service.hpp // ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ // -// Copyright (c) 2003-2015 Christopher M. Kohlhoff (chris at kohlhoff dot com) +// Copyright (c) 2003-2017 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) diff --git a/3party/boost/boost/asio/detail/reactive_null_buffers_op.hpp b/3party/boost/boost/asio/detail/reactive_null_buffers_op.hpp index 7e6f7b180c..4b1c7fedbf 100644 --- a/3party/boost/boost/asio/detail/reactive_null_buffers_op.hpp +++ b/3party/boost/boost/asio/detail/reactive_null_buffers_op.hpp @@ -2,7 +2,7 @@ // detail/reactive_null_buffers_op.hpp // ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ // -// Copyright (c) 2003-2015 Christopher M. Kohlhoff (chris at kohlhoff dot com) +// Copyright (c) 2003-2017 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) diff --git a/3party/boost/boost/asio/detail/reactive_serial_port_service.hpp b/3party/boost/boost/asio/detail/reactive_serial_port_service.hpp index d8ca699505..4976fbd08e 100644 --- a/3party/boost/boost/asio/detail/reactive_serial_port_service.hpp +++ b/3party/boost/boost/asio/detail/reactive_serial_port_service.hpp @@ -2,7 +2,7 @@ // detail/reactive_serial_port_service.hpp // ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ // -// Copyright (c) 2003-2015 Christopher M. Kohlhoff (chris at kohlhoff dot com) +// Copyright (c) 2003-2017 Christopher M. Kohlhoff (chris at kohlhoff dot com) // Copyright (c) 2008 Rep Invariant Systems, Inc. (info@repinvariant.com) // // Distributed under the Boost Software License, Version 1.0. (See accompanying diff --git a/3party/boost/boost/asio/detail/reactive_socket_accept_op.hpp b/3party/boost/boost/asio/detail/reactive_socket_accept_op.hpp index b6165c4c5c..fec6bddb55 100644 --- a/3party/boost/boost/asio/detail/reactive_socket_accept_op.hpp +++ b/3party/boost/boost/asio/detail/reactive_socket_accept_op.hpp @@ -2,7 +2,7 @@ // detail/reactive_socket_accept_op.hpp // ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ // -// Copyright (c) 2003-2015 Christopher M. Kohlhoff (chris at kohlhoff dot com) +// Copyright (c) 2003-2017 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) diff --git a/3party/boost/boost/asio/detail/reactive_socket_connect_op.hpp b/3party/boost/boost/asio/detail/reactive_socket_connect_op.hpp index ff7422fe81..809d63b7ae 100644 --- a/3party/boost/boost/asio/detail/reactive_socket_connect_op.hpp +++ b/3party/boost/boost/asio/detail/reactive_socket_connect_op.hpp @@ -2,7 +2,7 @@ // detail/reactive_socket_connect_op.hpp // ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ // -// Copyright (c) 2003-2015 Christopher M. Kohlhoff (chris at kohlhoff dot com) +// Copyright (c) 2003-2017 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) diff --git a/3party/boost/boost/asio/detail/reactive_socket_recv_op.hpp b/3party/boost/boost/asio/detail/reactive_socket_recv_op.hpp index 32e783706a..751160c48f 100644 --- a/3party/boost/boost/asio/detail/reactive_socket_recv_op.hpp +++ b/3party/boost/boost/asio/detail/reactive_socket_recv_op.hpp @@ -2,7 +2,7 @@ // detail/reactive_socket_recv_op.hpp // ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ // -// Copyright (c) 2003-2015 Christopher M. Kohlhoff (chris at kohlhoff dot com) +// Copyright (c) 2003-2017 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) diff --git a/3party/boost/boost/asio/detail/reactive_socket_recvfrom_op.hpp b/3party/boost/boost/asio/detail/reactive_socket_recvfrom_op.hpp index 1c2234017b..14829a0d75 100644 --- a/3party/boost/boost/asio/detail/reactive_socket_recvfrom_op.hpp +++ b/3party/boost/boost/asio/detail/reactive_socket_recvfrom_op.hpp @@ -2,7 +2,7 @@ // detail/reactive_socket_recvfrom_op.hpp // ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ // -// Copyright (c) 2003-2015 Christopher M. Kohlhoff (chris at kohlhoff dot com) +// Copyright (c) 2003-2017 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) diff --git a/3party/boost/boost/asio/detail/reactive_socket_recvmsg_op.hpp b/3party/boost/boost/asio/detail/reactive_socket_recvmsg_op.hpp index abd70a7f47..fed5d01098 100644 --- a/3party/boost/boost/asio/detail/reactive_socket_recvmsg_op.hpp +++ b/3party/boost/boost/asio/detail/reactive_socket_recvmsg_op.hpp @@ -2,7 +2,7 @@ // detail/reactive_socket_recvmsg_op.hpp // ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ // -// Copyright (c) 2003-2015 Christopher M. Kohlhoff (chris at kohlhoff dot com) +// Copyright (c) 2003-2017 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) diff --git a/3party/boost/boost/asio/detail/reactive_socket_send_op.hpp b/3party/boost/boost/asio/detail/reactive_socket_send_op.hpp index 7f811277d0..776117b6f7 100644 --- a/3party/boost/boost/asio/detail/reactive_socket_send_op.hpp +++ b/3party/boost/boost/asio/detail/reactive_socket_send_op.hpp @@ -2,7 +2,7 @@ // detail/reactive_socket_send_op.hpp // ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ // -// Copyright (c) 2003-2015 Christopher M. Kohlhoff (chris at kohlhoff dot com) +// Copyright (c) 2003-2017 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) diff --git a/3party/boost/boost/asio/detail/reactive_socket_sendto_op.hpp b/3party/boost/boost/asio/detail/reactive_socket_sendto_op.hpp index 1abded437e..134c767c86 100644 --- a/3party/boost/boost/asio/detail/reactive_socket_sendto_op.hpp +++ b/3party/boost/boost/asio/detail/reactive_socket_sendto_op.hpp @@ -2,7 +2,7 @@ // detail/reactive_socket_sendto_op.hpp // ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ // -// Copyright (c) 2003-2015 Christopher M. Kohlhoff (chris at kohlhoff dot com) +// Copyright (c) 2003-2017 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) diff --git a/3party/boost/boost/asio/detail/reactive_socket_service.hpp b/3party/boost/boost/asio/detail/reactive_socket_service.hpp index 1e53c0a9f5..d5a6e08eab 100644 --- a/3party/boost/boost/asio/detail/reactive_socket_service.hpp +++ b/3party/boost/boost/asio/detail/reactive_socket_service.hpp @@ -2,7 +2,7 @@ // detail/reactive_socket_service.hpp // ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ // -// Copyright (c) 2003-2015 Christopher M. Kohlhoff (chris at kohlhoff dot com) +// Copyright (c) 2003-2017 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) @@ -102,6 +102,7 @@ public: // Move-construct a new socket implementation from another protocol type. template void converting_move_construct(implementation_type& impl, + reactive_socket_service&, typename reactive_socket_service< Protocol1>::implementation_type& other_impl) { diff --git a/3party/boost/boost/asio/detail/reactive_socket_service_base.hpp b/3party/boost/boost/asio/detail/reactive_socket_service_base.hpp index 58b178d3e1..fb2aa5d028 100644 --- a/3party/boost/boost/asio/detail/reactive_socket_service_base.hpp +++ b/3party/boost/boost/asio/detail/reactive_socket_service_base.hpp @@ -2,7 +2,7 @@ // detail/reactive_socket_service_base.hpp // ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ // -// Copyright (c) 2003-2015 Christopher M. Kohlhoff (chris at kohlhoff dot com) +// Copyright (c) 2003-2017 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) diff --git a/3party/boost/boost/asio/detail/reactor.hpp b/3party/boost/boost/asio/detail/reactor.hpp index 057933a6d1..1a4ace8776 100644 --- a/3party/boost/boost/asio/detail/reactor.hpp +++ b/3party/boost/boost/asio/detail/reactor.hpp @@ -2,7 +2,7 @@ // detail/reactor.hpp // ~~~~~~~~~~~~~~~~~~ // -// Copyright (c) 2003-2015 Christopher M. Kohlhoff (chris at kohlhoff dot com) +// Copyright (c) 2003-2017 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) diff --git a/3party/boost/boost/asio/detail/reactor_fwd.hpp b/3party/boost/boost/asio/detail/reactor_fwd.hpp index 82be114202..6b2e49f5a4 100644 --- a/3party/boost/boost/asio/detail/reactor_fwd.hpp +++ b/3party/boost/boost/asio/detail/reactor_fwd.hpp @@ -2,7 +2,7 @@ // detail/reactor_fwd.hpp // ~~~~~~~~~~~~~~~~~~~~~~ // -// Copyright (c) 2003-2015 Christopher M. Kohlhoff (chris at kohlhoff dot com) +// Copyright (c) 2003-2017 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) diff --git a/3party/boost/boost/asio/detail/reactor_op.hpp b/3party/boost/boost/asio/detail/reactor_op.hpp index 240a06a862..c5964dea37 100644 --- a/3party/boost/boost/asio/detail/reactor_op.hpp +++ b/3party/boost/boost/asio/detail/reactor_op.hpp @@ -2,7 +2,7 @@ // detail/reactor_op.hpp // ~~~~~~~~~~~~~~~~~~~~~ // -// Copyright (c) 2003-2015 Christopher M. Kohlhoff (chris at kohlhoff dot com) +// Copyright (c) 2003-2017 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) diff --git a/3party/boost/boost/asio/detail/reactor_op_queue.hpp b/3party/boost/boost/asio/detail/reactor_op_queue.hpp index 11887a844b..4be5c2e05e 100644 --- a/3party/boost/boost/asio/detail/reactor_op_queue.hpp +++ b/3party/boost/boost/asio/detail/reactor_op_queue.hpp @@ -2,7 +2,7 @@ // detail/reactor_op_queue.hpp // ~~~~~~~~~~~~~~~~~~~~~~~~~~~ // -// Copyright (c) 2003-2015 Christopher M. Kohlhoff (chris at kohlhoff dot com) +// Copyright (c) 2003-2017 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) diff --git a/3party/boost/boost/asio/detail/regex_fwd.hpp b/3party/boost/boost/asio/detail/regex_fwd.hpp index 9eed6e042f..122d7b52e3 100644 --- a/3party/boost/boost/asio/detail/regex_fwd.hpp +++ b/3party/boost/boost/asio/detail/regex_fwd.hpp @@ -2,7 +2,7 @@ // detail/regex_fwd.hpp // ~~~~~~~~~~~~~~~~~~~~ // -// Copyright (c) 2003-2015 Christopher M. Kohlhoff (chris at kohlhoff dot com) +// Copyright (c) 2003-2017 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) diff --git a/3party/boost/boost/asio/detail/resolve_endpoint_op.hpp b/3party/boost/boost/asio/detail/resolve_endpoint_op.hpp index 989017bff0..0b7060ad6b 100644 --- a/3party/boost/boost/asio/detail/resolve_endpoint_op.hpp +++ b/3party/boost/boost/asio/detail/resolve_endpoint_op.hpp @@ -2,7 +2,7 @@ // detail/resolve_endpoint_op.hpp // ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ // -// Copyright (c) 2003-2015 Christopher M. Kohlhoff (chris at kohlhoff dot com) +// Copyright (c) 2003-2017 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) diff --git a/3party/boost/boost/asio/detail/resolve_op.hpp b/3party/boost/boost/asio/detail/resolve_op.hpp index 5e77a57f66..435e27026f 100644 --- a/3party/boost/boost/asio/detail/resolve_op.hpp +++ b/3party/boost/boost/asio/detail/resolve_op.hpp @@ -2,7 +2,7 @@ // detail/resolve_op.hpp // ~~~~~~~~~~~~~~~~~~~~~ // -// Copyright (c) 2003-2015 Christopher M. Kohlhoff (chris at kohlhoff dot com) +// Copyright (c) 2003-2017 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) diff --git a/3party/boost/boost/asio/detail/resolver_service.hpp b/3party/boost/boost/asio/detail/resolver_service.hpp index cd0d6a7c94..f73742e9b0 100644 --- a/3party/boost/boost/asio/detail/resolver_service.hpp +++ b/3party/boost/boost/asio/detail/resolver_service.hpp @@ -2,7 +2,7 @@ // detail/resolver_service.hpp // ~~~~~~~~~~~~~~~~~~~~~~~~~~~ // -// Copyright (c) 2003-2015 Christopher M. Kohlhoff (chris at kohlhoff dot com) +// Copyright (c) 2003-2017 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) diff --git a/3party/boost/boost/asio/detail/resolver_service_base.hpp b/3party/boost/boost/asio/detail/resolver_service_base.hpp index 6031315275..1a4180c166 100644 --- a/3party/boost/boost/asio/detail/resolver_service_base.hpp +++ b/3party/boost/boost/asio/detail/resolver_service_base.hpp @@ -2,7 +2,7 @@ // detail/resolver_service_base.hpp // ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ // -// Copyright (c) 2003-2015 Christopher M. Kohlhoff (chris at kohlhoff dot com) +// Copyright (c) 2003-2017 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) diff --git a/3party/boost/boost/asio/detail/scoped_lock.hpp b/3party/boost/boost/asio/detail/scoped_lock.hpp index 574cbf0aac..239dd6a940 100644 --- a/3party/boost/boost/asio/detail/scoped_lock.hpp +++ b/3party/boost/boost/asio/detail/scoped_lock.hpp @@ -2,7 +2,7 @@ // detail/scoped_lock.hpp // ~~~~~~~~~~~~~~~~~~~~~~ // -// Copyright (c) 2003-2015 Christopher M. Kohlhoff (chris at kohlhoff dot com) +// Copyright (c) 2003-2017 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) diff --git a/3party/boost/boost/asio/detail/scoped_ptr.hpp b/3party/boost/boost/asio/detail/scoped_ptr.hpp index b24320eb98..fd471631e1 100644 --- a/3party/boost/boost/asio/detail/scoped_ptr.hpp +++ b/3party/boost/boost/asio/detail/scoped_ptr.hpp @@ -2,7 +2,7 @@ // detail/scoped_ptr.hpp // ~~~~~~~~~~~~~~~~~~~~~ // -// Copyright (c) 2003-2015 Christopher M. Kohlhoff (chris at kohlhoff dot com) +// Copyright (c) 2003-2017 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) diff --git a/3party/boost/boost/asio/detail/select_interrupter.hpp b/3party/boost/boost/asio/detail/select_interrupter.hpp index 5abe1a0c87..a6c27a72f9 100644 --- a/3party/boost/boost/asio/detail/select_interrupter.hpp +++ b/3party/boost/boost/asio/detail/select_interrupter.hpp @@ -2,7 +2,7 @@ // detail/select_interrupter.hpp // ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ // -// Copyright (c) 2003-2015 Christopher M. Kohlhoff (chris at kohlhoff dot com) +// Copyright (c) 2003-2017 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) diff --git a/3party/boost/boost/asio/detail/select_reactor.hpp b/3party/boost/boost/asio/detail/select_reactor.hpp index 6a260fc53e..69b04c82b5 100644 --- a/3party/boost/boost/asio/detail/select_reactor.hpp +++ b/3party/boost/boost/asio/detail/select_reactor.hpp @@ -2,7 +2,7 @@ // detail/select_reactor.hpp // ~~~~~~~~~~~~~~~~~~~~~~~~~ // -// Copyright (c) 2003-2015 Christopher M. Kohlhoff (chris at kohlhoff dot com) +// Copyright (c) 2003-2017 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) diff --git a/3party/boost/boost/asio/detail/service_registry.hpp b/3party/boost/boost/asio/detail/service_registry.hpp index 06ec28c5a3..b5fa85bd01 100644 --- a/3party/boost/boost/asio/detail/service_registry.hpp +++ b/3party/boost/boost/asio/detail/service_registry.hpp @@ -2,7 +2,7 @@ // detail/service_registry.hpp // ~~~~~~~~~~~~~~~~~~~~~~~~~~~ // -// Copyright (c) 2003-2015 Christopher M. Kohlhoff (chris at kohlhoff dot com) +// Copyright (c) 2003-2017 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) diff --git a/3party/boost/boost/asio/detail/shared_ptr.hpp b/3party/boost/boost/asio/detail/shared_ptr.hpp index fc1facf0ef..f26c645121 100644 --- a/3party/boost/boost/asio/detail/shared_ptr.hpp +++ b/3party/boost/boost/asio/detail/shared_ptr.hpp @@ -2,7 +2,7 @@ // detail/shared_ptr.hpp // ~~~~~~~~~~~~~~~~~~~~~ // -// Copyright (c) 2003-2015 Christopher M. Kohlhoff (chris at kohlhoff dot com) +// Copyright (c) 2003-2017 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) diff --git a/3party/boost/boost/asio/detail/signal_blocker.hpp b/3party/boost/boost/asio/detail/signal_blocker.hpp index dfc19f8d79..c4d14f607d 100644 --- a/3party/boost/boost/asio/detail/signal_blocker.hpp +++ b/3party/boost/boost/asio/detail/signal_blocker.hpp @@ -2,7 +2,7 @@ // detail/signal_blocker.hpp // ~~~~~~~~~~~~~~~~~~~~~~~~~ // -// Copyright (c) 2003-2015 Christopher M. Kohlhoff (chris at kohlhoff dot com) +// Copyright (c) 2003-2017 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) diff --git a/3party/boost/boost/asio/detail/signal_handler.hpp b/3party/boost/boost/asio/detail/signal_handler.hpp index 66518051ce..edad41b8ee 100644 --- a/3party/boost/boost/asio/detail/signal_handler.hpp +++ b/3party/boost/boost/asio/detail/signal_handler.hpp @@ -2,7 +2,7 @@ // detail/signal_handler.hpp // ~~~~~~~~~~~~~~~~~~~~~~~~~ // -// Copyright (c) 2003-2015 Christopher M. Kohlhoff (chris at kohlhoff dot com) +// Copyright (c) 2003-2017 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) diff --git a/3party/boost/boost/asio/detail/signal_init.hpp b/3party/boost/boost/asio/detail/signal_init.hpp index 8950ee2b17..5065d6d8d9 100644 --- a/3party/boost/boost/asio/detail/signal_init.hpp +++ b/3party/boost/boost/asio/detail/signal_init.hpp @@ -2,7 +2,7 @@ // detail/signal_init.hpp // ~~~~~~~~~~~~~~~~~~~~~~ // -// Copyright (c) 2003-2015 Christopher M. Kohlhoff (chris at kohlhoff dot com) +// Copyright (c) 2003-2017 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) diff --git a/3party/boost/boost/asio/detail/signal_op.hpp b/3party/boost/boost/asio/detail/signal_op.hpp index f894805523..c8dfd52a0e 100644 --- a/3party/boost/boost/asio/detail/signal_op.hpp +++ b/3party/boost/boost/asio/detail/signal_op.hpp @@ -2,7 +2,7 @@ // detail/signal_op.hpp // ~~~~~~~~~~~~~~~~~~~~ // -// Copyright (c) 2003-2015 Christopher M. Kohlhoff (chris at kohlhoff dot com) +// Copyright (c) 2003-2017 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) diff --git a/3party/boost/boost/asio/detail/signal_set_service.hpp b/3party/boost/boost/asio/detail/signal_set_service.hpp index 34137f5c98..a023ebb66f 100644 --- a/3party/boost/boost/asio/detail/signal_set_service.hpp +++ b/3party/boost/boost/asio/detail/signal_set_service.hpp @@ -2,7 +2,7 @@ // detail/signal_set_service.hpp // ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ // -// Copyright (c) 2003-2015 Christopher M. Kohlhoff (chris at kohlhoff dot com) +// Copyright (c) 2003-2017 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) diff --git a/3party/boost/boost/asio/detail/socket_holder.hpp b/3party/boost/boost/asio/detail/socket_holder.hpp index 87af6b0044..8a3c8e8917 100644 --- a/3party/boost/boost/asio/detail/socket_holder.hpp +++ b/3party/boost/boost/asio/detail/socket_holder.hpp @@ -2,7 +2,7 @@ // detail/socket_holder.hpp // ~~~~~~~~~~~~~~~~~~~~~~~~ // -// Copyright (c) 2003-2015 Christopher M. Kohlhoff (chris at kohlhoff dot com) +// Copyright (c) 2003-2017 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) diff --git a/3party/boost/boost/asio/detail/socket_ops.hpp b/3party/boost/boost/asio/detail/socket_ops.hpp index 60b64cd8b6..136a3f01f7 100644 --- a/3party/boost/boost/asio/detail/socket_ops.hpp +++ b/3party/boost/boost/asio/detail/socket_ops.hpp @@ -2,7 +2,7 @@ // detail/socket_ops.hpp // ~~~~~~~~~~~~~~~~~~~~~ // -// Copyright (c) 2003-2015 Christopher M. Kohlhoff (chris at kohlhoff dot com) +// Copyright (c) 2003-2017 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) diff --git a/3party/boost/boost/asio/detail/socket_option.hpp b/3party/boost/boost/asio/detail/socket_option.hpp index 0cbf00fb5b..2ca77badc8 100644 --- a/3party/boost/boost/asio/detail/socket_option.hpp +++ b/3party/boost/boost/asio/detail/socket_option.hpp @@ -2,7 +2,7 @@ // detail/socket_option.hpp // ~~~~~~~~~~~~~~~~~~~~~~~~ // -// Copyright (c) 2003-2015 Christopher M. Kohlhoff (chris at kohlhoff dot com) +// Copyright (c) 2003-2017 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) diff --git a/3party/boost/boost/asio/detail/socket_select_interrupter.hpp b/3party/boost/boost/asio/detail/socket_select_interrupter.hpp index de8b7930b0..82bcaba5f1 100644 --- a/3party/boost/boost/asio/detail/socket_select_interrupter.hpp +++ b/3party/boost/boost/asio/detail/socket_select_interrupter.hpp @@ -2,7 +2,7 @@ // detail/socket_select_interrupter.hpp // ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ // -// Copyright (c) 2003-2015 Christopher M. Kohlhoff (chris at kohlhoff dot com) +// Copyright (c) 2003-2017 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) diff --git a/3party/boost/boost/asio/detail/socket_types.hpp b/3party/boost/boost/asio/detail/socket_types.hpp index f4be937703..8467118b54 100644 --- a/3party/boost/boost/asio/detail/socket_types.hpp +++ b/3party/boost/boost/asio/detail/socket_types.hpp @@ -2,7 +2,7 @@ // detail/socket_types.hpp // ~~~~~~~~~~~~~~~~~~~~~~~ // -// Copyright (c) 2003-2015 Christopher M. Kohlhoff (chris at kohlhoff dot com) +// Copyright (c) 2003-2017 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) @@ -30,14 +30,16 @@ # define BOOST_ASIO_WSPIAPI_H_DEFINED # endif // !defined(_WSPIAPI_H_) # endif // defined(__BORLANDC__) +# include +# include # if defined(WINAPI_FAMILY) # if ((WINAPI_FAMILY & WINAPI_PARTITION_DESKTOP) != 0) # include # endif // ((WINAPI_FAMILY & WINAPI_PARTITION_DESKTOP) != 0) # endif // defined(WINAPI_FAMILY) -# include -# include -# include +# if !defined(BOOST_ASIO_WINDOWS_APP) +# include +# endif // !defined(BOOST_ASIO_WINDOWS_APP) # if defined(BOOST_ASIO_WSPIAPI_H_DEFINED) # undef _WSPIAPI_H_ # undef BOOST_ASIO_WSPIAPI_H_DEFINED @@ -47,7 +49,9 @@ # pragma comment(lib, "ws2.lib") # elif defined(_MSC_VER) || defined(__BORLANDC__) # pragma comment(lib, "ws2_32.lib") -# pragma comment(lib, "mswsock.lib") +# if !defined(BOOST_ASIO_WINDOWS_APP) +# pragma comment(lib, "mswsock.lib") +# endif // !defined(BOOST_ASIO_WINDOWS_APP) # endif // defined(_MSC_VER) || defined(__BORLANDC__) # endif // !defined(BOOST_ASIO_NO_DEFAULT_LINKED_LIBS) # include diff --git a/3party/boost/boost/asio/detail/solaris_fenced_block.hpp b/3party/boost/boost/asio/detail/solaris_fenced_block.hpp index 31ccf5013f..2aef0229f1 100644 --- a/3party/boost/boost/asio/detail/solaris_fenced_block.hpp +++ b/3party/boost/boost/asio/detail/solaris_fenced_block.hpp @@ -2,7 +2,7 @@ // detail/solaris_fenced_block.hpp // ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ // -// Copyright (c) 2003-2015 Christopher M. Kohlhoff (chris at kohlhoff dot com) +// Copyright (c) 2003-2017 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) diff --git a/3party/boost/boost/asio/detail/static_mutex.hpp b/3party/boost/boost/asio/detail/static_mutex.hpp index ea671c9b11..d4af68f1ca 100644 --- a/3party/boost/boost/asio/detail/static_mutex.hpp +++ b/3party/boost/boost/asio/detail/static_mutex.hpp @@ -2,7 +2,7 @@ // detail/static_mutex.hpp // ~~~~~~~~~~~~~~~~~~~~~~~ // -// Copyright (c) 2003-2015 Christopher M. Kohlhoff (chris at kohlhoff dot com) +// Copyright (c) 2003-2017 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) diff --git a/3party/boost/boost/asio/detail/std_event.hpp b/3party/boost/boost/asio/detail/std_event.hpp index 2bc609493b..2add1f9f8c 100644 --- a/3party/boost/boost/asio/detail/std_event.hpp +++ b/3party/boost/boost/asio/detail/std_event.hpp @@ -2,7 +2,7 @@ // detail/std_event.hpp // ~~~~~~~~~~~~~~~~~~~~ // -// Copyright (c) 2003-2015 Christopher M. Kohlhoff (chris at kohlhoff dot com) +// Copyright (c) 2003-2017 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) diff --git a/3party/boost/boost/asio/detail/std_fenced_block.hpp b/3party/boost/boost/asio/detail/std_fenced_block.hpp new file mode 100644 index 0000000000..b3bd9d5931 --- /dev/null +++ b/3party/boost/boost/asio/detail/std_fenced_block.hpp @@ -0,0 +1,64 @@ +// +// detail/std_fenced_block.hpp +// ~~~~~~~~~~~~~~~~~~~~~~~~~~~ +// +// Copyright (c) 2003-2017 Christopher M. Kohlhoff (chris at kohlhoff dot com) +// +// Distributed under the Boost Software License, Version 1.0. (See accompanying +// file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt) +// + +#ifndef BOOST_ASIO_DETAIL_STD_FENCED_BLOCK_HPP +#define BOOST_ASIO_DETAIL_STD_FENCED_BLOCK_HPP + +#if defined(_MSC_VER) && (_MSC_VER >= 1200) +# pragma once +#endif // defined(_MSC_VER) && (_MSC_VER >= 1200) + +#include + +#if defined(BOOST_ASIO_HAS_STD_ATOMIC) + +#include +#include + +#include + +namespace boost { +namespace asio { +namespace detail { + +class std_fenced_block + : private noncopyable +{ +public: + enum half_t { half }; + enum full_t { full }; + + // Constructor for a half fenced block. + explicit std_fenced_block(half_t) + { + } + + // Constructor for a full fenced block. + explicit std_fenced_block(full_t) + { + std::atomic_thread_fence(std::memory_order_acquire); + } + + // Destructor. + ~std_fenced_block() + { + std::atomic_thread_fence(std::memory_order_release); + } +}; + +} // namespace detail +} // namespace asio +} // namespace boost + +#include + +#endif // defined(BOOST_ASIO_HAS_STD_ATOMIC) + +#endif // BOOST_ASIO_DETAIL_STD_FENCED_BLOCK_HPP diff --git a/3party/boost/boost/asio/detail/std_mutex.hpp b/3party/boost/boost/asio/detail/std_mutex.hpp index e9cc4bda69..ac60e2337d 100644 --- a/3party/boost/boost/asio/detail/std_mutex.hpp +++ b/3party/boost/boost/asio/detail/std_mutex.hpp @@ -2,7 +2,7 @@ // detail/std_mutex.hpp // ~~~~~~~~~~~~~~~~~~~~ // -// Copyright (c) 2003-2015 Christopher M. Kohlhoff (chris at kohlhoff dot com) +// Copyright (c) 2003-2017 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) diff --git a/3party/boost/boost/asio/detail/std_static_mutex.hpp b/3party/boost/boost/asio/detail/std_static_mutex.hpp index 2c4063e9de..a2b2c6f83e 100644 --- a/3party/boost/boost/asio/detail/std_static_mutex.hpp +++ b/3party/boost/boost/asio/detail/std_static_mutex.hpp @@ -2,7 +2,7 @@ // detail/std_static_mutex.hpp // ~~~~~~~~~~~~~~~~~~~~~~~~~~~ // -// Copyright (c) 2003-2015 Christopher M. Kohlhoff (chris at kohlhoff dot com) +// Copyright (c) 2003-2017 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) diff --git a/3party/boost/boost/asio/detail/std_thread.hpp b/3party/boost/boost/asio/detail/std_thread.hpp index a1934ffa21..cd2a61dac2 100644 --- a/3party/boost/boost/asio/detail/std_thread.hpp +++ b/3party/boost/boost/asio/detail/std_thread.hpp @@ -2,7 +2,7 @@ // detail/std_thread.hpp // ~~~~~~~~~~~~~~~~~~~~~ // -// Copyright (c) 2003-2015 Christopher M. Kohlhoff (chris at kohlhoff dot com) +// Copyright (c) 2003-2017 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) diff --git a/3party/boost/boost/asio/detail/strand_service.hpp b/3party/boost/boost/asio/detail/strand_service.hpp index 51d3211c87..8a94e58e36 100644 --- a/3party/boost/boost/asio/detail/strand_service.hpp +++ b/3party/boost/boost/asio/detail/strand_service.hpp @@ -2,7 +2,7 @@ // detail/strand_service.hpp // ~~~~~~~~~~~~~~~~~~~~~~~~~ // -// Copyright (c) 2003-2015 Christopher M. Kohlhoff (chris at kohlhoff dot com) +// Copyright (c) 2003-2017 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) diff --git a/3party/boost/boost/asio/detail/task_io_service.hpp b/3party/boost/boost/asio/detail/task_io_service.hpp index 8c4617c497..5184ea5a58 100644 --- a/3party/boost/boost/asio/detail/task_io_service.hpp +++ b/3party/boost/boost/asio/detail/task_io_service.hpp @@ -2,7 +2,7 @@ // detail/task_io_service.hpp // ~~~~~~~~~~~~~~~~~~~~~~~~~~ // -// Copyright (c) 2003-2015 Christopher M. Kohlhoff (chris at kohlhoff dot com) +// Copyright (c) 2003-2017 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) diff --git a/3party/boost/boost/asio/detail/task_io_service_operation.hpp b/3party/boost/boost/asio/detail/task_io_service_operation.hpp index 0822bccde5..91bee25cb4 100644 --- a/3party/boost/boost/asio/detail/task_io_service_operation.hpp +++ b/3party/boost/boost/asio/detail/task_io_service_operation.hpp @@ -2,7 +2,7 @@ // detail/task_io_service_operation.hpp // ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ // -// Copyright (c) 2003-2015 Christopher M. Kohlhoff (chris at kohlhoff dot com) +// Copyright (c) 2003-2017 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) diff --git a/3party/boost/boost/asio/detail/task_io_service_thread_info.hpp b/3party/boost/boost/asio/detail/task_io_service_thread_info.hpp index c17e1010cb..0af044c009 100644 --- a/3party/boost/boost/asio/detail/task_io_service_thread_info.hpp +++ b/3party/boost/boost/asio/detail/task_io_service_thread_info.hpp @@ -2,7 +2,7 @@ // detail/task_io_service_thread_info.hpp // ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ // -// Copyright (c) 2003-2015 Christopher M. Kohlhoff (chris at kohlhoff dot com) +// Copyright (c) 2003-2017 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) diff --git a/3party/boost/boost/asio/detail/thread.hpp b/3party/boost/boost/asio/detail/thread.hpp index adc5a55708..f385fc85a1 100644 --- a/3party/boost/boost/asio/detail/thread.hpp +++ b/3party/boost/boost/asio/detail/thread.hpp @@ -2,7 +2,7 @@ // detail/thread.hpp // ~~~~~~~~~~~~~~~~~ // -// Copyright (c) 2003-2015 Christopher M. Kohlhoff (chris at kohlhoff dot com) +// Copyright (c) 2003-2017 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) @@ -20,8 +20,8 @@ #if !defined(BOOST_ASIO_HAS_THREADS) # include #elif defined(BOOST_ASIO_WINDOWS) -# if defined(UNDER_CE) -# include +# if defined(BOOST_ASIO_WINDOWS_APP) || defined(UNDER_CE) +# include # else # include # endif @@ -40,8 +40,8 @@ namespace detail { #if !defined(BOOST_ASIO_HAS_THREADS) typedef null_thread thread; #elif defined(BOOST_ASIO_WINDOWS) -# if defined(UNDER_CE) -typedef wince_thread thread; +# if defined(BOOST_ASIO_WINDOWS_APP) || defined(UNDER_CE) +typedef winapi_thread thread; # else typedef win_thread thread; # endif diff --git a/3party/boost/boost/asio/detail/thread_info_base.hpp b/3party/boost/boost/asio/detail/thread_info_base.hpp index b2b900bee2..3baa8ef39f 100644 --- a/3party/boost/boost/asio/detail/thread_info_base.hpp +++ b/3party/boost/boost/asio/detail/thread_info_base.hpp @@ -2,7 +2,7 @@ // detail/thread_info_base.hpp // ~~~~~~~~~~~~~~~~~~~~~~~~~~~ // -// Copyright (c) 2003-2015 Christopher M. Kohlhoff (chris at kohlhoff dot com) +// Copyright (c) 2003-2017 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) diff --git a/3party/boost/boost/asio/detail/throw_error.hpp b/3party/boost/boost/asio/detail/throw_error.hpp index 43e1a69f83..6669f2e527 100644 --- a/3party/boost/boost/asio/detail/throw_error.hpp +++ b/3party/boost/boost/asio/detail/throw_error.hpp @@ -2,7 +2,7 @@ // detail/throw_error.hpp // ~~~~~~~~~~~~~~~~~~~~~~ // -// Copyright (c) 2003-2015 Christopher M. Kohlhoff (chris at kohlhoff dot com) +// Copyright (c) 2003-2017 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) diff --git a/3party/boost/boost/asio/detail/throw_exception.hpp b/3party/boost/boost/asio/detail/throw_exception.hpp index f4cccaa23f..9f0052ad42 100644 --- a/3party/boost/boost/asio/detail/throw_exception.hpp +++ b/3party/boost/boost/asio/detail/throw_exception.hpp @@ -2,7 +2,7 @@ // detail/throw_exception.hpp // ~~~~~~~~~~~~~~~~~~~~~~~~~~ // -// Copyright (c) 2003-2015 Christopher M. Kohlhoff (chris at kohlhoff dot com) +// Copyright (c) 2003-2017 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) diff --git a/3party/boost/boost/asio/detail/timer_queue.hpp b/3party/boost/boost/asio/detail/timer_queue.hpp index 3ad6a86919..cb848dfb3a 100644 --- a/3party/boost/boost/asio/detail/timer_queue.hpp +++ b/3party/boost/boost/asio/detail/timer_queue.hpp @@ -2,7 +2,7 @@ // detail/timer_queue.hpp // ~~~~~~~~~~~~~~~~~~~~~~ // -// Copyright (c) 2003-2015 Christopher M. Kohlhoff (chris at kohlhoff dot com) +// Copyright (c) 2003-2017 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) diff --git a/3party/boost/boost/asio/detail/timer_queue_base.hpp b/3party/boost/boost/asio/detail/timer_queue_base.hpp index 4d4898bcaa..33f005d456 100644 --- a/3party/boost/boost/asio/detail/timer_queue_base.hpp +++ b/3party/boost/boost/asio/detail/timer_queue_base.hpp @@ -2,7 +2,7 @@ // detail/timer_queue_base.hpp // ~~~~~~~~~~~~~~~~~~~~~~~~~~~ // -// Copyright (c) 2003-2015 Christopher M. Kohlhoff (chris at kohlhoff dot com) +// Copyright (c) 2003-2017 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) diff --git a/3party/boost/boost/asio/detail/timer_queue_ptime.hpp b/3party/boost/boost/asio/detail/timer_queue_ptime.hpp index ecde27eb8a..0693acca83 100644 --- a/3party/boost/boost/asio/detail/timer_queue_ptime.hpp +++ b/3party/boost/boost/asio/detail/timer_queue_ptime.hpp @@ -2,7 +2,7 @@ // detail/timer_queue_ptime.hpp // ~~~~~~~~~~~~~~~~~~~~~~~~~~~~ // -// Copyright (c) 2003-2015 Christopher M. Kohlhoff (chris at kohlhoff dot com) +// Copyright (c) 2003-2017 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) diff --git a/3party/boost/boost/asio/detail/timer_queue_set.hpp b/3party/boost/boost/asio/detail/timer_queue_set.hpp index c0d8d1e59b..b044edd593 100644 --- a/3party/boost/boost/asio/detail/timer_queue_set.hpp +++ b/3party/boost/boost/asio/detail/timer_queue_set.hpp @@ -2,7 +2,7 @@ // detail/timer_queue_set.hpp // ~~~~~~~~~~~~~~~~~~~~~~~~~~ // -// Copyright (c) 2003-2015 Christopher M. Kohlhoff (chris at kohlhoff dot com) +// Copyright (c) 2003-2017 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) diff --git a/3party/boost/boost/asio/detail/timer_scheduler.hpp b/3party/boost/boost/asio/detail/timer_scheduler.hpp index f723cef5c1..49dc113d10 100644 --- a/3party/boost/boost/asio/detail/timer_scheduler.hpp +++ b/3party/boost/boost/asio/detail/timer_scheduler.hpp @@ -2,7 +2,7 @@ // detail/timer_scheduler.hpp // ~~~~~~~~~~~~~~~~~~~~~~~~~~ // -// Copyright (c) 2003-2015 Christopher M. Kohlhoff (chris at kohlhoff dot com) +// Copyright (c) 2003-2017 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) diff --git a/3party/boost/boost/asio/detail/timer_scheduler_fwd.hpp b/3party/boost/boost/asio/detail/timer_scheduler_fwd.hpp index 98d0781dc7..bf732a63d3 100644 --- a/3party/boost/boost/asio/detail/timer_scheduler_fwd.hpp +++ b/3party/boost/boost/asio/detail/timer_scheduler_fwd.hpp @@ -2,7 +2,7 @@ // detail/timer_scheduler_fwd.hpp // ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ // -// Copyright (c) 2003-2015 Christopher M. Kohlhoff (chris at kohlhoff dot com) +// Copyright (c) 2003-2017 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) diff --git a/3party/boost/boost/asio/detail/tss_ptr.hpp b/3party/boost/boost/asio/detail/tss_ptr.hpp index fa04a4902f..a3d41ca6bd 100644 --- a/3party/boost/boost/asio/detail/tss_ptr.hpp +++ b/3party/boost/boost/asio/detail/tss_ptr.hpp @@ -2,7 +2,7 @@ // detail/tss_ptr.hpp // ~~~~~~~~~~~~~~~~~~ // -// Copyright (c) 2003-2015 Christopher M. Kohlhoff (chris at kohlhoff dot com) +// Copyright (c) 2003-2017 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) diff --git a/3party/boost/boost/asio/detail/type_traits.hpp b/3party/boost/boost/asio/detail/type_traits.hpp index 8bed3d55cd..53a73a0eb1 100644 --- a/3party/boost/boost/asio/detail/type_traits.hpp +++ b/3party/boost/boost/asio/detail/type_traits.hpp @@ -2,7 +2,7 @@ // detail/type_traits.hpp // ~~~~~~~~~~~~~~~~~~~~~~ // -// Copyright (c) 2003-2015 Christopher M. Kohlhoff (chris at kohlhoff dot com) +// Copyright (c) 2003-2017 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) diff --git a/3party/boost/boost/asio/detail/variadic_templates.hpp b/3party/boost/boost/asio/detail/variadic_templates.hpp index 890f54c17a..6d55bc7a7c 100644 --- a/3party/boost/boost/asio/detail/variadic_templates.hpp +++ b/3party/boost/boost/asio/detail/variadic_templates.hpp @@ -2,7 +2,7 @@ // detail/variadic_templates.hpp // ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ // -// Copyright (c) 2003-2015 Christopher M. Kohlhoff (chris at kohlhoff dot com) +// Copyright (c) 2003-2017 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) diff --git a/3party/boost/boost/asio/detail/wait_handler.hpp b/3party/boost/boost/asio/detail/wait_handler.hpp index ed0aeb68aa..440dae1f18 100644 --- a/3party/boost/boost/asio/detail/wait_handler.hpp +++ b/3party/boost/boost/asio/detail/wait_handler.hpp @@ -2,7 +2,7 @@ // detail/wait_handler.hpp // ~~~~~~~~~~~~~~~~~~~~~~~ // -// Copyright (c) 2003-2015 Christopher M. Kohlhoff (chris at kohlhoff dot com) +// Copyright (c) 2003-2017 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) diff --git a/3party/boost/boost/asio/detail/wait_op.hpp b/3party/boost/boost/asio/detail/wait_op.hpp index 8a5dd7fec5..16835139b6 100644 --- a/3party/boost/boost/asio/detail/wait_op.hpp +++ b/3party/boost/boost/asio/detail/wait_op.hpp @@ -2,7 +2,7 @@ // detail/wait_op.hpp // ~~~~~~~~~~~~~~~~~~ // -// Copyright (c) 2003-2015 Christopher M. Kohlhoff (chris at kohlhoff dot com) +// Copyright (c) 2003-2017 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) diff --git a/3party/boost/boost/asio/detail/weak_ptr.hpp b/3party/boost/boost/asio/detail/weak_ptr.hpp index 08bc1dd4b9..1870c0e0e8 100644 --- a/3party/boost/boost/asio/detail/weak_ptr.hpp +++ b/3party/boost/boost/asio/detail/weak_ptr.hpp @@ -2,7 +2,7 @@ // detail/weak_ptr.hpp // ~~~~~~~~~~~~~~~~~~~ // -// Copyright (c) 2003-2015 Christopher M. Kohlhoff (chris at kohlhoff dot com) +// Copyright (c) 2003-2017 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) diff --git a/3party/boost/boost/asio/detail/win_event.hpp b/3party/boost/boost/asio/detail/win_event.hpp index ff4df5be23..7a7d54fac6 100644 --- a/3party/boost/boost/asio/detail/win_event.hpp +++ b/3party/boost/boost/asio/detail/win_event.hpp @@ -2,7 +2,7 @@ // detail/win_event.hpp // ~~~~~~~~~~~~~~~~~~~~ // -// Copyright (c) 2003-2015 Christopher M. Kohlhoff (chris at kohlhoff dot com) +// Copyright (c) 2003-2017 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) @@ -102,7 +102,11 @@ public: { state_ += 2; lock.unlock(); +#if defined(BOOST_ASIO_WINDOWS_APP) + ::WaitForMultipleObjectsEx(2, events_, false, INFINITE, false); +#else // defined(BOOST_ASIO_WINDOWS_APP) ::WaitForMultipleObjects(2, events_, false, INFINITE); +#endif // defined(BOOST_ASIO_WINDOWS_APP) lock.lock(); state_ -= 2; } diff --git a/3party/boost/boost/asio/detail/win_fd_set_adapter.hpp b/3party/boost/boost/asio/detail/win_fd_set_adapter.hpp index 7687476b5a..b8e1b31a09 100644 --- a/3party/boost/boost/asio/detail/win_fd_set_adapter.hpp +++ b/3party/boost/boost/asio/detail/win_fd_set_adapter.hpp @@ -2,7 +2,7 @@ // detail/win_fd_set_adapter.hpp // ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ // -// Copyright (c) 2003-2015 Christopher M. Kohlhoff (chris at kohlhoff dot com) +// Copyright (c) 2003-2017 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) diff --git a/3party/boost/boost/asio/detail/win_fenced_block.hpp b/3party/boost/boost/asio/detail/win_fenced_block.hpp index a1a82e519a..dba1d5355d 100644 --- a/3party/boost/boost/asio/detail/win_fenced_block.hpp +++ b/3party/boost/boost/asio/detail/win_fenced_block.hpp @@ -2,7 +2,7 @@ // detail/win_fenced_block.hpp // ~~~~~~~~~~~~~~~~~~~~~~~~~~~ // -// Copyright (c) 2003-2015 Christopher M. Kohlhoff (chris at kohlhoff dot com) +// Copyright (c) 2003-2017 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) diff --git a/3party/boost/boost/asio/detail/win_iocp_handle_read_op.hpp b/3party/boost/boost/asio/detail/win_iocp_handle_read_op.hpp index 5f8b8c2494..fda3cc1e77 100644 --- a/3party/boost/boost/asio/detail/win_iocp_handle_read_op.hpp +++ b/3party/boost/boost/asio/detail/win_iocp_handle_read_op.hpp @@ -2,7 +2,7 @@ // detail/win_iocp_handle_read_op.hpp // ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ // -// Copyright (c) 2003-2015 Christopher M. Kohlhoff (chris at kohlhoff dot com) +// Copyright (c) 2003-2017 Christopher M. Kohlhoff (chris at kohlhoff dot com) // Copyright (c) 2008 Rep Invariant Systems, Inc. (info@repinvariant.com) // // Distributed under the Boost Software License, Version 1.0. (See accompanying diff --git a/3party/boost/boost/asio/detail/win_iocp_handle_service.hpp b/3party/boost/boost/asio/detail/win_iocp_handle_service.hpp index f6ca634dc2..29f24f90c5 100644 --- a/3party/boost/boost/asio/detail/win_iocp_handle_service.hpp +++ b/3party/boost/boost/asio/detail/win_iocp_handle_service.hpp @@ -2,7 +2,7 @@ // detail/win_iocp_handle_service.hpp // ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ // -// Copyright (c) 2003-2015 Christopher M. Kohlhoff (chris at kohlhoff dot com) +// Copyright (c) 2003-2017 Christopher M. Kohlhoff (chris at kohlhoff dot com) // Copyright (c) 2008 Rep Invariant Systems, Inc. (info@repinvariant.com) // // Distributed under the Boost Software License, Version 1.0. (See accompanying diff --git a/3party/boost/boost/asio/detail/win_iocp_handle_write_op.hpp b/3party/boost/boost/asio/detail/win_iocp_handle_write_op.hpp index b03fb8bacb..a53db910a8 100644 --- a/3party/boost/boost/asio/detail/win_iocp_handle_write_op.hpp +++ b/3party/boost/boost/asio/detail/win_iocp_handle_write_op.hpp @@ -2,7 +2,7 @@ // detail/win_iocp_handle_write_op.hpp // ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ // -// Copyright (c) 2003-2015 Christopher M. Kohlhoff (chris at kohlhoff dot com) +// Copyright (c) 2003-2017 Christopher M. Kohlhoff (chris at kohlhoff dot com) // Copyright (c) 2008 Rep Invariant Systems, Inc. (info@repinvariant.com) // // Distributed under the Boost Software License, Version 1.0. (See accompanying diff --git a/3party/boost/boost/asio/detail/win_iocp_io_service.hpp b/3party/boost/boost/asio/detail/win_iocp_io_service.hpp index 9e44c2d1e0..0abb9fe89a 100644 --- a/3party/boost/boost/asio/detail/win_iocp_io_service.hpp +++ b/3party/boost/boost/asio/detail/win_iocp_io_service.hpp @@ -2,7 +2,7 @@ // detail/win_iocp_io_service.hpp // ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ // -// Copyright (c) 2003-2015 Christopher M. Kohlhoff (chris at kohlhoff dot com) +// Copyright (c) 2003-2017 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) diff --git a/3party/boost/boost/asio/detail/win_iocp_null_buffers_op.hpp b/3party/boost/boost/asio/detail/win_iocp_null_buffers_op.hpp index 91118fb72b..905d7a664e 100644 --- a/3party/boost/boost/asio/detail/win_iocp_null_buffers_op.hpp +++ b/3party/boost/boost/asio/detail/win_iocp_null_buffers_op.hpp @@ -2,7 +2,7 @@ // detail/win_iocp_null_buffers_op.hpp // ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ // -// Copyright (c) 2003-2015 Christopher M. Kohlhoff (chris at kohlhoff dot com) +// Copyright (c) 2003-2017 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) diff --git a/3party/boost/boost/asio/detail/win_iocp_operation.hpp b/3party/boost/boost/asio/detail/win_iocp_operation.hpp index b3b4ae77f5..232930344b 100644 --- a/3party/boost/boost/asio/detail/win_iocp_operation.hpp +++ b/3party/boost/boost/asio/detail/win_iocp_operation.hpp @@ -2,7 +2,7 @@ // detail/win_iocp_operation.hpp // ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ // -// Copyright (c) 2003-2015 Christopher M. Kohlhoff (chris at kohlhoff dot com) +// Copyright (c) 2003-2017 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) diff --git a/3party/boost/boost/asio/detail/win_iocp_overlapped_op.hpp b/3party/boost/boost/asio/detail/win_iocp_overlapped_op.hpp index da292388db..6d0e4bfcc2 100644 --- a/3party/boost/boost/asio/detail/win_iocp_overlapped_op.hpp +++ b/3party/boost/boost/asio/detail/win_iocp_overlapped_op.hpp @@ -2,7 +2,7 @@ // detail/win_iocp_overlapped_op.hpp // ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ // -// Copyright (c) 2003-2015 Christopher M. Kohlhoff (chris at kohlhoff dot com) +// Copyright (c) 2003-2017 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) diff --git a/3party/boost/boost/asio/detail/win_iocp_overlapped_ptr.hpp b/3party/boost/boost/asio/detail/win_iocp_overlapped_ptr.hpp index 9177e312bb..5d252c6fb1 100644 --- a/3party/boost/boost/asio/detail/win_iocp_overlapped_ptr.hpp +++ b/3party/boost/boost/asio/detail/win_iocp_overlapped_ptr.hpp @@ -2,7 +2,7 @@ // detail/win_iocp_overlapped_ptr.hpp // ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ // -// Copyright (c) 2003-2015 Christopher M. Kohlhoff (chris at kohlhoff dot com) +// Copyright (c) 2003-2017 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) diff --git a/3party/boost/boost/asio/detail/win_iocp_serial_port_service.hpp b/3party/boost/boost/asio/detail/win_iocp_serial_port_service.hpp index 96dfa1070e..6b21f96535 100644 --- a/3party/boost/boost/asio/detail/win_iocp_serial_port_service.hpp +++ b/3party/boost/boost/asio/detail/win_iocp_serial_port_service.hpp @@ -2,7 +2,7 @@ // detail/win_iocp_serial_port_service.hpp // ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ // -// Copyright (c) 2003-2015 Christopher M. Kohlhoff (chris at kohlhoff dot com) +// Copyright (c) 2003-2017 Christopher M. Kohlhoff (chris at kohlhoff dot com) // Copyright (c) 2008 Rep Invariant Systems, Inc. (info@repinvariant.com) // // Distributed under the Boost Software License, Version 1.0. (See accompanying diff --git a/3party/boost/boost/asio/detail/win_iocp_socket_accept_op.hpp b/3party/boost/boost/asio/detail/win_iocp_socket_accept_op.hpp index 4011c02fc3..d296103c54 100644 --- a/3party/boost/boost/asio/detail/win_iocp_socket_accept_op.hpp +++ b/3party/boost/boost/asio/detail/win_iocp_socket_accept_op.hpp @@ -2,7 +2,7 @@ // detail/win_iocp_socket_accept_op.hpp // ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ // -// Copyright (c) 2003-2015 Christopher M. Kohlhoff (chris at kohlhoff dot com) +// Copyright (c) 2003-2017 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) diff --git a/3party/boost/boost/asio/detail/win_iocp_socket_connect_op.hpp b/3party/boost/boost/asio/detail/win_iocp_socket_connect_op.hpp index c9c5d2ac5b..e987c6b6c4 100644 --- a/3party/boost/boost/asio/detail/win_iocp_socket_connect_op.hpp +++ b/3party/boost/boost/asio/detail/win_iocp_socket_connect_op.hpp @@ -2,7 +2,7 @@ // detail/win_iocp_socket_connect_op.hpp // ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ // -// Copyright (c) 2003-2015 Christopher M. Kohlhoff (chris at kohlhoff dot com) +// Copyright (c) 2003-2017 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) diff --git a/3party/boost/boost/asio/detail/win_iocp_socket_recv_op.hpp b/3party/boost/boost/asio/detail/win_iocp_socket_recv_op.hpp index a5a6a51160..4202822d17 100644 --- a/3party/boost/boost/asio/detail/win_iocp_socket_recv_op.hpp +++ b/3party/boost/boost/asio/detail/win_iocp_socket_recv_op.hpp @@ -2,7 +2,7 @@ // detail/win_iocp_socket_recv_op.hpp // ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ // -// Copyright (c) 2003-2015 Christopher M. Kohlhoff (chris at kohlhoff dot com) +// Copyright (c) 2003-2017 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) diff --git a/3party/boost/boost/asio/detail/win_iocp_socket_recvfrom_op.hpp b/3party/boost/boost/asio/detail/win_iocp_socket_recvfrom_op.hpp index ee0503a9f8..21ca4fb331 100644 --- a/3party/boost/boost/asio/detail/win_iocp_socket_recvfrom_op.hpp +++ b/3party/boost/boost/asio/detail/win_iocp_socket_recvfrom_op.hpp @@ -2,7 +2,7 @@ // detail/win_iocp_socket_recvfrom_op.hpp // ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ // -// Copyright (c) 2003-2015 Christopher M. Kohlhoff (chris at kohlhoff dot com) +// Copyright (c) 2003-2017 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) diff --git a/3party/boost/boost/asio/detail/win_iocp_socket_recvmsg_op.hpp b/3party/boost/boost/asio/detail/win_iocp_socket_recvmsg_op.hpp index e56c87497a..5179bb2945 100644 --- a/3party/boost/boost/asio/detail/win_iocp_socket_recvmsg_op.hpp +++ b/3party/boost/boost/asio/detail/win_iocp_socket_recvmsg_op.hpp @@ -2,7 +2,7 @@ // detail/win_iocp_socket_recvmsg_op.hpp // ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ // -// Copyright (c) 2003-2015 Christopher M. Kohlhoff (chris at kohlhoff dot com) +// Copyright (c) 2003-2017 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) diff --git a/3party/boost/boost/asio/detail/win_iocp_socket_send_op.hpp b/3party/boost/boost/asio/detail/win_iocp_socket_send_op.hpp index 362b5fd0c5..c9abc0e664 100644 --- a/3party/boost/boost/asio/detail/win_iocp_socket_send_op.hpp +++ b/3party/boost/boost/asio/detail/win_iocp_socket_send_op.hpp @@ -2,7 +2,7 @@ // detail/win_iocp_socket_send_op.hpp // ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ // -// Copyright (c) 2003-2015 Christopher M. Kohlhoff (chris at kohlhoff dot com) +// Copyright (c) 2003-2017 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) diff --git a/3party/boost/boost/asio/detail/win_iocp_socket_service.hpp b/3party/boost/boost/asio/detail/win_iocp_socket_service.hpp index 90ae4ab5ba..179798c8d9 100644 --- a/3party/boost/boost/asio/detail/win_iocp_socket_service.hpp +++ b/3party/boost/boost/asio/detail/win_iocp_socket_service.hpp @@ -2,7 +2,7 @@ // detail/win_iocp_socket_service.hpp // ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ // -// Copyright (c) 2003-2015 Christopher M. Kohlhoff (chris at kohlhoff dot com) +// Copyright (c) 2003-2017 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) @@ -169,6 +169,7 @@ public: // Move-construct a new socket implementation from another protocol type. template void converting_move_construct(implementation_type& impl, + win_iocp_socket_service&, typename win_iocp_socket_service< Protocol1>::implementation_type& other_impl) { diff --git a/3party/boost/boost/asio/detail/win_iocp_socket_service_base.hpp b/3party/boost/boost/asio/detail/win_iocp_socket_service_base.hpp index a5335b1001..8ecf219598 100644 --- a/3party/boost/boost/asio/detail/win_iocp_socket_service_base.hpp +++ b/3party/boost/boost/asio/detail/win_iocp_socket_service_base.hpp @@ -2,7 +2,7 @@ // detail/win_iocp_socket_service_base.hpp // ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ // -// Copyright (c) 2003-2015 Christopher M. Kohlhoff (chris at kohlhoff dot com) +// Copyright (c) 2003-2017 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) diff --git a/3party/boost/boost/asio/detail/win_iocp_thread_info.hpp b/3party/boost/boost/asio/detail/win_iocp_thread_info.hpp index 8c9b11a1d2..d8b77c9a6c 100644 --- a/3party/boost/boost/asio/detail/win_iocp_thread_info.hpp +++ b/3party/boost/boost/asio/detail/win_iocp_thread_info.hpp @@ -2,7 +2,7 @@ // detail/win_iocp_thread_info.hpp // ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ // -// Copyright (c) 2003-2015 Christopher M. Kohlhoff (chris at kohlhoff dot com) +// Copyright (c) 2003-2017 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) diff --git a/3party/boost/boost/asio/detail/win_mutex.hpp b/3party/boost/boost/asio/detail/win_mutex.hpp index c2b150b254..1bf99ec0e0 100644 --- a/3party/boost/boost/asio/detail/win_mutex.hpp +++ b/3party/boost/boost/asio/detail/win_mutex.hpp @@ -2,7 +2,7 @@ // detail/win_mutex.hpp // ~~~~~~~~~~~~~~~~~~~~ // -// Copyright (c) 2003-2015 Christopher M. Kohlhoff (chris at kohlhoff dot com) +// Copyright (c) 2003-2017 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) diff --git a/3party/boost/boost/asio/detail/win_object_handle_service.hpp b/3party/boost/boost/asio/detail/win_object_handle_service.hpp index 823a24fe0f..3383657304 100644 --- a/3party/boost/boost/asio/detail/win_object_handle_service.hpp +++ b/3party/boost/boost/asio/detail/win_object_handle_service.hpp @@ -2,7 +2,7 @@ // detail/win_object_handle_service.hpp // ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ // -// Copyright (c) 2003-2015 Christopher M. Kohlhoff (chris at kohlhoff dot com) +// Copyright (c) 2003-2017 Christopher M. Kohlhoff (chris at kohlhoff dot com) // Copyright (c) 2011 Boris Schaeling (boris@highscore.de) // // Distributed under the Boost Software License, Version 1.0. (See accompanying diff --git a/3party/boost/boost/asio/detail/win_static_mutex.hpp b/3party/boost/boost/asio/detail/win_static_mutex.hpp index 306fbf6b52..5f0099705d 100644 --- a/3party/boost/boost/asio/detail/win_static_mutex.hpp +++ b/3party/boost/boost/asio/detail/win_static_mutex.hpp @@ -2,7 +2,7 @@ // detail/win_static_mutex.hpp // ~~~~~~~~~~~~~~~~~~~~~~~~~~~ // -// Copyright (c) 2003-2015 Christopher M. Kohlhoff (chris at kohlhoff dot com) +// Copyright (c) 2003-2017 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) diff --git a/3party/boost/boost/asio/detail/win_thread.hpp b/3party/boost/boost/asio/detail/win_thread.hpp index e465430031..a138d92ee8 100644 --- a/3party/boost/boost/asio/detail/win_thread.hpp +++ b/3party/boost/boost/asio/detail/win_thread.hpp @@ -2,7 +2,7 @@ // detail/win_thread.hpp // ~~~~~~~~~~~~~~~~~~~~~ // -// Copyright (c) 2003-2015 Christopher M. Kohlhoff (chris at kohlhoff dot com) +// Copyright (c) 2003-2017 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) @@ -17,7 +17,9 @@ #include -#if defined(BOOST_ASIO_WINDOWS) && !defined(UNDER_CE) +#if defined(BOOST_ASIO_WINDOWS) \ + && !defined(BOOST_ASIO_WINDOWS_APP) \ + && !defined(UNDER_CE) #include #include @@ -136,6 +138,8 @@ private: # include #endif // defined(BOOST_ASIO_HEADER_ONLY) -#endif // defined(BOOST_ASIO_WINDOWS) && !defined(UNDER_CE) +#endif // defined(BOOST_ASIO_WINDOWS) + // && !defined(BOOST_ASIO_WINDOWS_APP) + // && !defined(UNDER_CE) #endif // BOOST_ASIO_DETAIL_WIN_THREAD_HPP diff --git a/3party/boost/boost/asio/detail/win_tss_ptr.hpp b/3party/boost/boost/asio/detail/win_tss_ptr.hpp index c4ec696f8a..99200d0a90 100644 --- a/3party/boost/boost/asio/detail/win_tss_ptr.hpp +++ b/3party/boost/boost/asio/detail/win_tss_ptr.hpp @@ -2,7 +2,7 @@ // detail/win_tss_ptr.hpp // ~~~~~~~~~~~~~~~~~~~~~~ // -// Copyright (c) 2003-2015 Christopher M. Kohlhoff (chris at kohlhoff dot com) +// Copyright (c) 2003-2017 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) diff --git a/3party/boost/boost/asio/detail/wince_thread.hpp b/3party/boost/boost/asio/detail/winapi_thread.hpp similarity index 62% rename from 3party/boost/boost/asio/detail/wince_thread.hpp rename to 3party/boost/boost/asio/detail/winapi_thread.hpp index 59a9341463..204e73f42a 100644 --- a/3party/boost/boost/asio/detail/wince_thread.hpp +++ b/3party/boost/boost/asio/detail/winapi_thread.hpp @@ -1,15 +1,15 @@ // -// detail/wince_thread.hpp -// ~~~~~~~~~~~~~~~~~~~~~~~ +// detail/winapi_thread.hpp +// ~~~~~~~~~~~~~~~~~~~~~~~~ // -// Copyright (c) 2003-2015 Christopher M. Kohlhoff (chris at kohlhoff dot com) +// Copyright (c) 2003-2017 Christopher M. Kohlhoff (chris at kohlhoff dot com) // // Distributed under the Boost Software License, Version 1.0. (See accompanying // file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt) // -#ifndef BOOST_ASIO_DETAIL_WINCE_THREAD_HPP -#define BOOST_ASIO_DETAIL_WINCE_THREAD_HPP +#ifndef BOOST_ASIO_DETAIL_WINAPI_THREAD_HPP +#define BOOST_ASIO_DETAIL_WINAPI_THREAD_HPP #if defined(_MSC_VER) && (_MSC_VER >= 1200) # pragma once @@ -17,7 +17,8 @@ #include -#if defined(BOOST_ASIO_WINDOWS) && defined(UNDER_CE) +#if defined(BOOST_ASIO_WINDOWS) +#if defined(BOOST_ASIO_WINDOWS_APP) || defined(UNDER_CE) #include #include @@ -31,19 +32,19 @@ namespace boost { namespace asio { namespace detail { -DWORD WINAPI wince_thread_function(LPVOID arg); +DWORD WINAPI winapi_thread_function(LPVOID arg); -class wince_thread +class winapi_thread : private noncopyable { public: // Constructor. template - wince_thread(Function f, unsigned int = 0) + winapi_thread(Function f, unsigned int = 0) { std::auto_ptr arg(new func(f)); DWORD thread_id = 0; - thread_ = ::CreateThread(0, 0, wince_thread_function, + thread_ = ::CreateThread(0, 0, winapi_thread_function, arg.get(), 0, &thread_id); if (!thread_) { @@ -56,7 +57,7 @@ public: } // Destructor. - ~wince_thread() + ~winapi_thread() { ::CloseHandle(thread_); } @@ -64,11 +65,15 @@ public: // Wait for the thread to exit. void join() { +#if defined(BOOST_ASIO_WINDOWS_APP) + ::WaitForSingleObjectEx(thread_, INFINITE, false); +#else // defined(BOOST_ASIO_WINDOWS_APP) ::WaitForSingleObject(thread_, INFINITE); +#endif // defined(BOOST_ASIO_WINDOWS_APP) } private: - friend DWORD WINAPI wince_thread_function(LPVOID arg); + friend DWORD WINAPI winapi_thread_function(LPVOID arg); class func_base { @@ -99,10 +104,10 @@ private: ::HANDLE thread_; }; -inline DWORD WINAPI wince_thread_function(LPVOID arg) +inline DWORD WINAPI winapi_thread_function(LPVOID arg) { - std::auto_ptr func( - static_cast(arg)); + std::auto_ptr func( + static_cast(arg)); func->run(); return 0; } @@ -113,6 +118,7 @@ inline DWORD WINAPI wince_thread_function(LPVOID arg) #include -#endif // defined(BOOST_ASIO_WINDOWS) && defined(UNDER_CE) +#endif // defined(BOOST_ASIO_WINDOWS_APP) || defined(UNDER_CE) +#endif // defined(BOOST_ASIO_WINDOWS) -#endif // BOOST_ASIO_DETAIL_WINCE_THREAD_HPP +#endif // BOOST_ASIO_DETAIL_WINAPI_THREAD_HPP diff --git a/3party/boost/boost/asio/detail/winrt_async_manager.hpp b/3party/boost/boost/asio/detail/winrt_async_manager.hpp index 6ae9253f27..d6d823d689 100644 --- a/3party/boost/boost/asio/detail/winrt_async_manager.hpp +++ b/3party/boost/boost/asio/detail/winrt_async_manager.hpp @@ -2,7 +2,7 @@ // detail/winrt_async_manager.hpp // ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ // -// Copyright (c) 2003-2015 Christopher M. Kohlhoff (chris at kohlhoff dot com) +// Copyright (c) 2003-2017 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) diff --git a/3party/boost/boost/asio/detail/winrt_async_op.hpp b/3party/boost/boost/asio/detail/winrt_async_op.hpp index 95e47a38df..078016ebc7 100644 --- a/3party/boost/boost/asio/detail/winrt_async_op.hpp +++ b/3party/boost/boost/asio/detail/winrt_async_op.hpp @@ -2,7 +2,7 @@ // detail/winrt_async_op.hpp // ~~~~~~~~~~~~~~~~~~~~~~~~~ // -// Copyright (c) 2003-2015 Christopher M. Kohlhoff (chris at kohlhoff dot com) +// Copyright (c) 2003-2017 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) diff --git a/3party/boost/boost/asio/detail/winrt_resolve_op.hpp b/3party/boost/boost/asio/detail/winrt_resolve_op.hpp index d563e04d31..12d56933b1 100644 --- a/3party/boost/boost/asio/detail/winrt_resolve_op.hpp +++ b/3party/boost/boost/asio/detail/winrt_resolve_op.hpp @@ -2,7 +2,7 @@ // detail/winrt_resolve_op.hpp // ~~~~~~~~~~~~~~~~~~~~~~~~~~~ // -// Copyright (c) 2003-2015 Christopher M. Kohlhoff (chris at kohlhoff dot com) +// Copyright (c) 2003-2017 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) diff --git a/3party/boost/boost/asio/detail/winrt_resolver_service.hpp b/3party/boost/boost/asio/detail/winrt_resolver_service.hpp index e6ce7dd357..dfd1dddeb2 100644 --- a/3party/boost/boost/asio/detail/winrt_resolver_service.hpp +++ b/3party/boost/boost/asio/detail/winrt_resolver_service.hpp @@ -2,7 +2,7 @@ // detail/winrt_resolver_service.hpp // ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ // -// Copyright (c) 2003-2015 Christopher M. Kohlhoff (chris at kohlhoff dot com) +// Copyright (c) 2003-2017 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) diff --git a/3party/boost/boost/asio/detail/winrt_socket_connect_op.hpp b/3party/boost/boost/asio/detail/winrt_socket_connect_op.hpp index 6c9dc993d0..548f7d631a 100644 --- a/3party/boost/boost/asio/detail/winrt_socket_connect_op.hpp +++ b/3party/boost/boost/asio/detail/winrt_socket_connect_op.hpp @@ -2,7 +2,7 @@ // detail/winrt_socket_connect_op.hpp // ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ // -// Copyright (c) 2003-2015 Christopher M. Kohlhoff (chris at kohlhoff dot com) +// Copyright (c) 2003-2017 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) diff --git a/3party/boost/boost/asio/detail/winrt_socket_recv_op.hpp b/3party/boost/boost/asio/detail/winrt_socket_recv_op.hpp index 57e80b8bf5..2cbbb3c8d8 100644 --- a/3party/boost/boost/asio/detail/winrt_socket_recv_op.hpp +++ b/3party/boost/boost/asio/detail/winrt_socket_recv_op.hpp @@ -2,7 +2,7 @@ // detail/winrt_socket_recv_op.hpp // ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ // -// Copyright (c) 2003-2015 Christopher M. Kohlhoff (chris at kohlhoff dot com) +// Copyright (c) 2003-2017 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) diff --git a/3party/boost/boost/asio/detail/winrt_socket_send_op.hpp b/3party/boost/boost/asio/detail/winrt_socket_send_op.hpp index cadfcc4271..591d9536c3 100644 --- a/3party/boost/boost/asio/detail/winrt_socket_send_op.hpp +++ b/3party/boost/boost/asio/detail/winrt_socket_send_op.hpp @@ -2,7 +2,7 @@ // detail/winrt_socket_send_op.hpp // ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ // -// Copyright (c) 2003-2015 Christopher M. Kohlhoff (chris at kohlhoff dot com) +// Copyright (c) 2003-2017 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) diff --git a/3party/boost/boost/asio/detail/winrt_ssocket_service.hpp b/3party/boost/boost/asio/detail/winrt_ssocket_service.hpp index 9897cacd98..b9b1910e78 100644 --- a/3party/boost/boost/asio/detail/winrt_ssocket_service.hpp +++ b/3party/boost/boost/asio/detail/winrt_ssocket_service.hpp @@ -2,7 +2,7 @@ // detail/winrt_ssocket_service.hpp // ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ // -// Copyright (c) 2003-2015 Christopher M. Kohlhoff (chris at kohlhoff dot com) +// Copyright (c) 2003-2017 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) @@ -90,6 +90,7 @@ public: // Move-construct a new socket implementation from another protocol type. template void converting_move_construct(implementation_type& impl, + winrt_ssocket_service&, typename winrt_ssocket_service< Protocol1>::implementation_type& other_impl) { diff --git a/3party/boost/boost/asio/detail/winrt_ssocket_service_base.hpp b/3party/boost/boost/asio/detail/winrt_ssocket_service_base.hpp index 54a435562b..88e5674576 100644 --- a/3party/boost/boost/asio/detail/winrt_ssocket_service_base.hpp +++ b/3party/boost/boost/asio/detail/winrt_ssocket_service_base.hpp @@ -2,7 +2,7 @@ // detail/winrt_ssocket_service_base.hpp // ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ // -// Copyright (c) 2003-2015 Christopher M. Kohlhoff (chris at kohlhoff dot com) +// Copyright (c) 2003-2017 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) diff --git a/3party/boost/boost/asio/detail/winrt_timer_scheduler.hpp b/3party/boost/boost/asio/detail/winrt_timer_scheduler.hpp index 07b41fa01a..8b119b2724 100644 --- a/3party/boost/boost/asio/detail/winrt_timer_scheduler.hpp +++ b/3party/boost/boost/asio/detail/winrt_timer_scheduler.hpp @@ -2,7 +2,7 @@ // detail/winrt_timer_scheduler.hpp // ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ // -// Copyright (c) 2003-2015 Christopher M. Kohlhoff (chris at kohlhoff dot com) +// Copyright (c) 2003-2017 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) diff --git a/3party/boost/boost/asio/detail/winrt_utils.hpp b/3party/boost/boost/asio/detail/winrt_utils.hpp index d06e7c66aa..351aa62f23 100644 --- a/3party/boost/boost/asio/detail/winrt_utils.hpp +++ b/3party/boost/boost/asio/detail/winrt_utils.hpp @@ -2,7 +2,7 @@ // detail/winrt_utils.hpp // ~~~~~~~~~~~~~~~~~~~~~~ // -// Copyright (c) 2003-2015 Christopher M. Kohlhoff (chris at kohlhoff dot com) +// Copyright (c) 2003-2017 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) diff --git a/3party/boost/boost/asio/detail/winsock_init.hpp b/3party/boost/boost/asio/detail/winsock_init.hpp index 46fcd3d79f..23688366c5 100644 --- a/3party/boost/boost/asio/detail/winsock_init.hpp +++ b/3party/boost/boost/asio/detail/winsock_init.hpp @@ -2,7 +2,7 @@ // detail/winsock_init.hpp // ~~~~~~~~~~~~~~~~~~~~~~~ // -// Copyright (c) 2003-2015 Christopher M. Kohlhoff (chris at kohlhoff dot com) +// Copyright (c) 2003-2017 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) diff --git a/3party/boost/boost/asio/detail/wrapped_handler.hpp b/3party/boost/boost/asio/detail/wrapped_handler.hpp index 6489d6dcec..28f1b01020 100644 --- a/3party/boost/boost/asio/detail/wrapped_handler.hpp +++ b/3party/boost/boost/asio/detail/wrapped_handler.hpp @@ -2,7 +2,7 @@ // detail/wrapped_handler.hpp // ~~~~~~~~~~~~~~~~~~~~~~~~~~ // -// Copyright (c) 2003-2015 Christopher M. Kohlhoff (chris at kohlhoff dot com) +// Copyright (c) 2003-2017 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) diff --git a/3party/boost/boost/asio/error.hpp b/3party/boost/boost/asio/error.hpp index 4252c15b9c..dd338fb156 100644 --- a/3party/boost/boost/asio/error.hpp +++ b/3party/boost/boost/asio/error.hpp @@ -2,7 +2,7 @@ // error.hpp // ~~~~~~~~~ // -// Copyright (c) 2003-2015 Christopher M. Kohlhoff (chris at kohlhoff dot com) +// Copyright (c) 2003-2017 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) @@ -255,13 +255,17 @@ inline const boost::system::error_category& get_addrinfo_category() extern BOOST_ASIO_DECL const boost::system::error_category& get_misc_category(); -static const boost::system::error_category& system_category +static const boost::system::error_category& + system_category BOOST_ASIO_UNUSED_VARIABLE = boost::asio::error::get_system_category(); -static const boost::system::error_category& netdb_category +static const boost::system::error_category& + netdb_category BOOST_ASIO_UNUSED_VARIABLE = boost::asio::error::get_netdb_category(); -static const boost::system::error_category& addrinfo_category +static const boost::system::error_category& + addrinfo_category BOOST_ASIO_UNUSED_VARIABLE = boost::asio::error::get_addrinfo_category(); -static const boost::system::error_category& misc_category +static const boost::system::error_category& + misc_category BOOST_ASIO_UNUSED_VARIABLE = boost::asio::error::get_misc_category(); } // namespace error diff --git a/3party/boost/boost/asio/generic/basic_endpoint.hpp b/3party/boost/boost/asio/generic/basic_endpoint.hpp index 9b1702ea1b..3c9b294f9a 100644 --- a/3party/boost/boost/asio/generic/basic_endpoint.hpp +++ b/3party/boost/boost/asio/generic/basic_endpoint.hpp @@ -2,7 +2,7 @@ // generic/basic_endpoint.hpp // ~~~~~~~~~~~~~~~~~~~~~~~~~~ // -// Copyright (c) 2003-2015 Christopher M. Kohlhoff (chris at kohlhoff dot com) +// Copyright (c) 2003-2017 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) diff --git a/3party/boost/boost/asio/generic/datagram_protocol.hpp b/3party/boost/boost/asio/generic/datagram_protocol.hpp index daafb6c39d..16f170544b 100644 --- a/3party/boost/boost/asio/generic/datagram_protocol.hpp +++ b/3party/boost/boost/asio/generic/datagram_protocol.hpp @@ -2,7 +2,7 @@ // generic/datagram_protocol.hpp // ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ // -// Copyright (c) 2003-2015 Christopher M. Kohlhoff (chris at kohlhoff dot com) +// Copyright (c) 2003-2017 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) diff --git a/3party/boost/boost/asio/generic/detail/endpoint.hpp b/3party/boost/boost/asio/generic/detail/endpoint.hpp index 69080a01c5..5496ef557c 100644 --- a/3party/boost/boost/asio/generic/detail/endpoint.hpp +++ b/3party/boost/boost/asio/generic/detail/endpoint.hpp @@ -2,7 +2,7 @@ // generic/detail/endpoint.hpp // ~~~~~~~~~~~~~~~~~~~~~~~~~~~ // -// Copyright (c) 2003-2015 Christopher M. Kohlhoff (chris at kohlhoff dot com) +// Copyright (c) 2003-2017 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) diff --git a/3party/boost/boost/asio/generic/detail/impl/endpoint.ipp b/3party/boost/boost/asio/generic/detail/impl/endpoint.ipp index af1950c284..3c2da4a608 100644 --- a/3party/boost/boost/asio/generic/detail/impl/endpoint.ipp +++ b/3party/boost/boost/asio/generic/detail/impl/endpoint.ipp @@ -2,7 +2,7 @@ // generic/detail/impl/endpoint.hpp // ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ // -// Copyright (c) 2003-2015 Christopher M. Kohlhoff (chris at kohlhoff dot com) +// Copyright (c) 2003-2017 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) diff --git a/3party/boost/boost/asio/generic/raw_protocol.hpp b/3party/boost/boost/asio/generic/raw_protocol.hpp index 62f930b588..0cd9d50be3 100644 --- a/3party/boost/boost/asio/generic/raw_protocol.hpp +++ b/3party/boost/boost/asio/generic/raw_protocol.hpp @@ -2,7 +2,7 @@ // generic/raw_protocol.hpp // ~~~~~~~~~~~~~~~~~~~~~~~~ // -// Copyright (c) 2003-2015 Christopher M. Kohlhoff (chris at kohlhoff dot com) +// Copyright (c) 2003-2017 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) diff --git a/3party/boost/boost/asio/generic/seq_packet_protocol.hpp b/3party/boost/boost/asio/generic/seq_packet_protocol.hpp index 13090fedc0..13ecd8ae73 100644 --- a/3party/boost/boost/asio/generic/seq_packet_protocol.hpp +++ b/3party/boost/boost/asio/generic/seq_packet_protocol.hpp @@ -2,7 +2,7 @@ // generic/seq_packet_protocol.hpp // ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ // -// Copyright (c) 2003-2015 Christopher M. Kohlhoff (chris at kohlhoff dot com) +// Copyright (c) 2003-2017 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) diff --git a/3party/boost/boost/asio/generic/stream_protocol.hpp b/3party/boost/boost/asio/generic/stream_protocol.hpp index 5113040c14..f57131a24d 100644 --- a/3party/boost/boost/asio/generic/stream_protocol.hpp +++ b/3party/boost/boost/asio/generic/stream_protocol.hpp @@ -2,7 +2,7 @@ // generic/stream_protocol.hpp // ~~~~~~~~~~~~~~~~~~~~~~~~~~~ // -// Copyright (c) 2003-2015 Christopher M. Kohlhoff (chris at kohlhoff dot com) +// Copyright (c) 2003-2017 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) diff --git a/3party/boost/boost/asio/handler_alloc_hook.hpp b/3party/boost/boost/asio/handler_alloc_hook.hpp index 8658683d6f..84071d0378 100644 --- a/3party/boost/boost/asio/handler_alloc_hook.hpp +++ b/3party/boost/boost/asio/handler_alloc_hook.hpp @@ -2,7 +2,7 @@ // handler_alloc_hook.hpp // ~~~~~~~~~~~~~~~~~~~~~~ // -// Copyright (c) 2003-2015 Christopher M. Kohlhoff (chris at kohlhoff dot com) +// Copyright (c) 2003-2017 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) diff --git a/3party/boost/boost/asio/handler_continuation_hook.hpp b/3party/boost/boost/asio/handler_continuation_hook.hpp index dd3d782278..da516bc205 100644 --- a/3party/boost/boost/asio/handler_continuation_hook.hpp +++ b/3party/boost/boost/asio/handler_continuation_hook.hpp @@ -2,7 +2,7 @@ // handler_continuation_hook.hpp // ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ // -// Copyright (c) 2003-2015 Christopher M. Kohlhoff (chris at kohlhoff dot com) +// Copyright (c) 2003-2017 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) diff --git a/3party/boost/boost/asio/handler_invoke_hook.hpp b/3party/boost/boost/asio/handler_invoke_hook.hpp index b97a79ce8c..6605d87499 100644 --- a/3party/boost/boost/asio/handler_invoke_hook.hpp +++ b/3party/boost/boost/asio/handler_invoke_hook.hpp @@ -2,7 +2,7 @@ // handler_invoke_hook.hpp // ~~~~~~~~~~~~~~~~~~~~~~~ // -// Copyright (c) 2003-2015 Christopher M. Kohlhoff (chris at kohlhoff dot com) +// Copyright (c) 2003-2017 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) diff --git a/3party/boost/boost/asio/handler_type.hpp b/3party/boost/boost/asio/handler_type.hpp index 14b449f67d..11e97e3ea0 100644 --- a/3party/boost/boost/asio/handler_type.hpp +++ b/3party/boost/boost/asio/handler_type.hpp @@ -2,7 +2,7 @@ // handler_type.hpp // ~~~~~~~~~~~~~~~~ // -// Copyright (c) 2003-2015 Christopher M. Kohlhoff (chris at kohlhoff dot com) +// Copyright (c) 2003-2017 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) diff --git a/3party/boost/boost/asio/high_resolution_timer.hpp b/3party/boost/boost/asio/high_resolution_timer.hpp index 3474c45219..5d6cef0296 100644 --- a/3party/boost/boost/asio/high_resolution_timer.hpp +++ b/3party/boost/boost/asio/high_resolution_timer.hpp @@ -2,7 +2,7 @@ // high_resolution_timer.hpp // ~~~~~~~~~~~~~~~~~~~~~~~~~ // -// Copyright (c) 2003-2015 Christopher M. Kohlhoff (chris at kohlhoff dot com) +// Copyright (c) 2003-2017 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) diff --git a/3party/boost/boost/asio/impl/buffered_read_stream.hpp b/3party/boost/boost/asio/impl/buffered_read_stream.hpp index f45230870d..082ed0338b 100644 --- a/3party/boost/boost/asio/impl/buffered_read_stream.hpp +++ b/3party/boost/boost/asio/impl/buffered_read_stream.hpp @@ -2,7 +2,7 @@ // impl/buffered_read_stream.hpp // ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ // -// Copyright (c) 2003-2015 Christopher M. Kohlhoff (chris at kohlhoff dot com) +// Copyright (c) 2003-2017 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) diff --git a/3party/boost/boost/asio/impl/buffered_write_stream.hpp b/3party/boost/boost/asio/impl/buffered_write_stream.hpp index d49c9d9680..22585eb6ce 100644 --- a/3party/boost/boost/asio/impl/buffered_write_stream.hpp +++ b/3party/boost/boost/asio/impl/buffered_write_stream.hpp @@ -2,7 +2,7 @@ // impl/buffered_write_stream.hpp // ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ // -// Copyright (c) 2003-2015 Christopher M. Kohlhoff (chris at kohlhoff dot com) +// Copyright (c) 2003-2017 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) diff --git a/3party/boost/boost/asio/impl/connect.hpp b/3party/boost/boost/asio/impl/connect.hpp index b434f7f5d3..ba587eca02 100644 --- a/3party/boost/boost/asio/impl/connect.hpp +++ b/3party/boost/boost/asio/impl/connect.hpp @@ -2,7 +2,7 @@ // impl/connect.hpp // ~~~~~~~~~~~~~~~~ // -// Copyright (c) 2003-2015 Christopher M. Kohlhoff (chris at kohlhoff dot com) +// Copyright (c) 2003-2017 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) @@ -123,6 +123,8 @@ Iterator connect(basic_socket& s, if (!ec) return iter; } + else + break; } if (!ec) diff --git a/3party/boost/boost/asio/impl/error.ipp b/3party/boost/boost/asio/impl/error.ipp index 635734fcd5..8626aded6a 100644 --- a/3party/boost/boost/asio/impl/error.ipp +++ b/3party/boost/boost/asio/impl/error.ipp @@ -2,7 +2,7 @@ // impl/error.ipp // ~~~~~~~~~~~~~~ // -// Copyright (c) 2003-2015 Christopher M. Kohlhoff (chris at kohlhoff dot com) +// Copyright (c) 2003-2017 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) diff --git a/3party/boost/boost/asio/impl/handler_alloc_hook.ipp b/3party/boost/boost/asio/impl/handler_alloc_hook.ipp index 68b7912a78..ddc84c75cf 100644 --- a/3party/boost/boost/asio/impl/handler_alloc_hook.ipp +++ b/3party/boost/boost/asio/impl/handler_alloc_hook.ipp @@ -2,7 +2,7 @@ // impl/handler_alloc_hook.ipp // ~~~~~~~~~~~~~~~~~~~~~~~~~~~ // -// Copyright (c) 2003-2015 Christopher M. Kohlhoff (chris at kohlhoff dot com) +// Copyright (c) 2003-2017 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) diff --git a/3party/boost/boost/asio/impl/io_service.hpp b/3party/boost/boost/asio/impl/io_service.hpp index 120d76caa9..beee3f3978 100644 --- a/3party/boost/boost/asio/impl/io_service.hpp +++ b/3party/boost/boost/asio/impl/io_service.hpp @@ -2,7 +2,7 @@ // impl/io_service.hpp // ~~~~~~~~~~~~~~~~~~~ // -// Copyright (c) 2003-2015 Christopher M. Kohlhoff (chris at kohlhoff dot com) +// Copyright (c) 2003-2017 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) diff --git a/3party/boost/boost/asio/impl/io_service.ipp b/3party/boost/boost/asio/impl/io_service.ipp index b6daa0f588..428db3f879 100644 --- a/3party/boost/boost/asio/impl/io_service.ipp +++ b/3party/boost/boost/asio/impl/io_service.ipp @@ -2,7 +2,7 @@ // impl/io_service.ipp // ~~~~~~~~~~~~~~~~~~~ // -// Copyright (c) 2003-2015 Christopher M. Kohlhoff (chris at kohlhoff dot com) +// Copyright (c) 2003-2017 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) diff --git a/3party/boost/boost/asio/impl/read.hpp b/3party/boost/boost/asio/impl/read.hpp index d5021a27c8..8648e47918 100644 --- a/3party/boost/boost/asio/impl/read.hpp +++ b/3party/boost/boost/asio/impl/read.hpp @@ -2,7 +2,7 @@ // impl/read.hpp // ~~~~~~~~~~~~~ // -// Copyright (c) 2003-2015 Christopher M. Kohlhoff (chris at kohlhoff dot com) +// Copyright (c) 2003-2017 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) diff --git a/3party/boost/boost/asio/impl/read_at.hpp b/3party/boost/boost/asio/impl/read_at.hpp index c2dbb3b070..0ec8a94e44 100644 --- a/3party/boost/boost/asio/impl/read_at.hpp +++ b/3party/boost/boost/asio/impl/read_at.hpp @@ -2,7 +2,7 @@ // impl/read_at.hpp // ~~~~~~~~~~~~~~~~ // -// Copyright (c) 2003-2015 Christopher M. Kohlhoff (chris at kohlhoff dot com) +// Copyright (c) 2003-2017 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) diff --git a/3party/boost/boost/asio/impl/read_until.hpp b/3party/boost/boost/asio/impl/read_until.hpp index e516c1f0d6..737dedcdf2 100644 --- a/3party/boost/boost/asio/impl/read_until.hpp +++ b/3party/boost/boost/asio/impl/read_until.hpp @@ -2,7 +2,7 @@ // impl/read_until.hpp // ~~~~~~~~~~~~~~~~~~~ // -// Copyright (c) 2003-2015 Christopher M. Kohlhoff (chris at kohlhoff dot com) +// Copyright (c) 2003-2017 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) diff --git a/3party/boost/boost/asio/impl/serial_port_base.hpp b/3party/boost/boost/asio/impl/serial_port_base.hpp index 247de48bc3..a138011347 100644 --- a/3party/boost/boost/asio/impl/serial_port_base.hpp +++ b/3party/boost/boost/asio/impl/serial_port_base.hpp @@ -2,7 +2,7 @@ // impl/serial_port_base.hpp // ~~~~~~~~~~~~~~~~~~~~~~~~~ // -// Copyright (c) 2003-2015 Christopher M. Kohlhoff (chris at kohlhoff dot com) +// Copyright (c) 2003-2017 Christopher M. Kohlhoff (chris at kohlhoff dot com) // Copyright (c) 2008 Rep Invariant Systems, Inc. (info@repinvariant.com) // // Distributed under the Boost Software License, Version 1.0. (See accompanying diff --git a/3party/boost/boost/asio/impl/serial_port_base.ipp b/3party/boost/boost/asio/impl/serial_port_base.ipp index 0c4fdbacd9..fcb6ce3df4 100644 --- a/3party/boost/boost/asio/impl/serial_port_base.ipp +++ b/3party/boost/boost/asio/impl/serial_port_base.ipp @@ -2,7 +2,7 @@ // impl/serial_port_base.ipp // ~~~~~~~~~~~~~~~~~~~~~~~~~ // -// Copyright (c) 2003-2015 Christopher M. Kohlhoff (chris at kohlhoff dot com) +// Copyright (c) 2003-2017 Christopher M. Kohlhoff (chris at kohlhoff dot com) // Copyright (c) 2008 Rep Invariant Systems, Inc. (info@repinvariant.com) // // Distributed under the Boost Software License, Version 1.0. (See accompanying diff --git a/3party/boost/boost/asio/impl/spawn.hpp b/3party/boost/boost/asio/impl/spawn.hpp index 7c6b2c240b..a42fc6fbad 100644 --- a/3party/boost/boost/asio/impl/spawn.hpp +++ b/3party/boost/boost/asio/impl/spawn.hpp @@ -2,7 +2,7 @@ // impl/spawn.hpp // ~~~~~~~~~~~~~~ // -// Copyright (c) 2003-2015 Christopher M. Kohlhoff (chris at kohlhoff dot com) +// Copyright (c) 2003-2017 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) diff --git a/3party/boost/boost/asio/impl/src.cpp b/3party/boost/boost/asio/impl/src.cpp index 15c071456c..1b76dd83c4 100644 --- a/3party/boost/boost/asio/impl/src.cpp +++ b/3party/boost/boost/asio/impl/src.cpp @@ -2,7 +2,7 @@ // impl/src.cpp // ~~~~~~~~~~~~ // -// Copyright (c) 2003-2015 Christopher M. Kohlhoff (chris at kohlhoff dot com) +// Copyright (c) 2003-2017 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) diff --git a/3party/boost/boost/asio/impl/src.hpp b/3party/boost/boost/asio/impl/src.hpp index d638e3622f..7b9a03eda9 100644 --- a/3party/boost/boost/asio/impl/src.hpp +++ b/3party/boost/boost/asio/impl/src.hpp @@ -2,7 +2,7 @@ // impl/src.hpp // ~~~~~~~~~~~~ // -// Copyright (c) 2003-2015 Christopher M. Kohlhoff (chris at kohlhoff dot com) +// Copyright (c) 2003-2017 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) diff --git a/3party/boost/boost/asio/impl/use_future.hpp b/3party/boost/boost/asio/impl/use_future.hpp index 5acc127bfa..c74050ea63 100644 --- a/3party/boost/boost/asio/impl/use_future.hpp +++ b/3party/boost/boost/asio/impl/use_future.hpp @@ -2,7 +2,7 @@ // impl/use_future.hpp // ~~~~~~~~~~~~~~~~~~~ // -// Copyright (c) 2003-2015 Christopher M. Kohlhoff (chris at kohlhoff dot com) +// Copyright (c) 2003-2017 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) @@ -21,6 +21,7 @@ #include #include #include +#include #include @@ -34,10 +35,12 @@ namespace detail { { public: // Construct from use_future special value. - template - promise_handler(use_future_t uf) + template + promise_handler(use_future_t uf) : promise_(std::allocate_shared >( - uf.get_allocator(), std::allocator_arg, uf.get_allocator())) + BOOST_ASIO_REBIND_ALLOC(Alloc, char)(uf.get_allocator()), + std::allocator_arg, + BOOST_ASIO_REBIND_ALLOC(Alloc, char)(uf.get_allocator()))) { } @@ -66,10 +69,12 @@ namespace detail { { public: // Construct from use_future special value. Used during rebinding. - template - promise_handler(use_future_t uf) + template + promise_handler(use_future_t uf) : promise_(std::allocate_shared >( - uf.get_allocator(), std::allocator_arg, uf.get_allocator())) + BOOST_ASIO_REBIND_ALLOC(Alloc, char)(uf.get_allocator()), + std::allocator_arg, + BOOST_ASIO_REBIND_ALLOC(Alloc, char)(uf.get_allocator()))) { } diff --git a/3party/boost/boost/asio/impl/write.hpp b/3party/boost/boost/asio/impl/write.hpp index af3b279abe..84313fed09 100644 --- a/3party/boost/boost/asio/impl/write.hpp +++ b/3party/boost/boost/asio/impl/write.hpp @@ -2,7 +2,7 @@ // impl/write.hpp // ~~~~~~~~~~~~~~ // -// Copyright (c) 2003-2015 Christopher M. Kohlhoff (chris at kohlhoff dot com) +// Copyright (c) 2003-2017 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) diff --git a/3party/boost/boost/asio/impl/write_at.hpp b/3party/boost/boost/asio/impl/write_at.hpp index 85a7610c15..20e95d9338 100644 --- a/3party/boost/boost/asio/impl/write_at.hpp +++ b/3party/boost/boost/asio/impl/write_at.hpp @@ -2,7 +2,7 @@ // impl/write_at.hpp // ~~~~~~~~~~~~~~~~~ // -// Copyright (c) 2003-2015 Christopher M. Kohlhoff (chris at kohlhoff dot com) +// Copyright (c) 2003-2017 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) diff --git a/3party/boost/boost/asio/io_service.hpp b/3party/boost/boost/asio/io_service.hpp index ffbd9ce2ab..f2b4667311 100644 --- a/3party/boost/boost/asio/io_service.hpp +++ b/3party/boost/boost/asio/io_service.hpp @@ -2,7 +2,7 @@ // io_service.hpp // ~~~~~~~~~~~~~~ // -// Copyright (c) 2003-2015 Christopher M. Kohlhoff (chris at kohlhoff dot com) +// Copyright (c) 2003-2017 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) diff --git a/3party/boost/boost/asio/ip/address.hpp b/3party/boost/boost/asio/ip/address.hpp index 01485e9206..6e1b19e650 100644 --- a/3party/boost/boost/asio/ip/address.hpp +++ b/3party/boost/boost/asio/ip/address.hpp @@ -2,7 +2,7 @@ // ip/address.hpp // ~~~~~~~~~~~~~~ // -// Copyright (c) 2003-2015 Christopher M. Kohlhoff (chris at kohlhoff dot com) +// Copyright (c) 2003-2017 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) diff --git a/3party/boost/boost/asio/ip/address_v4.hpp b/3party/boost/boost/asio/ip/address_v4.hpp index a03dac9f20..3db4d4c825 100644 --- a/3party/boost/boost/asio/ip/address_v4.hpp +++ b/3party/boost/boost/asio/ip/address_v4.hpp @@ -2,7 +2,7 @@ // ip/address_v4.hpp // ~~~~~~~~~~~~~~~~~ // -// Copyright (c) 2003-2015 Christopher M. Kohlhoff (chris at kohlhoff dot com) +// Copyright (c) 2003-2017 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) diff --git a/3party/boost/boost/asio/ip/address_v6.hpp b/3party/boost/boost/asio/ip/address_v6.hpp index 11dad23e44..10e9bc1594 100644 --- a/3party/boost/boost/asio/ip/address_v6.hpp +++ b/3party/boost/boost/asio/ip/address_v6.hpp @@ -2,7 +2,7 @@ // ip/address_v6.hpp // ~~~~~~~~~~~~~~~~~ // -// Copyright (c) 2003-2015 Christopher M. Kohlhoff (chris at kohlhoff dot com) +// Copyright (c) 2003-2017 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) diff --git a/3party/boost/boost/asio/ip/basic_endpoint.hpp b/3party/boost/boost/asio/ip/basic_endpoint.hpp index 347aede689..235b178589 100644 --- a/3party/boost/boost/asio/ip/basic_endpoint.hpp +++ b/3party/boost/boost/asio/ip/basic_endpoint.hpp @@ -2,7 +2,7 @@ // ip/basic_endpoint.hpp // ~~~~~~~~~~~~~~~~~~~~~ // -// Copyright (c) 2003-2015 Christopher M. Kohlhoff (chris at kohlhoff dot com) +// Copyright (c) 2003-2017 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) diff --git a/3party/boost/boost/asio/ip/basic_resolver.hpp b/3party/boost/boost/asio/ip/basic_resolver.hpp index 743f9d1348..c5941de4f1 100644 --- a/3party/boost/boost/asio/ip/basic_resolver.hpp +++ b/3party/boost/boost/asio/ip/basic_resolver.hpp @@ -2,7 +2,7 @@ // ip/basic_resolver.hpp // ~~~~~~~~~~~~~~~~~~~~~ // -// Copyright (c) 2003-2015 Christopher M. Kohlhoff (chris at kohlhoff dot com) +// Copyright (c) 2003-2017 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) diff --git a/3party/boost/boost/asio/ip/basic_resolver_entry.hpp b/3party/boost/boost/asio/ip/basic_resolver_entry.hpp index bb4111715d..05c8547a0c 100644 --- a/3party/boost/boost/asio/ip/basic_resolver_entry.hpp +++ b/3party/boost/boost/asio/ip/basic_resolver_entry.hpp @@ -2,7 +2,7 @@ // ip/basic_resolver_entry.hpp // ~~~~~~~~~~~~~~~~~~~~~~~~~~~ // -// Copyright (c) 2003-2015 Christopher M. Kohlhoff (chris at kohlhoff dot com) +// Copyright (c) 2003-2017 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) diff --git a/3party/boost/boost/asio/ip/basic_resolver_iterator.hpp b/3party/boost/boost/asio/ip/basic_resolver_iterator.hpp index 9b0f678e10..b7deb77364 100644 --- a/3party/boost/boost/asio/ip/basic_resolver_iterator.hpp +++ b/3party/boost/boost/asio/ip/basic_resolver_iterator.hpp @@ -2,7 +2,7 @@ // ip/basic_resolver_iterator.hpp // ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ // -// Copyright (c) 2003-2015 Christopher M. Kohlhoff (chris at kohlhoff dot com) +// Copyright (c) 2003-2017 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) diff --git a/3party/boost/boost/asio/ip/basic_resolver_query.hpp b/3party/boost/boost/asio/ip/basic_resolver_query.hpp index 15f5f2b6ce..4f1b66d274 100644 --- a/3party/boost/boost/asio/ip/basic_resolver_query.hpp +++ b/3party/boost/boost/asio/ip/basic_resolver_query.hpp @@ -2,7 +2,7 @@ // ip/basic_resolver_query.hpp // ~~~~~~~~~~~~~~~~~~~~~~~~~~~ // -// Copyright (c) 2003-2015 Christopher M. Kohlhoff (chris at kohlhoff dot com) +// Copyright (c) 2003-2017 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) diff --git a/3party/boost/boost/asio/ip/detail/endpoint.hpp b/3party/boost/boost/asio/ip/detail/endpoint.hpp index c0e7e1de82..0a354e12a9 100644 --- a/3party/boost/boost/asio/ip/detail/endpoint.hpp +++ b/3party/boost/boost/asio/ip/detail/endpoint.hpp @@ -2,7 +2,7 @@ // ip/detail/endpoint.hpp // ~~~~~~~~~~~~~~~~~~~~~~ // -// Copyright (c) 2003-2015 Christopher M. Kohlhoff (chris at kohlhoff dot com) +// Copyright (c) 2003-2017 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) diff --git a/3party/boost/boost/asio/ip/detail/impl/endpoint.ipp b/3party/boost/boost/asio/ip/detail/impl/endpoint.ipp index 4cd0c2bee2..f1f9309af5 100644 --- a/3party/boost/boost/asio/ip/detail/impl/endpoint.ipp +++ b/3party/boost/boost/asio/ip/detail/impl/endpoint.ipp @@ -2,7 +2,7 @@ // ip/detail/impl/endpoint.ipp // ~~~~~~~~~~~~~~~~~~~~~~~~~~~ // -// Copyright (c) 2003-2015 Christopher M. Kohlhoff (chris at kohlhoff dot com) +// Copyright (c) 2003-2017 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) @@ -58,13 +58,13 @@ endpoint::endpoint(int family, unsigned short port_num) boost::asio::detail::socket_ops::host_to_network_short(port_num); data_.v6.sin6_flowinfo = 0; data_.v6.sin6_addr.s6_addr[0] = 0; data_.v6.sin6_addr.s6_addr[1] = 0; - data_.v6.sin6_addr.s6_addr[2] = 0, data_.v6.sin6_addr.s6_addr[3] = 0; - data_.v6.sin6_addr.s6_addr[4] = 0, data_.v6.sin6_addr.s6_addr[5] = 0; - data_.v6.sin6_addr.s6_addr[6] = 0, data_.v6.sin6_addr.s6_addr[7] = 0; - data_.v6.sin6_addr.s6_addr[8] = 0, data_.v6.sin6_addr.s6_addr[9] = 0; - data_.v6.sin6_addr.s6_addr[10] = 0, data_.v6.sin6_addr.s6_addr[11] = 0; - data_.v6.sin6_addr.s6_addr[12] = 0, data_.v6.sin6_addr.s6_addr[13] = 0; - data_.v6.sin6_addr.s6_addr[14] = 0, data_.v6.sin6_addr.s6_addr[15] = 0; + data_.v6.sin6_addr.s6_addr[2] = 0; data_.v6.sin6_addr.s6_addr[3] = 0; + data_.v6.sin6_addr.s6_addr[4] = 0; data_.v6.sin6_addr.s6_addr[5] = 0; + data_.v6.sin6_addr.s6_addr[6] = 0; data_.v6.sin6_addr.s6_addr[7] = 0; + data_.v6.sin6_addr.s6_addr[8] = 0; data_.v6.sin6_addr.s6_addr[9] = 0; + data_.v6.sin6_addr.s6_addr[10] = 0; data_.v6.sin6_addr.s6_addr[11] = 0; + data_.v6.sin6_addr.s6_addr[12] = 0; data_.v6.sin6_addr.s6_addr[13] = 0; + data_.v6.sin6_addr.s6_addr[14] = 0; data_.v6.sin6_addr.s6_addr[15] = 0; data_.v6.sin6_scope_id = 0; } } diff --git a/3party/boost/boost/asio/ip/detail/socket_option.hpp b/3party/boost/boost/asio/ip/detail/socket_option.hpp index 125a219c95..e8849fda92 100644 --- a/3party/boost/boost/asio/ip/detail/socket_option.hpp +++ b/3party/boost/boost/asio/ip/detail/socket_option.hpp @@ -2,7 +2,7 @@ // detail/socket_option.hpp // ~~~~~~~~~~~~~~~~~~~~~~~~ // -// Copyright (c) 2003-2015 Christopher M. Kohlhoff (chris at kohlhoff dot com) +// Copyright (c) 2003-2017 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) diff --git a/3party/boost/boost/asio/ip/host_name.hpp b/3party/boost/boost/asio/ip/host_name.hpp index f43ad3631d..69106eeb35 100644 --- a/3party/boost/boost/asio/ip/host_name.hpp +++ b/3party/boost/boost/asio/ip/host_name.hpp @@ -2,7 +2,7 @@ // ip/host_name.hpp // ~~~~~~~~~~~~~~~~ // -// Copyright (c) 2003-2015 Christopher M. Kohlhoff (chris at kohlhoff dot com) +// Copyright (c) 2003-2017 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) diff --git a/3party/boost/boost/asio/ip/icmp.hpp b/3party/boost/boost/asio/ip/icmp.hpp index a0f3493e30..fa8da94777 100644 --- a/3party/boost/boost/asio/ip/icmp.hpp +++ b/3party/boost/boost/asio/ip/icmp.hpp @@ -2,7 +2,7 @@ // ip/icmp.hpp // ~~~~~~~~~~~ // -// Copyright (c) 2003-2015 Christopher M. Kohlhoff (chris at kohlhoff dot com) +// Copyright (c) 2003-2017 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) diff --git a/3party/boost/boost/asio/ip/impl/address.hpp b/3party/boost/boost/asio/ip/impl/address.hpp index f55fbfcf39..e595d7063b 100644 --- a/3party/boost/boost/asio/ip/impl/address.hpp +++ b/3party/boost/boost/asio/ip/impl/address.hpp @@ -2,7 +2,7 @@ // ip/impl/address.hpp // ~~~~~~~~~~~~~~~~~~~ // -// Copyright (c) 2003-2015 Christopher M. Kohlhoff (chris at kohlhoff dot com) +// Copyright (c) 2003-2017 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) diff --git a/3party/boost/boost/asio/ip/impl/address.ipp b/3party/boost/boost/asio/ip/impl/address.ipp index e2c9c8d3eb..5eda3e9ecf 100644 --- a/3party/boost/boost/asio/ip/impl/address.ipp +++ b/3party/boost/boost/asio/ip/impl/address.ipp @@ -2,7 +2,7 @@ // ip/impl/address.ipp // ~~~~~~~~~~~~~~~~~~~ // -// Copyright (c) 2003-2015 Christopher M. Kohlhoff (chris at kohlhoff dot com) +// Copyright (c) 2003-2017 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) diff --git a/3party/boost/boost/asio/ip/impl/address_v4.hpp b/3party/boost/boost/asio/ip/impl/address_v4.hpp index 33ca80c39c..028b69b676 100644 --- a/3party/boost/boost/asio/ip/impl/address_v4.hpp +++ b/3party/boost/boost/asio/ip/impl/address_v4.hpp @@ -2,7 +2,7 @@ // ip/impl/address_v4.hpp // ~~~~~~~~~~~~~~~~~~~~~~ // -// Copyright (c) 2003-2015 Christopher M. Kohlhoff (chris at kohlhoff dot com) +// Copyright (c) 2003-2017 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) diff --git a/3party/boost/boost/asio/ip/impl/address_v4.ipp b/3party/boost/boost/asio/ip/impl/address_v4.ipp index b9bdf4deb8..440217bcb2 100644 --- a/3party/boost/boost/asio/ip/impl/address_v4.ipp +++ b/3party/boost/boost/asio/ip/impl/address_v4.ipp @@ -2,7 +2,7 @@ // ip/impl/address_v4.ipp // ~~~~~~~~~~~~~~~~~~~~~~ // -// Copyright (c) 2003-2015 Christopher M. Kohlhoff (chris at kohlhoff dot com) +// Copyright (c) 2003-2017 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) diff --git a/3party/boost/boost/asio/ip/impl/address_v6.hpp b/3party/boost/boost/asio/ip/impl/address_v6.hpp index dee6a1e915..4b88129c50 100644 --- a/3party/boost/boost/asio/ip/impl/address_v6.hpp +++ b/3party/boost/boost/asio/ip/impl/address_v6.hpp @@ -2,7 +2,7 @@ // ip/impl/address_v6.hpp // ~~~~~~~~~~~~~~~~~~~~~~ // -// Copyright (c) 2003-2015 Christopher M. Kohlhoff (chris at kohlhoff dot com) +// Copyright (c) 2003-2017 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) diff --git a/3party/boost/boost/asio/ip/impl/address_v6.ipp b/3party/boost/boost/asio/ip/impl/address_v6.ipp index 1080c99d7d..2d1a1974bf 100644 --- a/3party/boost/boost/asio/ip/impl/address_v6.ipp +++ b/3party/boost/boost/asio/ip/impl/address_v6.ipp @@ -2,7 +2,7 @@ // ip/impl/address_v6.ipp // ~~~~~~~~~~~~~~~~~~~~~~ // -// Copyright (c) 2003-2015 Christopher M. Kohlhoff (chris at kohlhoff dot com) +// Copyright (c) 2003-2017 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) diff --git a/3party/boost/boost/asio/ip/impl/basic_endpoint.hpp b/3party/boost/boost/asio/ip/impl/basic_endpoint.hpp index a92d92a28a..4d9c4505c3 100644 --- a/3party/boost/boost/asio/ip/impl/basic_endpoint.hpp +++ b/3party/boost/boost/asio/ip/impl/basic_endpoint.hpp @@ -2,7 +2,7 @@ // ip/impl/basic_endpoint.hpp // ~~~~~~~~~~~~~~~~~~~~~~~~~~ // -// Copyright (c) 2003-2015 Christopher M. Kohlhoff (chris at kohlhoff dot com) +// Copyright (c) 2003-2017 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) diff --git a/3party/boost/boost/asio/ip/impl/host_name.ipp b/3party/boost/boost/asio/ip/impl/host_name.ipp index 4ee5639472..ab85f41793 100644 --- a/3party/boost/boost/asio/ip/impl/host_name.ipp +++ b/3party/boost/boost/asio/ip/impl/host_name.ipp @@ -2,7 +2,7 @@ // ip/impl/host_name.ipp // ~~~~~~~~~~~~~~~~~~~~~ // -// Copyright (c) 2003-2015 Christopher M. Kohlhoff (chris at kohlhoff dot com) +// Copyright (c) 2003-2017 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) diff --git a/3party/boost/boost/asio/ip/multicast.hpp b/3party/boost/boost/asio/ip/multicast.hpp index 677eac28b3..d82e442116 100644 --- a/3party/boost/boost/asio/ip/multicast.hpp +++ b/3party/boost/boost/asio/ip/multicast.hpp @@ -2,7 +2,7 @@ // ip/multicast.hpp // ~~~~~~~~~~~~~~~~ // -// Copyright (c) 2003-2015 Christopher M. Kohlhoff (chris at kohlhoff dot com) +// Copyright (c) 2003-2017 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) diff --git a/3party/boost/boost/asio/ip/resolver_query_base.hpp b/3party/boost/boost/asio/ip/resolver_query_base.hpp index e220ce4b6b..fd74059772 100644 --- a/3party/boost/boost/asio/ip/resolver_query_base.hpp +++ b/3party/boost/boost/asio/ip/resolver_query_base.hpp @@ -2,7 +2,7 @@ // ip/resolver_query_base.hpp // ~~~~~~~~~~~~~~~~~~~~~~~~~~ // -// Copyright (c) 2003-2015 Christopher M. Kohlhoff (chris at kohlhoff dot com) +// Copyright (c) 2003-2017 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) diff --git a/3party/boost/boost/asio/ip/resolver_service.hpp b/3party/boost/boost/asio/ip/resolver_service.hpp index 2695c5d91b..b4aa4d25bb 100644 --- a/3party/boost/boost/asio/ip/resolver_service.hpp +++ b/3party/boost/boost/asio/ip/resolver_service.hpp @@ -2,7 +2,7 @@ // ip/resolver_service.hpp // ~~~~~~~~~~~~~~~~~~~~~~~ // -// Copyright (c) 2003-2015 Christopher M. Kohlhoff (chris at kohlhoff dot com) +// Copyright (c) 2003-2017 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) diff --git a/3party/boost/boost/asio/ip/tcp.hpp b/3party/boost/boost/asio/ip/tcp.hpp index b00433d053..079ec46a25 100644 --- a/3party/boost/boost/asio/ip/tcp.hpp +++ b/3party/boost/boost/asio/ip/tcp.hpp @@ -2,7 +2,7 @@ // ip/tcp.hpp // ~~~~~~~~~~ // -// Copyright (c) 2003-2015 Christopher M. Kohlhoff (chris at kohlhoff dot com) +// Copyright (c) 2003-2017 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) diff --git a/3party/boost/boost/asio/ip/udp.hpp b/3party/boost/boost/asio/ip/udp.hpp index 81ec3cc244..c63bc986eb 100644 --- a/3party/boost/boost/asio/ip/udp.hpp +++ b/3party/boost/boost/asio/ip/udp.hpp @@ -2,7 +2,7 @@ // ip/udp.hpp // ~~~~~~~~~~ // -// Copyright (c) 2003-2015 Christopher M. Kohlhoff (chris at kohlhoff dot com) +// Copyright (c) 2003-2017 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) diff --git a/3party/boost/boost/asio/ip/unicast.hpp b/3party/boost/boost/asio/ip/unicast.hpp index 2286469815..4a9df8bfd2 100644 --- a/3party/boost/boost/asio/ip/unicast.hpp +++ b/3party/boost/boost/asio/ip/unicast.hpp @@ -2,7 +2,7 @@ // ip/unicast.hpp // ~~~~~~~~~~~~~~ // -// Copyright (c) 2003-2015 Christopher M. Kohlhoff (chris at kohlhoff dot com) +// Copyright (c) 2003-2017 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) diff --git a/3party/boost/boost/asio/ip/v6_only.hpp b/3party/boost/boost/asio/ip/v6_only.hpp index a759d5576b..b22c9a5db8 100644 --- a/3party/boost/boost/asio/ip/v6_only.hpp +++ b/3party/boost/boost/asio/ip/v6_only.hpp @@ -2,7 +2,7 @@ // ip/v6_only.hpp // ~~~~~~~~~~~~~~ // -// Copyright (c) 2003-2015 Christopher M. Kohlhoff (chris at kohlhoff dot com) +// Copyright (c) 2003-2017 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) diff --git a/3party/boost/boost/asio/is_read_buffered.hpp b/3party/boost/boost/asio/is_read_buffered.hpp index 7cb3643d2c..c2d45a0ab6 100644 --- a/3party/boost/boost/asio/is_read_buffered.hpp +++ b/3party/boost/boost/asio/is_read_buffered.hpp @@ -2,7 +2,7 @@ // is_read_buffered.hpp // ~~~~~~~~~~~~~~~~~~~~ // -// Copyright (c) 2003-2015 Christopher M. Kohlhoff (chris at kohlhoff dot com) +// Copyright (c) 2003-2017 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) diff --git a/3party/boost/boost/asio/is_write_buffered.hpp b/3party/boost/boost/asio/is_write_buffered.hpp index 02ce6c25e0..1f462cd6ca 100644 --- a/3party/boost/boost/asio/is_write_buffered.hpp +++ b/3party/boost/boost/asio/is_write_buffered.hpp @@ -2,7 +2,7 @@ // is_write_buffered.hpp // ~~~~~~~~~~~~~~~~~~~~~ // -// Copyright (c) 2003-2015 Christopher M. Kohlhoff (chris at kohlhoff dot com) +// Copyright (c) 2003-2017 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) diff --git a/3party/boost/boost/asio/local/basic_endpoint.hpp b/3party/boost/boost/asio/local/basic_endpoint.hpp index 753b54ed98..9fa281f70b 100644 --- a/3party/boost/boost/asio/local/basic_endpoint.hpp +++ b/3party/boost/boost/asio/local/basic_endpoint.hpp @@ -2,7 +2,7 @@ // local/basic_endpoint.hpp // ~~~~~~~~~~~~~~~~~~~~~~~~ // -// Copyright (c) 2003-2015 Christopher M. Kohlhoff (chris at kohlhoff dot com) +// Copyright (c) 2003-2017 Christopher M. Kohlhoff (chris at kohlhoff dot com) // Derived from a public domain implementation written by Daniel Casimiro. // // Distributed under the Boost Software License, Version 1.0. (See accompanying diff --git a/3party/boost/boost/asio/local/connect_pair.hpp b/3party/boost/boost/asio/local/connect_pair.hpp index dcb9ccdb8b..333c758783 100644 --- a/3party/boost/boost/asio/local/connect_pair.hpp +++ b/3party/boost/boost/asio/local/connect_pair.hpp @@ -2,7 +2,7 @@ // local/connect_pair.hpp // ~~~~~~~~~~~~~~~~~~~~~~ // -// Copyright (c) 2003-2015 Christopher M. Kohlhoff (chris at kohlhoff dot com) +// Copyright (c) 2003-2017 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) diff --git a/3party/boost/boost/asio/local/datagram_protocol.hpp b/3party/boost/boost/asio/local/datagram_protocol.hpp index 53d3809013..3d0fa08ec6 100644 --- a/3party/boost/boost/asio/local/datagram_protocol.hpp +++ b/3party/boost/boost/asio/local/datagram_protocol.hpp @@ -2,7 +2,7 @@ // local/datagram_protocol.hpp // ~~~~~~~~~~~~~~~~~~~~~~~~~~~ // -// Copyright (c) 2003-2015 Christopher M. Kohlhoff (chris at kohlhoff dot com) +// Copyright (c) 2003-2017 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) diff --git a/3party/boost/boost/asio/local/detail/endpoint.hpp b/3party/boost/boost/asio/local/detail/endpoint.hpp index 91eb0f9654..68893fb1b1 100644 --- a/3party/boost/boost/asio/local/detail/endpoint.hpp +++ b/3party/boost/boost/asio/local/detail/endpoint.hpp @@ -2,7 +2,7 @@ // local/detail/endpoint.hpp // ~~~~~~~~~~~~~~~~~~~~~~~~~ // -// Copyright (c) 2003-2015 Christopher M. Kohlhoff (chris at kohlhoff dot com) +// Copyright (c) 2003-2017 Christopher M. Kohlhoff (chris at kohlhoff dot com) // Derived from a public domain implementation written by Daniel Casimiro. // // Distributed under the Boost Software License, Version 1.0. (See accompanying diff --git a/3party/boost/boost/asio/local/detail/impl/endpoint.ipp b/3party/boost/boost/asio/local/detail/impl/endpoint.ipp index 6cf7640d4a..4173a8242e 100644 --- a/3party/boost/boost/asio/local/detail/impl/endpoint.ipp +++ b/3party/boost/boost/asio/local/detail/impl/endpoint.ipp @@ -2,7 +2,7 @@ // local/detail/impl/endpoint.hpp // ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ // -// Copyright (c) 2003-2015 Christopher M. Kohlhoff (chris at kohlhoff dot com) +// Copyright (c) 2003-2017 Christopher M. Kohlhoff (chris at kohlhoff dot com) // Derived from a public domain implementation written by Daniel Casimiro. // // Distributed under the Boost Software License, Version 1.0. (See accompanying diff --git a/3party/boost/boost/asio/local/stream_protocol.hpp b/3party/boost/boost/asio/local/stream_protocol.hpp index c3f2472729..eac968311b 100644 --- a/3party/boost/boost/asio/local/stream_protocol.hpp +++ b/3party/boost/boost/asio/local/stream_protocol.hpp @@ -2,7 +2,7 @@ // local/stream_protocol.hpp // ~~~~~~~~~~~~~~~~~~~~~~~~~ // -// Copyright (c) 2003-2015 Christopher M. Kohlhoff (chris at kohlhoff dot com) +// Copyright (c) 2003-2017 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) diff --git a/3party/boost/boost/asio/placeholders.hpp b/3party/boost/boost/asio/placeholders.hpp index c7650f174e..8714e3454a 100644 --- a/3party/boost/boost/asio/placeholders.hpp +++ b/3party/boost/boost/asio/placeholders.hpp @@ -2,7 +2,7 @@ // placeholders.hpp // ~~~~~~~~~~~~~~~~ // -// Copyright (c) 2003-2015 Christopher M. Kohlhoff (chris at kohlhoff dot com) +// Copyright (c) 2003-2017 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) diff --git a/3party/boost/boost/asio/posix/basic_descriptor.hpp b/3party/boost/boost/asio/posix/basic_descriptor.hpp index 7222722f8e..a857c237a3 100644 --- a/3party/boost/boost/asio/posix/basic_descriptor.hpp +++ b/3party/boost/boost/asio/posix/basic_descriptor.hpp @@ -2,7 +2,7 @@ // posix/basic_descriptor.hpp // ~~~~~~~~~~~~~~~~~~~~~~~~~~ // -// Copyright (c) 2003-2015 Christopher M. Kohlhoff (chris at kohlhoff dot com) +// Copyright (c) 2003-2017 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) diff --git a/3party/boost/boost/asio/posix/basic_stream_descriptor.hpp b/3party/boost/boost/asio/posix/basic_stream_descriptor.hpp index 2a800d5002..4baacb519b 100644 --- a/3party/boost/boost/asio/posix/basic_stream_descriptor.hpp +++ b/3party/boost/boost/asio/posix/basic_stream_descriptor.hpp @@ -2,7 +2,7 @@ // posix/basic_stream_descriptor.hpp // ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ // -// Copyright (c) 2003-2015 Christopher M. Kohlhoff (chris at kohlhoff dot com) +// Copyright (c) 2003-2017 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) diff --git a/3party/boost/boost/asio/posix/descriptor_base.hpp b/3party/boost/boost/asio/posix/descriptor_base.hpp index 6287517efa..e23af43bc8 100644 --- a/3party/boost/boost/asio/posix/descriptor_base.hpp +++ b/3party/boost/boost/asio/posix/descriptor_base.hpp @@ -2,7 +2,7 @@ // posix/descriptor_base.hpp // ~~~~~~~~~~~~~~~~~~~~~~~~~ // -// Copyright (c) 2003-2015 Christopher M. Kohlhoff (chris at kohlhoff dot com) +// Copyright (c) 2003-2017 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) diff --git a/3party/boost/boost/asio/posix/stream_descriptor.hpp b/3party/boost/boost/asio/posix/stream_descriptor.hpp index 231cd77ee7..d6d1344702 100644 --- a/3party/boost/boost/asio/posix/stream_descriptor.hpp +++ b/3party/boost/boost/asio/posix/stream_descriptor.hpp @@ -2,7 +2,7 @@ // posix/stream_descriptor.hpp // ~~~~~~~~~~~~~~~~~~~~~~~~~~~ // -// Copyright (c) 2003-2015 Christopher M. Kohlhoff (chris at kohlhoff dot com) +// Copyright (c) 2003-2017 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) diff --git a/3party/boost/boost/asio/posix/stream_descriptor_service.hpp b/3party/boost/boost/asio/posix/stream_descriptor_service.hpp index ab1e72e217..e42580d3f3 100644 --- a/3party/boost/boost/asio/posix/stream_descriptor_service.hpp +++ b/3party/boost/boost/asio/posix/stream_descriptor_service.hpp @@ -2,7 +2,7 @@ // posix/stream_descriptor_service.hpp // ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ // -// Copyright (c) 2003-2015 Christopher M. Kohlhoff (chris at kohlhoff dot com) +// Copyright (c) 2003-2017 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) diff --git a/3party/boost/boost/asio/raw_socket_service.hpp b/3party/boost/boost/asio/raw_socket_service.hpp index 4849bf41cb..06880d5abb 100644 --- a/3party/boost/boost/asio/raw_socket_service.hpp +++ b/3party/boost/boost/asio/raw_socket_service.hpp @@ -2,7 +2,7 @@ // raw_socket_service.hpp // ~~~~~~~~~~~~~~~~~~~~~~ // -// Copyright (c) 2003-2015 Christopher M. Kohlhoff (chris at kohlhoff dot com) +// Copyright (c) 2003-2017 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) @@ -118,17 +118,21 @@ public: service_impl_.move_assign(impl, other_service.service_impl_, other_impl); } + // All socket services have access to each other's implementations. + template friend class raw_socket_service; + /// Move-construct a new raw socket implementation from another protocol /// type. template void converting_move_construct(implementation_type& impl, + raw_socket_service& other_service, typename raw_socket_service< Protocol1>::implementation_type& other_impl, typename enable_if::value>::type* = 0) { service_impl_.template converting_move_construct( - impl, other_impl); + impl, other_service.service_impl_, other_impl); } #endif // defined(BOOST_ASIO_HAS_MOVE) || defined(GENERATING_DOCUMENTATION) diff --git a/3party/boost/boost/asio/read.hpp b/3party/boost/boost/asio/read.hpp index 559bc43a57..0db29b7831 100644 --- a/3party/boost/boost/asio/read.hpp +++ b/3party/boost/boost/asio/read.hpp @@ -2,7 +2,7 @@ // read.hpp // ~~~~~~~~ // -// Copyright (c) 2003-2015 Christopher M. Kohlhoff (chris at kohlhoff dot com) +// Copyright (c) 2003-2017 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) diff --git a/3party/boost/boost/asio/read_at.hpp b/3party/boost/boost/asio/read_at.hpp index fe85139fd5..03f6c155c1 100644 --- a/3party/boost/boost/asio/read_at.hpp +++ b/3party/boost/boost/asio/read_at.hpp @@ -2,7 +2,7 @@ // read_at.hpp // ~~~~~~~~~~~ // -// Copyright (c) 2003-2015 Christopher M. Kohlhoff (chris at kohlhoff dot com) +// Copyright (c) 2003-2017 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) diff --git a/3party/boost/boost/asio/read_until.hpp b/3party/boost/boost/asio/read_until.hpp index ece4ca8998..3ed288fc2c 100644 --- a/3party/boost/boost/asio/read_until.hpp +++ b/3party/boost/boost/asio/read_until.hpp @@ -2,7 +2,7 @@ // read_until.hpp // ~~~~~~~~~~~~~~ // -// Copyright (c) 2003-2015 Christopher M. Kohlhoff (chris at kohlhoff dot com) +// Copyright (c) 2003-2017 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) diff --git a/3party/boost/boost/asio/seq_packet_socket_service.hpp b/3party/boost/boost/asio/seq_packet_socket_service.hpp index 31d5165b1b..fcccafe5ec 100644 --- a/3party/boost/boost/asio/seq_packet_socket_service.hpp +++ b/3party/boost/boost/asio/seq_packet_socket_service.hpp @@ -2,7 +2,7 @@ // seq_packet_socket_service.hpp // ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ // -// Copyright (c) 2003-2015 Christopher M. Kohlhoff (chris at kohlhoff dot com) +// Copyright (c) 2003-2017 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) @@ -120,17 +120,21 @@ public: service_impl_.move_assign(impl, other_service.service_impl_, other_impl); } + // All socket services have access to each other's implementations. + template friend class seq_packet_socket_service; + /// Move-construct a new sequenced packet socket implementation from another /// protocol type. template void converting_move_construct(implementation_type& impl, + seq_packet_socket_service& other_service, typename seq_packet_socket_service< Protocol1>::implementation_type& other_impl, typename enable_if::value>::type* = 0) { service_impl_.template converting_move_construct( - impl, other_impl); + impl, other_service.service_impl_, other_impl); } #endif // defined(BOOST_ASIO_HAS_MOVE) || defined(GENERATING_DOCUMENTATION) diff --git a/3party/boost/boost/asio/serial_port.hpp b/3party/boost/boost/asio/serial_port.hpp index 64fad65089..f3b6fb2450 100644 --- a/3party/boost/boost/asio/serial_port.hpp +++ b/3party/boost/boost/asio/serial_port.hpp @@ -2,7 +2,7 @@ // serial_port.hpp // ~~~~~~~~~~~~~~~ // -// Copyright (c) 2003-2015 Christopher M. Kohlhoff (chris at kohlhoff dot com) +// Copyright (c) 2003-2017 Christopher M. Kohlhoff (chris at kohlhoff dot com) // Copyright (c) 2008 Rep Invariant Systems, Inc. (info@repinvariant.com) // // Distributed under the Boost Software License, Version 1.0. (See accompanying diff --git a/3party/boost/boost/asio/serial_port_base.hpp b/3party/boost/boost/asio/serial_port_base.hpp index 8132262442..884c7ba95d 100644 --- a/3party/boost/boost/asio/serial_port_base.hpp +++ b/3party/boost/boost/asio/serial_port_base.hpp @@ -2,7 +2,7 @@ // serial_port_base.hpp // ~~~~~~~~~~~~~~~~~~~~ // -// Copyright (c) 2003-2015 Christopher M. Kohlhoff (chris at kohlhoff dot com) +// Copyright (c) 2003-2017 Christopher M. Kohlhoff (chris at kohlhoff dot com) // Copyright (c) 2008 Rep Invariant Systems, Inc. (info@repinvariant.com) // // Distributed under the Boost Software License, Version 1.0. (See accompanying diff --git a/3party/boost/boost/asio/serial_port_service.hpp b/3party/boost/boost/asio/serial_port_service.hpp index b648327749..20cb288b1b 100644 --- a/3party/boost/boost/asio/serial_port_service.hpp +++ b/3party/boost/boost/asio/serial_port_service.hpp @@ -2,7 +2,7 @@ // serial_port_service.hpp // ~~~~~~~~~~~~~~~~~~~~~~~ // -// Copyright (c) 2003-2015 Christopher M. Kohlhoff (chris at kohlhoff dot com) +// Copyright (c) 2003-2017 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) diff --git a/3party/boost/boost/asio/signal_set.hpp b/3party/boost/boost/asio/signal_set.hpp index 549f2b6613..422e4fca49 100644 --- a/3party/boost/boost/asio/signal_set.hpp +++ b/3party/boost/boost/asio/signal_set.hpp @@ -2,7 +2,7 @@ // signal_set.hpp // ~~~~~~~~~~~~~~ // -// Copyright (c) 2003-2015 Christopher M. Kohlhoff (chris at kohlhoff dot com) +// Copyright (c) 2003-2017 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) diff --git a/3party/boost/boost/asio/signal_set_service.hpp b/3party/boost/boost/asio/signal_set_service.hpp index 41c7fcec5a..632eaf0aca 100644 --- a/3party/boost/boost/asio/signal_set_service.hpp +++ b/3party/boost/boost/asio/signal_set_service.hpp @@ -2,7 +2,7 @@ // signal_set_service.hpp // ~~~~~~~~~~~~~~~~~~~~~~ // -// Copyright (c) 2003-2015 Christopher M. Kohlhoff (chris at kohlhoff dot com) +// Copyright (c) 2003-2017 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) diff --git a/3party/boost/boost/asio/socket_acceptor_service.hpp b/3party/boost/boost/asio/socket_acceptor_service.hpp index d3f8fe4b51..e00c76c901 100644 --- a/3party/boost/boost/asio/socket_acceptor_service.hpp +++ b/3party/boost/boost/asio/socket_acceptor_service.hpp @@ -2,7 +2,7 @@ // socket_acceptor_service.hpp // ~~~~~~~~~~~~~~~~~~~~~~~~~~~ // -// Copyright (c) 2003-2015 Christopher M. Kohlhoff (chris at kohlhoff dot com) +// Copyright (c) 2003-2017 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) @@ -117,17 +117,21 @@ public: service_impl_.move_assign(impl, other_service.service_impl_, other_impl); } + // All acceptor services have access to each other's implementations. + template friend class socket_acceptor_service; + /// Move-construct a new socket acceptor implementation from another protocol /// type. template void converting_move_construct(implementation_type& impl, + socket_acceptor_service& other_service, typename socket_acceptor_service< Protocol1>::implementation_type& other_impl, typename enable_if::value>::type* = 0) { service_impl_.template converting_move_construct( - impl, other_impl); + impl, other_service.service_impl_, other_impl); } #endif // defined(BOOST_ASIO_HAS_MOVE) || defined(GENERATING_DOCUMENTATION) diff --git a/3party/boost/boost/asio/socket_base.hpp b/3party/boost/boost/asio/socket_base.hpp index 88889a1c9e..7adbf5abfd 100644 --- a/3party/boost/boost/asio/socket_base.hpp +++ b/3party/boost/boost/asio/socket_base.hpp @@ -2,7 +2,7 @@ // socket_base.hpp // ~~~~~~~~~~~~~~~ // -// Copyright (c) 2003-2015 Christopher M. Kohlhoff (chris at kohlhoff dot com) +// Copyright (c) 2003-2017 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) diff --git a/3party/boost/boost/asio/spawn.hpp b/3party/boost/boost/asio/spawn.hpp index 2854bfad89..966bd3efcc 100644 --- a/3party/boost/boost/asio/spawn.hpp +++ b/3party/boost/boost/asio/spawn.hpp @@ -2,7 +2,7 @@ // spawn.hpp // ~~~~~~~~~ // -// Copyright (c) 2003-2015 Christopher M. Kohlhoff (chris at kohlhoff dot com) +// Copyright (c) 2003-2017 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) diff --git a/3party/boost/boost/asio/ssl.hpp b/3party/boost/boost/asio/ssl.hpp index ddd2f365de..f82bdc043d 100644 --- a/3party/boost/boost/asio/ssl.hpp +++ b/3party/boost/boost/asio/ssl.hpp @@ -2,7 +2,7 @@ // ssl.hpp // ~~~~~~~ // -// Copyright (c) 2003-2015 Christopher M. Kohlhoff (chris at kohlhoff dot com) +// Copyright (c) 2003-2017 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) diff --git a/3party/boost/boost/asio/ssl/basic_context.hpp b/3party/boost/boost/asio/ssl/basic_context.hpp index 6b6b1b353c..734398bc29 100644 --- a/3party/boost/boost/asio/ssl/basic_context.hpp +++ b/3party/boost/boost/asio/ssl/basic_context.hpp @@ -2,7 +2,7 @@ // ssl/basic_context.hpp // ~~~~~~~~~~~~~~~~~~~~~ // -// Copyright (c) 2003-2015 Christopher M. Kohlhoff (chris at kohlhoff dot com) +// Copyright (c) 2003-2017 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) diff --git a/3party/boost/boost/asio/ssl/context.hpp b/3party/boost/boost/asio/ssl/context.hpp index 2e5b282724..8bab40ab3e 100644 --- a/3party/boost/boost/asio/ssl/context.hpp +++ b/3party/boost/boost/asio/ssl/context.hpp @@ -2,7 +2,7 @@ // ssl/context.hpp // ~~~~~~~~~~~~~~~ // -// Copyright (c) 2003-2015 Christopher M. Kohlhoff (chris at kohlhoff dot com) +// Copyright (c) 2003-2017 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) diff --git a/3party/boost/boost/asio/ssl/context_base.hpp b/3party/boost/boost/asio/ssl/context_base.hpp index 8bf128db66..1b5365bba1 100644 --- a/3party/boost/boost/asio/ssl/context_base.hpp +++ b/3party/boost/boost/asio/ssl/context_base.hpp @@ -2,7 +2,7 @@ // ssl/context_base.hpp // ~~~~~~~~~~~~~~~~~~~~ // -// Copyright (c) 2003-2015 Christopher M. Kohlhoff (chris at kohlhoff dot com) +// Copyright (c) 2003-2017 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) @@ -84,7 +84,16 @@ public: tlsv12_client, /// TLS version 1.2 server. - tlsv12_server + tlsv12_server, + + /// Generic TLS. + tls, + + /// TLS client. + tls_client, + + /// TLS server. + tls_server }; /// Bitmask type for SSL options. diff --git a/3party/boost/boost/asio/ssl/context_service.hpp b/3party/boost/boost/asio/ssl/context_service.hpp index 1a1b1797ed..b0a31f3750 100644 --- a/3party/boost/boost/asio/ssl/context_service.hpp +++ b/3party/boost/boost/asio/ssl/context_service.hpp @@ -2,7 +2,7 @@ // ssl/context_service.hpp // ~~~~~~~~~~~~~~~~~~~~~~~ // -// Copyright (c) 2003-2015 Christopher M. Kohlhoff (chris at kohlhoff dot com) +// Copyright (c) 2003-2017 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) diff --git a/3party/boost/boost/asio/ssl/detail/buffered_handshake_op.hpp b/3party/boost/boost/asio/ssl/detail/buffered_handshake_op.hpp index 74f12f41a8..b40fe5d69d 100644 --- a/3party/boost/boost/asio/ssl/detail/buffered_handshake_op.hpp +++ b/3party/boost/boost/asio/ssl/detail/buffered_handshake_op.hpp @@ -2,7 +2,7 @@ // ssl/detail/buffered_handshake_op.hpp // ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ // -// Copyright (c) 2003-2015 Christopher M. Kohlhoff (chris at kohlhoff dot com) +// Copyright (c) 2003-2017 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) diff --git a/3party/boost/boost/asio/ssl/detail/engine.hpp b/3party/boost/boost/asio/ssl/detail/engine.hpp index b84c22c2fd..f31a4a7287 100644 --- a/3party/boost/boost/asio/ssl/detail/engine.hpp +++ b/3party/boost/boost/asio/ssl/detail/engine.hpp @@ -2,7 +2,7 @@ // ssl/detail/engine.hpp // ~~~~~~~~~~~~~~~~~~~~~ // -// Copyright (c) 2003-2015 Christopher M. Kohlhoff (chris at kohlhoff dot com) +// Copyright (c) 2003-2017 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) diff --git a/3party/boost/boost/asio/ssl/detail/handshake_op.hpp b/3party/boost/boost/asio/ssl/detail/handshake_op.hpp index d8be283a0d..dc61b702f0 100644 --- a/3party/boost/boost/asio/ssl/detail/handshake_op.hpp +++ b/3party/boost/boost/asio/ssl/detail/handshake_op.hpp @@ -2,7 +2,7 @@ // ssl/detail/handshake_op.hpp // ~~~~~~~~~~~~~~~~~~~~~~~~~~~ // -// Copyright (c) 2003-2015 Christopher M. Kohlhoff (chris at kohlhoff dot com) +// Copyright (c) 2003-2017 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) diff --git a/3party/boost/boost/asio/ssl/detail/impl/engine.ipp b/3party/boost/boost/asio/ssl/detail/impl/engine.ipp index 3fcfd70d8e..f7d869c56d 100644 --- a/3party/boost/boost/asio/ssl/detail/impl/engine.ipp +++ b/3party/boost/boost/asio/ssl/detail/impl/engine.ipp @@ -2,7 +2,7 @@ // ssl/detail/impl/engine.ipp // ~~~~~~~~~~~~~~~~~~~~~~~~~~ // -// Copyright (c) 2003-2015 Christopher M. Kohlhoff (chris at kohlhoff dot com) +// Copyright (c) 2003-2017 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) @@ -203,23 +203,21 @@ const boost::system::error_code& engine::map_error_code( // If there's data yet to be read, it's an error. if (BIO_wpending(ext_bio_)) { - ec = boost::system::error_code( - ERR_PACK(ERR_LIB_SSL, 0, SSL_R_SHORT_READ), - boost::asio::error::get_ssl_category()); + ec = boost::asio::ssl::error::stream_truncated; return ec; } // SSL v2 doesn't provide a protocol-level shutdown, so an eof on the // underlying transport is passed through. +#if (OPENSSL_VERSION_NUMBER < 0x10100000L) if (ssl_->version == SSL2_VERSION) return ec; +#endif // (OPENSSL_VERSION_NUMBER < 0x10100000L) // Otherwise, the peer should have negotiated a proper shutdown. if ((::SSL_get_shutdown(ssl_) & SSL_RECEIVED_SHUTDOWN) == 0) { - ec = boost::system::error_code( - ERR_PACK(ERR_LIB_SSL, 0, SSL_R_SHORT_READ), - boost::asio::error::get_ssl_category()); + ec = boost::asio::ssl::error::stream_truncated; } return ec; diff --git a/3party/boost/boost/asio/ssl/detail/impl/openssl_init.ipp b/3party/boost/boost/asio/ssl/detail/impl/openssl_init.ipp index 8326c84144..725f5a75ee 100644 --- a/3party/boost/boost/asio/ssl/detail/impl/openssl_init.ipp +++ b/3party/boost/boost/asio/ssl/detail/impl/openssl_init.ipp @@ -3,7 +3,7 @@ // ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ // // Copyright (c) 2005 Voipster / Indrek dot Juhani at voipster dot com -// Copyright (c) 2005-2015 Christopher M. Kohlhoff (chris at kohlhoff dot com) +// Copyright (c) 2005-2017 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) @@ -36,6 +36,7 @@ class openssl_init_base::do_init public: do_init() { +#if (OPENSSL_VERSION_NUMBER < 0x10100000L) ::SSL_library_init(); ::SSL_load_error_strings(); ::OpenSSL_add_all_algorithms(); @@ -44,7 +45,10 @@ public: for (size_t i = 0; i < mutexes_.size(); ++i) mutexes_[i].reset(new boost::asio::detail::mutex); ::CRYPTO_set_locking_callback(&do_init::openssl_locking_func); +#endif // (OPENSSL_VERSION_NUMBER < 0x10100000L) +#if (OPENSSL_VERSION_NUMBER < 0x10000000L) ::CRYPTO_set_id_callback(&do_init::openssl_id_func); +#endif // (OPENSSL_VERSION_NUMBER < 0x10000000L) #if !defined(SSL_OP_NO_COMPRESSION) \ && (OPENSSL_VERSION_NUMBER >= 0x00908000L) @@ -61,20 +65,34 @@ public: #endif // !defined(SSL_OP_NO_COMPRESSION) // && (OPENSSL_VERSION_NUMBER >= 0x00908000L) +#if (OPENSSL_VERSION_NUMBER < 0x10000000L) ::CRYPTO_set_id_callback(0); +#endif // (OPENSSL_VERSION_NUMBER < 0x10000000L) +#if (OPENSSL_VERSION_NUMBER < 0x10100000L) ::CRYPTO_set_locking_callback(0); ::ERR_free_strings(); -#if (OPENSSL_VERSION_NUMBER >= 0x10000000L) - ::ERR_remove_thread_state(NULL); -#else // (OPENSSL_VERSION_NUMBER >= 0x10000000L) - ::ERR_remove_state(0); -#endif // (OPENSSL_VERSION_NUMBER >= 0x10000000L) ::EVP_cleanup(); ::CRYPTO_cleanup_all_ex_data(); +#endif // (OPENSSL_VERSION_NUMBER < 0x10100000L) +#if (OPENSSL_VERSION_NUMBER < 0x10000000L) + ::ERR_remove_state(0); +#elif (OPENSSL_VERSION_NUMBER < 0x10100000L) + ::ERR_remove_thread_state(NULL); +#endif // (OPENSSL_VERSION_NUMBER < 0x10000000L) +#if !defined(SSL_OP_NO_COMPRESSION) \ + && (OPENSSL_VERSION_NUMBER >= 0x10002000L) \ + && (OPENSSL_VERSION_NUMBER < 0x10100000L) + ::SSL_COMP_free_compression_methods(); +#endif // (OPENSSL_VERSION_NUMBER >= 0x10002000L) + // && (OPENSSL_VERSION_NUMBER < 0x10100000L) +#if !defined(OPENSSL_IS_BORINGSSL) ::CONF_modules_unload(1); -#if !defined(OPENSSL_NO_ENGINE) +#endif // !defined(OPENSSL_IS_BORINGSSL) +#if !defined(OPENSSL_NO_ENGINE) \ + && (OPENSSL_VERSION_NUMBER < 0x10100000L) ::ENGINE_cleanup(); #endif // !defined(OPENSSL_NO_ENGINE) + // && (OPENSSL_VERSION_NUMBER < 0x10100000L) } #if !defined(SSL_OP_NO_COMPRESSION) \ @@ -87,19 +105,20 @@ public: // && (OPENSSL_VERSION_NUMBER >= 0x00908000L) private: +#if (OPENSSL_VERSION_NUMBER < 0x10000000L) static unsigned long openssl_id_func() { #if defined(BOOST_ASIO_WINDOWS) || defined(__CYGWIN__) return ::GetCurrentThreadId(); #else // defined(BOOST_ASIO_WINDOWS) || defined(__CYGWIN__) - void* id = instance()->thread_id_; - if (id == 0) - instance()->thread_id_ = id = &id; // Ugh. + void* id = &errno; BOOST_ASIO_ASSERT(sizeof(unsigned long) >= sizeof(void*)); return reinterpret_cast(id); #endif // defined(BOOST_ASIO_WINDOWS) || defined(__CYGWIN__) } +#endif // (OPENSSL_VERSION_NUMBER < 0x10000000L) +#if (OPENSSL_VERSION_NUMBER < 0x10100000L) static void openssl_locking_func(int mode, int n, const char* /*file*/, int /*line*/) { @@ -112,11 +131,7 @@ private: // Mutexes to be used in locking callbacks. std::vector > mutexes_; - -#if !defined(BOOST_ASIO_WINDOWS) && !defined(__CYGWIN__) - // The thread identifiers to be used by openssl. - boost::asio::detail::tss_ptr thread_id_; -#endif // !defined(BOOST_ASIO_WINDOWS) && !defined(__CYGWIN__) +#endif // (OPENSSL_VERSION_NUMBER < 0x10100000L) #if !defined(SSL_OP_NO_COMPRESSION) \ && (OPENSSL_VERSION_NUMBER >= 0x00908000L) diff --git a/3party/boost/boost/asio/ssl/detail/io.hpp b/3party/boost/boost/asio/ssl/detail/io.hpp index 2e889ec8b0..3dbe4520ef 100644 --- a/3party/boost/boost/asio/ssl/detail/io.hpp +++ b/3party/boost/boost/asio/ssl/detail/io.hpp @@ -2,7 +2,7 @@ // ssl/detail/io.hpp // ~~~~~~~~~~~~~~~~~ // -// Copyright (c) 2003-2015 Christopher M. Kohlhoff (chris at kohlhoff dot com) +// Copyright (c) 2003-2017 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) diff --git a/3party/boost/boost/asio/ssl/detail/openssl_init.hpp b/3party/boost/boost/asio/ssl/detail/openssl_init.hpp index 221709aa03..fd0432e589 100644 --- a/3party/boost/boost/asio/ssl/detail/openssl_init.hpp +++ b/3party/boost/boost/asio/ssl/detail/openssl_init.hpp @@ -2,7 +2,7 @@ // ssl/detail/openssl_init.hpp // ~~~~~~~~~~~~~~~~~~~~~~~~~~~ // -// Copyright (c) 2003-2015 Christopher M. Kohlhoff (chris at kohlhoff dot com) +// Copyright (c) 2003-2017 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) diff --git a/3party/boost/boost/asio/ssl/detail/openssl_types.hpp b/3party/boost/boost/asio/ssl/detail/openssl_types.hpp index c83d110b2a..ca12943b7c 100644 --- a/3party/boost/boost/asio/ssl/detail/openssl_types.hpp +++ b/3party/boost/boost/asio/ssl/detail/openssl_types.hpp @@ -2,7 +2,7 @@ // ssl/detail/openssl_types.hpp // ~~~~~~~~~~~~~~~~~~~~~~~~~~~~ // -// Copyright (c) 2003-2015 Christopher M. Kohlhoff (chris at kohlhoff dot com) +// Copyright (c) 2003-2017 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) @@ -16,13 +16,15 @@ #endif // defined(_MSC_VER) && (_MSC_VER >= 1200) #include +#include #include #include #if !defined(OPENSSL_NO_ENGINE) # include #endif // !defined(OPENSSL_NO_ENGINE) +#include #include +#include #include -#include #endif // BOOST_ASIO_SSL_DETAIL_OPENSSL_TYPES_HPP diff --git a/3party/boost/boost/asio/ssl/detail/password_callback.hpp b/3party/boost/boost/asio/ssl/detail/password_callback.hpp index 1ba89900bd..5df01946ba 100644 --- a/3party/boost/boost/asio/ssl/detail/password_callback.hpp +++ b/3party/boost/boost/asio/ssl/detail/password_callback.hpp @@ -2,7 +2,7 @@ // ssl/detail/password_callback.hpp // ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ // -// Copyright (c) 2003-2015 Christopher M. Kohlhoff (chris at kohlhoff dot com) +// Copyright (c) 2003-2017 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) diff --git a/3party/boost/boost/asio/ssl/detail/read_op.hpp b/3party/boost/boost/asio/ssl/detail/read_op.hpp index df50540e63..f0b5d6ddf9 100644 --- a/3party/boost/boost/asio/ssl/detail/read_op.hpp +++ b/3party/boost/boost/asio/ssl/detail/read_op.hpp @@ -2,7 +2,7 @@ // ssl/detail/read_op.hpp // ~~~~~~~~~~~~~~~~~~~~~~ // -// Copyright (c) 2003-2015 Christopher M. Kohlhoff (chris at kohlhoff dot com) +// Copyright (c) 2003-2017 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) diff --git a/3party/boost/boost/asio/ssl/detail/shutdown_op.hpp b/3party/boost/boost/asio/ssl/detail/shutdown_op.hpp index 1a206c1643..3a3f761c08 100644 --- a/3party/boost/boost/asio/ssl/detail/shutdown_op.hpp +++ b/3party/boost/boost/asio/ssl/detail/shutdown_op.hpp @@ -2,7 +2,7 @@ // ssl/detail/shutdown_op.hpp // ~~~~~~~~~~~~~~~~~~~~~~~~~~ // -// Copyright (c) 2003-2015 Christopher M. Kohlhoff (chris at kohlhoff dot com) +// Copyright (c) 2003-2017 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) diff --git a/3party/boost/boost/asio/ssl/detail/stream_core.hpp b/3party/boost/boost/asio/ssl/detail/stream_core.hpp index 2ef4110fc7..70d1feddbb 100644 --- a/3party/boost/boost/asio/ssl/detail/stream_core.hpp +++ b/3party/boost/boost/asio/ssl/detail/stream_core.hpp @@ -2,7 +2,7 @@ // ssl/detail/stream_core.hpp // ~~~~~~~~~~~~~~~~~~~~~~~~~~ // -// Copyright (c) 2003-2015 Christopher M. Kohlhoff (chris at kohlhoff dot com) +// Copyright (c) 2003-2017 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) diff --git a/3party/boost/boost/asio/ssl/detail/verify_callback.hpp b/3party/boost/boost/asio/ssl/detail/verify_callback.hpp index 5ddc89a9e1..c4bea7c215 100644 --- a/3party/boost/boost/asio/ssl/detail/verify_callback.hpp +++ b/3party/boost/boost/asio/ssl/detail/verify_callback.hpp @@ -2,7 +2,7 @@ // ssl/detail/verify_callback.hpp // ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ // -// Copyright (c) 2003-2015 Christopher M. Kohlhoff (chris at kohlhoff dot com) +// Copyright (c) 2003-2017 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) diff --git a/3party/boost/boost/asio/ssl/detail/write_op.hpp b/3party/boost/boost/asio/ssl/detail/write_op.hpp index d7b49c936b..c04eda86d2 100644 --- a/3party/boost/boost/asio/ssl/detail/write_op.hpp +++ b/3party/boost/boost/asio/ssl/detail/write_op.hpp @@ -2,7 +2,7 @@ // ssl/detail/write_op.hpp // ~~~~~~~~~~~~~~~~~~~~~~~ // -// Copyright (c) 2003-2015 Christopher M. Kohlhoff (chris at kohlhoff dot com) +// Copyright (c) 2003-2017 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) diff --git a/3party/boost/boost/asio/ssl/error.hpp b/3party/boost/boost/asio/ssl/error.hpp index eb95e8c140..968902c5d9 100644 --- a/3party/boost/boost/asio/ssl/error.hpp +++ b/3party/boost/boost/asio/ssl/error.hpp @@ -2,7 +2,7 @@ // ssl/error.hpp // ~~~~~~~~~~~~~ // -// Copyright (c) 2003-2015 Christopher M. Kohlhoff (chris at kohlhoff dot com) +// Copyright (c) 2003-2017 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) @@ -17,6 +17,7 @@ #include #include +#include #include @@ -26,15 +27,41 @@ namespace error { enum ssl_errors { + // Error numbers are those produced by openssl. }; extern BOOST_ASIO_DECL const boost::system::error_category& get_ssl_category(); -static const boost::system::error_category& ssl_category +static const boost::system::error_category& + ssl_category BOOST_ASIO_UNUSED_VARIABLE = boost::asio::error::get_ssl_category(); } // namespace error +namespace ssl { +namespace error { + +enum stream_errors +{ +#if defined(GENERATING_DOCUMENTATION) + /// The underlying stream closed before the ssl stream gracefully shut down. + stream_truncated +#elif (OPENSSL_VERSION_NUMBER < 0x10100000L) && !defined(OPENSSL_IS_BORINGSSL) + stream_truncated = ERR_PACK(ERR_LIB_SSL, 0, SSL_R_SHORT_READ) +#else + stream_truncated = 1 +#endif +}; + +extern BOOST_ASIO_DECL +const boost::system::error_category& get_stream_category(); + +static const boost::system::error_category& + stream_category BOOST_ASIO_UNUSED_VARIABLE + = boost::asio::ssl::error::get_stream_category(); + +} // namespace error +} // namespace ssl } // namespace asio } // namespace boost @@ -46,6 +73,11 @@ template<> struct is_error_code_enum static const bool value = true; }; +template<> struct is_error_code_enum +{ + static const bool value = true; +}; + } // namespace system } // namespace boost @@ -60,6 +92,17 @@ inline boost::system::error_code make_error_code(ssl_errors e) } } // namespace error +namespace ssl { +namespace error { + +inline boost::system::error_code make_error_code(stream_errors e) +{ + return boost::system::error_code( + static_cast(e), get_stream_category()); +} + +} // namespace error +} // namespace ssl } // namespace asio } // namespace boost diff --git a/3party/boost/boost/asio/ssl/impl/context.hpp b/3party/boost/boost/asio/ssl/impl/context.hpp index c4a751e8ff..52547d0437 100644 --- a/3party/boost/boost/asio/ssl/impl/context.hpp +++ b/3party/boost/boost/asio/ssl/impl/context.hpp @@ -3,7 +3,7 @@ // ~~~~~~~~~~~~~~~~~~~~ // // Copyright (c) 2005 Voipster / Indrek dot Juhani at voipster dot com -// Copyright (c) 2005-2015 Christopher M. Kohlhoff (chris at kohlhoff dot com) +// Copyright (c) 2005-2017 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) diff --git a/3party/boost/boost/asio/ssl/impl/context.ipp b/3party/boost/boost/asio/ssl/impl/context.ipp index 67191ade20..a1fb9a578b 100644 --- a/3party/boost/boost/asio/ssl/impl/context.ipp +++ b/3party/boost/boost/asio/ssl/impl/context.ipp @@ -3,7 +3,7 @@ // ~~~~~~~~~~~~~~~~~~~~ // // Copyright (c) 2005 Voipster / Indrek dot Juhani at voipster dot com -// Copyright (c) 2005-2015 Christopher M. Kohlhoff (chris at kohlhoff dot com) +// Copyright (c) 2005-2017 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) @@ -71,14 +71,15 @@ context::context(context::method m) switch (m) { -#if defined(OPENSSL_NO_SSL2) + // SSL v2. +#if (OPENSSL_VERSION_NUMBER >= 0x10100000L) || defined(OPENSSL_NO_SSL2) case context::sslv2: case context::sslv2_client: case context::sslv2_server: boost::asio::detail::throw_error( boost::asio::error::invalid_argument, "context"); break; -#else // defined(OPENSSL_NO_SSL2) +#else // (OPENSSL_VERSION_NUMBER >= 0x10100000L) || defined(OPENSSL_NO_SSL2) case context::sslv2: handle_ = ::SSL_CTX_new(::SSLv2_method()); break; @@ -88,7 +89,42 @@ context::context(context::method m) case context::sslv2_server: handle_ = ::SSL_CTX_new(::SSLv2_server_method()); break; -#endif // defined(OPENSSL_NO_SSL2) +#endif // (OPENSSL_VERSION_NUMBER >= 0x10100000L) || defined(OPENSSL_NO_SSL2) + + // SSL v3. +#if (OPENSSL_VERSION_NUMBER >= 0x10100000L) && !defined(LIBRESSL_VERSION_NUMBER) + case context::sslv3: + handle_ = ::SSL_CTX_new(::TLS_method()); + if (handle_) + { + SSL_CTX_set_min_proto_version(handle_, SSL3_VERSION); + SSL_CTX_set_max_proto_version(handle_, SSL3_VERSION); + } + break; + case context::sslv3_client: + handle_ = ::SSL_CTX_new(::TLS_client_method()); + if (handle_) + { + SSL_CTX_set_min_proto_version(handle_, SSL3_VERSION); + SSL_CTX_set_max_proto_version(handle_, SSL3_VERSION); + } + break; + case context::sslv3_server: + handle_ = ::SSL_CTX_new(::TLS_server_method()); + if (handle_) + { + SSL_CTX_set_min_proto_version(handle_, SSL3_VERSION); + SSL_CTX_set_max_proto_version(handle_, SSL3_VERSION); + } + break; +#elif defined(OPENSSL_NO_SSL3) + case context::sslv3: + case context::sslv3_client: + case context::sslv3_server: + boost::asio::detail::throw_error( + boost::asio::error::invalid_argument, "context"); + break; +#else // defined(OPENSSL_NO_SSL3) case context::sslv3: handle_ = ::SSL_CTX_new(::SSLv3_method()); break; @@ -98,6 +134,35 @@ context::context(context::method m) case context::sslv3_server: handle_ = ::SSL_CTX_new(::SSLv3_server_method()); break; +#endif // defined(OPENSSL_NO_SSL3) + + // TLS v1.0. +#if (OPENSSL_VERSION_NUMBER >= 0x10100000L) && !defined(LIBRESSL_VERSION_NUMBER) + case context::tlsv1: + handle_ = ::SSL_CTX_new(::TLS_method()); + if (handle_) + { + SSL_CTX_set_min_proto_version(handle_, TLS1_VERSION); + SSL_CTX_set_max_proto_version(handle_, TLS1_VERSION); + } + break; + case context::tlsv1_client: + handle_ = ::SSL_CTX_new(::TLS_client_method()); + if (handle_) + { + SSL_CTX_set_min_proto_version(handle_, TLS1_VERSION); + SSL_CTX_set_max_proto_version(handle_, TLS1_VERSION); + } + break; + case context::tlsv1_server: + handle_ = ::SSL_CTX_new(::TLS_server_method()); + if (handle_) + { + SSL_CTX_set_min_proto_version(handle_, TLS1_VERSION); + SSL_CTX_set_max_proto_version(handle_, TLS1_VERSION); + } + break; +#else // (OPENSSL_VERSION_NUMBER >= 0x10100000L) case context::tlsv1: handle_ = ::SSL_CTX_new(::TLSv1_method()); break; @@ -107,16 +172,35 @@ context::context(context::method m) case context::tlsv1_server: handle_ = ::SSL_CTX_new(::TLSv1_server_method()); break; - case context::sslv23: - handle_ = ::SSL_CTX_new(::SSLv23_method()); +#endif // (OPENSSL_VERSION_NUMBER >= 0x10100000L) + + // TLS v1.1. +#if (OPENSSL_VERSION_NUMBER >= 0x10100000L) && !defined(LIBRESSL_VERSION_NUMBER) + case context::tlsv11: + handle_ = ::SSL_CTX_new(::TLS_method()); + if (handle_) + { + SSL_CTX_set_min_proto_version(handle_, TLS1_1_VERSION); + SSL_CTX_set_max_proto_version(handle_, TLS1_1_VERSION); + } break; - case context::sslv23_client: - handle_ = ::SSL_CTX_new(::SSLv23_client_method()); + case context::tlsv11_client: + handle_ = ::SSL_CTX_new(::TLS_client_method()); + if (handle_) + { + SSL_CTX_set_min_proto_version(handle_, TLS1_1_VERSION); + SSL_CTX_set_max_proto_version(handle_, TLS1_1_VERSION); + } break; - case context::sslv23_server: - handle_ = ::SSL_CTX_new(::SSLv23_server_method()); + case context::tlsv11_server: + handle_ = ::SSL_CTX_new(::TLS_server_method()); + if (handle_) + { + SSL_CTX_set_min_proto_version(handle_, TLS1_1_VERSION); + SSL_CTX_set_max_proto_version(handle_, TLS1_1_VERSION); + } break; -#if defined(SSL_TXT_TLSV1_1) +#elif defined(SSL_TXT_TLSV1_1) case context::tlsv11: handle_ = ::SSL_CTX_new(::TLSv1_1_method()); break; @@ -134,7 +218,34 @@ context::context(context::method m) boost::asio::error::invalid_argument, "context"); break; #endif // defined(SSL_TXT_TLSV1_1) -#if defined(SSL_TXT_TLSV1_2) + + // TLS v1.2. +#if (OPENSSL_VERSION_NUMBER >= 0x10100000L) && !defined(LIBRESSL_VERSION_NUMBER) + case context::tlsv12: + handle_ = ::SSL_CTX_new(::TLS_method()); + if (handle_) + { + SSL_CTX_set_min_proto_version(handle_, TLS1_2_VERSION); + SSL_CTX_set_max_proto_version(handle_, TLS1_2_VERSION); + } + break; + case context::tlsv12_client: + handle_ = ::SSL_CTX_new(::TLS_client_method()); + if (handle_) + { + SSL_CTX_set_min_proto_version(handle_, TLS1_2_VERSION); + SSL_CTX_set_max_proto_version(handle_, TLS1_2_VERSION); + } + break; + case context::tlsv12_server: + handle_ = ::SSL_CTX_new(::TLS_server_method()); + if (handle_) + { + SSL_CTX_set_min_proto_version(handle_, TLS1_2_VERSION); + SSL_CTX_set_max_proto_version(handle_, TLS1_2_VERSION); + } + break; +#elif defined(SSL_TXT_TLSV1_1) case context::tlsv12: handle_ = ::SSL_CTX_new(::TLSv1_2_method()); break; @@ -144,14 +255,61 @@ context::context(context::method m) case context::tlsv12_server: handle_ = ::SSL_CTX_new(::TLSv1_2_server_method()); break; -#else // defined(SSL_TXT_TLSV1_2) +#else // defined(SSL_TXT_TLSV1_1) case context::tlsv12: case context::tlsv12_client: case context::tlsv12_server: boost::asio::detail::throw_error( boost::asio::error::invalid_argument, "context"); break; -#endif // defined(SSL_TXT_TLSV1_2) +#endif // defined(SSL_TXT_TLSV1_1) + + // Any supported SSL/TLS version. + case context::sslv23: + handle_ = ::SSL_CTX_new(::SSLv23_method()); + break; + case context::sslv23_client: + handle_ = ::SSL_CTX_new(::SSLv23_client_method()); + break; + case context::sslv23_server: + handle_ = ::SSL_CTX_new(::SSLv23_server_method()); + break; + + // Any supported TLS version. +#if (OPENSSL_VERSION_NUMBER >= 0x10100000L) && !defined(LIBRESSL_VERSION_NUMBER) + case context::tls: + handle_ = ::SSL_CTX_new(::TLS_method()); + if (handle_) + SSL_CTX_set_min_proto_version(handle_, TLS1_VERSION); + break; + case context::tls_client: + handle_ = ::SSL_CTX_new(::TLS_client_method()); + if (handle_) + SSL_CTX_set_min_proto_version(handle_, TLS1_VERSION); + break; + case context::tls_server: + handle_ = ::SSL_CTX_new(::TLS_server_method()); + if (handle_) + SSL_CTX_set_min_proto_version(handle_, TLS1_VERSION); + break; +#else // (OPENSSL_VERSION_NUMBER >= 0x10100000L) + case context::tls: + handle_ = ::SSL_CTX_new(::SSLv23_method()); + if (handle_) + SSL_CTX_set_options(handle_, SSL_OP_NO_SSLv2 | SSL_OP_NO_SSLv3); + break; + case context::tls_client: + handle_ = ::SSL_CTX_new(::SSLv23_client_method()); + if (handle_) + SSL_CTX_set_options(handle_, SSL_OP_NO_SSLv2 | SSL_OP_NO_SSLv3); + break; + case context::tls_server: + handle_ = ::SSL_CTX_new(::SSLv23_server_method()); + if (handle_) + SSL_CTX_set_options(handle_, SSL_OP_NO_SSLv2 | SSL_OP_NO_SSLv3); + break; +#endif // (OPENSSL_VERSION_NUMBER >= 0x10100000L) + default: handle_ = ::SSL_CTX_new(0); break; @@ -196,13 +354,22 @@ context::~context() { if (handle_) { - if (handle_->default_passwd_callback_userdata) +#if (OPENSSL_VERSION_NUMBER >= 0x10100000L) && !defined(LIBRESSL_VERSION_NUMBER) + void* cb_userdata = ::SSL_CTX_get_default_passwd_cb_userdata(handle_); +#else // (OPENSSL_VERSION_NUMBER >= 0x10100000L) + void* cb_userdata = handle_->default_passwd_callback_userdata; +#endif // (OPENSSL_VERSION_NUMBER >= 0x10100000L) + if (cb_userdata) { detail::password_callback_base* callback = static_cast( - handle_->default_passwd_callback_userdata); + cb_userdata); delete callback; +#if (OPENSSL_VERSION_NUMBER >= 0x10100000L) && !defined(LIBRESSL_VERSION_NUMBER) + ::SSL_CTX_set_default_passwd_cb_userdata(handle_, 0); +#else // (OPENSSL_VERSION_NUMBER >= 0x10100000L) handle_->default_passwd_callback_userdata = 0; +#endif // (OPENSSL_VERSION_NUMBER >= 0x10100000L) } if (SSL_CTX_get_app_data(handle_)) @@ -537,10 +704,17 @@ boost::system::error_code context::use_certificate_chain( bio_cleanup bio = { make_buffer_bio(chain) }; if (bio.p) { +#if (OPENSSL_VERSION_NUMBER >= 0x10100000L) && !defined(LIBRESSL_VERSION_NUMBER) + pem_password_cb* callback = ::SSL_CTX_get_default_passwd_cb(handle_); + void* cb_userdata = ::SSL_CTX_get_default_passwd_cb_userdata(handle_); +#else // (OPENSSL_VERSION_NUMBER >= 0x10100000L) + pem_password_cb* callback = handle_->default_passwd_callback; + void* cb_userdata = handle_->default_passwd_callback_userdata; +#endif // (OPENSSL_VERSION_NUMBER >= 0x10100000L) x509_cleanup cert = { ::PEM_read_bio_X509_AUX(bio.p, 0, - handle_->default_passwd_callback, - handle_->default_passwd_callback_userdata) }; + callback, + cb_userdata) }; if (!cert.p) { ec = boost::system::error_code(ERR_R_PEM_LIB, @@ -557,15 +731,19 @@ boost::system::error_code context::use_certificate_chain( return ec; } +#if (OPENSSL_VERSION_NUMBER >= 0x10002000L) && !defined(LIBRESSL_VERSION_NUMBER) + ::SSL_CTX_clear_chain_certs(handle_); +#else if (handle_->extra_certs) { ::sk_X509_pop_free(handle_->extra_certs, X509_free); handle_->extra_certs = 0; } +#endif // (OPENSSL_VERSION_NUMBER >= 0x10002000L) while (X509* cacert = ::PEM_read_bio_X509(bio.p, 0, - handle_->default_passwd_callback, - handle_->default_passwd_callback_userdata)) + callback, + cb_userdata)) { if (!::SSL_CTX_add_extra_chain_cert(handle_, cacert)) { @@ -630,6 +808,14 @@ boost::system::error_code context::use_private_key( { ::ERR_clear_error(); +#if (OPENSSL_VERSION_NUMBER >= 0x10100000L) && !defined(LIBRESSL_VERSION_NUMBER) + pem_password_cb* callback = ::SSL_CTX_get_default_passwd_cb(handle_); + void* cb_userdata = ::SSL_CTX_get_default_passwd_cb_userdata(handle_); +#else // (OPENSSL_VERSION_NUMBER >= 0x10100000L) + pem_password_cb* callback = handle_->default_passwd_callback; + void* cb_userdata = handle_->default_passwd_callback_userdata; +#endif // (OPENSSL_VERSION_NUMBER >= 0x10100000L) + bio_cleanup bio = { make_buffer_bio(private_key) }; if (bio.p) { @@ -641,8 +827,8 @@ boost::system::error_code context::use_private_key( break; case context_base::pem: evp_private_key.p = ::PEM_read_bio_PrivateKey( - bio.p, 0, handle_->default_passwd_callback, - handle_->default_passwd_callback_userdata); + bio.p, 0, callback, + cb_userdata); break; default: { @@ -689,6 +875,14 @@ boost::system::error_code context::use_rsa_private_key( { ::ERR_clear_error(); +#if (OPENSSL_VERSION_NUMBER >= 0x10100000L) && !defined(LIBRESSL_VERSION_NUMBER) + pem_password_cb* callback = ::SSL_CTX_get_default_passwd_cb(handle_); + void* cb_userdata = ::SSL_CTX_get_default_passwd_cb_userdata(handle_); +#else // (OPENSSL_VERSION_NUMBER >= 0x10100000L) + pem_password_cb* callback = handle_->default_passwd_callback; + void* cb_userdata = handle_->default_passwd_callback_userdata; +#endif // (OPENSSL_VERSION_NUMBER >= 0x10100000L) + bio_cleanup bio = { make_buffer_bio(private_key) }; if (bio.p) { @@ -700,8 +894,8 @@ boost::system::error_code context::use_rsa_private_key( break; case context_base::pem: rsa_private_key.p = ::PEM_read_bio_RSAPrivateKey( - bio.p, 0, handle_->default_passwd_callback, - handle_->default_passwd_callback_userdata); + bio.p, 0, callback, + cb_userdata); break; default: { @@ -920,11 +1114,17 @@ int context::verify_callback_function(int preverified, X509_STORE_CTX* ctx) boost::system::error_code context::do_set_password_callback( detail::password_callback_base* callback, boost::system::error_code& ec) { - if (handle_->default_passwd_callback_userdata) - delete static_cast( - handle_->default_passwd_callback_userdata); - +#if (OPENSSL_VERSION_NUMBER >= 0x10100000L) && !defined(LIBRESSL_VERSION_NUMBER) + void* old_callback = ::SSL_CTX_get_default_passwd_cb_userdata(handle_); + ::SSL_CTX_set_default_passwd_cb_userdata(handle_, callback); +#else // (OPENSSL_VERSION_NUMBER >= 0x10100000L) + void* old_callback = handle_->default_passwd_callback_userdata; handle_->default_passwd_callback_userdata = callback; +#endif // (OPENSSL_VERSION_NUMBER >= 0x10100000L) + + if (old_callback) + delete static_cast( + old_callback); SSL_CTX_set_default_passwd_cb(handle_, &context::password_callback_function); @@ -949,7 +1149,8 @@ int context::password_callback_function( strcpy_s(buf, size, passwd.c_str()); #else // defined(BOOST_ASIO_HAS_SECURE_RTL) *buf = '\0'; - strncat(buf, passwd.c_str(), size); + if (size > 0) + strncat(buf, passwd.c_str(), size - 1); #endif // defined(BOOST_ASIO_HAS_SECURE_RTL) return static_cast(strlen(buf)); diff --git a/3party/boost/boost/asio/ssl/impl/error.ipp b/3party/boost/boost/asio/ssl/impl/error.ipp index 503b7481ff..bdbd836f3b 100644 --- a/3party/boost/boost/asio/ssl/impl/error.ipp +++ b/3party/boost/boost/asio/ssl/impl/error.ipp @@ -2,7 +2,7 @@ // ssl/impl/error.ipp // ~~~~~~~~~~~~~~~~~~ // -// Copyright (c) 2003-2015 Christopher M. Kohlhoff (chris at kohlhoff dot com) +// Copyright (c) 2003-2017 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) @@ -24,7 +24,6 @@ namespace boost { namespace asio { namespace error { - namespace detail { class ssl_category : public boost::system::error_category @@ -51,6 +50,50 @@ const boost::system::error_category& get_ssl_category() } } // namespace error +namespace ssl { +namespace error { + +#if (OPENSSL_VERSION_NUMBER < 0x10100000L) && !defined(OPENSSL_IS_BORINGSSL) + +const boost::system::error_category& get_stream_category() +{ + return boost::asio::error::get_ssl_category(); +} + +#else + +namespace detail { + +class stream_category : public boost::system::error_category +{ +public: + const char* name() const BOOST_ASIO_ERROR_CATEGORY_NOEXCEPT + { + return "asio.ssl.stream"; + } + + std::string message(int value) const + { + switch (value) + { + case stream_truncated: return "stream truncated"; + default: return "asio.ssl.stream error"; + } + } +}; + +} // namespace detail + +const boost::system::error_category& get_stream_category() +{ + static detail::stream_category instance; + return instance; +} + +#endif + +} // namespace error +} // namespace ssl } // namespace asio } // namespace boost diff --git a/3party/boost/boost/asio/ssl/impl/rfc2818_verification.ipp b/3party/boost/boost/asio/ssl/impl/rfc2818_verification.ipp index b6784435be..7f22806735 100644 --- a/3party/boost/boost/asio/ssl/impl/rfc2818_verification.ipp +++ b/3party/boost/boost/asio/ssl/impl/rfc2818_verification.ipp @@ -2,7 +2,7 @@ // ssl/impl/rfc2818_verification.ipp // ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ // -// Copyright (c) 2003-2015 Christopher M. Kohlhoff (chris at kohlhoff dot com) +// Copyright (c) 2003-2017 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) diff --git a/3party/boost/boost/asio/ssl/impl/src.hpp b/3party/boost/boost/asio/ssl/impl/src.hpp index 172fb1a93b..942cc32308 100644 --- a/3party/boost/boost/asio/ssl/impl/src.hpp +++ b/3party/boost/boost/asio/ssl/impl/src.hpp @@ -2,7 +2,7 @@ // impl/ssl/src.hpp // ~~~~~~~~~~~~~~~~ // -// Copyright (c) 2003-2015 Christopher M. Kohlhoff (chris at kohlhoff dot com) +// Copyright (c) 2003-2017 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) diff --git a/3party/boost/boost/asio/ssl/old/basic_context.hpp b/3party/boost/boost/asio/ssl/old/basic_context.hpp index 6d2353933b..d8703b21ae 100644 --- a/3party/boost/boost/asio/ssl/old/basic_context.hpp +++ b/3party/boost/boost/asio/ssl/old/basic_context.hpp @@ -3,7 +3,7 @@ // ~~~~~~~~~~~~~~~~~~~~~~~~~ // // Copyright (c) 2005 Voipster / Indrek dot Juhani at voipster dot com -// Copyright (c) 2005-2015 Christopher M. Kohlhoff (chris at kohlhoff dot com) +// Copyright (c) 2005-2017 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) diff --git a/3party/boost/boost/asio/ssl/old/context_service.hpp b/3party/boost/boost/asio/ssl/old/context_service.hpp index 9c3e9c7e2c..1d9fbc0751 100644 --- a/3party/boost/boost/asio/ssl/old/context_service.hpp +++ b/3party/boost/boost/asio/ssl/old/context_service.hpp @@ -3,7 +3,7 @@ // ~~~~~~~~~~~~~~~~~~~~~~~~~~~ // // Copyright (c) 2005 Voipster / Indrek dot Juhani at voipster dot com -// Copyright (c) 2005-2015 Christopher M. Kohlhoff (chris at kohlhoff dot com) +// Copyright (c) 2005-2017 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) diff --git a/3party/boost/boost/asio/ssl/old/detail/openssl_context_service.hpp b/3party/boost/boost/asio/ssl/old/detail/openssl_context_service.hpp index 9b45e3585f..dd54c3297b 100644 --- a/3party/boost/boost/asio/ssl/old/detail/openssl_context_service.hpp +++ b/3party/boost/boost/asio/ssl/old/detail/openssl_context_service.hpp @@ -3,7 +3,7 @@ // ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ // // Copyright (c) 2005 Voipster / Indrek dot Juhani at voipster dot com -// Copyright (c) 2005-2015 Christopher M. Kohlhoff (chris at kohlhoff dot com) +// Copyright (c) 2005-2017 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) @@ -85,6 +85,13 @@ public: impl = ::SSL_CTX_new(::SSLv2_server_method()); break; #endif // defined(OPENSSL_NO_SSL2) +#if defined(OPENSSL_NO_SSL3) + case context_base::sslv3: + case context_base::sslv3_client: + case context_base::sslv3_server: + boost::asio::detail::throw_error(boost::asio::error::invalid_argument); + break; +#else // defined(OPENSSL_NO_SSL3) case context_base::sslv3: impl = ::SSL_CTX_new(::SSLv3_method()); break; @@ -94,6 +101,7 @@ public: case context_base::sslv3_server: impl = ::SSL_CTX_new(::SSLv3_server_method()); break; +#endif // defined(OPENSSL_NO_SSL3) case context_base::tlsv1: impl = ::SSL_CTX_new(::TLSv1_method()); break; diff --git a/3party/boost/boost/asio/ssl/old/detail/openssl_stream_service.hpp b/3party/boost/boost/asio/ssl/old/detail/openssl_stream_service.hpp index 2206ca010d..afccf3652a 100644 --- a/3party/boost/boost/asio/ssl/old/detail/openssl_stream_service.hpp +++ b/3party/boost/boost/asio/ssl/old/detail/openssl_stream_service.hpp @@ -3,7 +3,7 @@ // ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ // // Copyright (c) 2005 Voipster / Indrek dot Juhani at voipster dot com -// Copyright (c) 2005-2015 Christopher M. Kohlhoff (chris at kohlhoff dot com) +// Copyright (c) 2005-2017 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) diff --git a/3party/boost/boost/asio/ssl/old/stream.hpp b/3party/boost/boost/asio/ssl/old/stream.hpp index ddf4d17468..a8c570ee08 100644 --- a/3party/boost/boost/asio/ssl/old/stream.hpp +++ b/3party/boost/boost/asio/ssl/old/stream.hpp @@ -3,7 +3,7 @@ // ~~~~~~~~~~~~~~~~~~ // // Copyright (c) 2005 Voipster / Indrek dot Juhani at voipster dot com -// Copyright (c) 2005-2015 Christopher M. Kohlhoff (chris at kohlhoff dot com) +// Copyright (c) 2005-2017 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) diff --git a/3party/boost/boost/asio/ssl/old/stream_service.hpp b/3party/boost/boost/asio/ssl/old/stream_service.hpp index e046f7c43d..282687c2ea 100644 --- a/3party/boost/boost/asio/ssl/old/stream_service.hpp +++ b/3party/boost/boost/asio/ssl/old/stream_service.hpp @@ -3,7 +3,7 @@ // ~~~~~~~~~~~~~~~~~~~~~~~~~~ // // Copyright (c) 2005 Voipster / Indrek dot Juhani at voipster dot com -// Copyright (c) 2005-2015 Christopher M. Kohlhoff (chris at kohlhoff dot com) +// Copyright (c) 2005-2017 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) diff --git a/3party/boost/boost/asio/ssl/rfc2818_verification.hpp b/3party/boost/boost/asio/ssl/rfc2818_verification.hpp index 502a41ee68..21b0bca317 100644 --- a/3party/boost/boost/asio/ssl/rfc2818_verification.hpp +++ b/3party/boost/boost/asio/ssl/rfc2818_verification.hpp @@ -2,7 +2,7 @@ // ssl/rfc2818_verification.hpp // ~~~~~~~~~~~~~~~~~~~~~~~~~~~~ // -// Copyright (c) 2003-2015 Christopher M. Kohlhoff (chris at kohlhoff dot com) +// Copyright (c) 2003-2017 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) diff --git a/3party/boost/boost/asio/ssl/stream.hpp b/3party/boost/boost/asio/ssl/stream.hpp index 17f6e15bbb..1b883d3245 100644 --- a/3party/boost/boost/asio/ssl/stream.hpp +++ b/3party/boost/boost/asio/ssl/stream.hpp @@ -2,7 +2,7 @@ // ssl/stream.hpp // ~~~~~~~~~~~~~~ // -// Copyright (c) 2003-2015 Christopher M. Kohlhoff (chris at kohlhoff dot com) +// Copyright (c) 2003-2017 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) diff --git a/3party/boost/boost/asio/ssl/stream_base.hpp b/3party/boost/boost/asio/ssl/stream_base.hpp index 264fba9bae..54404ca4b0 100644 --- a/3party/boost/boost/asio/ssl/stream_base.hpp +++ b/3party/boost/boost/asio/ssl/stream_base.hpp @@ -2,7 +2,7 @@ // ssl/stream_base.hpp // ~~~~~~~~~~~~~~~~~~~ // -// Copyright (c) 2003-2015 Christopher M. Kohlhoff (chris at kohlhoff dot com) +// Copyright (c) 2003-2017 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) diff --git a/3party/boost/boost/asio/ssl/stream_service.hpp b/3party/boost/boost/asio/ssl/stream_service.hpp index 4a295eb268..39e39f539c 100644 --- a/3party/boost/boost/asio/ssl/stream_service.hpp +++ b/3party/boost/boost/asio/ssl/stream_service.hpp @@ -2,7 +2,7 @@ // ssl/stream_service.hpp // ~~~~~~~~~~~~~~~~~~~~~~ // -// Copyright (c) 2003-2015 Christopher M. Kohlhoff (chris at kohlhoff dot com) +// Copyright (c) 2003-2017 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) diff --git a/3party/boost/boost/asio/ssl/verify_context.hpp b/3party/boost/boost/asio/ssl/verify_context.hpp index 26b712cd50..6b7a884e77 100644 --- a/3party/boost/boost/asio/ssl/verify_context.hpp +++ b/3party/boost/boost/asio/ssl/verify_context.hpp @@ -2,7 +2,7 @@ // ssl/verify_context.hpp // ~~~~~~~~~~~~~~~~~~~~~~ // -// Copyright (c) 2003-2015 Christopher M. Kohlhoff (chris at kohlhoff dot com) +// Copyright (c) 2003-2017 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) diff --git a/3party/boost/boost/asio/ssl/verify_mode.hpp b/3party/boost/boost/asio/ssl/verify_mode.hpp index a99553b3bf..d63be08c9c 100644 --- a/3party/boost/boost/asio/ssl/verify_mode.hpp +++ b/3party/boost/boost/asio/ssl/verify_mode.hpp @@ -2,7 +2,7 @@ // ssl/verify_mode.hpp // ~~~~~~~~~~~~~~~~~~~ // -// Copyright (c) 2003-2015 Christopher M. Kohlhoff (chris at kohlhoff dot com) +// Copyright (c) 2003-2017 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) diff --git a/3party/boost/boost/asio/steady_timer.hpp b/3party/boost/boost/asio/steady_timer.hpp index f16b07da43..f18ce399ae 100644 --- a/3party/boost/boost/asio/steady_timer.hpp +++ b/3party/boost/boost/asio/steady_timer.hpp @@ -2,7 +2,7 @@ // steady_timer.hpp // ~~~~~~~~~~~~~~~~ // -// Copyright (c) 2003-2015 Christopher M. Kohlhoff (chris at kohlhoff dot com) +// Copyright (c) 2003-2017 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) diff --git a/3party/boost/boost/asio/strand.hpp b/3party/boost/boost/asio/strand.hpp index 8c6d94509b..a4f3797e6a 100644 --- a/3party/boost/boost/asio/strand.hpp +++ b/3party/boost/boost/asio/strand.hpp @@ -2,7 +2,7 @@ // strand.hpp // ~~~~~~~~~~ // -// Copyright (c) 2003-2015 Christopher M. Kohlhoff (chris at kohlhoff dot com) +// Copyright (c) 2003-2017 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) diff --git a/3party/boost/boost/asio/stream_socket_service.hpp b/3party/boost/boost/asio/stream_socket_service.hpp index 2657fefb4a..09463f4718 100644 --- a/3party/boost/boost/asio/stream_socket_service.hpp +++ b/3party/boost/boost/asio/stream_socket_service.hpp @@ -2,7 +2,7 @@ // stream_socket_service.hpp // ~~~~~~~~~~~~~~~~~~~~~~~~~ // -// Copyright (c) 2003-2015 Christopher M. Kohlhoff (chris at kohlhoff dot com) +// Copyright (c) 2003-2017 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) @@ -118,17 +118,21 @@ public: service_impl_.move_assign(impl, other_service.service_impl_, other_impl); } + // All socket services have access to each other's implementations. + template friend class stream_socket_service; + /// Move-construct a new stream socket implementation from another protocol /// type. template void converting_move_construct(implementation_type& impl, + stream_socket_service& other_service, typename stream_socket_service< Protocol1>::implementation_type& other_impl, typename enable_if::value>::type* = 0) { service_impl_.template converting_move_construct( - impl, other_impl); + impl, other_service.service_impl_, other_impl); } #endif // defined(BOOST_ASIO_HAS_MOVE) || defined(GENERATING_DOCUMENTATION) diff --git a/3party/boost/boost/asio/streambuf.hpp b/3party/boost/boost/asio/streambuf.hpp index 1e77750d2d..de11184892 100644 --- a/3party/boost/boost/asio/streambuf.hpp +++ b/3party/boost/boost/asio/streambuf.hpp @@ -2,7 +2,7 @@ // streambuf.hpp // ~~~~~~~~~~~~~ // -// Copyright (c) 2003-2015 Christopher M. Kohlhoff (chris at kohlhoff dot com) +// Copyright (c) 2003-2017 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) diff --git a/3party/boost/boost/asio/system_timer.hpp b/3party/boost/boost/asio/system_timer.hpp index 53b9f7129c..e95370dbbc 100644 --- a/3party/boost/boost/asio/system_timer.hpp +++ b/3party/boost/boost/asio/system_timer.hpp @@ -2,7 +2,7 @@ // system_timer.hpp // ~~~~~~~~~~~~~~~~ // -// Copyright (c) 2003-2015 Christopher M. Kohlhoff (chris at kohlhoff dot com) +// Copyright (c) 2003-2017 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) diff --git a/3party/boost/boost/asio/time_traits.hpp b/3party/boost/boost/asio/time_traits.hpp index d27b80d592..feab4e1a72 100644 --- a/3party/boost/boost/asio/time_traits.hpp +++ b/3party/boost/boost/asio/time_traits.hpp @@ -2,7 +2,7 @@ // time_traits.hpp // ~~~~~~~~~~~~~~~ // -// Copyright (c) 2003-2015 Christopher M. Kohlhoff (chris at kohlhoff dot com) +// Copyright (c) 2003-2017 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) diff --git a/3party/boost/boost/asio/unyield.hpp b/3party/boost/boost/asio/unyield.hpp index 50ff8cf111..37539810de 100644 --- a/3party/boost/boost/asio/unyield.hpp +++ b/3party/boost/boost/asio/unyield.hpp @@ -2,7 +2,7 @@ // unyield.hpp // ~~~~~~~~~~~ // -// Copyright (c) 2003-2015 Christopher M. Kohlhoff (chris at kohlhoff dot com) +// Copyright (c) 2003-2017 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) diff --git a/3party/boost/boost/asio/use_future.hpp b/3party/boost/boost/asio/use_future.hpp index 66a9f6a9b8..43f6102e4d 100644 --- a/3party/boost/boost/asio/use_future.hpp +++ b/3party/boost/boost/asio/use_future.hpp @@ -2,7 +2,7 @@ // use_future.hpp // ~~~~~~~~~~~~~~ // -// Copyright (c) 2003-2015 Christopher M. Kohlhoff (chris at kohlhoff dot com) +// Copyright (c) 2003-2017 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) diff --git a/3party/boost/boost/asio/version.hpp b/3party/boost/boost/asio/version.hpp index e8eefafb17..7dfc1c3d18 100644 --- a/3party/boost/boost/asio/version.hpp +++ b/3party/boost/boost/asio/version.hpp @@ -2,7 +2,7 @@ // version.hpp // ~~~~~~~~~~~ // -// Copyright (c) 2003-2015 Christopher M. Kohlhoff (chris at kohlhoff dot com) +// Copyright (c) 2003-2017 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) @@ -18,6 +18,6 @@ // BOOST_ASIO_VERSION % 100 is the sub-minor version // BOOST_ASIO_VERSION / 100 % 1000 is the minor version // BOOST_ASIO_VERSION / 100000 is the major version -#define BOOST_ASIO_VERSION 101006 // 1.10.6 +#define BOOST_ASIO_VERSION 101009 // 1.10.9 #endif // BOOST_ASIO_VERSION_HPP diff --git a/3party/boost/boost/asio/wait_traits.hpp b/3party/boost/boost/asio/wait_traits.hpp index dc7d3a33b2..f1a3c18243 100644 --- a/3party/boost/boost/asio/wait_traits.hpp +++ b/3party/boost/boost/asio/wait_traits.hpp @@ -2,7 +2,7 @@ // wait_traits.hpp // ~~~~~~~~~~~~~~~ // -// Copyright (c) 2003-2015 Christopher M. Kohlhoff (chris at kohlhoff dot com) +// Copyright (c) 2003-2017 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) diff --git a/3party/boost/boost/asio/waitable_timer_service.hpp b/3party/boost/boost/asio/waitable_timer_service.hpp index f1709051d6..139d124ec5 100644 --- a/3party/boost/boost/asio/waitable_timer_service.hpp +++ b/3party/boost/boost/asio/waitable_timer_service.hpp @@ -2,7 +2,7 @@ // waitable_timer_service.hpp // ~~~~~~~~~~~~~~~~~~~~~~~~~~ // -// Copyright (c) 2003-2015 Christopher M. Kohlhoff (chris at kohlhoff dot com) +// Copyright (c) 2003-2017 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) diff --git a/3party/boost/boost/asio/windows/basic_handle.hpp b/3party/boost/boost/asio/windows/basic_handle.hpp index 3545f0f477..6f903fd454 100644 --- a/3party/boost/boost/asio/windows/basic_handle.hpp +++ b/3party/boost/boost/asio/windows/basic_handle.hpp @@ -2,7 +2,7 @@ // windows/basic_handle.hpp // ~~~~~~~~~~~~~~~~~~~~~~~~ // -// Copyright (c) 2003-2015 Christopher M. Kohlhoff (chris at kohlhoff dot com) +// Copyright (c) 2003-2017 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) diff --git a/3party/boost/boost/asio/windows/basic_object_handle.hpp b/3party/boost/boost/asio/windows/basic_object_handle.hpp index c7a5fcd80e..c82c2a7039 100644 --- a/3party/boost/boost/asio/windows/basic_object_handle.hpp +++ b/3party/boost/boost/asio/windows/basic_object_handle.hpp @@ -2,7 +2,7 @@ // windows/basic_object_handle.hpp // ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ // -// Copyright (c) 2003-2015 Christopher M. Kohlhoff (chris at kohlhoff dot com) +// Copyright (c) 2003-2017 Christopher M. Kohlhoff (chris at kohlhoff dot com) // Copyright (c) 2011 Boris Schaeling (boris@highscore.de) // // Distributed under the Boost Software License, Version 1.0. (See accompanying diff --git a/3party/boost/boost/asio/windows/basic_random_access_handle.hpp b/3party/boost/boost/asio/windows/basic_random_access_handle.hpp index 9aebd24485..0d4184fb64 100644 --- a/3party/boost/boost/asio/windows/basic_random_access_handle.hpp +++ b/3party/boost/boost/asio/windows/basic_random_access_handle.hpp @@ -2,7 +2,7 @@ // windows/basic_random_access_handle.hpp // ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ // -// Copyright (c) 2003-2015 Christopher M. Kohlhoff (chris at kohlhoff dot com) +// Copyright (c) 2003-2017 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) diff --git a/3party/boost/boost/asio/windows/basic_stream_handle.hpp b/3party/boost/boost/asio/windows/basic_stream_handle.hpp index 25916accac..1b954fffbd 100644 --- a/3party/boost/boost/asio/windows/basic_stream_handle.hpp +++ b/3party/boost/boost/asio/windows/basic_stream_handle.hpp @@ -2,7 +2,7 @@ // windows/basic_stream_handle.hpp // ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ // -// Copyright (c) 2003-2015 Christopher M. Kohlhoff (chris at kohlhoff dot com) +// Copyright (c) 2003-2017 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) diff --git a/3party/boost/boost/asio/windows/object_handle.hpp b/3party/boost/boost/asio/windows/object_handle.hpp index 843b8bb98c..614cc6bf3e 100644 --- a/3party/boost/boost/asio/windows/object_handle.hpp +++ b/3party/boost/boost/asio/windows/object_handle.hpp @@ -2,7 +2,7 @@ // windows/object_handle.hpp // ~~~~~~~~~~~~~~~~~~~~~~~~~ // -// Copyright (c) 2003-2015 Christopher M. Kohlhoff (chris at kohlhoff dot com) +// Copyright (c) 2003-2017 Christopher M. Kohlhoff (chris at kohlhoff dot com) // Copyright (c) 2011 Boris Schaeling (boris@highscore.de) // // Distributed under the Boost Software License, Version 1.0. (See accompanying diff --git a/3party/boost/boost/asio/windows/object_handle_service.hpp b/3party/boost/boost/asio/windows/object_handle_service.hpp index 7087ea9fe5..26ef6ed507 100644 --- a/3party/boost/boost/asio/windows/object_handle_service.hpp +++ b/3party/boost/boost/asio/windows/object_handle_service.hpp @@ -2,7 +2,7 @@ // windows/object_handle_service.hpp // ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ // -// Copyright (c) 2003-2015 Christopher M. Kohlhoff (chris at kohlhoff dot com) +// Copyright (c) 2003-2017 Christopher M. Kohlhoff (chris at kohlhoff dot com) // Copyright (c) 2011 Boris Schaeling (boris@highscore.de) // // Distributed under the Boost Software License, Version 1.0. (See accompanying diff --git a/3party/boost/boost/asio/windows/overlapped_ptr.hpp b/3party/boost/boost/asio/windows/overlapped_ptr.hpp index f6f2d6d397..fa9fb3d200 100644 --- a/3party/boost/boost/asio/windows/overlapped_ptr.hpp +++ b/3party/boost/boost/asio/windows/overlapped_ptr.hpp @@ -2,7 +2,7 @@ // windows/overlapped_ptr.hpp // ~~~~~~~~~~~~~~~~~~~~~~~~~~ // -// Copyright (c) 2003-2015 Christopher M. Kohlhoff (chris at kohlhoff dot com) +// Copyright (c) 2003-2017 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) diff --git a/3party/boost/boost/asio/windows/random_access_handle.hpp b/3party/boost/boost/asio/windows/random_access_handle.hpp index 48e4cfe29e..993e193278 100644 --- a/3party/boost/boost/asio/windows/random_access_handle.hpp +++ b/3party/boost/boost/asio/windows/random_access_handle.hpp @@ -2,7 +2,7 @@ // windows/random_access_handle.hpp // ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ // -// Copyright (c) 2003-2015 Christopher M. Kohlhoff (chris at kohlhoff dot com) +// Copyright (c) 2003-2017 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) diff --git a/3party/boost/boost/asio/windows/random_access_handle_service.hpp b/3party/boost/boost/asio/windows/random_access_handle_service.hpp index 33fbf9f945..15a808f69a 100644 --- a/3party/boost/boost/asio/windows/random_access_handle_service.hpp +++ b/3party/boost/boost/asio/windows/random_access_handle_service.hpp @@ -2,7 +2,7 @@ // windows/random_access_handle_service.hpp // ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ // -// Copyright (c) 2003-2015 Christopher M. Kohlhoff (chris at kohlhoff dot com) +// Copyright (c) 2003-2017 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) diff --git a/3party/boost/boost/asio/windows/stream_handle.hpp b/3party/boost/boost/asio/windows/stream_handle.hpp index ffe0e03d94..e52b8a16a6 100644 --- a/3party/boost/boost/asio/windows/stream_handle.hpp +++ b/3party/boost/boost/asio/windows/stream_handle.hpp @@ -2,7 +2,7 @@ // windows/stream_handle.hpp // ~~~~~~~~~~~~~~~~~~~~~~~~~ // -// Copyright (c) 2003-2015 Christopher M. Kohlhoff (chris at kohlhoff dot com) +// Copyright (c) 2003-2017 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) diff --git a/3party/boost/boost/asio/windows/stream_handle_service.hpp b/3party/boost/boost/asio/windows/stream_handle_service.hpp index 13dc476d59..5adcfaed1b 100644 --- a/3party/boost/boost/asio/windows/stream_handle_service.hpp +++ b/3party/boost/boost/asio/windows/stream_handle_service.hpp @@ -2,7 +2,7 @@ // windows/stream_handle_service.hpp // ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ // -// Copyright (c) 2003-2015 Christopher M. Kohlhoff (chris at kohlhoff dot com) +// Copyright (c) 2003-2017 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) diff --git a/3party/boost/boost/asio/write.hpp b/3party/boost/boost/asio/write.hpp index b5d7051d82..b70e6f5bf5 100644 --- a/3party/boost/boost/asio/write.hpp +++ b/3party/boost/boost/asio/write.hpp @@ -2,7 +2,7 @@ // write.hpp // ~~~~~~~~~ // -// Copyright (c) 2003-2015 Christopher M. Kohlhoff (chris at kohlhoff dot com) +// Copyright (c) 2003-2017 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) diff --git a/3party/boost/boost/asio/write_at.hpp b/3party/boost/boost/asio/write_at.hpp index b1a6ac79f3..266fc5bcaf 100644 --- a/3party/boost/boost/asio/write_at.hpp +++ b/3party/boost/boost/asio/write_at.hpp @@ -2,7 +2,7 @@ // write_at.hpp // ~~~~~~~~~~~~ // -// Copyright (c) 2003-2015 Christopher M. Kohlhoff (chris at kohlhoff dot com) +// Copyright (c) 2003-2017 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) diff --git a/3party/boost/boost/asio/yield.hpp b/3party/boost/boost/asio/yield.hpp index d4c3f2f032..85f71c7b8f 100644 --- a/3party/boost/boost/asio/yield.hpp +++ b/3party/boost/boost/asio/yield.hpp @@ -2,7 +2,7 @@ // yield.hpp // ~~~~~~~~~ // -// Copyright (c) 2003-2015 Christopher M. Kohlhoff (chris at kohlhoff dot com) +// Copyright (c) 2003-2017 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) diff --git a/3party/boost/boost/assert.hpp b/3party/boost/boost/assert.hpp index 1713d9bb1d..9650d7a290 100644 --- a/3party/boost/boost/assert.hpp +++ b/3party/boost/boost/assert.hpp @@ -3,10 +3,12 @@ // BOOST_ASSERT_MSG(expr, msg) // BOOST_VERIFY(expr) // BOOST_VERIFY_MSG(expr, msg) +// BOOST_ASSERT_IS_VOID // // Copyright (c) 2001, 2002 Peter Dimov and Multi Media Ltd. // Copyright (c) 2007, 2014 Peter Dimov // Copyright (c) Beman Dawes 2011 +// Copyright (c) 2015 Ion Gaztanaga // // Distributed under the Boost Software License, Version 1.0. // See accompanying file LICENSE_1_0.txt or copy at @@ -24,16 +26,18 @@ // // -// BOOST_ASSERT, BOOST_ASSERT_MSG +// BOOST_ASSERT, BOOST_ASSERT_MSG, BOOST_ASSERT_IS_VOID // #undef BOOST_ASSERT #undef BOOST_ASSERT_MSG +#undef BOOST_ASSERT_IS_VOID #if defined(BOOST_DISABLE_ASSERTS) || ( defined(BOOST_ENABLE_ASSERT_DEBUG_HANDLER) && defined(NDEBUG) ) # define BOOST_ASSERT(expr) ((void)0) # define BOOST_ASSERT_MSG(expr, msg) ((void)0) +# define BOOST_ASSERT_IS_VOID #elif defined(BOOST_ENABLE_ASSERT_HANDLER) || ( defined(BOOST_ENABLE_ASSERT_DEBUG_HANDLER) && !defined(NDEBUG) ) @@ -55,6 +59,9 @@ namespace boost # define BOOST_ASSERT(expr) assert(expr) # define BOOST_ASSERT_MSG(expr, msg) assert((expr)&&(msg)) +#if defined(NDEBUG) +# define BOOST_ASSERT_IS_VOID +#endif #endif diff --git a/3party/boost/boost/atomic/detail/atomic_flag.hpp b/3party/boost/boost/atomic/detail/atomic_flag.hpp index 6a6667d8eb..7fb44cdb1a 100644 --- a/3party/boost/boost/atomic/detail/atomic_flag.hpp +++ b/3party/boost/boost/atomic/detail/atomic_flag.hpp @@ -42,7 +42,7 @@ struct atomic_flag typedef atomics::detail::operations< 1u, false > operations; typedef operations::storage_type storage_type; - storage_type m_storage; + operations::aligned_storage_type m_storage; BOOST_FORCEINLINE BOOST_CONSTEXPR atomic_flag() BOOST_NOEXCEPT : m_storage(0) { @@ -50,14 +50,14 @@ struct atomic_flag BOOST_FORCEINLINE bool test_and_set(memory_order order = memory_order_seq_cst) volatile BOOST_NOEXCEPT { - return operations::test_and_set(m_storage, order); + return operations::test_and_set(m_storage.value, order); } BOOST_FORCEINLINE void clear(memory_order order = memory_order_seq_cst) volatile BOOST_NOEXCEPT { BOOST_ASSERT(order != memory_order_acquire); BOOST_ASSERT(order != memory_order_acq_rel); - operations::clear(m_storage, order); + operations::clear(m_storage.value, order); } BOOST_DELETED_FUNCTION(atomic_flag(atomic_flag const&)) diff --git a/3party/boost/boost/atomic/detail/atomic_template.hpp b/3party/boost/boost/atomic/detail/atomic_template.hpp index bc3922a711..dd3c741506 100644 --- a/3party/boost/boost/atomic/detail/atomic_template.hpp +++ b/3party/boost/boost/atomic/detail/atomic_template.hpp @@ -22,7 +22,7 @@ #include #include #include -#include +#include #include #ifdef BOOST_HAS_PRAGMA_ONCE @@ -78,16 +78,16 @@ class base_atomic< T, int > private: typedef T value_type; typedef T difference_type; - typedef atomics::detail::operations< storage_size_of< value_type >::value, boost::is_signed< T >::value > operations; protected: + typedef atomics::detail::operations< storage_size_of< value_type >::value, boost::is_signed< T >::value > operations; typedef value_type value_arg_type; public: typedef typename operations::storage_type storage_type; protected: - storage_type m_storage; + typename operations::aligned_storage_type m_storage; public: BOOST_DEFAULTED_FUNCTION(base_atomic(), {}) @@ -99,7 +99,7 @@ public: BOOST_ASSERT(order != memory_order_acquire); BOOST_ASSERT(order != memory_order_acq_rel); - operations::store(m_storage, static_cast< storage_type >(v), order); + operations::store(m_storage.value, static_cast< storage_type >(v), order); } BOOST_FORCEINLINE value_type load(memory_order order = memory_order_seq_cst) const volatile BOOST_NOEXCEPT @@ -107,22 +107,22 @@ public: BOOST_ASSERT(order != memory_order_release); BOOST_ASSERT(order != memory_order_acq_rel); - return static_cast< value_type >(operations::load(m_storage, order)); + return static_cast< value_type >(operations::load(m_storage.value, order)); } BOOST_FORCEINLINE value_type fetch_add(difference_type v, memory_order order = memory_order_seq_cst) volatile BOOST_NOEXCEPT { - return static_cast< value_type >(operations::fetch_add(m_storage, static_cast< storage_type >(v), order)); + return static_cast< value_type >(operations::fetch_add(m_storage.value, static_cast< storage_type >(v), order)); } BOOST_FORCEINLINE value_type fetch_sub(difference_type v, memory_order order = memory_order_seq_cst) volatile BOOST_NOEXCEPT { - return static_cast< value_type >(operations::fetch_sub(m_storage, static_cast< storage_type >(v), order)); + return static_cast< value_type >(operations::fetch_sub(m_storage.value, static_cast< storage_type >(v), order)); } BOOST_FORCEINLINE value_type exchange(value_type v, memory_order order = memory_order_seq_cst) volatile BOOST_NOEXCEPT { - return static_cast< value_type >(operations::exchange(m_storage, static_cast< storage_type >(v), order)); + return static_cast< value_type >(operations::exchange(m_storage.value, static_cast< storage_type >(v), order)); } BOOST_FORCEINLINE bool compare_exchange_strong(value_type& expected, value_type desired, memory_order success_order, memory_order failure_order) volatile BOOST_NOEXCEPT @@ -132,7 +132,7 @@ public: BOOST_ASSERT(cas_failure_order_must_not_be_stronger_than_success_order(success_order, failure_order)); storage_type old_value = static_cast< storage_type >(expected); - const bool res = operations::compare_exchange_strong(m_storage, old_value, static_cast< storage_type >(desired), success_order, failure_order); + const bool res = operations::compare_exchange_strong(m_storage.value, old_value, static_cast< storage_type >(desired), success_order, failure_order); expected = static_cast< value_type >(old_value); return res; } @@ -149,7 +149,7 @@ public: BOOST_ASSERT(cas_failure_order_must_not_be_stronger_than_success_order(success_order, failure_order)); storage_type old_value = static_cast< storage_type >(expected); - const bool res = operations::compare_exchange_weak(m_storage, old_value, static_cast< storage_type >(desired), success_order, failure_order); + const bool res = operations::compare_exchange_weak(m_storage.value, old_value, static_cast< storage_type >(desired), success_order, failure_order); expected = static_cast< value_type >(old_value); return res; } @@ -161,22 +161,22 @@ public: BOOST_FORCEINLINE value_type fetch_and(value_type v, memory_order order = memory_order_seq_cst) volatile BOOST_NOEXCEPT { - return static_cast< value_type >(operations::fetch_and(m_storage, static_cast< storage_type >(v), order)); + return static_cast< value_type >(operations::fetch_and(m_storage.value, static_cast< storage_type >(v), order)); } BOOST_FORCEINLINE value_type fetch_or(value_type v, memory_order order = memory_order_seq_cst) volatile BOOST_NOEXCEPT { - return static_cast< value_type >(operations::fetch_or(m_storage, static_cast< storage_type >(v), order)); + return static_cast< value_type >(operations::fetch_or(m_storage.value, static_cast< storage_type >(v), order)); } BOOST_FORCEINLINE value_type fetch_xor(value_type v, memory_order order = memory_order_seq_cst) volatile BOOST_NOEXCEPT { - return static_cast< value_type >(operations::fetch_xor(m_storage, static_cast< storage_type >(v), order)); + return static_cast< value_type >(operations::fetch_xor(m_storage.value, static_cast< storage_type >(v), order)); } BOOST_FORCEINLINE bool is_lock_free() const volatile BOOST_NOEXCEPT { - return operations::is_lock_free(m_storage); + return operations::is_lock_free(m_storage.value); } BOOST_FORCEINLINE value_type operator++(int) volatile BOOST_NOEXCEPT @@ -234,16 +234,16 @@ class base_atomic< bool, int > { private: typedef bool value_type; - typedef atomics::detail::operations< 1u, false > operations; protected: + typedef atomics::detail::operations< 1u, false > operations; typedef value_type value_arg_type; public: typedef operations::storage_type storage_type; protected: - storage_type m_storage; + operations::aligned_storage_type m_storage; public: BOOST_DEFAULTED_FUNCTION(base_atomic(), {}) @@ -255,7 +255,7 @@ public: BOOST_ASSERT(order != memory_order_acquire); BOOST_ASSERT(order != memory_order_acq_rel); - operations::store(m_storage, static_cast< storage_type >(v), order); + operations::store(m_storage.value, static_cast< storage_type >(v), order); } BOOST_FORCEINLINE value_type load(memory_order order = memory_order_seq_cst) const volatile BOOST_NOEXCEPT @@ -263,12 +263,12 @@ public: BOOST_ASSERT(order != memory_order_release); BOOST_ASSERT(order != memory_order_acq_rel); - return !!operations::load(m_storage, order); + return !!operations::load(m_storage.value, order); } BOOST_FORCEINLINE value_type exchange(value_type v, memory_order order = memory_order_seq_cst) volatile BOOST_NOEXCEPT { - return !!operations::exchange(m_storage, static_cast< storage_type >(v), order); + return !!operations::exchange(m_storage.value, static_cast< storage_type >(v), order); } BOOST_FORCEINLINE bool compare_exchange_strong(value_type& expected, value_type desired, memory_order success_order, memory_order failure_order) volatile BOOST_NOEXCEPT @@ -278,7 +278,7 @@ public: BOOST_ASSERT(cas_failure_order_must_not_be_stronger_than_success_order(success_order, failure_order)); storage_type old_value = static_cast< storage_type >(expected); - const bool res = operations::compare_exchange_strong(m_storage, old_value, static_cast< storage_type >(desired), success_order, failure_order); + const bool res = operations::compare_exchange_strong(m_storage.value, old_value, static_cast< storage_type >(desired), success_order, failure_order); expected = !!old_value; return res; } @@ -295,7 +295,7 @@ public: BOOST_ASSERT(cas_failure_order_must_not_be_stronger_than_success_order(success_order, failure_order)); storage_type old_value = static_cast< storage_type >(expected); - const bool res = operations::compare_exchange_weak(m_storage, old_value, static_cast< storage_type >(desired), success_order, failure_order); + const bool res = operations::compare_exchange_weak(m_storage.value, old_value, static_cast< storage_type >(desired), success_order, failure_order); expected = !!old_value; return res; } @@ -307,7 +307,7 @@ public: BOOST_FORCEINLINE bool is_lock_free() const volatile BOOST_NOEXCEPT { - return operations::is_lock_free(m_storage); + return operations::is_lock_free(m_storage.value); } BOOST_DELETED_FUNCTION(base_atomic(base_atomic const&)) @@ -321,19 +321,19 @@ class base_atomic< T, void > { private: typedef T value_type; - typedef atomics::detail::operations< storage_size_of< value_type >::value, false > operations; protected: + typedef atomics::detail::operations< storage_size_of< value_type >::value, false > operations; typedef value_type const& value_arg_type; public: typedef typename operations::storage_type storage_type; protected: - storage_type m_storage; + typename operations::aligned_storage_type m_storage; public: - BOOST_FORCEINLINE explicit base_atomic(value_type const& v = value_type()) BOOST_NOEXCEPT : m_storage(atomics::detail::memcpy_cast< storage_type >(v)) + BOOST_FORCEINLINE explicit base_atomic(value_type const& v = value_type()) BOOST_NOEXCEPT : m_storage(atomics::detail::bitwise_cast< storage_type >(v)) { } @@ -343,7 +343,7 @@ public: BOOST_ASSERT(order != memory_order_acquire); BOOST_ASSERT(order != memory_order_acq_rel); - operations::store(m_storage, atomics::detail::memcpy_cast< storage_type >(v), order); + operations::store(m_storage.value, atomics::detail::bitwise_cast< storage_type >(v), order); } BOOST_FORCEINLINE value_type load(memory_order order = memory_order_seq_cst) const volatile BOOST_NOEXCEPT @@ -351,12 +351,12 @@ public: BOOST_ASSERT(order != memory_order_release); BOOST_ASSERT(order != memory_order_acq_rel); - return atomics::detail::memcpy_cast< value_type >(operations::load(m_storage, order)); + return atomics::detail::bitwise_cast< value_type >(operations::load(m_storage.value, order)); } BOOST_FORCEINLINE value_type exchange(value_type v, memory_order order = memory_order_seq_cst) volatile BOOST_NOEXCEPT { - return atomics::detail::memcpy_cast< value_type >(operations::exchange(m_storage, atomics::detail::memcpy_cast< storage_type >(v), order)); + return atomics::detail::bitwise_cast< value_type >(operations::exchange(m_storage.value, atomics::detail::bitwise_cast< storage_type >(v), order)); } BOOST_FORCEINLINE bool compare_exchange_strong(value_type& expected, value_type desired, memory_order success_order, memory_order failure_order) volatile BOOST_NOEXCEPT @@ -365,9 +365,9 @@ public: BOOST_ASSERT(failure_order != memory_order_acq_rel); BOOST_ASSERT(cas_failure_order_must_not_be_stronger_than_success_order(success_order, failure_order)); - storage_type old_value = atomics::detail::memcpy_cast< storage_type >(expected); - const bool res = operations::compare_exchange_strong(m_storage, old_value, atomics::detail::memcpy_cast< storage_type >(desired), success_order, failure_order); - expected = atomics::detail::memcpy_cast< value_type >(old_value); + storage_type old_value = atomics::detail::bitwise_cast< storage_type >(expected); + const bool res = operations::compare_exchange_strong(m_storage.value, old_value, atomics::detail::bitwise_cast< storage_type >(desired), success_order, failure_order); + expected = atomics::detail::bitwise_cast< value_type >(old_value); return res; } @@ -382,9 +382,9 @@ public: BOOST_ASSERT(failure_order != memory_order_acq_rel); BOOST_ASSERT(cas_failure_order_must_not_be_stronger_than_success_order(success_order, failure_order)); - storage_type old_value = atomics::detail::memcpy_cast< storage_type >(expected); - const bool res = operations::compare_exchange_weak(m_storage, old_value, atomics::detail::memcpy_cast< storage_type >(desired), success_order, failure_order); - expected = atomics::detail::memcpy_cast< value_type >(old_value); + storage_type old_value = atomics::detail::bitwise_cast< storage_type >(expected); + const bool res = operations::compare_exchange_weak(m_storage.value, old_value, atomics::detail::bitwise_cast< storage_type >(desired), success_order, failure_order); + expected = atomics::detail::bitwise_cast< value_type >(old_value); return res; } @@ -395,7 +395,7 @@ public: BOOST_FORCEINLINE bool is_lock_free() const volatile BOOST_NOEXCEPT { - return operations::is_lock_free(m_storage); + return operations::is_lock_free(m_storage.value); } BOOST_DELETED_FUNCTION(base_atomic(base_atomic const&)) @@ -410,20 +410,20 @@ class base_atomic< T*, void* > private: typedef T* value_type; typedef std::ptrdiff_t difference_type; - typedef atomics::detail::operations< storage_size_of< value_type >::value, false > operations; protected: + typedef atomics::detail::operations< storage_size_of< value_type >::value, false > operations; typedef value_type value_arg_type; public: typedef typename operations::storage_type storage_type; protected: - storage_type m_storage; + typename operations::aligned_storage_type m_storage; public: BOOST_DEFAULTED_FUNCTION(base_atomic(), {}) - BOOST_FORCEINLINE explicit base_atomic(value_type const& v) BOOST_NOEXCEPT : m_storage(atomics::detail::union_cast< storage_type >(v)) + BOOST_FORCEINLINE explicit base_atomic(value_type const& v) BOOST_NOEXCEPT : m_storage(atomics::detail::bitwise_cast< storage_type >(v)) { } @@ -433,7 +433,7 @@ public: BOOST_ASSERT(order != memory_order_acquire); BOOST_ASSERT(order != memory_order_acq_rel); - operations::store(m_storage, atomics::detail::union_cast< storage_type >(v), order); + operations::store(m_storage.value, atomics::detail::bitwise_cast< storage_type >(v), order); } BOOST_FORCEINLINE value_type load(memory_order order = memory_order_seq_cst) const volatile BOOST_NOEXCEPT @@ -441,22 +441,22 @@ public: BOOST_ASSERT(order != memory_order_release); BOOST_ASSERT(order != memory_order_acq_rel); - return atomics::detail::union_cast< value_type >(operations::load(m_storage, order)); + return atomics::detail::bitwise_cast< value_type >(operations::load(m_storage.value, order)); } BOOST_FORCEINLINE value_type fetch_add(difference_type v, memory_order order = memory_order_seq_cst) volatile BOOST_NOEXCEPT { - return atomics::detail::union_cast< value_type >(operations::fetch_add(m_storage, static_cast< storage_type >(v * sizeof(T)), order)); + return atomics::detail::bitwise_cast< value_type >(operations::fetch_add(m_storage.value, static_cast< storage_type >(v * sizeof(T)), order)); } BOOST_FORCEINLINE value_type fetch_sub(difference_type v, memory_order order = memory_order_seq_cst) volatile BOOST_NOEXCEPT { - return atomics::detail::union_cast< value_type >(operations::fetch_sub(m_storage, static_cast< storage_type >(v * sizeof(T)), order)); + return atomics::detail::bitwise_cast< value_type >(operations::fetch_sub(m_storage.value, static_cast< storage_type >(v * sizeof(T)), order)); } BOOST_FORCEINLINE value_type exchange(value_type v, memory_order order = memory_order_seq_cst) volatile BOOST_NOEXCEPT { - return atomics::detail::union_cast< value_type >(operations::exchange(m_storage, atomics::detail::union_cast< storage_type >(v), order)); + return atomics::detail::bitwise_cast< value_type >(operations::exchange(m_storage.value, atomics::detail::bitwise_cast< storage_type >(v), order)); } BOOST_FORCEINLINE bool compare_exchange_strong(value_type& expected, value_type desired, memory_order success_order, memory_order failure_order) volatile BOOST_NOEXCEPT @@ -465,9 +465,9 @@ public: BOOST_ASSERT(failure_order != memory_order_acq_rel); BOOST_ASSERT(cas_failure_order_must_not_be_stronger_than_success_order(success_order, failure_order)); - storage_type old_value = atomics::detail::union_cast< storage_type >(expected); - const bool res = operations::compare_exchange_strong(m_storage, old_value, atomics::detail::union_cast< storage_type >(desired), success_order, failure_order); - expected = atomics::detail::union_cast< value_type >(old_value); + storage_type old_value = atomics::detail::bitwise_cast< storage_type >(expected); + const bool res = operations::compare_exchange_strong(m_storage.value, old_value, atomics::detail::bitwise_cast< storage_type >(desired), success_order, failure_order); + expected = atomics::detail::bitwise_cast< value_type >(old_value); return res; } @@ -482,9 +482,9 @@ public: BOOST_ASSERT(failure_order != memory_order_acq_rel); BOOST_ASSERT(cas_failure_order_must_not_be_stronger_than_success_order(success_order, failure_order)); - storage_type old_value = atomics::detail::union_cast< storage_type >(expected); - const bool res = operations::compare_exchange_weak(m_storage, old_value, atomics::detail::union_cast< storage_type >(desired), success_order, failure_order); - expected = atomics::detail::union_cast< value_type >(old_value); + storage_type old_value = atomics::detail::bitwise_cast< storage_type >(expected); + const bool res = operations::compare_exchange_weak(m_storage.value, old_value, atomics::detail::bitwise_cast< storage_type >(desired), success_order, failure_order); + expected = atomics::detail::bitwise_cast< value_type >(old_value); return res; } @@ -495,7 +495,7 @@ public: BOOST_FORCEINLINE bool is_lock_free() const volatile BOOST_NOEXCEPT { - return operations::is_lock_free(m_storage); + return operations::is_lock_free(m_storage.value); } BOOST_FORCEINLINE value_type operator++(int) volatile BOOST_NOEXCEPT @@ -540,20 +540,20 @@ class base_atomic< void*, void* > private: typedef void* value_type; typedef std::ptrdiff_t difference_type; - typedef atomics::detail::operations< storage_size_of< value_type >::value, false > operations; protected: + typedef atomics::detail::operations< storage_size_of< value_type >::value, false > operations; typedef value_type value_arg_type; public: typedef operations::storage_type storage_type; protected: - storage_type m_storage; + operations::aligned_storage_type m_storage; public: BOOST_DEFAULTED_FUNCTION(base_atomic(), {}) - BOOST_FORCEINLINE explicit base_atomic(value_type const& v) BOOST_NOEXCEPT : m_storage(atomics::detail::union_cast< storage_type >(v)) + BOOST_FORCEINLINE explicit base_atomic(value_type const& v) BOOST_NOEXCEPT : m_storage(atomics::detail::bitwise_cast< storage_type >(v)) { } @@ -563,7 +563,7 @@ public: BOOST_ASSERT(order != memory_order_acquire); BOOST_ASSERT(order != memory_order_acq_rel); - operations::store(m_storage, atomics::detail::union_cast< storage_type >(v), order); + operations::store(m_storage.value, atomics::detail::bitwise_cast< storage_type >(v), order); } BOOST_FORCEINLINE value_type load(memory_order order = memory_order_seq_cst) const volatile BOOST_NOEXCEPT @@ -571,22 +571,22 @@ public: BOOST_ASSERT(order != memory_order_release); BOOST_ASSERT(order != memory_order_acq_rel); - return atomics::detail::union_cast< value_type >(operations::load(m_storage, order)); + return atomics::detail::bitwise_cast< value_type >(operations::load(m_storage.value, order)); } BOOST_FORCEINLINE value_type fetch_add(difference_type v, memory_order order = memory_order_seq_cst) volatile BOOST_NOEXCEPT { - return atomics::detail::union_cast< value_type >(operations::fetch_add(m_storage, static_cast< storage_type >(v), order)); + return atomics::detail::bitwise_cast< value_type >(operations::fetch_add(m_storage.value, static_cast< storage_type >(v), order)); } BOOST_FORCEINLINE value_type fetch_sub(difference_type v, memory_order order = memory_order_seq_cst) volatile BOOST_NOEXCEPT { - return atomics::detail::union_cast< value_type >(operations::fetch_sub(m_storage, static_cast< storage_type >(v), order)); + return atomics::detail::bitwise_cast< value_type >(operations::fetch_sub(m_storage.value, static_cast< storage_type >(v), order)); } BOOST_FORCEINLINE value_type exchange(value_type v, memory_order order = memory_order_seq_cst) volatile BOOST_NOEXCEPT { - return atomics::detail::union_cast< value_type >(operations::exchange(m_storage, atomics::detail::union_cast< storage_type >(v), order)); + return atomics::detail::bitwise_cast< value_type >(operations::exchange(m_storage.value, atomics::detail::bitwise_cast< storage_type >(v), order)); } BOOST_FORCEINLINE bool compare_exchange_strong(value_type& expected, value_type desired, memory_order success_order, memory_order failure_order) volatile BOOST_NOEXCEPT @@ -595,9 +595,9 @@ public: BOOST_ASSERT(failure_order != memory_order_acq_rel); BOOST_ASSERT(cas_failure_order_must_not_be_stronger_than_success_order(success_order, failure_order)); - storage_type old_value = atomics::detail::union_cast< storage_type >(expected); - const bool res = operations::compare_exchange_strong(m_storage, old_value, atomics::detail::union_cast< storage_type >(desired), success_order, failure_order); - expected = atomics::detail::union_cast< value_type >(old_value); + storage_type old_value = atomics::detail::bitwise_cast< storage_type >(expected); + const bool res = operations::compare_exchange_strong(m_storage.value, old_value, atomics::detail::bitwise_cast< storage_type >(desired), success_order, failure_order); + expected = atomics::detail::bitwise_cast< value_type >(old_value); return res; } @@ -612,9 +612,9 @@ public: BOOST_ASSERT(failure_order != memory_order_acq_rel); BOOST_ASSERT(cas_failure_order_must_not_be_stronger_than_success_order(success_order, failure_order)); - storage_type old_value = atomics::detail::union_cast< storage_type >(expected); - const bool res = operations::compare_exchange_weak(m_storage, old_value, atomics::detail::union_cast< storage_type >(desired), success_order, failure_order); - expected = atomics::detail::union_cast< value_type >(old_value); + storage_type old_value = atomics::detail::bitwise_cast< storage_type >(expected); + const bool res = operations::compare_exchange_weak(m_storage.value, old_value, atomics::detail::bitwise_cast< storage_type >(desired), success_order, failure_order); + expected = atomics::detail::bitwise_cast< value_type >(old_value); return res; } @@ -625,7 +625,7 @@ public: BOOST_FORCEINLINE bool is_lock_free() const volatile BOOST_NOEXCEPT { - return operations::is_lock_free(m_storage); + return operations::is_lock_free(m_storage.value); } BOOST_FORCEINLINE value_type operator++(int) volatile BOOST_NOEXCEPT @@ -676,6 +676,9 @@ private: public: typedef typename base_type::storage_type storage_type; +public: + static BOOST_CONSTEXPR_OR_CONST bool is_always_lock_free = base_type::operations::is_always_lock_free; + public: BOOST_DEFAULTED_FUNCTION(atomic(), BOOST_NOEXCEPT {}) @@ -696,16 +699,19 @@ public: return this->load(); } - BOOST_FORCEINLINE storage_type& storage() BOOST_NOEXCEPT { return this->m_storage; } - BOOST_FORCEINLINE storage_type volatile& storage() volatile BOOST_NOEXCEPT { return this->m_storage; } - BOOST_FORCEINLINE storage_type const& storage() const BOOST_NOEXCEPT { return this->m_storage; } - BOOST_FORCEINLINE storage_type const volatile& storage() const volatile BOOST_NOEXCEPT { return this->m_storage; } + BOOST_FORCEINLINE storage_type& storage() BOOST_NOEXCEPT { return this->m_storage.value; } + BOOST_FORCEINLINE storage_type volatile& storage() volatile BOOST_NOEXCEPT { return this->m_storage.value; } + BOOST_FORCEINLINE storage_type const& storage() const BOOST_NOEXCEPT { return this->m_storage.value; } + BOOST_FORCEINLINE storage_type const volatile& storage() const volatile BOOST_NOEXCEPT { return this->m_storage.value; } BOOST_DELETED_FUNCTION(atomic(atomic const&)) BOOST_DELETED_FUNCTION(atomic& operator= (atomic const&)) BOOST_DELETED_FUNCTION(atomic& operator= (atomic const&) volatile) }; +template< typename T > +BOOST_CONSTEXPR_OR_CONST bool atomic< T >::is_always_lock_free; + typedef atomic< char > atomic_char; typedef atomic< unsigned char > atomic_uchar; typedef atomic< signed char > atomic_schar; diff --git a/3party/boost/boost/atomic/detail/bitwise_cast.hpp b/3party/boost/boost/atomic/detail/bitwise_cast.hpp new file mode 100644 index 0000000000..1405a25d6a --- /dev/null +++ b/3party/boost/boost/atomic/detail/bitwise_cast.hpp @@ -0,0 +1,64 @@ +/* + * 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) + * + * Copyright (c) 2009 Helge Bahmann + * Copyright (c) 2012 Tim Blechmann + * Copyright (c) 2013 - 2014 Andrey Semashev + */ +/*! + * \file atomic/detail/bitwise_cast.hpp + * + * This header defines \c bitwise_cast used to convert between storage and value types + */ + +#ifndef BOOST_ATOMIC_DETAIL_BITWISE_CAST_HPP_INCLUDED_ +#define BOOST_ATOMIC_DETAIL_BITWISE_CAST_HPP_INCLUDED_ + +#include +#if !defined(BOOST_ATOMIC_DETAIL_HAS_BUILTIN_MEMCPY) +#include +#endif + +#ifdef BOOST_HAS_PRAGMA_ONCE +#pragma once +#endif + +namespace boost { +namespace atomics { +namespace detail { + +template< typename T > +BOOST_FORCEINLINE T* addressof(T& value) BOOST_NOEXCEPT +{ + // Note: The point of using a local struct as the intermediate type instead of char is to avoid gcc warnings + // if T is a const volatile char*: + // warning: casting ‘const volatile char* const’ to ‘const volatile char&’ does not dereference pointer + // The local struct makes sure T is not related to the cast target type. + struct opaque_type; + return reinterpret_cast< T* >(&const_cast< opaque_type& >(reinterpret_cast< const volatile opaque_type& >(value))); +} + +template< typename To, typename From > +BOOST_FORCEINLINE To bitwise_cast(From const& from) BOOST_NOEXCEPT +{ + struct + { + To to; + } + value = {}; + BOOST_ATOMIC_DETAIL_MEMCPY + ( + atomics::detail::addressof(value.to), + atomics::detail::addressof(from), + (sizeof(From) < sizeof(To) ? sizeof(From) : sizeof(To)) + ); + return value.to; +} + +} // namespace detail +} // namespace atomics +} // namespace boost + +#endif // BOOST_ATOMIC_DETAIL_BITWISE_CAST_HPP_INCLUDED_ diff --git a/3party/boost/boost/atomic/detail/caps_gcc_ppc.hpp b/3party/boost/boost/atomic/detail/caps_gcc_ppc.hpp index 6dbdde826d..ee2346081b 100644 --- a/3party/boost/boost/atomic/detail/caps_gcc_ppc.hpp +++ b/3party/boost/boost/atomic/detail/caps_gcc_ppc.hpp @@ -25,7 +25,7 @@ #define BOOST_ATOMIC_INT8_LOCK_FREE 2 #define BOOST_ATOMIC_INT16_LOCK_FREE 2 #define BOOST_ATOMIC_INT32_LOCK_FREE 2 -#if defined(__powerpc64__) +#if defined(__powerpc64__) || defined(__PPC64__) #define BOOST_ATOMIC_INT64_LOCK_FREE 2 #endif #define BOOST_ATOMIC_POINTER_LOCK_FREE 2 diff --git a/3party/boost/boost/atomic/detail/caps_gcc_x86.hpp b/3party/boost/boost/atomic/detail/caps_gcc_x86.hpp index 0696bf1d2f..7485b010c7 100644 --- a/3party/boost/boost/atomic/detail/caps_gcc_x86.hpp +++ b/3party/boost/boost/atomic/detail/caps_gcc_x86.hpp @@ -22,6 +22,8 @@ #pragma once #endif +#if defined(__GNUC__) + #if defined(__i386__) &&\ (\ defined(__GCC_HAVE_SYNC_COMPARE_AND_SWAP_8) ||\ @@ -35,6 +37,27 @@ #define BOOST_ATOMIC_DETAIL_X86_HAS_CMPXCHG16B 1 #endif +#if defined(__x86_64__) || defined(__SSE2__) +// Use mfence only if SSE2 is available +#define BOOST_ATOMIC_DETAIL_X86_HAS_MFENCE 1 +#endif + +#else // defined(__GNUC__) + +#if defined(__i386__) && !defined(BOOST_ATOMIC_NO_CMPXCHG8B) +#define BOOST_ATOMIC_DETAIL_X86_HAS_CMPXCHG8B 1 +#endif + +#if defined(__x86_64__) && !defined(BOOST_ATOMIC_NO_CMPXCHG16B) +#define BOOST_ATOMIC_DETAIL_X86_HAS_CMPXCHG16B 1 +#endif + +#if !defined(BOOST_ATOMIC_NO_MFENCE) +#define BOOST_ATOMIC_DETAIL_X86_HAS_MFENCE 1 +#endif + +#endif // defined(__GNUC__) + #define BOOST_ATOMIC_INT8_LOCK_FREE 2 #define BOOST_ATOMIC_INT16_LOCK_FREE 2 #define BOOST_ATOMIC_INT32_LOCK_FREE 2 diff --git a/3party/boost/boost/atomic/detail/caps_msvc_x86.hpp b/3party/boost/boost/atomic/detail/caps_msvc_x86.hpp index 5661a5b7ab..2ee4c92111 100644 --- a/3party/boost/boost/atomic/detail/caps_msvc_x86.hpp +++ b/3party/boost/boost/atomic/detail/caps_msvc_x86.hpp @@ -30,6 +30,11 @@ #define BOOST_ATOMIC_DETAIL_X86_HAS_CMPXCHG16B 1 #endif +#if defined(_MSC_VER) && (defined(_M_AMD64) || (defined(_M_IX86) && defined(_M_IX86_FP) && _M_IX86_FP >= 2)) +// Use mfence only if SSE2 is available +#define BOOST_ATOMIC_DETAIL_X86_HAS_MFENCE 1 +#endif + #define BOOST_ATOMIC_INT8_LOCK_FREE 2 #define BOOST_ATOMIC_INT16_LOCK_FREE 2 #define BOOST_ATOMIC_INT32_LOCK_FREE 2 diff --git a/3party/boost/boost/atomic/detail/casts.hpp b/3party/boost/boost/atomic/detail/casts.hpp deleted file mode 100644 index db28bc25ff..0000000000 --- a/3party/boost/boost/atomic/detail/casts.hpp +++ /dev/null @@ -1,64 +0,0 @@ -/* - * 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) - * - * Copyright (c) 2009 Helge Bahmann - * Copyright (c) 2012 Tim Blechmann - * Copyright (c) 2013 - 2014 Andrey Semashev - */ -/*! - * \file atomic/detail/casts.hpp - * - * This header defines \c union_cast and \c memcpy_cast used to convert between storage and value types - */ - -#ifndef BOOST_ATOMIC_DETAIL_CASTS_HPP_INCLUDED_ -#define BOOST_ATOMIC_DETAIL_CASTS_HPP_INCLUDED_ - -#include -#include - -#ifdef BOOST_HAS_PRAGMA_ONCE -#pragma once -#endif - -namespace boost { -namespace atomics { -namespace detail { - -template< typename To, typename From > -BOOST_FORCEINLINE To union_cast(From const& from) BOOST_NOEXCEPT -{ - union - { - To as_to; - From as_from; - } - caster = {}; - caster.as_from = from; - return caster.as_to; -} - -template< typename To, typename From > -BOOST_FORCEINLINE To memcpy_cast(From const& from) BOOST_NOEXCEPT -{ - struct - { - To to; - } - value = {}; - std::memcpy - ( - &reinterpret_cast< char& >(value.to), - &reinterpret_cast< const char& >(from), - (sizeof(From) < sizeof(To) ? sizeof(From) : sizeof(To)) - ); - return value.to; -} - -} // namespace detail -} // namespace atomics -} // namespace boost - -#endif // BOOST_ATOMIC_DETAIL_CASTS_HPP_INCLUDED_ diff --git a/3party/boost/boost/atomic/detail/config.hpp b/3party/boost/boost/atomic/detail/config.hpp index 6b0e418693..00f7bff696 100644 --- a/3party/boost/boost/atomic/detail/config.hpp +++ b/3party/boost/boost/atomic/detail/config.hpp @@ -21,6 +21,30 @@ #pragma once #endif +#if defined(__has_builtin) +#if __has_builtin(__builtin_memcpy) +#define BOOST_ATOMIC_DETAIL_HAS_BUILTIN_MEMCPY +#endif +#if __has_builtin(__builtin_memcmp) +#define BOOST_ATOMIC_DETAIL_HAS_BUILTIN_MEMCMP +#endif +#elif defined(BOOST_GCC) +#define BOOST_ATOMIC_DETAIL_HAS_BUILTIN_MEMCPY +#define BOOST_ATOMIC_DETAIL_HAS_BUILTIN_MEMCMP +#endif + +#if defined(BOOST_ATOMIC_DETAIL_HAS_BUILTIN_MEMCPY) +#define BOOST_ATOMIC_DETAIL_MEMCPY __builtin_memcpy +#else +#define BOOST_ATOMIC_DETAIL_MEMCPY std::memcpy +#endif + +#if defined(BOOST_ATOMIC_DETAIL_HAS_BUILTIN_MEMCMP) +#define BOOST_ATOMIC_DETAIL_MEMCMP __builtin_memcmp +#else +#define BOOST_ATOMIC_DETAIL_MEMCMP std::memcmp +#endif + #if defined(__CUDACC__) // nvcc does not support alternatives in asm statement constraints #define BOOST_ATOMIC_DETAIL_NO_ASM_CONSTRAINT_ALTERNATIVES @@ -36,4 +60,17 @@ #define BOOST_ATOMIC_DETAIL_ASM_CLOBBER_CC_COMMA #endif +#if ((defined(macintosh) || defined(__APPLE__) || defined(__APPLE_CC__)) && (defined(__GNUC__) && (__GNUC__ * 100 + __GNUC_MINOR__) < 403)) ||\ + defined(__SUNPRO_CC) +// This macro indicates we're using older binutils that don't support implied zero displacements for memory opereands, +// making code like this invalid: +// movl 4+(%%edx), %%eax +#define BOOST_ATOMIC_DETAIL_NO_ASM_IMPLIED_ZERO_DISPLACEMENTS +#endif + +#if defined(__clang__) || (defined(BOOST_GCC) && (BOOST_GCC+0) < 40500) || defined(__SUNPRO_CC) +// This macro indicates that the compiler does not support allocating rax:rdx register pairs ("A") in asm blocks +#define BOOST_ATOMIC_DETAIL_NO_ASM_RAX_RDX_PAIRS +#endif + #endif // BOOST_ATOMIC_DETAIL_CONFIG_HPP_INCLUDED_ diff --git a/3party/boost/boost/atomic/detail/int_sizes.hpp b/3party/boost/boost/atomic/detail/int_sizes.hpp index d06ed42a11..eada4fff07 100644 --- a/3party/boost/boost/atomic/detail/int_sizes.hpp +++ b/3party/boost/boost/atomic/detail/int_sizes.hpp @@ -117,8 +117,8 @@ #include #include -#if defined(_MSC_VER) && _MSC_VER <= 1310 -// MSVC 7.1 defines WCHAR_MAX to a value not suitable for constant expressions + #if defined(_MSC_VER) && ( _MSC_VER <= 1310 || defined(UNDER_CE) && _MSC_VER <= 1500 ) +// MSVC 7.1 and MSVC 8 (arm) define WCHAR_MAX to a value not suitable for constant expressions #define BOOST_ATOMIC_DETAIL_SIZEOF_WCHAR_T 2 #elif (WCHAR_MAX + 0) == 0xff || (WCHAR_MAX + 0) == 0x7f #define BOOST_ATOMIC_DETAIL_SIZEOF_WCHAR_T 1 diff --git a/3party/boost/boost/atomic/detail/interlocked.hpp b/3party/boost/boost/atomic/detail/interlocked.hpp index 1c62396bf5..82b6d3a0dc 100644 --- a/3party/boost/boost/atomic/detail/interlocked.hpp +++ b/3party/boost/boost/atomic/detail/interlocked.hpp @@ -169,7 +169,7 @@ extern "C" long __cdecl _InterlockedExchange( long volatile *, long ); #endif -#if _MSC_VER >= 1700 && defined(_M_ARM) +#if _MSC_VER >= 1700 && (defined(_M_ARM) || defined(_M_ARM64)) #if defined(BOOST_MSVC) #pragma intrinsic(_InterlockedExchangeAdd64) @@ -251,10 +251,17 @@ extern "C" long __cdecl _InterlockedExchange( long volatile *, long ); #define BOOST_ATOMIC_INTERLOCKED_EXCHANGE_ADD64_ACQUIRE(dest, addend) _InterlockedExchangeAdd64_acq((__int64*)(dest), (__int64)(addend)) #define BOOST_ATOMIC_INTERLOCKED_EXCHANGE_ADD64_RELEASE(dest, addend) _InterlockedExchangeAdd64_rel((__int64*)(dest), (__int64)(addend)) +#if defined(_M_ARM64) +#define BOOST_ATOMIC_INTERLOCKED_EXCHANGE_ADD_POINTER(dest, byte_offset) ((void*)BOOST_ATOMIC_INTERLOCKED_EXCHANGE_ADD64((__int64*)(dest), byte_offset)) +#define BOOST_ATOMIC_INTERLOCKED_EXCHANGE_ADD_POINTER_RELAXED(dest, byte_offset) ((void*)BOOST_ATOMIC_INTERLOCKED_EXCHANGE_ADD64_RELAXED((__int64*)(dest), byte_offset)) +#define BOOST_ATOMIC_INTERLOCKED_EXCHANGE_ADD_POINTER_ACQUIRE(dest, byte_offset) ((void*)BOOST_ATOMIC_INTERLOCKED_EXCHANGE_ADD64_ACQUIRE((__int64*)(dest), byte_offset)) +#define BOOST_ATOMIC_INTERLOCKED_EXCHANGE_ADD_POINTER_RELEASE(dest, byte_offset) ((void*)BOOST_ATOMIC_INTERLOCKED_EXCHANGE_ADD64_RELEASE((__int64*)(dest), byte_offset)) +#else #define BOOST_ATOMIC_INTERLOCKED_EXCHANGE_ADD_POINTER(dest, byte_offset) ((void*)BOOST_ATOMIC_INTERLOCKED_EXCHANGE_ADD((long*)(dest), byte_offset)) #define BOOST_ATOMIC_INTERLOCKED_EXCHANGE_ADD_POINTER_RELAXED(dest, byte_offset) ((void*)BOOST_ATOMIC_INTERLOCKED_EXCHANGE_ADD_RELAXED((long*)(dest), byte_offset)) #define BOOST_ATOMIC_INTERLOCKED_EXCHANGE_ADD_POINTER_ACQUIRE(dest, byte_offset) ((void*)BOOST_ATOMIC_INTERLOCKED_EXCHANGE_ADD_ACQUIRE((long*)(dest), byte_offset)) #define BOOST_ATOMIC_INTERLOCKED_EXCHANGE_ADD_POINTER_RELEASE(dest, byte_offset) ((void*)BOOST_ATOMIC_INTERLOCKED_EXCHANGE_ADD_RELEASE((long*)(dest), byte_offset)) +#endif #if defined(BOOST_MSVC) #pragma intrinsic(_InterlockedExchange8_nf) diff --git a/3party/boost/boost/atomic/detail/operations_fwd.hpp b/3party/boost/boost/atomic/detail/operations_fwd.hpp index 69049e4630..efd4970747 100644 --- a/3party/boost/boost/atomic/detail/operations_fwd.hpp +++ b/3party/boost/boost/atomic/detail/operations_fwd.hpp @@ -14,6 +14,7 @@ #ifndef BOOST_ATOMIC_DETAIL_OPERATIONS_FWD_HPP_INCLUDED_ #define BOOST_ATOMIC_DETAIL_OPERATIONS_FWD_HPP_INCLUDED_ +#include #include #ifdef BOOST_HAS_PRAGMA_ONCE @@ -24,7 +25,7 @@ namespace boost { namespace atomics { namespace detail { -template< unsigned int Size, bool Signed > +template< std::size_t Size, bool Signed > struct operations; } // namespace detail diff --git a/3party/boost/boost/atomic/detail/ops_cas_based.hpp b/3party/boost/boost/atomic/detail/ops_cas_based.hpp index 7f8d288f7f..504cedb70f 100644 --- a/3party/boost/boost/atomic/detail/ops_cas_based.hpp +++ b/3party/boost/boost/atomic/detail/ops_cas_based.hpp @@ -16,6 +16,7 @@ #include #include +#include #ifdef BOOST_HAS_PRAGMA_ONCE #pragma once @@ -25,6 +26,21 @@ namespace boost { namespace atomics { namespace detail { +template< typename Base > +struct cas_based_exchange : + public Base +{ + typedef typename Base::storage_type storage_type; + + static BOOST_FORCEINLINE storage_type exchange(storage_type volatile& storage, storage_type v, memory_order order) BOOST_NOEXCEPT + { + storage_type old_val; + atomics::detail::non_atomic_load(storage, old_val); + while (!Base::compare_exchange_weak(storage, old_val, v, order, memory_order_relaxed)) {} + return old_val; + } +}; + template< typename Base > struct cas_based_operations : public Base @@ -33,49 +49,47 @@ struct cas_based_operations : static BOOST_FORCEINLINE storage_type fetch_add(storage_type volatile& storage, storage_type v, memory_order order) BOOST_NOEXCEPT { - storage_type old_val = Base::load(storage, memory_order_relaxed); + storage_type old_val; + atomics::detail::non_atomic_load(storage, old_val); while (!Base::compare_exchange_weak(storage, old_val, old_val + v, order, memory_order_relaxed)) {} return old_val; } static BOOST_FORCEINLINE storage_type fetch_sub(storage_type volatile& storage, storage_type v, memory_order order) BOOST_NOEXCEPT { - storage_type old_val = Base::load(storage, memory_order_relaxed); + storage_type old_val; + atomics::detail::non_atomic_load(storage, old_val); while (!Base::compare_exchange_weak(storage, old_val, old_val - v, order, memory_order_relaxed)) {} return old_val; } - static BOOST_FORCEINLINE storage_type exchange(storage_type volatile& storage, storage_type v, memory_order order) BOOST_NOEXCEPT - { - storage_type old_val = Base::load(storage, memory_order_relaxed); - while (!Base::compare_exchange_weak(storage, old_val, v, order, memory_order_relaxed)) {} - return old_val; - } - static BOOST_FORCEINLINE storage_type fetch_and(storage_type volatile& storage, storage_type v, memory_order order) BOOST_NOEXCEPT { - storage_type old_val = Base::load(storage, memory_order_relaxed); + storage_type old_val; + atomics::detail::non_atomic_load(storage, old_val); while (!Base::compare_exchange_weak(storage, old_val, old_val & v, order, memory_order_relaxed)) {} return old_val; } static BOOST_FORCEINLINE storage_type fetch_or(storage_type volatile& storage, storage_type v, memory_order order) BOOST_NOEXCEPT { - storage_type old_val = Base::load(storage, memory_order_relaxed); + storage_type old_val; + atomics::detail::non_atomic_load(storage, old_val); while (!Base::compare_exchange_weak(storage, old_val, old_val | v, order, memory_order_relaxed)) {} return old_val; } static BOOST_FORCEINLINE storage_type fetch_xor(storage_type volatile& storage, storage_type v, memory_order order) BOOST_NOEXCEPT { - storage_type old_val = Base::load(storage, memory_order_relaxed); + storage_type old_val; + atomics::detail::non_atomic_load(storage, old_val); while (!Base::compare_exchange_weak(storage, old_val, old_val ^ v, order, memory_order_relaxed)) {} return old_val; } static BOOST_FORCEINLINE bool test_and_set(storage_type volatile& storage, memory_order order) BOOST_NOEXCEPT { - return !!exchange(storage, (storage_type)1, order); + return !!Base::exchange(storage, (storage_type)1, order); } static BOOST_FORCEINLINE void clear(storage_type volatile& storage, memory_order order) BOOST_NOEXCEPT diff --git a/3party/boost/boost/atomic/detail/ops_emulated.hpp b/3party/boost/boost/atomic/detail/ops_emulated.hpp index 597490f2d7..a21128ec69 100644 --- a/3party/boost/boost/atomic/detail/ops_emulated.hpp +++ b/3party/boost/boost/atomic/detail/ops_emulated.hpp @@ -14,6 +14,7 @@ #ifndef BOOST_ATOMIC_DETAIL_OPS_EMULATED_HPP_INCLUDED_ #define BOOST_ATOMIC_DETAIL_OPS_EMULATED_HPP_INCLUDED_ +#include #include #include #include @@ -34,6 +35,8 @@ struct emulated_operations { typedef T storage_type; + static BOOST_CONSTEXPR_OR_CONST bool is_always_lock_free = false; + static BOOST_FORCEINLINE void store(storage_type volatile& storage, storage_type v, memory_order) BOOST_NOEXCEPT { lockpool::scoped_lock lock(&storage); @@ -88,9 +91,19 @@ struct emulated_operations } static BOOST_FORCEINLINE bool compare_exchange_weak( - storage_type volatile& storage, storage_type& expected, storage_type desired, memory_order success_order, memory_order failure_order) BOOST_NOEXCEPT + storage_type volatile& storage, storage_type& expected, storage_type desired, memory_order, memory_order) BOOST_NOEXCEPT { - return compare_exchange_strong(storage, expected, desired, success_order, failure_order); + // Note: This function is the exact copy of compare_exchange_strong. The reason we're not just forwarding the call + // is that MSVC-12 ICEs in this case. + storage_type& s = const_cast< storage_type& >(storage); + lockpool::scoped_lock lock(&storage); + storage_type old_val = s; + const bool res = old_val == expected; + if (res) + s = desired; + expected = old_val; + + return res; } static BOOST_FORCEINLINE storage_type fetch_and(storage_type volatile& storage, storage_type v, memory_order) BOOST_NOEXCEPT @@ -136,10 +149,11 @@ struct emulated_operations } }; -template< unsigned int Size, bool Signed > +template< std::size_t Size, bool Signed > struct operations : public emulated_operations< typename make_storage_type< Size, Signed >::type > { + typedef typename make_storage_type< Size, Signed >::aligned aligned_storage_type; }; } // namespace detail diff --git a/3party/boost/boost/atomic/detail/ops_extending_cas_based.hpp b/3party/boost/boost/atomic/detail/ops_extending_cas_based.hpp index d7f3c5f5de..3f21031f12 100644 --- a/3party/boost/boost/atomic/detail/ops_extending_cas_based.hpp +++ b/3party/boost/boost/atomic/detail/ops_extending_cas_based.hpp @@ -14,6 +14,7 @@ #ifndef BOOST_ATOMIC_DETAIL_OPS_EXTENDING_CAS_BASED_HPP_INCLUDED_ #define BOOST_ATOMIC_DETAIL_OPS_EXTENDING_CAS_BASED_HPP_INCLUDED_ +#include #include #include #include @@ -26,7 +27,7 @@ namespace boost { namespace atomics { namespace detail { -template< typename Base, unsigned int Size, bool Signed > +template< typename Base, std::size_t Size, bool Signed > struct extending_cas_based_operations : public Base { @@ -35,7 +36,8 @@ struct extending_cas_based_operations : static BOOST_FORCEINLINE storage_type fetch_add(storage_type volatile& storage, storage_type v, memory_order order) BOOST_NOEXCEPT { - storage_type old_val = Base::load(storage, memory_order_relaxed); + storage_type old_val; + atomics::detail::non_atomic_load(storage, old_val); emulated_storage_type new_val; do { @@ -47,7 +49,8 @@ struct extending_cas_based_operations : static BOOST_FORCEINLINE storage_type fetch_sub(storage_type volatile& storage, storage_type v, memory_order order) BOOST_NOEXCEPT { - storage_type old_val = Base::load(storage, memory_order_relaxed); + storage_type old_val; + atomics::detail::non_atomic_load(storage, old_val); emulated_storage_type new_val; do { diff --git a/3party/boost/boost/atomic/detail/ops_gcc_alpha.hpp b/3party/boost/boost/atomic/detail/ops_gcc_alpha.hpp index 6978c7f1c4..15118f58a2 100644 --- a/3party/boost/boost/atomic/detail/ops_gcc_alpha.hpp +++ b/3party/boost/boost/atomic/detail/ops_gcc_alpha.hpp @@ -63,6 +63,8 @@ namespace detail { struct gcc_alpha_operations_base { + static BOOST_CONSTEXPR_OR_CONST bool is_always_lock_free = true; + static BOOST_FORCEINLINE void fence_before(memory_order order) BOOST_NOEXCEPT { if ((order & memory_order_release) != 0) @@ -88,6 +90,7 @@ struct operations< 4u, Signed > : public gcc_alpha_operations_base { typedef typename make_storage_type< 4u, Signed >::type storage_type; + typedef typename make_storage_type< 4u, Signed >::aligned aligned_storage_type; static BOOST_FORCEINLINE void store(storage_type volatile& storage, storage_type v, memory_order order) BOOST_NOEXCEPT { @@ -599,6 +602,7 @@ struct operations< 8u, Signed > : public gcc_alpha_operations_base { typedef typename make_storage_type< 8u, Signed >::type storage_type; + typedef typename make_storage_type< 8u, Signed >::aligned aligned_storage_type; static BOOST_FORCEINLINE void store(storage_type volatile& storage, storage_type v, memory_order order) BOOST_NOEXCEPT { diff --git a/3party/boost/boost/atomic/detail/ops_gcc_arm.hpp b/3party/boost/boost/atomic/detail/ops_gcc_arm.hpp index a28da6919d..e181b16853 100644 --- a/3party/boost/boost/atomic/detail/ops_gcc_arm.hpp +++ b/3party/boost/boost/atomic/detail/ops_gcc_arm.hpp @@ -100,6 +100,8 @@ namespace detail { struct gcc_arm_operations_base { + static BOOST_CONSTEXPR_OR_CONST bool is_always_lock_free = true; + static BOOST_FORCEINLINE void fence_before(memory_order order) BOOST_NOEXCEPT { if ((order & memory_order_release) != 0) @@ -156,6 +158,7 @@ struct operations< 4u, Signed > : public gcc_arm_operations_base { typedef typename make_storage_type< 4u, Signed >::type storage_type; + typedef typename make_storage_type< 4u, Signed >::aligned aligned_storage_type; static BOOST_FORCEINLINE void store(storage_type volatile& storage, storage_type v, memory_order order) BOOST_NOEXCEPT { @@ -677,6 +680,7 @@ struct operations< 8u, Signed > : public gcc_arm_operations_base { typedef typename make_storage_type< 8u, Signed >::type storage_type; + typedef typename make_storage_type< 8u, Signed >::aligned aligned_storage_type; static BOOST_FORCEINLINE void store(storage_type volatile& storage, storage_type v, memory_order order) BOOST_NOEXCEPT { diff --git a/3party/boost/boost/atomic/detail/ops_gcc_atomic.hpp b/3party/boost/boost/atomic/detail/ops_gcc_atomic.hpp index 2e4c37bec7..0a34c01f16 100644 --- a/3party/boost/boost/atomic/detail/ops_gcc_atomic.hpp +++ b/3party/boost/boost/atomic/detail/ops_gcc_atomic.hpp @@ -85,6 +85,11 @@ struct gcc_atomic_operations { typedef T storage_type; + // Note: In the current implementation, gcc_atomic_operations are used onlu when the particularly sized __atomic + // intrinsics are always lock-free (i.e. the corresponding LOCK_FREE macro is 2). Therefore it is safe to + // always set is_always_lock_free to true here. + static BOOST_CONSTEXPR_OR_CONST bool is_always_lock_free = true; + static BOOST_FORCEINLINE void store(storage_type volatile& storage, storage_type v, memory_order order) BOOST_NOEXCEPT { __atomic_store_n(&storage, v, atomics::detail::convert_memory_order_to_gcc(order)); @@ -180,6 +185,7 @@ template< bool Signed > struct operations< 16u, Signed > : public gcc_atomic_operations< typename make_storage_type< 16u, Signed >::type > { + typedef typename make_storage_type< 16u, Signed >::aligned aligned_storage_type; }; #endif @@ -208,6 +214,7 @@ template< bool Signed > struct operations< 8u, Signed > : public extending_cas_based_operations< gcc_atomic_operations< typename make_storage_type< 16u, Signed >::type >, 8u, Signed > { + typedef typename make_storage_type< 16u, Signed >::aligned aligned_storage_type; }; #else @@ -216,6 +223,7 @@ template< bool Signed > struct operations< 8u, Signed > : public gcc_atomic_operations< typename make_storage_type< 8u, Signed >::type > { + typedef typename make_storage_type< 8u, Signed >::aligned aligned_storage_type; }; #endif @@ -236,6 +244,7 @@ template< bool Signed > struct operations< 4u, Signed > : public extending_cas_based_operations< gcc_atomic_operations< typename make_storage_type< 8u, Signed >::type >, 4u, Signed > { + typedef typename make_storage_type< 8u, Signed >::aligned aligned_storage_type; }; #else // !defined(BOOST_ATOMIC_DETAIL_INT64_EXTENDED) @@ -244,6 +253,7 @@ template< bool Signed > struct operations< 4u, Signed > : public extending_cas_based_operations< gcc_atomic_operations< typename make_storage_type< 16u, Signed >::type >, 4u, Signed > { + typedef typename make_storage_type< 16u, Signed >::aligned aligned_storage_type; }; #endif // !defined(BOOST_ATOMIC_DETAIL_INT64_EXTENDED) @@ -254,6 +264,7 @@ template< bool Signed > struct operations< 4u, Signed > : public gcc_atomic_operations< typename make_storage_type< 4u, Signed >::type > { + typedef typename make_storage_type< 4u, Signed >::aligned aligned_storage_type; }; #endif @@ -274,6 +285,7 @@ template< bool Signed > struct operations< 2u, Signed > : public extending_cas_based_operations< gcc_atomic_operations< typename make_storage_type< 4u, Signed >::type >, 2u, Signed > { + typedef typename make_storage_type< 4u, Signed >::aligned aligned_storage_type; }; #elif !defined(BOOST_ATOMIC_DETAIL_INT64_EXTENDED) @@ -282,6 +294,7 @@ template< bool Signed > struct operations< 2u, Signed > : public extending_cas_based_operations< gcc_atomic_operations< typename make_storage_type< 8u, Signed >::type >, 2u, Signed > { + typedef typename make_storage_type< 8u, Signed >::aligned aligned_storage_type; }; #else @@ -290,6 +303,7 @@ template< bool Signed > struct operations< 2u, Signed > : public extending_cas_based_operations< gcc_atomic_operations< typename make_storage_type< 16u, Signed >::type >, 2u, Signed > { + typedef typename make_storage_type< 16u, Signed >::aligned aligned_storage_type; }; #endif @@ -300,6 +314,7 @@ template< bool Signed > struct operations< 2u, Signed > : public gcc_atomic_operations< typename make_storage_type< 2u, Signed >::type > { + typedef typename make_storage_type< 2u, Signed >::aligned aligned_storage_type; }; #endif @@ -320,6 +335,7 @@ template< bool Signed > struct operations< 1u, Signed > : public extending_cas_based_operations< gcc_atomic_operations< typename make_storage_type< 2u, Signed >::type >, 1u, Signed > { + typedef typename make_storage_type< 2u, Signed >::aligned aligned_storage_type; }; #elif !defined(BOOST_ATOMIC_DETAIL_INT32_EXTENDED) @@ -328,6 +344,7 @@ template< bool Signed > struct operations< 1u, Signed > : public extending_cas_based_operations< gcc_atomic_operations< typename make_storage_type< 4u, Signed >::type >, 1u, Signed > { + typedef typename make_storage_type< 4u, Signed >::aligned aligned_storage_type; }; #elif !defined(BOOST_ATOMIC_DETAIL_INT64_EXTENDED) @@ -336,6 +353,7 @@ template< bool Signed > struct operations< 1u, Signed > : public extending_cas_based_operations< gcc_atomic_operations< typename make_storage_type< 8u, Signed >::type >, 1u, Signed > { + typedef typename make_storage_type< 8u, Signed >::aligned aligned_storage_type; }; #else @@ -344,6 +362,7 @@ template< bool Signed > struct operations< 1u, Signed > : public extending_cas_based_operations< gcc_atomic_operations< typename make_storage_type< 16u, Signed >::type >, 1u, Signed > { + typedef typename make_storage_type< 16u, Signed >::aligned aligned_storage_type; }; #endif @@ -354,6 +373,7 @@ template< bool Signed > struct operations< 1u, Signed > : public gcc_atomic_operations< typename make_storage_type< 1u, Signed >::type > { + typedef typename make_storage_type< 1u, Signed >::aligned aligned_storage_type; }; #endif diff --git a/3party/boost/boost/atomic/detail/ops_gcc_ppc.hpp b/3party/boost/boost/atomic/detail/ops_gcc_ppc.hpp index 8698ee8d76..4183bc0485 100644 --- a/3party/boost/boost/atomic/detail/ops_gcc_ppc.hpp +++ b/3party/boost/boost/atomic/detail/ops_gcc_ppc.hpp @@ -30,6 +30,9 @@ namespace boost { namespace atomics { namespace detail { +// The implementation below uses information from this document: +// http://www.rdrop.com/users/paulmck/scalability/paper/N2745r.2010.02.19a.html + /* Refer to: Motorola: "Programming Environments Manual for 32-Bit Implementations of the PowerPC Architecture", Appendix E: @@ -82,9 +85,11 @@ namespace detail { struct gcc_ppc_operations_base { + static BOOST_CONSTEXPR_OR_CONST bool is_always_lock_free = true; + static BOOST_FORCEINLINE void fence_before(memory_order order) BOOST_NOEXCEPT { -#if defined(__powerpc64__) +#if defined(__powerpc64__) || defined(__PPC64__) if (order == memory_order_seq_cst) __asm__ __volatile__ ("sync" ::: "memory"); else if ((order & memory_order_release) != 0) @@ -100,12 +105,6 @@ struct gcc_ppc_operations_base if ((order & (memory_order_consume | memory_order_acquire)) != 0) __asm__ __volatile__ ("isync" ::: "memory"); } - - static BOOST_FORCEINLINE void fence_after_store(memory_order order) BOOST_NOEXCEPT - { - if (order == memory_order_seq_cst) - __asm__ __volatile__ ("sync" ::: "memory"); - } }; @@ -114,33 +113,47 @@ struct operations< 4u, Signed > : public gcc_ppc_operations_base { typedef typename make_storage_type< 4u, Signed >::type storage_type; + typedef typename make_storage_type< 4u, Signed >::aligned aligned_storage_type; static BOOST_FORCEINLINE void store(storage_type volatile& storage, storage_type v, memory_order order) BOOST_NOEXCEPT { fence_before(order); __asm__ __volatile__ ( - "stw %1, %0\n" + "stw %1, %0\n\t" : "+m" (storage) : "r" (v) ); - fence_after_store(order); } static BOOST_FORCEINLINE storage_type load(storage_type const volatile& storage, memory_order order) BOOST_NOEXCEPT { storage_type v; - __asm__ __volatile__ - ( - "lwz %0, %1\n" - "cmpw %0, %0\n" - "bne- 1f\n" - "1:\n" - : "=&r" (v) - : "m" (storage) - : "cr0" - ); - fence_after(order); + if (order == memory_order_seq_cst) + __asm__ __volatile__ ("sync" ::: "memory"); + if ((order & (memory_order_consume | memory_order_acquire)) != 0) + { + __asm__ __volatile__ + ( + "lwz %0, %1\n\t" + "cmpw %0, %0\n\t" + "bne- 1f\n\t" + "1:\n\t" + "isync\n\t" + : "=&r" (v) + : "m" (storage) + : "cr0", "memory" + ); + } + else + { + __asm__ __volatile__ + ( + "lwz %0, %1\n\t" + : "=&r" (v) + : "m" (storage) + ); + } return v; } @@ -150,10 +163,10 @@ struct operations< 4u, Signed > : fence_before(order); __asm__ __volatile__ ( - "1:\n" - "lwarx %0,%y1\n" - "stwcx. %2,%y1\n" - "bne- 1b\n" + "1:\n\t" + "lwarx %0,%y1\n\t" + "stwcx. %2,%y1\n\t" + "bne- 1b\n\t" : "=&b" (original), "+Z" (storage) : "b" (v) : "cr0" @@ -169,14 +182,14 @@ struct operations< 4u, Signed > : fence_before(success_order); __asm__ __volatile__ ( - "li %1, 0\n" - "lwarx %0,%y2\n" - "cmpw %0, %3\n" - "bne- 1f\n" - "stwcx. %4,%y2\n" - "bne- 1f\n" - "li %1, 1\n" - "1:" + "li %1, 0\n\t" + "lwarx %0,%y2\n\t" + "cmpw %0, %3\n\t" + "bne- 1f\n\t" + "stwcx. %4,%y2\n\t" + "bne- 1f\n\t" + "li %1, 1\n\t" + "1:\n\t" : "=&b" (expected), "=&b" (success), "+Z" (storage) : "b" (expected), "b" (desired) : "cr0" @@ -195,14 +208,14 @@ struct operations< 4u, Signed > : fence_before(success_order); __asm__ __volatile__ ( - "li %1, 0\n" - "0: lwarx %0,%y2\n" - "cmpw %0, %3\n" - "bne- 1f\n" - "stwcx. %4,%y2\n" - "bne- 0b\n" - "li %1, 1\n" - "1:" + "li %1, 0\n\t" + "0: lwarx %0,%y2\n\t" + "cmpw %0, %3\n\t" + "bne- 1f\n\t" + "stwcx. %4,%y2\n\t" + "bne- 0b\n\t" + "li %1, 1\n\t" + "1:\n\t" : "=&b" (expected), "=&b" (success), "+Z" (storage) : "b" (expected), "b" (desired) : "cr0" @@ -220,11 +233,11 @@ struct operations< 4u, Signed > : fence_before(order); __asm__ __volatile__ ( - "1:\n" - "lwarx %0,%y2\n" - "add %1,%0,%3\n" - "stwcx. %1,%y2\n" - "bne- 1b\n" + "1:\n\t" + "lwarx %0,%y2\n\t" + "add %1,%0,%3\n\t" + "stwcx. %1,%y2\n\t" + "bne- 1b\n\t" : "=&b" (original), "=&b" (tmp), "+Z" (storage) : "b" (v) : BOOST_ATOMIC_DETAIL_ASM_CLOBBER_CC @@ -239,11 +252,11 @@ struct operations< 4u, Signed > : fence_before(order); __asm__ __volatile__ ( - "1:\n" - "lwarx %0,%y2\n" - "sub %1,%0,%3\n" - "stwcx. %1,%y2\n" - "bne- 1b\n" + "1:\n\t" + "lwarx %0,%y2\n\t" + "sub %1,%0,%3\n\t" + "stwcx. %1,%y2\n\t" + "bne- 1b\n\t" : "=&b" (original), "=&b" (tmp), "+Z" (storage) : "b" (v) : BOOST_ATOMIC_DETAIL_ASM_CLOBBER_CC @@ -258,11 +271,11 @@ struct operations< 4u, Signed > : fence_before(order); __asm__ __volatile__ ( - "1:\n" - "lwarx %0,%y2\n" - "and %1,%0,%3\n" - "stwcx. %1,%y2\n" - "bne- 1b\n" + "1:\n\t" + "lwarx %0,%y2\n\t" + "and %1,%0,%3\n\t" + "stwcx. %1,%y2\n\t" + "bne- 1b\n\t" : "=&b" (original), "=&b" (tmp), "+Z" (storage) : "b" (v) : BOOST_ATOMIC_DETAIL_ASM_CLOBBER_CC @@ -277,11 +290,11 @@ struct operations< 4u, Signed > : fence_before(order); __asm__ __volatile__ ( - "1:\n" - "lwarx %0,%y2\n" - "or %1,%0,%3\n" - "stwcx. %1,%y2\n" - "bne- 1b\n" + "1:\n\t" + "lwarx %0,%y2\n\t" + "or %1,%0,%3\n\t" + "stwcx. %1,%y2\n\t" + "bne- 1b\n\t" : "=&b" (original), "=&b" (tmp), "+Z" (storage) : "b" (v) : BOOST_ATOMIC_DETAIL_ASM_CLOBBER_CC @@ -296,11 +309,11 @@ struct operations< 4u, Signed > : fence_before(order); __asm__ __volatile__ ( - "1:\n" - "lwarx %0,%y2\n" - "xor %1,%0,%3\n" - "stwcx. %1,%y2\n" - "bne- 1b\n" + "1:\n\t" + "lwarx %0,%y2\n\t" + "xor %1,%0,%3\n\t" + "stwcx. %1,%y2\n\t" + "bne- 1b\n\t" : "=&b" (original), "=&b" (tmp), "+Z" (storage) : "b" (v) : BOOST_ATOMIC_DETAIL_ASM_CLOBBER_CC @@ -339,12 +352,12 @@ struct operations< 1u, false > : fence_before(order); __asm__ __volatile__ ( - "1:\n" - "lwarx %0,%y2\n" - "add %1,%0,%3\n" - "rlwinm %1, %1, 0, 0xff\n" - "stwcx. %1,%y2\n" - "bne- 1b\n" + "1:\n\t" + "lwarx %0,%y2\n\t" + "add %1,%0,%3\n\t" + "rlwinm %1, %1, 0, 0xff\n\t" + "stwcx. %1,%y2\n\t" + "bne- 1b\n\t" : "=&b" (original), "=&b" (tmp), "+Z" (storage) : "b" (v) : BOOST_ATOMIC_DETAIL_ASM_CLOBBER_CC @@ -359,12 +372,12 @@ struct operations< 1u, false > : fence_before(order); __asm__ __volatile__ ( - "1:\n" - "lwarx %0,%y2\n" - "sub %1,%0,%3\n" - "rlwinm %1, %1, 0, 0xff\n" - "stwcx. %1,%y2\n" - "bne- 1b\n" + "1:\n\t" + "lwarx %0,%y2\n\t" + "sub %1,%0,%3\n\t" + "rlwinm %1, %1, 0, 0xff\n\t" + "stwcx. %1,%y2\n\t" + "bne- 1b\n\t" : "=&b" (original), "=&b" (tmp), "+Z" (storage) : "b" (v) : BOOST_ATOMIC_DETAIL_ASM_CLOBBER_CC @@ -387,12 +400,12 @@ struct operations< 1u, true > : fence_before(order); __asm__ __volatile__ ( - "1:\n" - "lwarx %0,%y2\n" - "add %1,%0,%3\n" - "extsb %1, %1\n" - "stwcx. %1,%y2\n" - "bne- 1b\n" + "1:\n\t" + "lwarx %0,%y2\n\t" + "add %1,%0,%3\n\t" + "extsb %1, %1\n\t" + "stwcx. %1,%y2\n\t" + "bne- 1b\n\t" : "=&b" (original), "=&b" (tmp), "+Z" (storage) : "b" (v) : BOOST_ATOMIC_DETAIL_ASM_CLOBBER_CC @@ -407,12 +420,12 @@ struct operations< 1u, true > : fence_before(order); __asm__ __volatile__ ( - "1:\n" - "lwarx %0,%y2\n" - "sub %1,%0,%3\n" - "extsb %1, %1\n" - "stwcx. %1,%y2\n" - "bne- 1b\n" + "1:\n\t" + "lwarx %0,%y2\n\t" + "sub %1,%0,%3\n\t" + "extsb %1, %1\n\t" + "stwcx. %1,%y2\n\t" + "bne- 1b\n\t" : "=&b" (original), "=&b" (tmp), "+Z" (storage) : "b" (v) : BOOST_ATOMIC_DETAIL_ASM_CLOBBER_CC @@ -436,12 +449,12 @@ struct operations< 2u, false > : fence_before(order); __asm__ __volatile__ ( - "1:\n" - "lwarx %0,%y2\n" - "add %1,%0,%3\n" - "rlwinm %1, %1, 0, 0xffff\n" - "stwcx. %1,%y2\n" - "bne- 1b\n" + "1:\n\t" + "lwarx %0,%y2\n\t" + "add %1,%0,%3\n\t" + "rlwinm %1, %1, 0, 0xffff\n\t" + "stwcx. %1,%y2\n\t" + "bne- 1b\n\t" : "=&b" (original), "=&b" (tmp), "+Z" (storage) : "b" (v) : BOOST_ATOMIC_DETAIL_ASM_CLOBBER_CC @@ -456,12 +469,12 @@ struct operations< 2u, false > : fence_before(order); __asm__ __volatile__ ( - "1:\n" - "lwarx %0,%y2\n" - "sub %1,%0,%3\n" - "rlwinm %1, %1, 0, 0xffff\n" - "stwcx. %1,%y2\n" - "bne- 1b\n" + "1:\n\t" + "lwarx %0,%y2\n\t" + "sub %1,%0,%3\n\t" + "rlwinm %1, %1, 0, 0xffff\n\t" + "stwcx. %1,%y2\n\t" + "bne- 1b\n\t" : "=&b" (original), "=&b" (tmp), "+Z" (storage) : "b" (v) : BOOST_ATOMIC_DETAIL_ASM_CLOBBER_CC @@ -484,12 +497,12 @@ struct operations< 2u, true > : fence_before(order); __asm__ __volatile__ ( - "1:\n" - "lwarx %0,%y2\n" - "add %1,%0,%3\n" - "extsh %1, %1\n" - "stwcx. %1,%y2\n" - "bne- 1b\n" + "1:\n\t" + "lwarx %0,%y2\n\t" + "add %1,%0,%3\n\t" + "extsh %1, %1\n\t" + "stwcx. %1,%y2\n\t" + "bne- 1b\n\t" : "=&b" (original), "=&b" (tmp), "+Z" (storage) : "b" (v) : BOOST_ATOMIC_DETAIL_ASM_CLOBBER_CC @@ -504,12 +517,12 @@ struct operations< 2u, true > : fence_before(order); __asm__ __volatile__ ( - "1:\n" - "lwarx %0,%y2\n" - "sub %1,%0,%3\n" - "extsh %1, %1\n" - "stwcx. %1,%y2\n" - "bne- 1b\n" + "1:\n\t" + "lwarx %0,%y2\n\t" + "sub %1,%0,%3\n\t" + "extsh %1, %1\n\t" + "stwcx. %1,%y2\n\t" + "bne- 1b\n\t" : "=&b" (original), "=&b" (tmp), "+Z" (storage) : "b" (v) : BOOST_ATOMIC_DETAIL_ASM_CLOBBER_CC @@ -520,40 +533,54 @@ struct operations< 2u, true > : }; -#if defined(__powerpc64__) +#if defined(__powerpc64__) || defined(__PPC64__) template< bool Signed > struct operations< 8u, Signed > : public gcc_ppc_operations_base { typedef typename make_storage_type< 8u, Signed >::type storage_type; + typedef typename make_storage_type< 8u, Signed >::aligned aligned_storage_type; static BOOST_FORCEINLINE void store(storage_type volatile& storage, storage_type v, memory_order order) BOOST_NOEXCEPT { fence_before(order); __asm__ __volatile__ ( - "std %1, %0\n" + "std %1, %0\n\t" : "+m" (storage) : "r" (v) ); - fence_after_store(order); } static BOOST_FORCEINLINE storage_type load(storage_type const volatile& storage, memory_order order) BOOST_NOEXCEPT { storage_type v; - __asm__ __volatile__ - ( - "ld %0, %1\n" - "cmpd %0, %0\n" - "bne- 1f\n" - "1:\n" - : "=&b" (v) - : "m" (storage) - : "cr0" - ); - fence_after(order); + if (order == memory_order_seq_cst) + __asm__ __volatile__ ("sync" ::: "memory"); + if ((order & (memory_order_consume | memory_order_acquire)) != 0) + { + __asm__ __volatile__ + ( + "ld %0, %1\n\t" + "cmpd %0, %0\n\t" + "bne- 1f\n\t" + "1:\n\t" + "isync\n\t" + : "=&b" (v) + : "m" (storage) + : "cr0", "memory" + ); + } + else + { + __asm__ __volatile__ + ( + "ld %0, %1\n\t" + : "=&b" (v) + : "m" (storage) + ); + } return v; } @@ -563,10 +590,10 @@ struct operations< 8u, Signed > : fence_before(order); __asm__ __volatile__ ( - "1:\n" - "ldarx %0,%y1\n" - "stdcx. %2,%y1\n" - "bne- 1b\n" + "1:\n\t" + "ldarx %0,%y1\n\t" + "stdcx. %2,%y1\n\t" + "bne- 1b\n\t" : "=&b" (original), "+Z" (storage) : "b" (v) : "cr0" @@ -582,13 +609,13 @@ struct operations< 8u, Signed > : fence_before(success_order); __asm__ __volatile__ ( - "li %1, 0\n" - "ldarx %0,%y2\n" - "cmpd %0, %3\n" - "bne- 1f\n" - "stdcx. %4,%y2\n" - "bne- 1f\n" - "li %1, 1\n" + "li %1, 0\n\t" + "ldarx %0,%y2\n\t" + "cmpd %0, %3\n\t" + "bne- 1f\n\t" + "stdcx. %4,%y2\n\t" + "bne- 1f\n\t" + "li %1, 1\n\t" "1:" : "=&b" (expected), "=&b" (success), "+Z" (storage) : "b" (expected), "b" (desired) @@ -608,14 +635,14 @@ struct operations< 8u, Signed > : fence_before(success_order); __asm__ __volatile__ ( - "li %1, 0\n" - "0: ldarx %0,%y2\n" - "cmpd %0, %3\n" - "bne- 1f\n" - "stdcx. %4,%y2\n" - "bne- 0b\n" - "li %1, 1\n" - "1:" + "li %1, 0\n\t" + "0: ldarx %0,%y2\n\t" + "cmpd %0, %3\n\t" + "bne- 1f\n\t" + "stdcx. %4,%y2\n\t" + "bne- 0b\n\t" + "li %1, 1\n\t" + "1:\n\t" : "=&b" (expected), "=&b" (success), "+Z" (storage) : "b" (expected), "b" (desired) : "cr0" @@ -633,11 +660,11 @@ struct operations< 8u, Signed > : fence_before(order); __asm__ __volatile__ ( - "1:\n" - "ldarx %0,%y2\n" - "add %1,%0,%3\n" - "stdcx. %1,%y2\n" - "bne- 1b\n" + "1:\n\t" + "ldarx %0,%y2\n\t" + "add %1,%0,%3\n\t" + "stdcx. %1,%y2\n\t" + "bne- 1b\n\t" : "=&b" (original), "=&b" (tmp), "+Z" (storage) : "b" (v) : BOOST_ATOMIC_DETAIL_ASM_CLOBBER_CC @@ -652,11 +679,11 @@ struct operations< 8u, Signed > : fence_before(order); __asm__ __volatile__ ( - "1:\n" - "ldarx %0,%y2\n" - "sub %1,%0,%3\n" - "stdcx. %1,%y2\n" - "bne- 1b\n" + "1:\n\t" + "ldarx %0,%y2\n\t" + "sub %1,%0,%3\n\t" + "stdcx. %1,%y2\n\t" + "bne- 1b\n\t" : "=&b" (original), "=&b" (tmp), "+Z" (storage) : "b" (v) : BOOST_ATOMIC_DETAIL_ASM_CLOBBER_CC @@ -671,11 +698,11 @@ struct operations< 8u, Signed > : fence_before(order); __asm__ __volatile__ ( - "1:\n" - "ldarx %0,%y2\n" - "and %1,%0,%3\n" - "stdcx. %1,%y2\n" - "bne- 1b\n" + "1:\n\t" + "ldarx %0,%y2\n\t" + "and %1,%0,%3\n\t" + "stdcx. %1,%y2\n\t" + "bne- 1b\n\t" : "=&b" (original), "=&b" (tmp), "+Z" (storage) : "b" (v) : BOOST_ATOMIC_DETAIL_ASM_CLOBBER_CC @@ -690,11 +717,11 @@ struct operations< 8u, Signed > : fence_before(order); __asm__ __volatile__ ( - "1:\n" - "ldarx %0,%y2\n" - "or %1,%0,%3\n" - "stdcx. %1,%y2\n" - "bne- 1b\n" + "1:\n\t" + "ldarx %0,%y2\n\t" + "or %1,%0,%3\n\t" + "stdcx. %1,%y2\n\t" + "bne- 1b\n\t" : "=&b" (original), "=&b" (tmp), "+Z" (storage) : "b" (v) : BOOST_ATOMIC_DETAIL_ASM_CLOBBER_CC @@ -709,11 +736,11 @@ struct operations< 8u, Signed > : fence_before(order); __asm__ __volatile__ ( - "1:\n" - "ldarx %0,%y2\n" - "xor %1,%0,%3\n" - "stdcx. %1,%y2\n" - "bne- 1b\n" + "1:\n\t" + "ldarx %0,%y2\n\t" + "xor %1,%0,%3\n\t" + "stdcx. %1,%y2\n\t" + "bne- 1b\n\t" : "=&b" (original), "=&b" (tmp), "+Z" (storage) : "b" (v) : BOOST_ATOMIC_DETAIL_ASM_CLOBBER_CC @@ -738,7 +765,7 @@ struct operations< 8u, Signed > : } }; -#endif // defined(__powerpc64__) +#endif // defined(__powerpc64__) || defined(__PPC64__) BOOST_FORCEINLINE void thread_fence(memory_order order) BOOST_NOEXCEPT @@ -747,14 +774,12 @@ BOOST_FORCEINLINE void thread_fence(memory_order order) BOOST_NOEXCEPT { case memory_order_consume: case memory_order_acquire: - __asm__ __volatile__ ("isync" ::: "memory"); - break; case memory_order_release: -#if defined(__powerpc64__) + case memory_order_acq_rel: +#if defined(__powerpc64__) || defined(__PPC64__) __asm__ __volatile__ ("lwsync" ::: "memory"); break; #endif - case memory_order_acq_rel: case memory_order_seq_cst: __asm__ __volatile__ ("sync" ::: "memory"); break; @@ -765,7 +790,11 @@ BOOST_FORCEINLINE void thread_fence(memory_order order) BOOST_NOEXCEPT BOOST_FORCEINLINE void signal_fence(memory_order order) BOOST_NOEXCEPT { if (order != memory_order_relaxed) +#if defined(__ibmxl__) || defined(__IBMCPP__) + __fence(); +#else __asm__ __volatile__ ("" ::: "memory"); +#endif } } // namespace detail diff --git a/3party/boost/boost/atomic/detail/ops_gcc_sparc.hpp b/3party/boost/boost/atomic/detail/ops_gcc_sparc.hpp index ea6df91dc6..fd42fa8095 100644 --- a/3party/boost/boost/atomic/detail/ops_gcc_sparc.hpp +++ b/3party/boost/boost/atomic/detail/ops_gcc_sparc.hpp @@ -34,6 +34,8 @@ namespace detail { struct gcc_sparc_cas_base { + static BOOST_CONSTEXPR_OR_CONST bool is_always_lock_free = true; + static BOOST_FORCEINLINE void fence_before(memory_order order) BOOST_NOEXCEPT { if (order == memory_order_seq_cst) @@ -62,10 +64,11 @@ struct gcc_sparc_cas32 : public gcc_sparc_cas_base { typedef typename make_storage_type< 4u, Signed >::type storage_type; + typedef typename make_storage_type< 4u, Signed >::aligned aligned_storage_type; static BOOST_FORCEINLINE void store(storage_type volatile& storage, storage_type v, memory_order order) BOOST_NOEXCEPT { - fence_before_store(order); + fence_before(order); storage = v; fence_after_store(order); } @@ -104,6 +107,20 @@ struct gcc_sparc_cas32 : return compare_exchange_strong(storage, expected, desired, success_order, failure_order); } + static BOOST_FORCEINLINE storage_type exchange(storage_type volatile& storage, storage_type v, memory_order order) BOOST_NOEXCEPT + { + fence_before(order); + __asm__ __volatile__ + ( + "swap [%1], %0" + : "+r" (v) + : "r" (&storage) + : "memory" + ); + fence_after(order); + return v; + } + static BOOST_FORCEINLINE bool is_lock_free(storage_type const volatile&) BOOST_NOEXCEPT { return true; @@ -114,27 +131,6 @@ template< bool Signed > struct operations< 4u, Signed > : public cas_based_operations< gcc_sparc_cas32< Signed > > { - typedef cas_based_operations< gcc_sparc_cas32< Signed > > base_type; - typedef typename base_type::storage_type storage_type; - - static BOOST_FORCEINLINE storage_type exchange(storage_type volatile& storage, storage_type v, memory_order order) BOOST_NOEXCEPT - { - base_type::fence_before(order); - __asm__ __volatile__ - ( - "swap [%1], %0" - : "+r" (v) - : "r" (&storage) - : "memory" - ); - base_type::fence_after(order); - return v; - } - - static BOOST_FORCEINLINE bool test_and_set(storage_type volatile& storage, memory_order order) BOOST_NOEXCEPT - { - return !!exchange(storage, (storage_type)1, order); - } }; template< bool Signed > @@ -154,10 +150,11 @@ struct gcc_sparc_cas64 : public gcc_sparc_cas_base { typedef typename make_storage_type< 8u, Signed >::type storage_type; + typedef typename make_storage_type< 8u, Signed >::aligned aligned_storage_type; static BOOST_FORCEINLINE void store(storage_type volatile& storage, storage_type v, memory_order order) BOOST_NOEXCEPT { - fence_before_store(order); + fence_before(order); storage = v; fence_after_store(order); } @@ -204,7 +201,7 @@ struct gcc_sparc_cas64 : template< bool Signed > struct operations< 8u, Signed > : - public cas_based_operations< gcc_sparc_cas64< Signed > > + public cas_based_operations< cas_based_exchange< gcc_sparc_cas64< Signed > > > { }; diff --git a/3party/boost/boost/atomic/detail/ops_gcc_sync.hpp b/3party/boost/boost/atomic/detail/ops_gcc_sync.hpp index f4fc3331c6..2f41aff279 100644 --- a/3party/boost/boost/atomic/detail/ops_gcc_sync.hpp +++ b/3party/boost/boost/atomic/detail/ops_gcc_sync.hpp @@ -33,6 +33,8 @@ namespace detail { struct gcc_sync_operations_base { + static BOOST_CONSTEXPR_OR_CONST bool is_always_lock_free = true; + static BOOST_FORCEINLINE void fence_before_store(memory_order order) BOOST_NOEXCEPT { if ((order & memory_order_release) != 0) @@ -165,6 +167,17 @@ struct operations< 1u, Signed > : public extending_cas_based_operations< gcc_sync_operations< typename make_storage_type< 16u, Signed >::type >, 1u, Signed > #endif { +#if defined(__GCC_HAVE_SYNC_COMPARE_AND_SWAP_1) + typedef typename make_storage_type< 1u, Signed >::aligned aligned_storage_type; +#elif defined(__GCC_HAVE_SYNC_COMPARE_AND_SWAP_2) + typedef typename make_storage_type< 2u, Signed >::aligned aligned_storage_type; +#elif defined(__GCC_HAVE_SYNC_COMPARE_AND_SWAP_4) + typedef typename make_storage_type< 4u, Signed >::aligned aligned_storage_type; +#elif defined(__GCC_HAVE_SYNC_COMPARE_AND_SWAP_8) + typedef typename make_storage_type< 8u, Signed >::aligned aligned_storage_type; +#else + typedef typename make_storage_type< 16u, Signed >::aligned aligned_storage_type; +#endif }; #endif @@ -181,6 +194,15 @@ struct operations< 2u, Signed > : public extending_cas_based_operations< gcc_sync_operations< typename make_storage_type< 16u, Signed >::type >, 2u, Signed > #endif { +#if defined(__GCC_HAVE_SYNC_COMPARE_AND_SWAP_2) + typedef typename make_storage_type< 2u, Signed >::aligned aligned_storage_type; +#elif defined(__GCC_HAVE_SYNC_COMPARE_AND_SWAP_4) + typedef typename make_storage_type< 4u, Signed >::aligned aligned_storage_type; +#elif defined(__GCC_HAVE_SYNC_COMPARE_AND_SWAP_8) + typedef typename make_storage_type< 8u, Signed >::aligned aligned_storage_type; +#else + typedef typename make_storage_type< 16u, Signed >::aligned aligned_storage_type; +#endif }; #endif @@ -195,6 +217,13 @@ struct operations< 4u, Signed > : public extending_cas_based_operations< gcc_sync_operations< typename make_storage_type< 16u, Signed >::type >, 4u, Signed > #endif { +#if defined(__GCC_HAVE_SYNC_COMPARE_AND_SWAP_4) + typedef typename make_storage_type< 4u, Signed >::aligned aligned_storage_type; +#elif defined(__GCC_HAVE_SYNC_COMPARE_AND_SWAP_8) + typedef typename make_storage_type< 8u, Signed >::aligned aligned_storage_type; +#else + typedef typename make_storage_type< 16u, Signed >::aligned aligned_storage_type; +#endif }; #endif @@ -207,6 +236,11 @@ struct operations< 8u, Signed > : public extending_cas_based_operations< gcc_sync_operations< typename make_storage_type< 16u, Signed >::type >, 8u, Signed > #endif { +#if defined(__GCC_HAVE_SYNC_COMPARE_AND_SWAP_8) + typedef typename make_storage_type< 8u, Signed >::aligned aligned_storage_type; +#else + typedef typename make_storage_type< 16u, Signed >::aligned aligned_storage_type; +#endif }; #endif @@ -215,6 +249,7 @@ template< bool Signed > struct operations< 16u, Signed > : public gcc_sync_operations< typename make_storage_type< 16u, Signed >::type > { + typedef typename make_storage_type< 16u, Signed >::aligned aligned_storage_type; }; #endif diff --git a/3party/boost/boost/atomic/detail/ops_gcc_x86.hpp b/3party/boost/boost/atomic/detail/ops_gcc_x86.hpp index 6e600457aa..98dcdc064e 100644 --- a/3party/boost/boost/atomic/detail/ops_gcc_x86.hpp +++ b/3party/boost/boost/atomic/detail/ops_gcc_x86.hpp @@ -42,6 +42,8 @@ namespace detail { struct gcc_x86_operations_base { + static BOOST_CONSTEXPR_OR_CONST bool is_always_lock_free = true; + static BOOST_FORCEINLINE void fence_before(memory_order order) BOOST_NOEXCEPT { if ((order & memory_order_release) != 0) @@ -115,6 +117,7 @@ struct operations< 1u, Signed > : { typedef gcc_x86_operations< typename make_storage_type< 1u, Signed >::type, operations< 1u, Signed > > base_type; typedef typename base_type::storage_type storage_type; + typedef typename make_storage_type< 1u, Signed >::aligned aligned_storage_type; static BOOST_FORCEINLINE storage_type fetch_add(storage_type volatile& storage, storage_type v, memory_order) BOOST_NOEXCEPT { @@ -201,6 +204,7 @@ struct operations< 2u, Signed > : { typedef gcc_x86_operations< typename make_storage_type< 2u, Signed >::type, operations< 2u, Signed > > base_type; typedef typename base_type::storage_type storage_type; + typedef typename make_storage_type< 2u, Signed >::aligned aligned_storage_type; static BOOST_FORCEINLINE storage_type fetch_add(storage_type volatile& storage, storage_type v, memory_order) BOOST_NOEXCEPT { @@ -287,6 +291,7 @@ struct operations< 4u, Signed > : { typedef gcc_x86_operations< typename make_storage_type< 4u, Signed >::type, operations< 4u, Signed > > base_type; typedef typename base_type::storage_type storage_type; + typedef typename make_storage_type< 4u, Signed >::aligned aligned_storage_type; static BOOST_FORCEINLINE storage_type fetch_add(storage_type volatile& storage, storage_type v, memory_order) BOOST_NOEXCEPT { @@ -383,6 +388,7 @@ struct operations< 8u, Signed > : { typedef gcc_x86_operations< typename make_storage_type< 8u, Signed >::type, operations< 8u, Signed > > base_type; typedef typename base_type::storage_type storage_type; + typedef typename make_storage_type< 8u, Signed >::aligned aligned_storage_type; static BOOST_FORCEINLINE storage_type fetch_add(storage_type volatile& storage, storage_type v, memory_order) BOOST_NOEXCEPT { @@ -481,7 +487,7 @@ BOOST_FORCEINLINE void thread_fence(memory_order order) BOOST_NOEXCEPT { __asm__ __volatile__ ( -#if defined(__x86_64__) || defined(__SSE2__) +#if defined(BOOST_ATOMIC_DETAIL_X86_HAS_MFENCE) "mfence\n" #else "lock; addl $0, (%%esp)\n" diff --git a/3party/boost/boost/atomic/detail/ops_gcc_x86_dcas.hpp b/3party/boost/boost/atomic/detail/ops_gcc_x86_dcas.hpp index a6109f926c..e356e8cfbd 100644 --- a/3party/boost/boost/atomic/detail/ops_gcc_x86_dcas.hpp +++ b/3party/boost/boost/atomic/detail/ops_gcc_x86_dcas.hpp @@ -36,6 +36,9 @@ template< bool Signed > struct gcc_dcas_x86 { typedef typename make_storage_type< 8u, Signed >::type storage_type; + typedef typename make_storage_type< 8u, Signed >::aligned aligned_storage_type; + + static BOOST_CONSTEXPR_OR_CONST bool is_always_lock_free = true; static BOOST_FORCEINLINE void store(storage_type volatile& storage, storage_type v, memory_order) BOOST_NOEXCEPT { @@ -68,7 +71,40 @@ struct gcc_dcas_x86 } else { +#if !defined(BOOST_ATOMIC_DETAIL_NO_ASM_IMPLIED_ZERO_DISPLACEMENTS) #if defined(__PIC__) + uint32_t v_lo = (uint32_t)v; + uint32_t scratch; + __asm__ __volatile__ + ( + "movl %%ebx, %[scratch]\n\t" + "movl %[value_lo], %%ebx\n\t" + "movl %[dest], %%eax\n\t" + "movl 4+%[dest], %%edx\n\t" + ".align 16\n\t" + "1: lock; cmpxchg8b %[dest]\n\t" + "jne 1b\n\t" + "movl %[scratch], %%ebx\n\t" + : [scratch] "=m" (scratch), [dest] "=o" (storage), [value_lo] "+a" (v_lo) + : "c" ((uint32_t)(v >> 32)) + : BOOST_ATOMIC_DETAIL_ASM_CLOBBER_CC_COMMA "edx", "memory" + ); +#else // defined(__PIC__) + __asm__ __volatile__ + ( + "movl %[dest], %%eax\n\t" + "movl 4+%[dest], %%edx\n\t" + ".align 16\n\t" + "1: lock; cmpxchg8b %[dest]\n\t" + "jne 1b\n\t" + : [dest] "=o" (storage) + : [value_lo] "b" ((uint32_t)v), "c" ((uint32_t)(v >> 32)) + : BOOST_ATOMIC_DETAIL_ASM_CLOBBER_CC_COMMA "eax", "edx", "memory" + ); +#endif // defined(__PIC__) +#else // !defined(BOOST_ATOMIC_DETAIL_NO_ASM_IMPLIED_ZERO_DISPLACEMENTS) +#if defined(__PIC__) + uint32_t v_lo = (uint32_t)v; uint32_t scratch; __asm__ __volatile__ ( @@ -79,17 +115,17 @@ struct gcc_dcas_x86 ".align 16\n\t" "1: lock; cmpxchg8b 0(%[dest])\n\t" "jne 1b\n\t" - "movl %[scratch], %%ebx" + "movl %[scratch], %%ebx\n\t" #if !defined(BOOST_ATOMIC_DETAIL_NO_ASM_CONSTRAINT_ALTERNATIVES) - : [scratch] "=m,m" (scratch) - : [value_lo] "a,a" ((uint32_t)v), "c,c" ((uint32_t)(v >> 32)), [dest] "D,S" (&storage) + : [scratch] "=m,m" (scratch), [value_lo] "+a,a" (v_lo) + : "c,c" ((uint32_t)(v >> 32)), [dest] "D,S" (&storage) #else - : [scratch] "=m" (scratch) - : [value_lo] "a" ((uint32_t)v), "c" ((uint32_t)(v >> 32)), [dest] "D" (&storage) + : [scratch] "=m" (scratch), [value_lo] "+a" (v_lo) + : "c" ((uint32_t)(v >> 32)), [dest] "D" (&storage) #endif : BOOST_ATOMIC_DETAIL_ASM_CLOBBER_CC_COMMA "edx", "memory" ); -#else +#else // defined(__PIC__) __asm__ __volatile__ ( "movl 0(%[dest]), %%eax\n\t" @@ -105,7 +141,8 @@ struct gcc_dcas_x86 #endif : BOOST_ATOMIC_DETAIL_ASM_CLOBBER_CC_COMMA "eax", "edx", "memory" ); -#endif +#endif // defined(__PIC__) +#endif // !defined(BOOST_ATOMIC_DETAIL_NO_ASM_IMPLIED_ZERO_DISPLACEMENTS) } } @@ -152,7 +189,7 @@ struct gcc_dcas_x86 ( "movl %%ebx, %%eax\n\t" "movl %%ecx, %%edx\n\t" - "lock; cmpxchg8b %[storage]" + "lock; cmpxchg8b %[storage]\n\t" : "=&A" (value) : [storage] "m" (storage) : BOOST_ATOMIC_DETAIL_ASM_CLOBBER_CC_COMMA "memory" @@ -191,7 +228,7 @@ struct gcc_dcas_x86 "movl %[desired_lo], %%ebx\n\t" "lock; cmpxchg8b %[dest]\n\t" "movl %[scratch], %%ebx\n\t" - "sete %[success]" + "sete %[success]\n\t" #if !defined(BOOST_ATOMIC_DETAIL_NO_ASM_CONSTRAINT_ALTERNATIVES) : "+A,A,A,A,A,A" (expected), [dest] "+m,m,m,m,m,m" (storage), [scratch] "=m,m,m,m,m,m" (scratch), [success] "=q,m,q,m,q,m" (success) : [desired_lo] "S,S,D,D,m,m" ((uint32_t)desired), "c,c,c,c,c,c" ((uint32_t)(desired >> 32)) @@ -207,7 +244,7 @@ struct gcc_dcas_x86 __asm__ __volatile__ ( "lock; cmpxchg8b %[dest]\n\t" - "sete %[success]" + "sete %[success]\n\t" #if !defined(BOOST_ATOMIC_DETAIL_NO_ASM_CONSTRAINT_ALTERNATIVES) : "+A,A" (expected), [dest] "+m,m" (storage), [success] "=q,m" (success) : "b,b" ((uint32_t)desired), "c,c" ((uint32_t)(desired >> 32)) @@ -227,6 +264,97 @@ struct gcc_dcas_x86 return compare_exchange_strong(storage, expected, desired, success_order, failure_order); } + static BOOST_FORCEINLINE storage_type exchange(storage_type volatile& storage, storage_type v, memory_order order) BOOST_NOEXCEPT + { +#if defined(__clang__) + // Clang cannot allocate eax:edx register pairs but it has sync intrinsics + storage_type old_val = storage; + while (true) + { + storage_type val = __sync_val_compare_and_swap(&storage, old_val, v); + if (val == old_val) + return val; + old_val = val; + } +#elif !defined(BOOST_ATOMIC_DETAIL_NO_ASM_IMPLIED_ZERO_DISPLACEMENTS) +#if defined(__PIC__) + uint32_t scratch; + __asm__ __volatile__ + ( + "movl %%ebx, %[scratch]\n\t" + "movl %%eax, %%ebx\n\t" + "movl %%edx, %%ecx\n\t" + "movl %[dest], %%eax\n\t" + "movl 4+%[dest], %%edx\n\t" + ".align 16\n\t" + "1: lock; cmpxchg8b %[dest]\n\t" + "jne 1b\n\t" + "movl %[scratch], %%ebx\n\t" + : "+A" (v), [scratch] "=m" (scratch), [dest] "+o" (storage) + : + : BOOST_ATOMIC_DETAIL_ASM_CLOBBER_CC_COMMA "ecx", "memory" + ); + return v; +#else // defined(__PIC__) + __asm__ __volatile__ + ( + "movl %[dest], %%eax\n\t" + "movl 4+%[dest], %%edx\n\t" + ".align 16\n\t" + "1: lock; cmpxchg8b %[dest]\n\t" + "jne 1b\n\t" + : "=A" (v), [dest] "+o" (storage) + : "b" ((uint32_t)v), "c" ((uint32_t)(v >> 32)) + : BOOST_ATOMIC_DETAIL_ASM_CLOBBER_CC_COMMA "memory" + ); + return v; +#endif // defined(__PIC__) +#else // !defined(BOOST_ATOMIC_DETAIL_NO_ASM_IMPLIED_ZERO_DISPLACEMENTS) +#if defined(__PIC__) + uint32_t scratch; + __asm__ __volatile__ + ( + "movl %%ebx, %[scratch]\n\t" + "movl %%eax, %%ebx\n\t" + "movl %%edx, %%ecx\n\t" + "movl 0(%[dest]), %%eax\n\t" + "movl 4(%[dest]), %%edx\n\t" + ".align 16\n\t" + "1: lock; cmpxchg8b 0(%[dest])\n\t" + "jne 1b\n\t" + "movl %[scratch], %%ebx\n\t" +#if !defined(BOOST_ATOMIC_DETAIL_NO_ASM_CONSTRAINT_ALTERNATIVES) + : "+A,A" (v), [scratch] "=m,m" (scratch) + : [dest] "D,S" (&storage) +#else + : "+A" (v), [scratch] "=m" (scratch) + : [dest] "D" (&storage) +#endif + : BOOST_ATOMIC_DETAIL_ASM_CLOBBER_CC_COMMA "ecx", "memory" + ); + return v; +#else // defined(__PIC__) + __asm__ __volatile__ + ( + "movl 0(%[dest]), %%eax\n\t" + "movl 4(%[dest]), %%edx\n\t" + ".align 16\n\t" + "1: lock; cmpxchg8b 0(%[dest])\n\t" + "jne 1b\n\t" +#if !defined(BOOST_ATOMIC_DETAIL_NO_ASM_CONSTRAINT_ALTERNATIVES) + : "=A,A" (v) + : "b,b" ((uint32_t)v), "c,c" ((uint32_t)(v >> 32)), [dest] "D,S" (&storage) +#else + : "=A" (v) + : "b" ((uint32_t)v), "c" ((uint32_t)(v >> 32)), [dest] "D" (&storage) +#endif + : BOOST_ATOMIC_DETAIL_ASM_CLOBBER_CC_COMMA "memory" + ); + return v; +#endif // defined(__PIC__) +#endif + } + static BOOST_FORCEINLINE bool is_lock_free(storage_type const volatile&) BOOST_NOEXCEPT { return true; @@ -241,21 +369,39 @@ template< bool Signed > struct gcc_dcas_x86_64 { typedef typename make_storage_type< 16u, Signed >::type storage_type; + typedef typename make_storage_type< 16u, Signed >::aligned aligned_storage_type; + + static BOOST_CONSTEXPR_OR_CONST bool is_always_lock_free = true; static BOOST_FORCEINLINE void store(storage_type volatile& storage, storage_type v, memory_order) BOOST_NOEXCEPT { uint64_t const* p_value = (uint64_t const*)&v; + const uint64_t v_lo = p_value[0], v_hi = p_value[1]; +#if !defined(BOOST_ATOMIC_DETAIL_NO_ASM_IMPLIED_ZERO_DISPLACEMENTS) + __asm__ __volatile__ + ( + "movq %[dest], %%rax\n\t" + "movq 8+%[dest], %%rdx\n\t" + ".align 16\n\t" + "1: lock; cmpxchg16b %[dest]\n\t" + "jne 1b\n\t" + : [dest] "=o" (storage) + : "b" (v_lo), "c" (v_hi) + : BOOST_ATOMIC_DETAIL_ASM_CLOBBER_CC_COMMA "rax", "rdx", "memory" + ); +#else // !defined(BOOST_ATOMIC_DETAIL_NO_ASM_IMPLIED_ZERO_DISPLACEMENTS) __asm__ __volatile__ ( "movq 0(%[dest]), %%rax\n\t" "movq 8(%[dest]), %%rdx\n\t" ".align 16\n\t" "1: lock; cmpxchg16b 0(%[dest])\n\t" - "jne 1b" + "jne 1b\n\t" : - : "b" (p_value[0]), "c" (p_value[1]), [dest] "r" (&storage) + : "b" (v_lo), "c" (v_hi), [dest] "r" (&storage) : BOOST_ATOMIC_DETAIL_ASM_CLOBBER_CC_COMMA "rax", "rdx", "memory" ); +#endif // !defined(BOOST_ATOMIC_DETAIL_NO_ASM_IMPLIED_ZERO_DISPLACEMENTS) } static BOOST_FORCEINLINE storage_type load(storage_type const volatile& storage, memory_order) BOOST_NOEXCEPT @@ -264,7 +410,40 @@ struct gcc_dcas_x86_64 // Clang cannot allocate rax:rdx register pairs but it has sync intrinsics storage_type value = storage_type(); return __sync_val_compare_and_swap(&storage, value, value); -#else +#elif defined(BOOST_ATOMIC_DETAIL_NO_ASM_RAX_RDX_PAIRS) + // GCC 4.4 can't allocate rax:rdx register pair either but it also doesn't support 128-bit __sync_val_compare_and_swap + storage_type value; + + // We don't care for comparison result here; the previous value will be stored into value anyway. + // Also we don't care for rbx and rcx values, they just have to be equal to rax and rdx before cmpxchg16b. +#if !defined(BOOST_ATOMIC_DETAIL_NO_ASM_IMPLIED_ZERO_DISPLACEMENTS) + __asm__ __volatile__ + ( + "movq %%rbx, %%rax\n\t" + "movq %%rcx, %%rdx\n\t" + "lock; cmpxchg16b %[storage]\n\t" + "movq %%rax, %[value]\n\t" + "movq %%rdx, 8+%[value]\n\t" + : [value] "=o" (value) + : [storage] "m" (storage) + : BOOST_ATOMIC_DETAIL_ASM_CLOBBER_CC_COMMA "memory", "rax", "rdx" + ); +#else // !defined(BOOST_ATOMIC_DETAIL_NO_ASM_IMPLIED_ZERO_DISPLACEMENTS) + __asm__ __volatile__ + ( + "movq %%rbx, %%rax\n\t" + "movq %%rcx, %%rdx\n\t" + "lock; cmpxchg16b %[storage]\n\t" + "movq %%rax, 0(%[value])\n\t" + "movq %%rdx, 8(%[value])\n\t" + : + : [storage] "m" (storage), [value] "r" (&value) + : BOOST_ATOMIC_DETAIL_ASM_CLOBBER_CC_COMMA "memory", "rax", "rdx" + ); +#endif // !defined(BOOST_ATOMIC_DETAIL_NO_ASM_IMPLIED_ZERO_DISPLACEMENTS) + + return value; +#else // defined(BOOST_ATOMIC_DETAIL_NO_ASM_RAX_RDX_PAIRS) storage_type value; // We don't care for comparison result here; the previous value will be stored into value anyway. @@ -273,7 +452,7 @@ struct gcc_dcas_x86_64 ( "movq %%rbx, %%rax\n\t" "movq %%rcx, %%rdx\n\t" - "lock; cmpxchg16b %[storage]" + "lock; cmpxchg16b %[storage]\n\t" : "=&A" (value) : [storage] "m" (storage) : BOOST_ATOMIC_DETAIL_ASM_CLOBBER_CC_COMMA "memory" @@ -291,19 +470,54 @@ struct gcc_dcas_x86_64 storage_type old_expected = expected; expected = __sync_val_compare_and_swap(&storage, old_expected, desired); return expected == old_expected; -#else +#elif defined(BOOST_ATOMIC_DETAIL_NO_ASM_RAX_RDX_PAIRS) + // GCC 4.4 can't allocate rax:rdx register pair either but it also doesn't support 128-bit __sync_val_compare_and_swap uint64_t const* p_desired = (uint64_t const*)&desired; + const uint64_t desired_lo = p_desired[0], desired_hi = p_desired[1]; + bool success; +#if !defined(BOOST_ATOMIC_DETAIL_NO_ASM_IMPLIED_ZERO_DISPLACEMENTS) + __asm__ __volatile__ + ( + "movq %[expected], %%rax\n\t" + "movq 8+%[expected], %%rdx\n\t" + "lock; cmpxchg16b %[dest]\n\t" + "sete %[success]\n\t" + "movq %%rax, %[expected]\n\t" + "movq %%rdx, 8+%[expected]\n\t" + : [dest] "+m" (storage), [expected] "+o" (expected), [success] "=q" (success) + : "b" (desired_lo), "c" (desired_hi) + : BOOST_ATOMIC_DETAIL_ASM_CLOBBER_CC_COMMA "memory", "rax", "rdx" + ); +#else // !defined(BOOST_ATOMIC_DETAIL_NO_ASM_IMPLIED_ZERO_DISPLACEMENTS) + __asm__ __volatile__ + ( + "movq 0(%[expected]), %%rax\n\t" + "movq 8(%[expected]), %%rdx\n\t" + "lock; cmpxchg16b %[dest]\n\t" + "sete %[success]\n\t" + "movq %%rax, 0(%[expected])\n\t" + "movq %%rdx, 8(%[expected])\n\t" + : [dest] "+m" (storage), [success] "=q" (success) + : "b" (desired_lo), "c" (desired_hi), [expected] "r" (&expected) + : BOOST_ATOMIC_DETAIL_ASM_CLOBBER_CC_COMMA "memory", "rax", "rdx" + ); +#endif // !defined(BOOST_ATOMIC_DETAIL_NO_ASM_IMPLIED_ZERO_DISPLACEMENTS) + + return success; +#else // defined(BOOST_ATOMIC_DETAIL_NO_ASM_RAX_RDX_PAIRS) + uint64_t const* p_desired = (uint64_t const*)&desired; + const uint64_t desired_lo = p_desired[0], desired_hi = p_desired[1]; bool success; __asm__ __volatile__ ( "lock; cmpxchg16b %[dest]\n\t" - "sete %[success]" + "sete %[success]\n\t" #if !defined(BOOST_ATOMIC_DETAIL_NO_ASM_CONSTRAINT_ALTERNATIVES) : "+A,A" (expected), [dest] "+m,m" (storage), [success] "=q,m" (success) - : "b,b" (p_desired[0]), "c,c" (p_desired[1]) + : "b,b" (desired_lo), "c,c" (desired_hi) #else : "+A" (expected), [dest] "+m" (storage), [success] "=q" (success) - : "b" (p_desired[0]), "c" (p_desired[1]) + : "b" (desired_lo), "c" (desired_hi) #endif : BOOST_ATOMIC_DETAIL_ASM_CLOBBER_CC_COMMA "memory" ); @@ -317,6 +531,87 @@ struct gcc_dcas_x86_64 return compare_exchange_strong(storage, expected, desired, success_order, failure_order); } + static BOOST_FORCEINLINE storage_type exchange(storage_type volatile& storage, storage_type v, memory_order) BOOST_NOEXCEPT + { +#if defined(__clang__) + // Clang cannot allocate eax:edx register pairs but it has sync intrinsics + storage_type old_val = storage; + while (true) + { + storage_type val = __sync_val_compare_and_swap(&storage, old_val, v); + if (val == old_val) + return val; + old_val = val; + } +#elif defined(BOOST_ATOMIC_DETAIL_NO_ASM_RAX_RDX_PAIRS) + // GCC 4.4 can't allocate rax:rdx register pair either but it also doesn't support 128-bit __sync_val_compare_and_swap + storage_type old_value; + uint64_t const* p_value = (uint64_t const*)&v; + const uint64_t v_lo = p_value[0], v_hi = p_value[1]; +#if !defined(BOOST_ATOMIC_DETAIL_NO_ASM_IMPLIED_ZERO_DISPLACEMENTS) + __asm__ __volatile__ + ( + "movq %[dest], %%rax\n\t" + "movq 8+%[dest], %%rdx\n\t" + ".align 16\n\t" + "1: lock; cmpxchg16b %[dest]\n\t" + "jne 1b\n\t" + "movq %%rax, %[old_value]\n\t" + "movq %%rdx, 8+%[old_value]\n\t" + : [dest] "+o" (storage), [old_value] "=o" (old_value) + : "b" (v_lo), "c" (v_hi) + : BOOST_ATOMIC_DETAIL_ASM_CLOBBER_CC_COMMA "memory", "rax", "rdx" + ); +#else // !defined(BOOST_ATOMIC_DETAIL_NO_ASM_IMPLIED_ZERO_DISPLACEMENTS) + __asm__ __volatile__ + ( + "movq 0(%[dest]), %%rax\n\t" + "movq 8(%[dest]), %%rdx\n\t" + ".align 16\n\t" + "1: lock; cmpxchg16b 0(%[dest])\n\t" + "jne 1b\n\t" + "movq %%rax, 0(%[old_value])\n\t" + "movq %%rdx, 8(%[old_value])\n\t" + : + : "b" (v_lo), "c" (v_hi), [dest] "r" (&storage), [old_value] "r" (&old_value) + : BOOST_ATOMIC_DETAIL_ASM_CLOBBER_CC_COMMA "memory", "rax", "rdx" + ); +#endif // !defined(BOOST_ATOMIC_DETAIL_NO_ASM_IMPLIED_ZERO_DISPLACEMENTS) + + return old_value; +#else // defined(BOOST_ATOMIC_DETAIL_NO_ASM_RAX_RDX_PAIRS) + uint64_t const* p_value = (uint64_t const*)&v; + const uint64_t v_lo = p_value[0], v_hi = p_value[1]; +#if !defined(BOOST_ATOMIC_DETAIL_NO_ASM_IMPLIED_ZERO_DISPLACEMENTS) + __asm__ __volatile__ + ( + "movq %[dest], %%rax\n\t" + "movq 8+%[dest], %%rdx\n\t" + ".align 16\n\t" + "1: lock; cmpxchg16b %[dest]\n\t" + "jne 1b\n\t" + : "=&A" (v), [dest] "+o" (storage) + : "b" (v_lo), "c" (v_hi) + : BOOST_ATOMIC_DETAIL_ASM_CLOBBER_CC_COMMA "memory" + ); +#else // !defined(BOOST_ATOMIC_DETAIL_NO_ASM_IMPLIED_ZERO_DISPLACEMENTS) + __asm__ __volatile__ + ( + "movq 0(%[dest]), %%rax\n\t" + "movq 8(%[dest]), %%rdx\n\t" + ".align 16\n\t" + "1: lock; cmpxchg16b 0(%[dest])\n\t" + "jne 1b\n\t" + : "=&A" (v) + : "b" (v_lo), "c" (v_hi), [dest] "r" (&storage) + : BOOST_ATOMIC_DETAIL_ASM_CLOBBER_CC_COMMA "memory" + ); +#endif // !defined(BOOST_ATOMIC_DETAIL_NO_ASM_IMPLIED_ZERO_DISPLACEMENTS) + + return v; +#endif + } + static BOOST_FORCEINLINE bool is_lock_free(storage_type const volatile&) BOOST_NOEXCEPT { return true; diff --git a/3party/boost/boost/atomic/detail/ops_linux_arm.hpp b/3party/boost/boost/atomic/detail/ops_linux_arm.hpp index 25167b1974..01894b63ee 100644 --- a/3party/boost/boost/atomic/detail/ops_linux_arm.hpp +++ b/3party/boost/boost/atomic/detail/ops_linux_arm.hpp @@ -57,6 +57,8 @@ namespace detail { struct linux_arm_cas_base { + static BOOST_CONSTEXPR_OR_CONST bool is_always_lock_free = true; + static BOOST_FORCEINLINE void fence_before_store(memory_order order) BOOST_NOEXCEPT { if ((order & memory_order_release) != 0) @@ -87,6 +89,7 @@ struct linux_arm_cas : public linux_arm_cas_base { typedef typename make_storage_type< 4u, Signed >::type storage_type; + typedef typename make_storage_type< 4u, Signed >::aligned aligned_storage_type; static BOOST_FORCEINLINE void store(storage_type volatile& storage, storage_type v, memory_order order) BOOST_NOEXCEPT { @@ -142,19 +145,19 @@ struct linux_arm_cas : template< bool Signed > struct operations< 1u, Signed > : - public extending_cas_based_operations< cas_based_operations< linux_arm_cas< Signed > >, 1u, Signed > + public extending_cas_based_operations< cas_based_operations< cas_based_exchange< linux_arm_cas< Signed > > >, 1u, Signed > { }; template< bool Signed > struct operations< 2u, Signed > : - public extending_cas_based_operations< cas_based_operations< linux_arm_cas< Signed > >, 2u, Signed > + public extending_cas_based_operations< cas_based_operations< cas_based_exchange< linux_arm_cas< Signed > > >, 2u, Signed > { }; template< bool Signed > struct operations< 4u, Signed > : - public cas_based_operations< linux_arm_cas< Signed > > + public cas_based_operations< cas_based_exchange< linux_arm_cas< Signed > > > { }; diff --git a/3party/boost/boost/atomic/detail/ops_msvc_arm.hpp b/3party/boost/boost/atomic/detail/ops_msvc_arm.hpp index 349f7a5ae8..fd07f093fb 100644 --- a/3party/boost/boost/atomic/detail/ops_msvc_arm.hpp +++ b/3party/boost/boost/atomic/detail/ops_msvc_arm.hpp @@ -53,6 +53,8 @@ namespace detail { struct msvc_arm_operations_base { + static BOOST_CONSTEXPR_OR_CONST bool is_always_lock_free = true; + static BOOST_FORCEINLINE void hardware_full_fence() BOOST_NOEXCEPT { __dmb(0xB); // _ARM_BARRIER_ISH, see armintr.h from MSVC 11 and later @@ -135,6 +137,7 @@ struct operations< 1u, Signed > : { typedef msvc_arm_operations< typename make_storage_type< 1u, Signed >::type, operations< 1u, Signed > > base_type; typedef typename base_type::storage_type storage_type; + typedef typename make_storage_type< 1u, Signed >::aligned aligned_storage_type; static BOOST_FORCEINLINE void store(storage_type volatile& storage, storage_type v, memory_order order) BOOST_NOEXCEPT { @@ -300,6 +303,7 @@ struct operations< 2u, Signed > : { typedef msvc_arm_operations< typename make_storage_type< 2u, Signed >::type, operations< 2u, Signed > > base_type; typedef typename base_type::storage_type storage_type; + typedef typename make_storage_type< 2u, Signed >::aligned aligned_storage_type; static BOOST_FORCEINLINE void store(storage_type volatile& storage, storage_type v, memory_order order) BOOST_NOEXCEPT { @@ -465,6 +469,7 @@ struct operations< 4u, Signed > : { typedef msvc_arm_operations< typename make_storage_type< 4u, Signed >::type, operations< 4u, Signed > > base_type; typedef typename base_type::storage_type storage_type; + typedef typename make_storage_type< 4u, Signed >::aligned aligned_storage_type; static BOOST_FORCEINLINE void store(storage_type volatile& storage, storage_type v, memory_order order) BOOST_NOEXCEPT { @@ -630,6 +635,7 @@ struct operations< 8u, Signed > : { typedef msvc_arm_operations< typename make_storage_type< 8u, Signed >::type, operations< 8u, Signed > > base_type; typedef typename base_type::storage_type storage_type; + typedef typename make_storage_type< 8u, Signed >::aligned aligned_storage_type; static BOOST_FORCEINLINE void store(storage_type volatile& storage, storage_type v, memory_order order) BOOST_NOEXCEPT { diff --git a/3party/boost/boost/atomic/detail/ops_msvc_x86.hpp b/3party/boost/boost/atomic/detail/ops_msvc_x86.hpp index 501d9c622d..24824214dd 100644 --- a/3party/boost/boost/atomic/detail/ops_msvc_x86.hpp +++ b/3party/boost/boost/atomic/detail/ops_msvc_x86.hpp @@ -42,7 +42,7 @@ #pragma warning(disable: 4731) #endif -#if defined(_MSC_VER) && (defined(_M_AMD64) || (defined(_M_IX86) && defined(_M_IX86_FP) && _M_IX86_FP >= 2)) +#if defined(BOOST_ATOMIC_DETAIL_X86_HAS_MFENCE) extern "C" void _mm_mfence(void); #if defined(BOOST_MSVC) #pragma intrinsic(_mm_mfence) @@ -72,10 +72,11 @@ namespace detail { struct msvc_x86_operations_base { + static BOOST_CONSTEXPR_OR_CONST bool is_always_lock_free = true; + static BOOST_FORCEINLINE void hardware_full_fence() BOOST_NOEXCEPT { -#if defined(_MSC_VER) && (defined(_M_AMD64) || (defined(_M_IX86) && defined(_M_IX86_FP) && _M_IX86_FP >= 2)) - // Use mfence only if SSE2 is available +#if defined(BOOST_ATOMIC_DETAIL_X86_HAS_MFENCE) _mm_mfence(); #else long tmp; @@ -166,6 +167,7 @@ struct operations< 4u, Signed > : { typedef msvc_x86_operations< typename make_storage_type< 4u, Signed >::type, operations< 4u, Signed > > base_type; typedef typename base_type::storage_type storage_type; + typedef typename make_storage_type< 4u, Signed >::aligned aligned_storage_type; static BOOST_FORCEINLINE storage_type fetch_add(storage_type volatile& storage, storage_type v, memory_order) BOOST_NOEXCEPT { @@ -237,6 +239,7 @@ struct operations< 1u, Signed > : { typedef msvc_x86_operations< typename make_storage_type< 1u, Signed >::type, operations< 1u, Signed > > base_type; typedef typename base_type::storage_type storage_type; + typedef typename make_storage_type< 1u, Signed >::aligned aligned_storage_type; static BOOST_FORCEINLINE storage_type fetch_add(storage_type volatile& storage, storage_type v, memory_order) BOOST_NOEXCEPT { @@ -281,6 +284,7 @@ struct operations< 1u, Signed > : { typedef msvc_x86_operations< typename make_storage_type< 1u, Signed >::type, operations< 1u, Signed > > base_type; typedef typename base_type::storage_type storage_type; + typedef typename make_storage_type< 1u, Signed >::aligned aligned_storage_type; static BOOST_FORCEINLINE storage_type fetch_add(storage_type volatile& storage, storage_type v, memory_order order) BOOST_NOEXCEPT { @@ -421,6 +425,7 @@ struct operations< 2u, Signed > : { typedef msvc_x86_operations< typename make_storage_type< 2u, Signed >::type, operations< 2u, Signed > > base_type; typedef typename base_type::storage_type storage_type; + typedef typename make_storage_type< 2u, Signed >::aligned aligned_storage_type; static BOOST_FORCEINLINE storage_type fetch_add(storage_type volatile& storage, storage_type v, memory_order) BOOST_NOEXCEPT { @@ -465,6 +470,7 @@ struct operations< 2u, Signed > : { typedef msvc_x86_operations< typename make_storage_type< 2u, Signed >::type, operations< 2u, Signed > > base_type; typedef typename base_type::storage_type storage_type; + typedef typename make_storage_type< 2u, Signed >::aligned aligned_storage_type; static BOOST_FORCEINLINE storage_type fetch_add(storage_type volatile& storage, storage_type v, memory_order order) BOOST_NOEXCEPT { @@ -604,6 +610,9 @@ template< bool Signed > struct msvc_dcas_x86 { typedef typename make_storage_type< 8u, Signed >::type storage_type; + typedef typename make_storage_type< 8u, Signed >::aligned aligned_storage_type; + + static BOOST_CONSTEXPR_OR_CONST bool is_always_lock_free = true; // Intel 64 and IA-32 Architectures Software Developer's Manual, Volume 3A, 8.1.1. Guaranteed Atomic Operations: // @@ -611,10 +620,12 @@ struct msvc_dcas_x86 // * Reading or writing a quadword aligned on a 64-bit boundary // // Luckily, the memory is almost always 8-byte aligned in our case because atomic<> uses 64 bit native types for storage and dynamic memory allocations - // have at least 8 byte alignment. The only unfortunate case is when atomic is placeod on the stack and it is not 8-byte aligned (like on 32 bit Windows). + // have at least 8 byte alignment. The only unfortunate case is when atomic is placed on the stack and it is not 8-byte aligned (like on 32 bit Windows). static BOOST_FORCEINLINE void store(storage_type volatile& storage, storage_type v, memory_order) BOOST_NOEXCEPT { + BOOST_ATOMIC_DETAIL_COMPILER_BARRIER(); + storage_type volatile* p = &storage; if (((uint32_t)p & 0x00000007) == 0) { @@ -661,10 +672,14 @@ struct msvc_dcas_x86 mov ebx, backup }; } + + BOOST_ATOMIC_DETAIL_COMPILER_BARRIER(); } static BOOST_FORCEINLINE storage_type load(storage_type const volatile& storage, memory_order) BOOST_NOEXCEPT { + BOOST_ATOMIC_DETAIL_COMPILER_BARRIER(); + storage_type const volatile* p = &storage; storage_type value; @@ -710,18 +725,23 @@ struct msvc_dcas_x86 }; } + BOOST_ATOMIC_DETAIL_COMPILER_BARRIER(); + return value; } static BOOST_FORCEINLINE bool compare_exchange_strong( storage_type volatile& storage, storage_type& expected, storage_type desired, memory_order, memory_order) BOOST_NOEXCEPT { + // MSVC-11 in 32-bit mode sometimes generates messed up code without compiler barriers, + // even though the _InterlockedCompareExchange64 intrinsic already provides one. + BOOST_ATOMIC_DETAIL_COMPILER_BARRIER(); + storage_type volatile* p = &storage; #if defined(BOOST_ATOMIC_INTERLOCKED_COMPARE_EXCHANGE64) const storage_type old_val = (storage_type)BOOST_ATOMIC_INTERLOCKED_COMPARE_EXCHANGE64(p, desired, expected); const bool result = (old_val == expected); expected = old_val; - return result; #else bool result; int backup; @@ -740,8 +760,10 @@ struct msvc_dcas_x86 mov ebx, backup sete result }; - return result; #endif + BOOST_ATOMIC_DETAIL_COMPILER_BARRIER(); + + return result; } static BOOST_FORCEINLINE bool compare_exchange_weak( @@ -750,6 +772,34 @@ struct msvc_dcas_x86 return compare_exchange_strong(storage, expected, desired, success_order, failure_order); } + static BOOST_FORCEINLINE storage_type exchange(storage_type volatile& storage, storage_type v, memory_order) BOOST_NOEXCEPT + { + BOOST_ATOMIC_DETAIL_COMPILER_BARRIER(); + + storage_type volatile* p = &storage; + int backup; + __asm + { + mov backup, ebx + mov edi, p + mov ebx, dword ptr [v] + mov ecx, dword ptr [v + 4] + mov eax, dword ptr [edi] + mov edx, dword ptr [edi + 4] + align 16 + again: + lock cmpxchg8b qword ptr [edi] + jne again + mov ebx, backup + mov dword ptr [v], eax + mov dword ptr [v + 4], edx + }; + + BOOST_ATOMIC_DETAIL_COMPILER_BARRIER(); + + return v; + } + static BOOST_FORCEINLINE bool is_lock_free(storage_type const volatile&) BOOST_NOEXCEPT { return true; @@ -770,6 +820,7 @@ struct operations< 8u, Signed > : { typedef msvc_x86_operations< typename make_storage_type< 8u, Signed >::type, operations< 8u, Signed > > base_type; typedef typename base_type::storage_type storage_type; + typedef typename make_storage_type< 8u, Signed >::aligned aligned_storage_type; static BOOST_FORCEINLINE storage_type fetch_add(storage_type volatile& storage, storage_type v, memory_order) BOOST_NOEXCEPT { @@ -814,6 +865,9 @@ template< bool Signed > struct msvc_dcas_x86_64 { typedef typename make_storage_type< 16u, Signed >::type storage_type; + typedef typename make_storage_type< 16u, Signed >::aligned aligned_storage_type; + + static BOOST_CONSTEXPR_OR_CONST bool is_always_lock_free = true; static BOOST_FORCEINLINE void store(storage_type volatile& storage, storage_type v, memory_order) BOOST_NOEXCEPT { @@ -848,7 +902,7 @@ struct msvc_dcas_x86_64 template< bool Signed > struct operations< 16u, Signed > : - public cas_based_operations< msvc_dcas_x86_64< Signed > > + public cas_based_operations< cas_based_exchange< msvc_dcas_x86_64< Signed > > > { }; diff --git a/3party/boost/boost/atomic/detail/ops_windows.hpp b/3party/boost/boost/atomic/detail/ops_windows.hpp index 1b4b04c8bc..867f1c6113 100644 --- a/3party/boost/boost/atomic/detail/ops_windows.hpp +++ b/3party/boost/boost/atomic/detail/ops_windows.hpp @@ -43,6 +43,8 @@ namespace detail { struct windows_operations_base { + static BOOST_CONSTEXPR_OR_CONST bool is_always_lock_free = true; + static BOOST_FORCEINLINE void hardware_full_fence() BOOST_NOEXCEPT { long tmp; @@ -110,6 +112,7 @@ struct operations< 4u, Signed > : { typedef windows_operations< typename make_storage_type< 4u, Signed >::type, operations< 4u, Signed > > base_type; typedef typename base_type::storage_type storage_type; + typedef typename make_storage_type< 4u, Signed >::aligned aligned_storage_type; static BOOST_FORCEINLINE storage_type fetch_add(storage_type volatile& storage, storage_type v, memory_order order) BOOST_NOEXCEPT { diff --git a/3party/boost/boost/atomic/detail/platform.hpp b/3party/boost/boost/atomic/detail/platform.hpp index 76ad4ebb8f..cc3cf1b67a 100644 --- a/3party/boost/boost/atomic/detail/platform.hpp +++ b/3party/boost/boost/atomic/detail/platform.hpp @@ -24,7 +24,13 @@ #if !defined(BOOST_ATOMIC_FORCE_FALLBACK) // Compiler-based backends -#if ((defined(__GNUC__) && ((__GNUC__ * 100 + __GNUC_MINOR__) >= 407)) ||\ +#if (defined(__ibmxl__) || defined(__IBMCPP__)) && defined(__PPC__) + +// IBM XL C++ Compiler has to be checked before GCC/Clang as it pretends to be one but does not support __atomic* intrinsics. +// It does support GCC inline assembler though. +#define BOOST_ATOMIC_DETAIL_PLATFORM gcc_ppc + +#elif ((defined(__GNUC__) && ((__GNUC__ * 100 + __GNUC_MINOR__) >= 407)) ||\ (defined(BOOST_CLANG) && ((__clang_major__ * 100 + __clang_minor__) >= 302))) &&\ (\ (__GCC_ATOMIC_BOOL_LOCK_FREE + 0) == 2 ||\ @@ -37,7 +43,7 @@ #define BOOST_ATOMIC_DETAIL_PLATFORM gcc_atomic -#elif defined(__GNUC__) && (defined(__i386__) || defined(__x86_64__)) +#elif (defined(__GNUC__) || defined(__SUNPRO_CC)) && (defined(__i386__) || defined(__x86_64__)) #define BOOST_ATOMIC_DETAIL_PLATFORM gcc_x86 @@ -59,7 +65,7 @@ #define BOOST_ATOMIC_DETAIL_PLATFORM gcc_arm -#elif defined(__GNUC__) && defined(__sparc_v9__) +#elif (defined(__GNUC__) || defined(__SUNPRO_CC)) && (defined(__sparcv8plus) || defined(__sparc_v9__)) #define BOOST_ATOMIC_DETAIL_PLATFORM gcc_sparc @@ -82,7 +88,7 @@ #define BOOST_ATOMIC_DETAIL_PLATFORM msvc_x86 -#elif defined(_MSC_VER) && _MSC_VER >= 1700 && defined(_M_ARM) +#elif defined(_MSC_VER) && _MSC_VER >= 1700 && (defined(_M_ARM) || defined(_M_ARM64)) #define BOOST_ATOMIC_DETAIL_PLATFORM msvc_arm diff --git a/3party/boost/boost/atomic/detail/storage_type.hpp b/3party/boost/boost/atomic/detail/storage_type.hpp index a024f1d327..63a7cef581 100644 --- a/3party/boost/boost/atomic/detail/storage_type.hpp +++ b/3party/boost/boost/atomic/detail/storage_type.hpp @@ -16,9 +16,12 @@ #ifndef BOOST_ATOMIC_DETAIL_STORAGE_TYPE_HPP_INCLUDED_ #define BOOST_ATOMIC_DETAIL_STORAGE_TYPE_HPP_INCLUDED_ -#include +#include #include #include +#if !defined(BOOST_ATOMIC_DETAIL_HAS_BUILTIN_MEMCMP) || !defined(BOOST_ATOMIC_DETAIL_HAS_BUILTIN_MEMCPY) +#include +#endif #ifdef BOOST_HAS_PRAGMA_ONCE #pragma once @@ -28,84 +31,163 @@ namespace boost { namespace atomics { namespace detail { -template< unsigned int Size > +template< typename T > +BOOST_FORCEINLINE void non_atomic_load(T const volatile& from, T& to) BOOST_NOEXCEPT +{ + to = from; +} + +template< std::size_t Size > struct buffer_storage { - unsigned char data[Size]; + BOOST_ALIGNMENT(16) unsigned char data[Size]; BOOST_FORCEINLINE bool operator! () const BOOST_NOEXCEPT { - bool result = true; - for (unsigned int i = 0; i < Size && result; ++i) - { - result &= data[i] == 0; - } - return result; + return (data[0] == 0u && BOOST_ATOMIC_DETAIL_MEMCMP(data, data + 1, Size - 1) == 0); } BOOST_FORCEINLINE bool operator== (buffer_storage const& that) const BOOST_NOEXCEPT { - return std::memcmp(data, that.data, Size) == 0; + return BOOST_ATOMIC_DETAIL_MEMCMP(data, that.data, Size) == 0; } BOOST_FORCEINLINE bool operator!= (buffer_storage const& that) const BOOST_NOEXCEPT { - return std::memcmp(data, that.data, Size) != 0; + return BOOST_ATOMIC_DETAIL_MEMCMP(data, that.data, Size) != 0; } }; -template< unsigned int Size, bool Signed > +template< std::size_t Size > +BOOST_FORCEINLINE void non_atomic_load(buffer_storage< Size > const volatile& from, buffer_storage< Size >& to) BOOST_NOEXCEPT +{ + BOOST_ATOMIC_DETAIL_MEMCPY(to.data, const_cast< unsigned char const* >(from.data), Size); +} + +template< std::size_t Size, bool Signed > struct make_storage_type { typedef buffer_storage< Size > type; + + struct aligned + { + type value; + + BOOST_DEFAULTED_FUNCTION(aligned(), {}) + BOOST_FORCEINLINE BOOST_CONSTEXPR explicit aligned(type const& v) BOOST_NOEXCEPT : value(v) {} + }; }; template< > struct make_storage_type< 1u, false > { typedef boost::uint8_t type; + + struct aligned + { + type value; + + BOOST_DEFAULTED_FUNCTION(aligned(), {}) + BOOST_FORCEINLINE BOOST_CONSTEXPR explicit aligned(type v) BOOST_NOEXCEPT : value(v) {} + }; }; template< > struct make_storage_type< 1u, true > { typedef boost::int8_t type; + + struct aligned + { + type value; + + BOOST_DEFAULTED_FUNCTION(aligned(), {}) + BOOST_FORCEINLINE BOOST_CONSTEXPR explicit aligned(type v) BOOST_NOEXCEPT : value(v) {} + }; }; template< > struct make_storage_type< 2u, false > { typedef boost::uint16_t type; + + struct aligned + { + BOOST_ALIGNMENT(2) type value; + + BOOST_DEFAULTED_FUNCTION(aligned(), {}) + BOOST_FORCEINLINE BOOST_CONSTEXPR explicit aligned(type v) BOOST_NOEXCEPT : value(v) {} + }; }; template< > struct make_storage_type< 2u, true > { typedef boost::int16_t type; + + struct aligned + { + BOOST_ALIGNMENT(2) type value; + + BOOST_DEFAULTED_FUNCTION(aligned(), {}) + BOOST_FORCEINLINE BOOST_CONSTEXPR explicit aligned(type v) BOOST_NOEXCEPT : value(v) {} + }; }; template< > struct make_storage_type< 4u, false > { typedef boost::uint32_t type; + + struct aligned + { + BOOST_ALIGNMENT(4) type value; + + BOOST_DEFAULTED_FUNCTION(aligned(), {}) + BOOST_FORCEINLINE BOOST_CONSTEXPR explicit aligned(type v) BOOST_NOEXCEPT : value(v) {} + }; }; template< > struct make_storage_type< 4u, true > { typedef boost::int32_t type; + + struct aligned + { + BOOST_ALIGNMENT(4) type value; + + BOOST_DEFAULTED_FUNCTION(aligned(), {}) + BOOST_FORCEINLINE BOOST_CONSTEXPR explicit aligned(type v) BOOST_NOEXCEPT : value(v) {} + }; }; template< > struct make_storage_type< 8u, false > { typedef boost::uint64_t type; + + struct aligned + { + BOOST_ALIGNMENT(8) type value; + + BOOST_DEFAULTED_FUNCTION(aligned(), {}) + BOOST_FORCEINLINE BOOST_CONSTEXPR explicit aligned(type v) BOOST_NOEXCEPT : value(v) {} + }; }; template< > struct make_storage_type< 8u, true > { typedef boost::int64_t type; + + struct aligned + { + BOOST_ALIGNMENT(8) type value; + + BOOST_DEFAULTED_FUNCTION(aligned(), {}) + BOOST_FORCEINLINE BOOST_CONSTEXPR explicit aligned(type v) BOOST_NOEXCEPT : value(v) {} + }; }; #if defined(BOOST_HAS_INT128) @@ -114,17 +196,33 @@ template< > struct make_storage_type< 16u, false > { typedef boost::uint128_type type; + + struct aligned + { + BOOST_ALIGNMENT(16) type value; + + BOOST_DEFAULTED_FUNCTION(aligned(), {}) + BOOST_FORCEINLINE BOOST_CONSTEXPR explicit aligned(type v) BOOST_NOEXCEPT : value(v) {} + }; }; template< > struct make_storage_type< 16u, true > { typedef boost::int128_type type; + + struct aligned + { + BOOST_ALIGNMENT(16) type value; + + BOOST_DEFAULTED_FUNCTION(aligned(), {}) + BOOST_FORCEINLINE BOOST_CONSTEXPR explicit aligned(type v) BOOST_NOEXCEPT : value(v) {} + }; }; #elif !defined(BOOST_NO_ALIGNMENT) -struct BOOST_ALIGNMENT(16) storage128_t +struct storage128_t { boost::uint64_t data[2]; @@ -143,10 +241,24 @@ BOOST_FORCEINLINE bool operator!= (storage128_t const& left, storage128_t const& return !(left == right); } +BOOST_FORCEINLINE void non_atomic_load(storage128_t const volatile& from, storage128_t& to) BOOST_NOEXCEPT +{ + to.data[0] = from.data[0]; + to.data[1] = from.data[1]; +} + template< bool Signed > struct make_storage_type< 16u, Signed > { typedef storage128_t type; + + struct aligned + { + BOOST_ALIGNMENT(16) type value; + + BOOST_DEFAULTED_FUNCTION(aligned(), {}) + BOOST_FORCEINLINE BOOST_CONSTEXPR explicit aligned(type const& v) BOOST_NOEXCEPT : value(v) {} + }; }; #endif diff --git a/3party/boost/boost/bimap/detail/debug/static_error.hpp b/3party/boost/boost/bimap/detail/debug/static_error.hpp index cbb1cadb8d..4e5cb26371 100644 --- a/3party/boost/boost/bimap/detail/debug/static_error.hpp +++ b/3party/boost/boost/bimap/detail/debug/static_error.hpp @@ -25,7 +25,6 @@ // a static error. /*===========================================================================*/ #define BOOST_BIMAP_STATIC_ERROR(MESSAGE,VARIABLES) \ - struct BOOST_PP_CAT(BIMAP_STATIC_ERROR__,MESSAGE) {}; \ BOOST_MPL_ASSERT_MSG(false, \ BOOST_PP_CAT(BIMAP_STATIC_ERROR__,MESSAGE), \ VARIABLES) diff --git a/3party/boost/boost/bind.hpp b/3party/boost/boost/bind.hpp index fd3421ea5a..450120c7a7 100644 --- a/3party/boost/boost/bind.hpp +++ b/3party/boost/boost/bind.hpp @@ -10,7 +10,7 @@ // // bind.hpp - binds function objects to arguments // -// Copyright (c) 2009 Peter Dimov +// Copyright (c) 2009, 2015 Peter Dimov // // Distributed under the Boost Software License, Version 1.0. // See accompanying file LICENSE_1_0.txt or copy at @@ -21,4 +21,21 @@ #include +#ifndef BOOST_BIND_NO_PLACEHOLDERS + +#if defined(BOOST_CLANG) +# pragma clang diagnostic push +# if __has_warning("-Wheader-hygiene") +# pragma clang diagnostic ignored "-Wheader-hygiene" +# endif +#endif + +using namespace boost::placeholders; + +#if defined(BOOST_CLANG) +# pragma clang diagnostic pop +#endif + +#endif // #ifndef BOOST_BIND_NO_PLACEHOLDERS + #endif // #ifndef BOOST_BIND_HPP_INCLUDED diff --git a/3party/boost/boost/bind/arg.hpp b/3party/boost/boost/bind/arg.hpp index c879bb408b..cb52e6689f 100644 --- a/3party/boost/boost/bind/arg.hpp +++ b/3party/boost/boost/bind/arg.hpp @@ -21,24 +21,31 @@ #include #include -#include namespace boost { +template struct _arg_eq +{ +}; + +template<> struct _arg_eq +{ + typedef void type; +}; + template< int I > struct arg { - arg() + BOOST_CONSTEXPR arg() { } - template< class T > arg( T const & /* t */ ) + template< class T > BOOST_CONSTEXPR arg( T const & /* t */, typename _arg_eq< I == is_placeholder::value >::type * = 0 ) { - BOOST_STATIC_ASSERT( I == is_placeholder::value ); } }; -template< int I > bool operator==( arg const &, arg const & ) +template< int I > BOOST_CONSTEXPR bool operator==( arg const &, arg const & ) { return true; } diff --git a/3party/boost/boost/bind/bind.hpp b/3party/boost/boost/bind/bind.hpp index fd05131236..85d675a0e3 100644 --- a/3party/boost/boost/bind/bind.hpp +++ b/3party/boost/boost/bind/bind.hpp @@ -32,6 +32,10 @@ #include #include +#if !defined( BOOST_NO_CXX11_RVALUE_REFERENCES ) +#include // std::forward +#endif + // Borland-specific bug, visit_each() silently fails to produce code #if defined(__BORLANDC__) @@ -863,14 +867,409 @@ public: #if !defined( BOOST_NO_CXX11_RVALUE_REFERENCES ) -template< class A > struct list_add_cref +template< class A1 > class rrlist1 { - typedef A const & type; +private: + + A1 & a1_; // not A1&& because of msvc-10.0 + +public: + + explicit rrlist1( A1 & a1 ): a1_( a1 ) {} + + A1 && operator[] (boost::arg<1>) const { return std::forward( a1_ ); } // not static_cast because of g++ 4.9 + + A1 && operator[] (boost::arg<1> (*) ()) const { return std::forward( a1_ ); } + + template T & operator[] ( _bi::value & v ) const { return v.get(); } + + template T const & operator[] ( _bi::value const & v ) const { return v.get(); } + + template T & operator[] (reference_wrapper const & v) const { return v.get(); } + + template typename result_traits::type operator[] (bind_t & b) const + { + rrlist1 a( a1_ ); + return b.eval( a ); + } + + template typename result_traits::type operator[] (bind_t const & b) const + { + rrlist1 a( a1_ ); + return b.eval( a ); + } }; -template< class A > struct list_add_cref< A& > +template< class A1, class A2 > class rrlist2 { - typedef A & type; +private: + + A1 & a1_; + A2 & a2_; + +public: + + rrlist2( A1 & a1, A2 & a2 ): a1_( a1 ), a2_( a2 ) {} + + A1 && operator[] (boost::arg<1>) const { return std::forward( a1_ ); } + A2 && operator[] (boost::arg<2>) const { return std::forward( a2_ ); } + + A1 && operator[] (boost::arg<1> (*) ()) const { return std::forward( a1_ ); } + A2 && operator[] (boost::arg<2> (*) ()) const { return std::forward( a2_ ); } + + template T & operator[] ( _bi::value & v ) const { return v.get(); } + + template T const & operator[] ( _bi::value const & v ) const { return v.get(); } + + template T & operator[] (reference_wrapper const & v) const { return v.get(); } + + template typename result_traits::type operator[] (bind_t & b) const + { + rrlist2 a( a1_, a2_ ); + return b.eval( a ); + } + + template typename result_traits::type operator[] (bind_t const & b) const + { + rrlist2 a( a1_, a2_ ); + return b.eval( a ); + } +}; + +template< class A1, class A2, class A3 > class rrlist3 +{ +private: + + A1 & a1_; + A2 & a2_; + A3 & a3_; + +public: + + rrlist3( A1 & a1, A2 & a2, A3 & a3 ): a1_( a1 ), a2_( a2 ), a3_( a3 ) {} + + A1 && operator[] (boost::arg<1>) const { return std::forward( a1_ ); } + A2 && operator[] (boost::arg<2>) const { return std::forward( a2_ ); } + A3 && operator[] (boost::arg<3>) const { return std::forward( a3_ ); } + + A1 && operator[] (boost::arg<1> (*) ()) const { return std::forward( a1_ ); } + A2 && operator[] (boost::arg<2> (*) ()) const { return std::forward( a2_ ); } + A3 && operator[] (boost::arg<3> (*) ()) const { return std::forward( a3_ ); } + + template T & operator[] ( _bi::value & v ) const { return v.get(); } + + template T const & operator[] ( _bi::value const & v ) const { return v.get(); } + + template T & operator[] (reference_wrapper const & v) const { return v.get(); } + + template typename result_traits::type operator[] (bind_t & b) const + { + rrlist3 a( a1_, a2_, a3_ ); + return b.eval( a ); + } + + template typename result_traits::type operator[] (bind_t const & b) const + { + rrlist3 a( a1_, a2_, a3_ ); + return b.eval( a ); + } +}; + +template< class A1, class A2, class A3, class A4 > class rrlist4 +{ +private: + + A1 & a1_; + A2 & a2_; + A3 & a3_; + A4 & a4_; + +public: + + rrlist4( A1 & a1, A2 & a2, A3 & a3, A4 & a4 ): a1_( a1 ), a2_( a2 ), a3_( a3 ), a4_( a4 ) {} + + A1 && operator[] (boost::arg<1>) const { return std::forward( a1_ ); } + A2 && operator[] (boost::arg<2>) const { return std::forward( a2_ ); } + A3 && operator[] (boost::arg<3>) const { return std::forward( a3_ ); } + A4 && operator[] (boost::arg<4>) const { return std::forward( a4_ ); } + + A1 && operator[] (boost::arg<1> (*) ()) const { return std::forward( a1_ ); } + A2 && operator[] (boost::arg<2> (*) ()) const { return std::forward( a2_ ); } + A3 && operator[] (boost::arg<3> (*) ()) const { return std::forward( a3_ ); } + A4 && operator[] (boost::arg<4> (*) ()) const { return std::forward( a4_ ); } + + template T & operator[] ( _bi::value & v ) const { return v.get(); } + + template T const & operator[] ( _bi::value const & v ) const { return v.get(); } + + template T & operator[] (reference_wrapper const & v) const { return v.get(); } + + template typename result_traits::type operator[] (bind_t & b) const + { + rrlist4 a( a1_, a2_, a3_, a4_ ); + return b.eval( a ); + } + + template typename result_traits::type operator[] (bind_t const & b) const + { + rrlist4 a( a1_, a2_, a3_, a4_ ); + return b.eval( a ); + } +}; + +template< class A1, class A2, class A3, class A4, class A5 > class rrlist5 +{ +private: + + A1 & a1_; + A2 & a2_; + A3 & a3_; + A4 & a4_; + A5 & a5_; + +public: + + rrlist5( A1 & a1, A2 & a2, A3 & a3, A4 & a4, A5 & a5 ): a1_( a1 ), a2_( a2 ), a3_( a3 ), a4_( a4 ), a5_( a5 ) {} + + A1 && operator[] (boost::arg<1>) const { return std::forward( a1_ ); } + A2 && operator[] (boost::arg<2>) const { return std::forward( a2_ ); } + A3 && operator[] (boost::arg<3>) const { return std::forward( a3_ ); } + A4 && operator[] (boost::arg<4>) const { return std::forward( a4_ ); } + A5 && operator[] (boost::arg<5>) const { return std::forward( a5_ ); } + + A1 && operator[] (boost::arg<1> (*) ()) const { return std::forward( a1_ ); } + A2 && operator[] (boost::arg<2> (*) ()) const { return std::forward( a2_ ); } + A3 && operator[] (boost::arg<3> (*) ()) const { return std::forward( a3_ ); } + A4 && operator[] (boost::arg<4> (*) ()) const { return std::forward( a4_ ); } + A5 && operator[] (boost::arg<5> (*) ()) const { return std::forward( a5_ ); } + + template T & operator[] ( _bi::value & v ) const { return v.get(); } + + template T const & operator[] ( _bi::value const & v ) const { return v.get(); } + + template T & operator[] (reference_wrapper const & v) const { return v.get(); } + + template typename result_traits::type operator[] (bind_t & b) const + { + rrlist5 a( a1_, a2_, a3_, a4_, a5_ ); + return b.eval( a ); + } + + template typename result_traits::type operator[] (bind_t const & b) const + { + rrlist5 a( a1_, a2_, a3_, a4_, a5_ ); + return b.eval( a ); + } +}; + +template< class A1, class A2, class A3, class A4, class A5, class A6 > class rrlist6 +{ +private: + + A1 & a1_; + A2 & a2_; + A3 & a3_; + A4 & a4_; + A5 & a5_; + A6 & a6_; + +public: + + rrlist6( A1 & a1, A2 & a2, A3 & a3, A4 & a4, A5 & a5, A6 & a6 ): a1_( a1 ), a2_( a2 ), a3_( a3 ), a4_( a4 ), a5_( a5 ), a6_( a6 ) {} + + A1 && operator[] (boost::arg<1>) const { return std::forward( a1_ ); } + A2 && operator[] (boost::arg<2>) const { return std::forward( a2_ ); } + A3 && operator[] (boost::arg<3>) const { return std::forward( a3_ ); } + A4 && operator[] (boost::arg<4>) const { return std::forward( a4_ ); } + A5 && operator[] (boost::arg<5>) const { return std::forward( a5_ ); } + A6 && operator[] (boost::arg<6>) const { return std::forward( a6_ ); } + + A1 && operator[] (boost::arg<1> (*) ()) const { return std::forward( a1_ ); } + A2 && operator[] (boost::arg<2> (*) ()) const { return std::forward( a2_ ); } + A3 && operator[] (boost::arg<3> (*) ()) const { return std::forward( a3_ ); } + A4 && operator[] (boost::arg<4> (*) ()) const { return std::forward( a4_ ); } + A5 && operator[] (boost::arg<5> (*) ()) const { return std::forward( a5_ ); } + A6 && operator[] (boost::arg<6> (*) ()) const { return std::forward( a6_ ); } + + template T & operator[] ( _bi::value & v ) const { return v.get(); } + + template T const & operator[] ( _bi::value const & v ) const { return v.get(); } + + template T & operator[] (reference_wrapper const & v) const { return v.get(); } + + template typename result_traits::type operator[] (bind_t & b) const + { + rrlist6 a( a1_, a2_, a3_, a4_, a5_, a6_ ); + return b.eval( a ); + } + + template typename result_traits::type operator[] (bind_t const & b) const + { + rrlist6 a( a1_, a2_, a3_, a4_, a5_, a6_ ); + return b.eval( a ); + } +}; + +template< class A1, class A2, class A3, class A4, class A5, class A6, class A7 > class rrlist7 +{ +private: + + A1 & a1_; + A2 & a2_; + A3 & a3_; + A4 & a4_; + A5 & a5_; + A6 & a6_; + A7 & a7_; + +public: + + rrlist7( A1 & a1, A2 & a2, A3 & a3, A4 & a4, A5 & a5, A6 & a6, A7 & a7 ): a1_( a1 ), a2_( a2 ), a3_( a3 ), a4_( a4 ), a5_( a5 ), a6_( a6 ), a7_( a7 ) {} + + A1 && operator[] (boost::arg<1>) const { return std::forward( a1_ ); } + A2 && operator[] (boost::arg<2>) const { return std::forward( a2_ ); } + A3 && operator[] (boost::arg<3>) const { return std::forward( a3_ ); } + A4 && operator[] (boost::arg<4>) const { return std::forward( a4_ ); } + A5 && operator[] (boost::arg<5>) const { return std::forward( a5_ ); } + A6 && operator[] (boost::arg<6>) const { return std::forward( a6_ ); } + A7 && operator[] (boost::arg<7>) const { return std::forward( a7_ ); } + + A1 && operator[] (boost::arg<1> (*) ()) const { return std::forward( a1_ ); } + A2 && operator[] (boost::arg<2> (*) ()) const { return std::forward( a2_ ); } + A3 && operator[] (boost::arg<3> (*) ()) const { return std::forward( a3_ ); } + A4 && operator[] (boost::arg<4> (*) ()) const { return std::forward( a4_ ); } + A5 && operator[] (boost::arg<5> (*) ()) const { return std::forward( a5_ ); } + A6 && operator[] (boost::arg<6> (*) ()) const { return std::forward( a6_ ); } + A7 && operator[] (boost::arg<7> (*) ()) const { return std::forward( a7_ ); } + + template T & operator[] ( _bi::value & v ) const { return v.get(); } + + template T const & operator[] ( _bi::value const & v ) const { return v.get(); } + + template T & operator[] (reference_wrapper const & v) const { return v.get(); } + + template typename result_traits::type operator[] (bind_t & b) const + { + rrlist7 a( a1_, a2_, a3_, a4_, a5_, a6_, a7_ ); + return b.eval( a ); + } + + template typename result_traits::type operator[] (bind_t const & b) const + { + rrlist7 a( a1_, a2_, a3_, a4_, a5_, a6_, a7_ ); + return b.eval( a ); + } +}; + +template< class A1, class A2, class A3, class A4, class A5, class A6, class A7, class A8 > class rrlist8 +{ +private: + + A1 & a1_; + A2 & a2_; + A3 & a3_; + A4 & a4_; + A5 & a5_; + A6 & a6_; + A7 & a7_; + A8 & a8_; + +public: + + rrlist8( A1 & a1, A2 & a2, A3 & a3, A4 & a4, A5 & a5, A6 & a6, A7 & a7, A8 & a8 ): a1_( a1 ), a2_( a2 ), a3_( a3 ), a4_( a4 ), a5_( a5 ), a6_( a6 ), a7_( a7 ), a8_( a8 ) {} + + A1 && operator[] (boost::arg<1>) const { return std::forward( a1_ ); } + A2 && operator[] (boost::arg<2>) const { return std::forward( a2_ ); } + A3 && operator[] (boost::arg<3>) const { return std::forward( a3_ ); } + A4 && operator[] (boost::arg<4>) const { return std::forward( a4_ ); } + A5 && operator[] (boost::arg<5>) const { return std::forward( a5_ ); } + A6 && operator[] (boost::arg<6>) const { return std::forward( a6_ ); } + A7 && operator[] (boost::arg<7>) const { return std::forward( a7_ ); } + A8 && operator[] (boost::arg<8>) const { return std::forward( a8_ ); } + + A1 && operator[] (boost::arg<1> (*) ()) const { return std::forward( a1_ ); } + A2 && operator[] (boost::arg<2> (*) ()) const { return std::forward( a2_ ); } + A3 && operator[] (boost::arg<3> (*) ()) const { return std::forward( a3_ ); } + A4 && operator[] (boost::arg<4> (*) ()) const { return std::forward( a4_ ); } + A5 && operator[] (boost::arg<5> (*) ()) const { return std::forward( a5_ ); } + A6 && operator[] (boost::arg<6> (*) ()) const { return std::forward( a6_ ); } + A7 && operator[] (boost::arg<7> (*) ()) const { return std::forward( a7_ ); } + A8 && operator[] (boost::arg<8> (*) ()) const { return std::forward( a8_ ); } + + template T & operator[] ( _bi::value & v ) const { return v.get(); } + + template T const & operator[] ( _bi::value const & v ) const { return v.get(); } + + template T & operator[] (reference_wrapper const & v) const { return v.get(); } + + template typename result_traits::type operator[] (bind_t & b) const + { + rrlist8 a( a1_, a2_, a3_, a4_, a5_, a6_, a7_, a8_ ); + return b.eval( a ); + } + + template typename result_traits::type operator[] (bind_t const & b) const + { + rrlist8 a( a1_, a2_, a3_, a4_, a5_, a6_, a7_, a8_ ); + return b.eval( a ); + } +}; + +template< class A1, class A2, class A3, class A4, class A5, class A6, class A7, class A8, class A9 > class rrlist9 +{ +private: + + A1 & a1_; + A2 & a2_; + A3 & a3_; + A4 & a4_; + A5 & a5_; + A6 & a6_; + A7 & a7_; + A8 & a8_; + A9 & a9_; + +public: + + rrlist9( A1 & a1, A2 & a2, A3 & a3, A4 & a4, A5 & a5, A6 & a6, A7 & a7, A8 & a8, A9 & a9 ): a1_( a1 ), a2_( a2 ), a3_( a3 ), a4_( a4 ), a5_( a5 ), a6_( a6 ), a7_( a7 ), a8_( a8 ), a9_( a9 ) {} + + A1 && operator[] (boost::arg<1>) const { return std::forward( a1_ ); } + A2 && operator[] (boost::arg<2>) const { return std::forward( a2_ ); } + A3 && operator[] (boost::arg<3>) const { return std::forward( a3_ ); } + A4 && operator[] (boost::arg<4>) const { return std::forward( a4_ ); } + A5 && operator[] (boost::arg<5>) const { return std::forward( a5_ ); } + A6 && operator[] (boost::arg<6>) const { return std::forward( a6_ ); } + A7 && operator[] (boost::arg<7>) const { return std::forward( a7_ ); } + A8 && operator[] (boost::arg<8>) const { return std::forward( a8_ ); } + A9 && operator[] (boost::arg<9>) const { return std::forward( a9_ ); } + + A1 && operator[] (boost::arg<1> (*) ()) const { return std::forward( a1_ ); } + A2 && operator[] (boost::arg<2> (*) ()) const { return std::forward( a2_ ); } + A3 && operator[] (boost::arg<3> (*) ()) const { return std::forward( a3_ ); } + A4 && operator[] (boost::arg<4> (*) ()) const { return std::forward( a4_ ); } + A5 && operator[] (boost::arg<5> (*) ()) const { return std::forward( a5_ ); } + A6 && operator[] (boost::arg<6> (*) ()) const { return std::forward( a6_ ); } + A7 && operator[] (boost::arg<7> (*) ()) const { return std::forward( a7_ ); } + A8 && operator[] (boost::arg<8> (*) ()) const { return std::forward( a8_ ); } + A9 && operator[] (boost::arg<9> (*) ()) const { return std::forward( a9_ ); } + + template T & operator[] ( _bi::value & v ) const { return v.get(); } + + template T const & operator[] ( _bi::value const & v ) const { return v.get(); } + + template T & operator[] (reference_wrapper const & v) const { return v.get(); } + + template typename result_traits::type operator[] (bind_t & b) const + { + rrlist9 a( a1_, a2_, a3_, a4_, a5_, a6_, a7_, a8_, a9_ ); + return b.eval( a ); + } + + template typename result_traits::type operator[] (bind_t const & b) const + { + rrlist9 a( a1_, a2_, a3_, a4_, a5_, a6_, a7_, a8_, a9_ ); + return b.eval( a ); + } }; template class bind_t @@ -903,221 +1302,109 @@ public: template result_type operator()( A1 && a1 ) { - list1< typename list_add_cref::type > a( a1 ); + rrlist1< A1 > a( a1 ); return l_( type(), f_, a, 0 ); } template result_type operator()( A1 && a1 ) const { - list1< typename list_add_cref::type > a( a1 ); + rrlist1< A1 > a( a1 ); return l_(type(), f_, a, 0); } template result_type operator()( A1 && a1, A2 && a2 ) { - list2< typename list_add_cref::type, typename list_add_cref::type > a( a1, a2 ); + rrlist2< A1, A2 > a( a1, a2 ); return l_( type(), f_, a, 0 ); } template result_type operator()( A1 && a1, A2 && a2 ) const { - list2< typename list_add_cref::type, typename list_add_cref::type > a( a1, a2 ); + rrlist2< A1, A2 > a( a1, a2 ); return l_( type(), f_, a, 0 ); } template result_type operator()( A1 && a1, A2 && a2, A3 && a3 ) { - list3< - typename list_add_cref::type, - typename list_add_cref::type, - typename list_add_cref::type - > a( a1, a2, a3 ); - + rrlist3< A1, A2, A3 > a( a1, a2, a3 ); return l_( type(), f_, a, 0 ); } template result_type operator()( A1 && a1, A2 && a2, A3 && a3 ) const { - list3< - typename list_add_cref::type, - typename list_add_cref::type, - typename list_add_cref::type - > a( a1, a2, a3 ); - + rrlist3< A1, A2, A3 > a( a1, a2, a3 ); return l_( type(), f_, a, 0 ); } template result_type operator()( A1 && a1, A2 && a2, A3 && a3, A4 && a4 ) { - list4< - typename list_add_cref::type, - typename list_add_cref::type, - typename list_add_cref::type, - typename list_add_cref::type - > a( a1, a2, a3, a4 ); - + rrlist4< A1, A2, A3, A4 > a( a1, a2, a3, a4 ); return l_( type(), f_, a, 0 ); } template result_type operator()( A1 && a1, A2 && a2, A3 && a3, A4 && a4 ) const { - list4< - typename list_add_cref::type, - typename list_add_cref::type, - typename list_add_cref::type, - typename list_add_cref::type - > a( a1, a2, a3, a4 ); - + rrlist4< A1, A2, A3, A4 > a( a1, a2, a3, a4 ); return l_( type(), f_, a, 0 ); } template result_type operator()( A1 && a1, A2 && a2, A3 && a3, A4 && a4, A5 && a5 ) { - list5< - typename list_add_cref::type, - typename list_add_cref::type, - typename list_add_cref::type, - typename list_add_cref::type, - typename list_add_cref::type - > a( a1, a2, a3, a4, a5 ); - + rrlist5< A1, A2, A3, A4, A5 > a( a1, a2, a3, a4, a5 ); return l_( type(), f_, a, 0 ); } template result_type operator()( A1 && a1, A2 && a2, A3 && a3, A4 && a4, A5 && a5 ) const { - list5< - typename list_add_cref::type, - typename list_add_cref::type, - typename list_add_cref::type, - typename list_add_cref::type, - typename list_add_cref::type - > a( a1, a2, a3, a4, a5 ); - + rrlist5< A1, A2, A3, A4, A5 > a( a1, a2, a3, a4, a5 ); return l_( type(), f_, a, 0 ); } template result_type operator()( A1 && a1, A2 && a2, A3 && a3, A4 && a4, A5 && a5, A6 && a6 ) { - list6< - typename list_add_cref::type, - typename list_add_cref::type, - typename list_add_cref::type, - typename list_add_cref::type, - typename list_add_cref::type, - typename list_add_cref::type - > a( a1, a2, a3, a4, a5, a6 ); - + rrlist6< A1, A2, A3, A4, A5, A6 > a( a1, a2, a3, a4, a5, a6 ); return l_( type(), f_, a, 0 ); } template result_type operator()( A1 && a1, A2 && a2, A3 && a3, A4 && a4, A5 && a5, A6 && a6 ) const { - list6< - typename list_add_cref::type, - typename list_add_cref::type, - typename list_add_cref::type, - typename list_add_cref::type, - typename list_add_cref::type, - typename list_add_cref::type - > a( a1, a2, a3, a4, a5, a6 ); - + rrlist6< A1, A2, A3, A4, A5, A6 > a( a1, a2, a3, a4, a5, a6 ); return l_( type(), f_, a, 0 ); } template result_type operator()( A1 && a1, A2 && a2, A3 && a3, A4 && a4, A5 && a5, A6 && a6, A7 && a7 ) { - list7< - typename list_add_cref::type, - typename list_add_cref::type, - typename list_add_cref::type, - typename list_add_cref::type, - typename list_add_cref::type, - typename list_add_cref::type, - typename list_add_cref::type - > a( a1, a2, a3, a4, a5, a6, a7 ); - + rrlist7< A1, A2, A3, A4, A5, A6, A7 > a( a1, a2, a3, a4, a5, a6, a7 ); return l_( type(), f_, a, 0 ); } template result_type operator()( A1 && a1, A2 && a2, A3 && a3, A4 && a4, A5 && a5, A6 && a6, A7 && a7 ) const { - list7< - typename list_add_cref::type, - typename list_add_cref::type, - typename list_add_cref::type, - typename list_add_cref::type, - typename list_add_cref::type, - typename list_add_cref::type, - typename list_add_cref::type - > a( a1, a2, a3, a4, a5, a6, a7 ); - + rrlist7< A1, A2, A3, A4, A5, A6, A7 > a( a1, a2, a3, a4, a5, a6, a7 ); return l_( type(), f_, a, 0 ); } template result_type operator()( A1 && a1, A2 && a2, A3 && a3, A4 && a4, A5 && a5, A6 && a6, A7 && a7, A8 && a8 ) { - list8< - typename list_add_cref::type, - typename list_add_cref::type, - typename list_add_cref::type, - typename list_add_cref::type, - typename list_add_cref::type, - typename list_add_cref::type, - typename list_add_cref::type, - typename list_add_cref::type - > a( a1, a2, a3, a4, a5, a6, a7, a8 ); - + rrlist8< A1, A2, A3, A4, A5, A6, A7, A8 > a( a1, a2, a3, a4, a5, a6, a7, a8 ); return l_( type(), f_, a, 0 ); } template result_type operator()( A1 && a1, A2 && a2, A3 && a3, A4 && a4, A5 && a5, A6 && a6, A7 && a7, A8 && a8 ) const { - list8< - typename list_add_cref::type, - typename list_add_cref::type, - typename list_add_cref::type, - typename list_add_cref::type, - typename list_add_cref::type, - typename list_add_cref::type, - typename list_add_cref::type, - typename list_add_cref::type - > a( a1, a2, a3, a4, a5, a6, a7, a8 ); - + rrlist8< A1, A2, A3, A4, A5, A6, A7, A8 > a( a1, a2, a3, a4, a5, a6, a7, a8 ); return l_( type(), f_, a, 0 ); } template result_type operator()( A1 && a1, A2 && a2, A3 && a3, A4 && a4, A5 && a5, A6 && a6, A7 && a7, A8 && a8, A9 && a9 ) { - list9< - typename list_add_cref::type, - typename list_add_cref::type, - typename list_add_cref::type, - typename list_add_cref::type, - typename list_add_cref::type, - typename list_add_cref::type, - typename list_add_cref::type, - typename list_add_cref::type, - typename list_add_cref::type - > a( a1, a2, a3, a4, a5, a6, a7, a8, a9 ); - + rrlist9< A1, A2, A3, A4, A5, A6, A7, A8, A9 > a( a1, a2, a3, a4, a5, a6, a7, a8, a9 ); return l_( type(), f_, a, 0 ); } template result_type operator()( A1 && a1, A2 && a2, A3 && a3, A4 && a4, A5 && a5, A6 && a6, A7 && a7, A8 && a8, A9 && a9 ) const { - list9< - typename list_add_cref::type, - typename list_add_cref::type, - typename list_add_cref::type, - typename list_add_cref::type, - typename list_add_cref::type, - typename list_add_cref::type, - typename list_add_cref::type, - typename list_add_cref::type, - typename list_add_cref::type - > a( a1, a2, a3, a4, a5, a6, a7, a8, a9 ); - + rrlist9< A1, A2, A3, A4, A5, A6, A7, A8, A9 > a( a1, a2, a3, a4, a5, a6, a7, a8, a9 ); return l_( type(), f_, a, 0 ); } diff --git a/3party/boost/boost/bind/placeholders.hpp b/3party/boost/boost/bind/placeholders.hpp index 3b098b14f8..b819ef4c46 100644 --- a/3party/boost/boost/bind/placeholders.hpp +++ b/3party/boost/boost/bind/placeholders.hpp @@ -11,10 +11,11 @@ // bind/placeholders.hpp - _N definitions // // Copyright (c) 2002 Peter Dimov and Multi Media Ltd. +// Copyright 2015 Peter Dimov // -// 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) +// 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 // // See http://www.boost.org/libs/bind/bind.html for documentation. // @@ -22,48 +23,40 @@ #include #include -namespace +namespace boost +{ + +namespace placeholders { #if defined(__BORLANDC__) || defined(__GNUC__) && (__GNUC__ < 4) -static inline boost::arg<1> _1() { return boost::arg<1>(); } -static inline boost::arg<2> _2() { return boost::arg<2>(); } -static inline boost::arg<3> _3() { return boost::arg<3>(); } -static inline boost::arg<4> _4() { return boost::arg<4>(); } -static inline boost::arg<5> _5() { return boost::arg<5>(); } -static inline boost::arg<6> _6() { return boost::arg<6>(); } -static inline boost::arg<7> _7() { return boost::arg<7>(); } -static inline boost::arg<8> _8() { return boost::arg<8>(); } -static inline boost::arg<9> _9() { return boost::arg<9>(); } - -#elif defined(BOOST_MSVC) || (defined(__DECCXX_VER) && __DECCXX_VER <= 60590031) || defined(__MWERKS__) || \ - defined(__GNUC__) && (__GNUC__ == 4 && __GNUC_MINOR__ < 2) - -static boost::arg<1> _1; -static boost::arg<2> _2; -static boost::arg<3> _3; -static boost::arg<4> _4; -static boost::arg<5> _5; -static boost::arg<6> _6; -static boost::arg<7> _7; -static boost::arg<8> _8; -static boost::arg<9> _9; +inline boost::arg<1> _1() { return boost::arg<1>(); } +inline boost::arg<2> _2() { return boost::arg<2>(); } +inline boost::arg<3> _3() { return boost::arg<3>(); } +inline boost::arg<4> _4() { return boost::arg<4>(); } +inline boost::arg<5> _5() { return boost::arg<5>(); } +inline boost::arg<6> _6() { return boost::arg<6>(); } +inline boost::arg<7> _7() { return boost::arg<7>(); } +inline boost::arg<8> _8() { return boost::arg<8>(); } +inline boost::arg<9> _9() { return boost::arg<9>(); } #else -boost::arg<1> _1; -boost::arg<2> _2; -boost::arg<3> _3; -boost::arg<4> _4; -boost::arg<5> _5; -boost::arg<6> _6; -boost::arg<7> _7; -boost::arg<8> _8; -boost::arg<9> _9; +BOOST_STATIC_CONSTEXPR boost::arg<1> _1; +BOOST_STATIC_CONSTEXPR boost::arg<2> _2; +BOOST_STATIC_CONSTEXPR boost::arg<3> _3; +BOOST_STATIC_CONSTEXPR boost::arg<4> _4; +BOOST_STATIC_CONSTEXPR boost::arg<5> _5; +BOOST_STATIC_CONSTEXPR boost::arg<6> _6; +BOOST_STATIC_CONSTEXPR boost::arg<7> _7; +BOOST_STATIC_CONSTEXPR boost::arg<8> _8; +BOOST_STATIC_CONSTEXPR boost::arg<9> _9; #endif -} // unnamed namespace +} // namespace placeholders + +} // namespace boost #endif // #ifndef BOOST_BIND_PLACEHOLDERS_HPP_INCLUDED diff --git a/3party/boost/boost/cerrno.hpp b/3party/boost/boost/cerrno.hpp index 6f2669846d..57278f5cee 100644 --- a/3party/boost/boost/cerrno.hpp +++ b/3party/boost/boost/cerrno.hpp @@ -7,8 +7,8 @@ // See library home page at http://www.boost.org/libs/system -#ifndef BOOST_CERRNO_HPP -#define BOOST_CERRNO_HPP +#ifndef BOOST_SYSTEM_CERRNO_HPP +#define BOOST_SYSTEM_CERRNO_HPP #include diff --git a/3party/boost/boost/chrono/detail/inlined/chrono.hpp b/3party/boost/boost/chrono/detail/inlined/chrono.hpp index 027884365e..3bad546d4c 100644 --- a/3party/boost/boost/chrono/detail/inlined/chrono.hpp +++ b/3party/boost/boost/chrono/detail/inlined/chrono.hpp @@ -11,7 +11,9 @@ #include #include +#if defined BOOST_CHRONO_PROVIDE_HYBRID_ERROR_HANDLING #include +#endif #include #include diff --git a/3party/boost/boost/chrono/detail/inlined/mac/chrono.hpp b/3party/boost/boost/chrono/detail/inlined/mac/chrono.hpp index bf20ae924b..0bd3400a25 100644 --- a/3party/boost/boost/chrono/detail/inlined/mac/chrono.hpp +++ b/3party/boost/boost/chrono/detail/inlined/mac/chrono.hpp @@ -13,6 +13,7 @@ #include //for gettimeofday and timeval #include // mach_absolute_time, mach_timebase_info_data_t +#include namespace boost { @@ -39,7 +40,7 @@ system_clock::now(system::error_code & ec) { timeval tv; gettimeofday(&tv, 0); - if (!BOOST_CHRONO_IS_THROWS(ec)) + if (!BOOST_CHRONO_IS_THROWS(ec)) { ec.clear(); } @@ -88,7 +89,7 @@ BOOST_CHRONO_STATIC steady_clock::rep steady_simplified_ec(system::error_code & ec) { - if (!BOOST_CHRONO_IS_THROWS(ec)) + if (!BOOST_CHRONO_IS_THROWS(ec)) { ec.clear(); } @@ -112,9 +113,9 @@ BOOST_CHRONO_STATIC steady_clock::rep steady_full() { - static kern_return_t err; - static const double factor = chrono_detail::compute_steady_factor(err); - if (err != 0) + kern_return_t err; + const double factor = chrono_detail::compute_steady_factor(err); + if (err != 0) { BOOST_ASSERT(0 && "Boost::Chrono - Internal Error"); } @@ -126,25 +127,25 @@ BOOST_CHRONO_STATIC steady_clock::rep steady_full_ec(system::error_code & ec) { - static kern_return_t err; - static const double factor = chrono_detail::compute_steady_factor(err); - if (err != 0) + kern_return_t err; + const double factor = chrono_detail::compute_steady_factor(err); + if (err != 0) { if (BOOST_CHRONO_IS_THROWS(ec)) { boost::throw_exception( - system::system_error( - err, - BOOST_CHRONO_SYSTEM_CATEGORY, + system::system_error( + err, + BOOST_CHRONO_SYSTEM_CATEGORY, "chrono::steady_clock" )); - } + } else { ec.assign( errno, BOOST_CHRONO_SYSTEM_CATEGORY ); return steady_clock::rep(); } } - if (!BOOST_CHRONO_IS_THROWS(ec)) + if (!BOOST_CHRONO_IS_THROWS(ec)) { ec.clear(); } @@ -163,7 +164,7 @@ init_steady_clock(kern_return_t & err) { mach_timebase_info_data_t MachInfo; err = mach_timebase_info(&MachInfo); - if ( err != 0 ) + if ( err != 0 ) { return 0; } @@ -182,12 +183,12 @@ init_steady_clock_ec(kern_return_t & err) { mach_timebase_info_data_t MachInfo; err = mach_timebase_info(&MachInfo); - if ( err != 0 ) + if ( err != 0 ) { return 0; } - if (MachInfo.numer == MachInfo.denom) + if (MachInfo.numer == MachInfo.denom) { return &chrono_detail::steady_simplified_ec; } @@ -199,10 +200,10 @@ init_steady_clock_ec(kern_return_t & err) steady_clock::time_point steady_clock::now() BOOST_NOEXCEPT { - static kern_return_t err; - static chrono_detail::FP fp = chrono_detail::init_steady_clock(err); - if ( err != 0 ) - { + kern_return_t err; + chrono_detail::FP fp = chrono_detail::init_steady_clock(err); + if ( err != 0 ) + { BOOST_ASSERT(0 && "Boost::Chrono - Internal Error"); } return time_point(duration(fp())); @@ -212,16 +213,16 @@ steady_clock::now() BOOST_NOEXCEPT steady_clock::time_point steady_clock::now(system::error_code & ec) { - static kern_return_t err; - static chrono_detail::FP_ec fp = chrono_detail::init_steady_clock_ec(err); - if ( err != 0 ) + kern_return_t err; + chrono_detail::FP_ec fp = chrono_detail::init_steady_clock_ec(err); + if ( err != 0 ) { if (BOOST_CHRONO_IS_THROWS(ec)) { boost::throw_exception( - system::system_error( - err, - BOOST_CHRONO_SYSTEM_CATEGORY, + system::system_error( + err, + BOOST_CHRONO_SYSTEM_CATEGORY, "chrono::steady_clock" )); } else @@ -230,7 +231,7 @@ steady_clock::now(system::error_code & ec) return time_point(); } } - if (!BOOST_CHRONO_IS_THROWS(ec)) + if (!BOOST_CHRONO_IS_THROWS(ec)) { ec.clear(); } diff --git a/3party/boost/boost/chrono/detail/inlined/mac/process_cpu_clocks.hpp b/3party/boost/boost/chrono/detail/inlined/mac/process_cpu_clocks.hpp index 6d09e2cb3a..6e55b0f2ff 100644 --- a/3party/boost/boost/chrono/detail/inlined/mac/process_cpu_clocks.hpp +++ b/3party/boost/boost/chrono/detail/inlined/mac/process_cpu_clocks.hpp @@ -28,7 +28,7 @@ namespace boost inline long tick_factor() // multiplier to convert ticks // to nanoseconds; -1 if unknown { - static long factor = 0; + long factor = 0; if (!factor) { if ((factor = ::sysconf(_SC_CLK_TCK)) <= 0) diff --git a/3party/boost/boost/chrono/detail/inlined/mac/thread_clock.hpp b/3party/boost/boost/chrono/detail/inlined/mac/thread_clock.hpp index 1a4406b83d..690458f41c 100644 --- a/3party/boost/boost/chrono/detail/inlined/mac/thread_clock.hpp +++ b/3party/boost/boost/chrono/detail/inlined/mac/thread_clock.hpp @@ -14,6 +14,7 @@ #include #include #include +#include # include # include diff --git a/3party/boost/boost/chrono/detail/inlined/posix/chrono.hpp b/3party/boost/boost/chrono/detail/inlined/posix/chrono.hpp index e35a7ce267..c4c8a6add7 100644 --- a/3party/boost/boost/chrono/detail/inlined/posix/chrono.hpp +++ b/3party/boost/boost/chrono/detail/inlined/posix/chrono.hpp @@ -11,6 +11,7 @@ //----------------------------------------------------------------------------// #include // for clock_gettime +#include namespace boost { @@ -38,9 +39,9 @@ namespace chrono if (BOOST_CHRONO_IS_THROWS(ec)) { boost::throw_exception( - system::system_error( - errno, - BOOST_CHRONO_SYSTEM_CATEGORY, + system::system_error( + errno, + BOOST_CHRONO_SYSTEM_CATEGORY, "chrono::system_clock" )); } else @@ -50,7 +51,7 @@ namespace chrono } } - if (!BOOST_CHRONO_IS_THROWS(ec)) + if (!BOOST_CHRONO_IS_THROWS(ec)) { ec.clear(); } @@ -92,9 +93,9 @@ namespace chrono if (BOOST_CHRONO_IS_THROWS(ec)) { boost::throw_exception( - system::system_error( - errno, - BOOST_CHRONO_SYSTEM_CATEGORY, + system::system_error( + errno, + BOOST_CHRONO_SYSTEM_CATEGORY, "chrono::steady_clock" )); } else @@ -104,7 +105,7 @@ namespace chrono } } - if (!BOOST_CHRONO_IS_THROWS(ec)) + if (!BOOST_CHRONO_IS_THROWS(ec)) { ec.clear(); } diff --git a/3party/boost/boost/chrono/detail/inlined/posix/process_cpu_clocks.hpp b/3party/boost/boost/chrono/detail/inlined/posix/process_cpu_clocks.hpp index 0476f590c9..feecc86792 100644 --- a/3party/boost/boost/chrono/detail/inlined/posix/process_cpu_clocks.hpp +++ b/3party/boost/boost/chrono/detail/inlined/posix/process_cpu_clocks.hpp @@ -25,7 +25,7 @@ namespace chrono_detail inline nanoseconds::rep tick_factor() // multiplier to convert ticks // to nanoseconds; -1 if unknown { - static long factor = 0; + long factor = 0; if ( !factor ) { if ( (factor = ::sysconf( _SC_CLK_TCK )) <= 0 ) diff --git a/3party/boost/boost/chrono/detail/inlined/posix/thread_clock.hpp b/3party/boost/boost/chrono/detail/inlined/posix/thread_clock.hpp index a1012240ec..a42b3c8a15 100644 --- a/3party/boost/boost/chrono/detail/inlined/posix/thread_clock.hpp +++ b/3party/boost/boost/chrono/detail/inlined/posix/thread_clock.hpp @@ -13,6 +13,7 @@ #include #include #include +#include #if !defined(__VXWORKS__) # include diff --git a/3party/boost/boost/chrono/detail/inlined/process_cpu_clocks.hpp b/3party/boost/boost/chrono/detail/inlined/process_cpu_clocks.hpp index d37f6754cb..fad60361a3 100644 --- a/3party/boost/boost/chrono/detail/inlined/process_cpu_clocks.hpp +++ b/3party/boost/boost/chrono/detail/inlined/process_cpu_clocks.hpp @@ -18,8 +18,9 @@ #include #include #include +#if defined BOOST_CHRONO_PROVIDE_HYBRID_ERROR_HANDLING #include - +#endif //----------------------------------------------------------------------------// // Windows // //----------------------------------------------------------------------------// diff --git a/3party/boost/boost/chrono/detail/inlined/thread_clock.hpp b/3party/boost/boost/chrono/detail/inlined/thread_clock.hpp index 16d19ef488..e4f8317ec6 100644 --- a/3party/boost/boost/chrono/detail/inlined/thread_clock.hpp +++ b/3party/boost/boost/chrono/detail/inlined/thread_clock.hpp @@ -16,7 +16,9 @@ #if defined(BOOST_CHRONO_HAS_THREAD_CLOCK) #include #include +#if defined BOOST_CHRONO_PROVIDE_HYBRID_ERROR_HANDLING #include +#endif #include #include diff --git a/3party/boost/boost/chrono/detail/inlined/win/chrono.hpp b/3party/boost/boost/chrono/detail/inlined/win/chrono.hpp index 16e8c51426..e61f11e7ce 100644 --- a/3party/boost/boost/chrono/detail/inlined/win/chrono.hpp +++ b/3party/boost/boost/chrono/detail/inlined/win/chrono.hpp @@ -14,7 +14,8 @@ #include #include -#include +#include +#include namespace boost { diff --git a/3party/boost/boost/chrono/detail/inlined/win/process_cpu_clocks.hpp b/3party/boost/boost/chrono/detail/inlined/win/process_cpu_clocks.hpp index e97bfe590c..7169f8020a 100644 --- a/3party/boost/boost/chrono/detail/inlined/win/process_cpu_clocks.hpp +++ b/3party/boost/boost/chrono/detail/inlined/win/process_cpu_clocks.hpp @@ -14,15 +14,15 @@ #define BOOST_CHRONO_DETAIL_INLINED_WIN_PROCESS_CLOCK_HPP #include -//#include #include #include #include +#include -#include -#include +#include +#include #if BOOST_PLAT_WINDOWS_DESKTOP -#include +#include #endif namespace boost diff --git a/3party/boost/boost/chrono/detail/inlined/win/thread_clock.hpp b/3party/boost/boost/chrono/detail/inlined/win/thread_clock.hpp index e47c481473..037ccbee3e 100644 --- a/3party/boost/boost/chrono/detail/inlined/win/thread_clock.hpp +++ b/3party/boost/boost/chrono/detail/inlined/win/thread_clock.hpp @@ -14,10 +14,11 @@ #include #include #include +#include -#include -#include -#include +#include +#include +#include namespace boost { @@ -42,7 +43,7 @@ thread_clock::time_point thread_clock::now( system::error_code & ec ) ((static_cast(system_time.dwHighDateTime) << 32) | system_time.dwLowDateTime) * 100 ); - if (!BOOST_CHRONO_IS_THROWS(ec)) + if (!BOOST_CHRONO_IS_THROWS(ec)) { ec.clear(); } @@ -51,15 +52,15 @@ thread_clock::time_point thread_clock::now( system::error_code & ec ) } else { - if (BOOST_CHRONO_IS_THROWS(ec)) + if (BOOST_CHRONO_IS_THROWS(ec)) { boost::throw_exception( - system::system_error( - boost::detail::winapi::GetLastError(), - BOOST_CHRONO_SYSTEM_CATEGORY, + system::system_error( + boost::detail::winapi::GetLastError(), + BOOST_CHRONO_SYSTEM_CATEGORY, "chrono::thread_clock" )); - } - else + } + else { ec.assign( boost::detail::winapi::GetLastError(), BOOST_CHRONO_SYSTEM_CATEGORY ); return thread_clock::time_point(duration(0)); @@ -74,7 +75,7 @@ thread_clock::time_point thread_clock::now() BOOST_NOEXCEPT // note that Windows uses 100 nanosecond ticks for FILETIME boost::detail::winapi::FILETIME_ creation, exit, user_time, system_time; - if ( boost::detail::winapi::GetThreadTimes( + if ( boost::detail::winapi::GetThreadTimes( boost::detail::winapi::GetCurrentThread (), &creation, &exit, &system_time, &user_time ) ) { diff --git a/3party/boost/boost/chrono/duration.hpp b/3party/boost/boost/chrono/duration.hpp index a2110bf411..737328c418 100644 --- a/3party/boost/boost/chrono/duration.hpp +++ b/3party/boost/boost/chrono/duration.hpp @@ -433,11 +433,12 @@ namespace chrono { rep rep_; public: -#if defined BOOST_NO_CXX11_DEFAULTED_FUNCTIONS +#if defined BOOST_NO_CXX11_DEFAULTED_FUNCTIONS || \ + defined BOOST_CHRONO_DURATION_DEFAULTS_TO_ZERO BOOST_FORCEINLINE BOOST_CONSTEXPR duration() : rep_(duration_values::zero()) { } #else - BOOST_CONSTEXPR duration() BOOST_NOEXCEPT {}; + BOOST_CONSTEXPR duration() BOOST_NOEXCEPT : rep_() {}; #endif template BOOST_SYMBOL_VISIBLE BOOST_FORCEINLINE BOOST_CONSTEXPR diff --git a/3party/boost/boost/chrono/io/ios_base_state.hpp b/3party/boost/boost/chrono/io/ios_base_state.hpp index 6e320a5678..1393e2e699 100644 --- a/3party/boost/boost/chrono/io/ios_base_state.hpp +++ b/3party/boost/boost/chrono/io/ios_base_state.hpp @@ -113,9 +113,10 @@ namespace boost std::basic_string duration_fmt; public: - ios_base_data_aux() : - time_fmt(""), - duration_fmt("") + ios_base_data_aux() + //: + // time_fmt(""), + // duration_fmt("") { } }; diff --git a/3party/boost/boost/chrono/io/time_point_get.hpp b/3party/boost/boost/chrono/io/time_point_get.hpp index 5e4acd39cc..44c641e6da 100644 --- a/3party/boost/boost/chrono/io/time_point_get.hpp +++ b/3party/boost/boost/chrono/io/time_point_get.hpp @@ -279,12 +279,12 @@ namespace boost if (std::has_facet >(is.getloc())) { time_point_units const &facet = std::use_facet >(is.getloc()); - return get_epoch(facet, i, e, is, err); + return get_epoch(facet, i, e, is, err); } else { time_point_units_default facet; - return get_epoch(facet, i, e, is, err); + return get_epoch(facet, i, e, is, err); } } diff --git a/3party/boost/boost/chrono/io/time_point_io.hpp b/3party/boost/boost/chrono/io/time_point_io.hpp index ec4ba13aeb..0cbc275c0e 100644 --- a/3party/boost/boost/chrono/io/time_point_io.hpp +++ b/3party/boost/boost/chrono/io/time_point_io.hpp @@ -125,9 +125,9 @@ namespace boost std::ios_base::iostate& err, const std::ctype& ct) const { - int t = get_up_to_n_digits(b, e, err, ct, 2) - 1; - if (!(err & std::ios_base::failbit) && t <= 11) - m = t; + int t = get_up_to_n_digits(b, e, err, ct, 2); + if (!(err & std::ios_base::failbit) && 1 <= t && t <= 12) + m = --t; else err |= std::ios_base::failbit; } @@ -224,8 +224,8 @@ namespace boost const std::ctype& ct) const { int t = get_up_to_n_digits(b, e, err, ct, 3); - if (!(err & std::ios_base::failbit) && t <= 365) - d = t; + if (!(err & std::ios_base::failbit) && 1 <= t && t <= 366) + d = --t; else err |= std::ios_base::failbit; } diff --git a/3party/boost/boost/chrono/io/time_point_units.hpp b/3party/boost/boost/chrono/io/time_point_units.hpp index 378c112603..7aef8526da 100644 --- a/3party/boost/boost/chrono/io/time_point_units.hpp +++ b/3party/boost/boost/chrono/io/time_point_units.hpp @@ -24,6 +24,16 @@ namespace boost { namespace chrono { + /** + * customization point to the epoch associated to the clock @c Clock + * The default calls @c f.do_get_epoch(Clock()). The user can overload this function. + * @return the string epoch associated to the @c Clock + */ + template + std::basic_string get_epoch_custom(Clock, TPUFacet& f) + { + return f.do_get_epoch(Clock()); + } /** * @c time_point_units facet gives useful information about the time_point pattern, @@ -74,7 +84,7 @@ namespace boost template string_type get_epoch() const { - return do_get_epoch(Clock()); + return get_epoch_custom(Clock(), *this); } protected: @@ -83,6 +93,7 @@ namespace boost */ virtual ~time_point_units() {} + public: /** * @@ -173,7 +184,7 @@ namespace boost return pattern; } - protected: + //protected: /** * @param c a dummy instance of @c system_clock. * @return The epoch string returned by @c clock_string::since(). diff --git a/3party/boost/boost/chrono/io/utility/ios_base_state_ptr.hpp b/3party/boost/boost/chrono/io/utility/ios_base_state_ptr.hpp index f7dfdddca0..15c8ac4d66 100644 --- a/3party/boost/boost/chrono/io/utility/ios_base_state_ptr.hpp +++ b/3party/boost/boost/chrono/io/utility/ios_base_state_ptr.hpp @@ -164,9 +164,10 @@ namespace boost */ T * release() BOOST_NOEXCEPT { - T const* f = get(); - reset(); - return f; + void*& pw = ios_.pword(index()); + T* ptr = static_cast (pw); + pw = 0; + return ptr; } /** diff --git a/3party/boost/boost/chrono/process_cpu_clocks.hpp b/3party/boost/boost/chrono/process_cpu_clocks.hpp index 248837506e..ca6bef38e9 100644 --- a/3party/boost/boost/chrono/process_cpu_clocks.hpp +++ b/3party/boost/boost/chrono/process_cpu_clocks.hpp @@ -193,7 +193,7 @@ namespace boost { namespace chrono { typedef std::istreambuf_iterator in_iterator; in_iterator i(is); in_iterator e; - if (i == e || *i != '{') // mandatory '{' + if (i == e || *i++ != '{') // mandatory '{' { is.setstate(is.failbit | is.eofbit); return; @@ -244,7 +244,8 @@ namespace chrono const duration, Period2>& rhs) { return boost::chrono::detail::duration_eq< - duration, Period1>, duration, Period2> >()(lhs, rhs); + duration, duration + >()(duration(lhs.count().real), duration(rhs.count().real)); } template @@ -285,7 +286,8 @@ namespace chrono operator< (const duration& lhs, const duration, Period2>& rhs) { - return rhs < lhs; + return boost::chrono::detail::duration_lt< + duration, duration >()(lhs, duration(rhs.count().real)); } template @@ -295,7 +297,8 @@ namespace chrono const duration, Period2>& rhs) { return boost::chrono::detail::duration_lt< - duration, duration >()(lhs, rhs); + duration, duration + >()(duration(lhs.count().real), duration(rhs.count().real)); } @@ -412,7 +415,7 @@ namespace chrono { static const CharT u[] = - { 'p', 'r', 'o', 'c', 'e', 's', 's', '_', 's', 'y', 's', 't', 't', 'e', 'm', '_', 'c', 'l', 'o', 'c', 'k' }; + { 'p', 'r', 'o', 'c', 'e', 's', 's', '_', 's', 'y', 's', 't', 'e', 'm', '_', 'c', 'l', 'o', 'c', 'k' }; static const std::basic_string str(u, u + sizeof(u) / sizeof(u[0])); return str; diff --git a/3party/boost/boost/circular_buffer.hpp b/3party/boost/boost/circular_buffer.hpp index f5eff60f08..7cf8928bc0 100644 --- a/3party/boost/boost/circular_buffer.hpp +++ b/3party/boost/boost/circular_buffer.hpp @@ -20,10 +20,8 @@ #include // BOOST_CB_ENABLE_DEBUG: Debug support control. -#if defined(NDEBUG) || defined(BOOST_CB_DISABLE_DEBUG) +#if !defined(BOOST_CB_ENABLE_DEBUG) #define BOOST_CB_ENABLE_DEBUG 0 -#else - #define BOOST_CB_ENABLE_DEBUG 1 #endif // BOOST_CB_ASSERT: Runtime assertion. @@ -60,6 +58,5 @@ #undef BOOST_CB_ASSERT_TEMPLATED_ITERATOR_CONSTRUCTORS #undef BOOST_CB_IS_CONVERTIBLE #undef BOOST_CB_ASSERT -#undef BOOST_CB_ENABLE_DEBUG #endif // #if !defined(BOOST_CIRCULAR_BUFFER_HPP) diff --git a/3party/boost/boost/circular_buffer/base.hpp b/3party/boost/boost/circular_buffer/base.hpp index cf0453031e..1dec2f2136 100644 --- a/3party/boost/boost/circular_buffer/base.hpp +++ b/3party/boost/boost/circular_buffer/base.hpp @@ -30,6 +30,7 @@ #include #include #include +#include #include #include #include @@ -668,7 +669,7 @@ public: boost::container::allocator_traits::construct(m_alloc, boost::addressof(*dest), boost::move_if_noexcept(*src)); ++constructed; } else { - value_type tmp = boost::move_if_noexcept(*src); + value_type tmp = boost::move_if_noexcept(*src); replace(src, boost::move_if_noexcept(*dest)); replace(dest, boost::move(tmp)); } @@ -1399,11 +1400,11 @@ public: */ void swap(circular_buffer& cb) BOOST_NOEXCEPT { swap_allocator(cb, is_stateless()); - std::swap(m_buff, cb.m_buff); - std::swap(m_end, cb.m_end); - std::swap(m_first, cb.m_first); - std::swap(m_last, cb.m_last); - std::swap(m_size, cb.m_size); + adl_move_swap(m_buff, cb.m_buff); + adl_move_swap(m_end, cb.m_end); + adl_move_swap(m_first, cb.m_first); + adl_move_swap(m_last, cb.m_last); + adl_move_swap(m_size, cb.m_size); #if BOOST_CB_ENABLE_DEBUG invalidate_all_iterators(); cb.invalidate_all_iterators(); @@ -2627,7 +2628,7 @@ private: //! Specialized method for swapping the allocator. void swap_allocator(circular_buffer& cb, const false_type&) { - std::swap(m_alloc, cb.m_alloc); + adl_move_swap(m_alloc, cb.m_alloc); } //! Specialized assign method. diff --git a/3party/boost/boost/circular_buffer/details.hpp b/3party/boost/boost/circular_buffer/details.hpp index 44ca9c9689..3262386acf 100644 --- a/3party/boost/boost/circular_buffer/details.hpp +++ b/3party/boost/boost/circular_buffer/details.hpp @@ -14,7 +14,6 @@ #pragma once #endif -#include #include #include #include @@ -196,7 +195,7 @@ public: */ template struct iterator : - public boost::iterator< + public std::iterator< std::random_access_iterator_tag, typename Traits::value_type, typename Traits::difference_type, @@ -209,7 +208,7 @@ struct iterator : // Helper types //! Base iterator. - typedef boost::iterator< + typedef std::iterator< std::random_access_iterator_tag, typename Traits::value_type, typename Traits::difference_type, diff --git a/3party/boost/boost/circular_buffer/space_optimized.hpp b/3party/boost/boost/circular_buffer/space_optimized.hpp index 688ab95796..3d001730b3 100644 --- a/3party/boost/boost/circular_buffer/space_optimized.hpp +++ b/3party/boost/boost/circular_buffer/space_optimized.hpp @@ -740,7 +740,7 @@ public: \par Iterator Invalidation Invalidates all iterators of both circular_buffer_space_optimized containers. (On the other hand the iterators still point to the same elements but within another container. If you want to rely on - this feature you have to turn the __debug_support off by defining macro BOOST_CB_DISABLE_DEBUG, + this feature you have to turn the __debug_support off, otherwise an assertion will report an error if such invalidated iterator is used.) \par Complexity Constant (in the size of the circular_buffer_space_optimized). diff --git a/3party/boost/boost/compute.hpp b/3party/boost/boost/compute.hpp new file mode 100644 index 0000000000..83e17acc1f --- /dev/null +++ b/3party/boost/boost/compute.hpp @@ -0,0 +1,44 @@ +//---------------------------------------------------------------------------// +// Copyright (c) 2013 Kyle Lutz +// +// 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 +// +// See http://boostorg.github.com/compute for more information. +//---------------------------------------------------------------------------// + +#ifndef BOOST_COMPUTE_HPP +#define BOOST_COMPUTE_HPP + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +#ifdef BOOST_COMPUTE_HAVE_HDR_CL_EXT +#include +#endif + +#endif // BOOST_COMPUTE_HPP diff --git a/3party/boost/boost/compute/algorithm.hpp b/3party/boost/boost/compute/algorithm.hpp new file mode 100644 index 0000000000..686640e9e9 --- /dev/null +++ b/3party/boost/boost/compute/algorithm.hpp @@ -0,0 +1,94 @@ +//---------------------------------------------------------------------------// +// Copyright (c) 2013 Kyle Lutz +// +// 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 +// +// See http://boostorg.github.com/compute for more information. +//---------------------------------------------------------------------------// + +#ifndef BOOST_COMPUTE_ALGORITHM_HPP +#define BOOST_COMPUTE_ALGORITHM_HPP + +/// \file +/// +/// Meta-header to include all Boost.Compute algorithm headers. + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +#endif // BOOST_COMPUTE_ALGORITHM_HPP diff --git a/3party/boost/boost/compute/algorithm/accumulate.hpp b/3party/boost/boost/compute/algorithm/accumulate.hpp new file mode 100644 index 0000000000..328420a07c --- /dev/null +++ b/3party/boost/boost/compute/algorithm/accumulate.hpp @@ -0,0 +1,184 @@ +//---------------------------------------------------------------------------// +// Copyright (c) 2013 Kyle Lutz +// +// 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 +// +// See http://boostorg.github.com/compute for more information. +//---------------------------------------------------------------------------// + +#ifndef BOOST_COMPUTE_ALGORITHM_ACCUMULATE_HPP +#define BOOST_COMPUTE_ALGORITHM_ACCUMULATE_HPP + +#include + +#include +#include +#include +#include +#include +#include +#include +#include + +namespace boost { +namespace compute { +namespace detail { + +template +inline T generic_accumulate(InputIterator first, + InputIterator last, + T init, + BinaryFunction function, + command_queue &queue) +{ + const context &context = queue.get_context(); + + size_t size = iterator_range_size(first, last); + if(size == 0){ + return init; + } + + // accumulate on device + array device_result(context); + detail::serial_accumulate( + first, last, device_result.begin(), init, function, queue + ); + + // copy result to host + T result; + ::boost::compute::copy_n(device_result.begin(), 1, &result, queue); + return result; +} + +// returns true if we can use reduce() instead of accumulate() when +// accumulate() this is true when the function is commutative (such as +// addition of integers) and the initial value is the identity value +// for the operation (zero for addition, one for multiplication). +template +inline bool can_accumulate_with_reduce(T init, F function) +{ + (void) init; + (void) function; + + return false; +} + +/// \internal_ +#define BOOST_COMPUTE_DETAIL_DECLARE_CAN_ACCUMULATE_WITH_REDUCE(r, data, type) \ + inline bool can_accumulate_with_reduce(type init, plus) \ + { \ + return init == type(0); \ + } \ + inline bool can_accumulate_with_reduce(type init, multiplies) \ + { \ + return init == type(1); \ + } + +BOOST_PP_SEQ_FOR_EACH( + BOOST_COMPUTE_DETAIL_DECLARE_CAN_ACCUMULATE_WITH_REDUCE, + _, + (char_)(uchar_)(short_)(ushort_)(int_)(uint_)(long_)(ulong_) +) + +template +inline bool can_accumulate_with_reduce(T init, min) +{ + return init == (std::numeric_limits::max)(); +} + +template +inline bool can_accumulate_with_reduce(T init, max) +{ + return init == (std::numeric_limits::min)(); +} + +#undef BOOST_COMPUTE_DETAIL_DECLARE_CAN_ACCUMULATE_WITH_REDUCE + +template +inline T dispatch_accumulate(InputIterator first, + InputIterator last, + T init, + BinaryFunction function, + command_queue &queue) +{ + size_t size = iterator_range_size(first, last); + if(size == 0){ + return init; + } + + if(can_accumulate_with_reduce(init, function)){ + T result; + reduce(first, last, &result, function, queue); + return result; + } + else { + return generic_accumulate(first, last, init, function, queue); + } +} + +} // end detail namespace + +/// Returns the result of applying \p function to the elements in the +/// range [\p first, \p last) and \p init. +/// +/// If no function is specified, \c plus will be used. +/// +/// \param first first element in the input range +/// \param last last element in the input range +/// \param init initial value +/// \param function binary reduction function +/// \param queue command queue to perform the operation +/// +/// \return the accumulated result value +/// +/// In specific situations the call to \c accumulate() can be automatically +/// optimized to a call to the more efficient \c reduce() algorithm. This +/// occurs when the binary reduction function is recognized as associative +/// (such as the \c plus function). +/// +/// Note that because floating-point addition is not associative, calling +/// \c accumulate() with \c plus results in a less efficient serial +/// reduction algorithm being executed. If a slight loss in precision is +/// acceptable, the more efficient parallel \c reduce() algorithm should be +/// used instead. +/// +/// For example: +/// \code +/// // with vec = boost::compute::vector +/// accumulate(vec.begin(), vec.end(), 0, plus()); // fast +/// reduce(vec.begin(), vec.end(), &result, plus()); // fast +/// +/// // with vec = boost::compute::vector +/// accumulate(vec.begin(), vec.end(), 0, plus()); // slow +/// reduce(vec.begin(), vec.end(), &result, plus()); // fast +/// \endcode +/// +/// \see reduce() +template +inline T accumulate(InputIterator first, + InputIterator last, + T init, + BinaryFunction function, + command_queue &queue = system::default_queue()) +{ + return detail::dispatch_accumulate(first, last, init, function, queue); +} + +/// \overload +template +inline T accumulate(InputIterator first, + InputIterator last, + T init, + command_queue &queue = system::default_queue()) +{ + typedef typename std::iterator_traits::value_type IT; + + return detail::dispatch_accumulate(first, last, init, plus(), queue); +} + +} // end compute namespace +} // end boost namespace + +#endif // BOOST_COMPUTE_ALGORITHM_ACCUMULATE_HPP diff --git a/3party/boost/boost/compute/algorithm/adjacent_difference.hpp b/3party/boost/boost/compute/algorithm/adjacent_difference.hpp new file mode 100644 index 0000000000..ef13970754 --- /dev/null +++ b/3party/boost/boost/compute/algorithm/adjacent_difference.hpp @@ -0,0 +1,116 @@ +//---------------------------------------------------------------------------// +// Copyright (c) 2013-2014 Kyle Lutz +// +// 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 +// +// See http://boostorg.github.com/compute for more information. +//---------------------------------------------------------------------------// + +#ifndef BOOST_COMPUTE_ALGORITHM_ADJACENT_DIFFERENCE_HPP +#define BOOST_COMPUTE_ALGORITHM_ADJACENT_DIFFERENCE_HPP + +#include + +#include +#include +#include +#include +#include +#include + +namespace boost { +namespace compute { + +namespace detail { + +template +inline OutputIterator +dispatch_adjacent_difference(InputIterator first, + InputIterator last, + OutputIterator result, + BinaryFunction op, + command_queue &queue = system::default_queue()) +{ + size_t count = detail::iterator_range_size(first, last); + detail::meta_kernel k("adjacent_difference"); + + k << "const uint i = get_global_id(0);\n" + << "if(i == 0){\n" + << " " << result[k.var("0")] << " = " << first[k.var("0")] << ";\n" + << "}\n" + << "else {\n" + << " " << result[k.var("i")] << " = " + << op(first[k.var("i")], first[k.var("i-1")]) << ";\n" + << "}\n"; + + k.exec_1d(queue, 0, count, 1); + + return result + count; +} + +} // end detail namespace + +/// Stores the difference of each pair of consecutive values in the range +/// [\p first, \p last) to the range beginning at \p result. If \p op is not +/// provided, \c minus is used. +/// +/// \param first first element in the input range +/// \param last last element in the input range +/// \param result first element in the output range +/// \param op binary difference function +/// \param queue command queue to perform the operation +/// +/// \return \c OutputIterator to the end of the result range +/// +/// \see adjacent_find() +template +inline OutputIterator +adjacent_difference(InputIterator first, + InputIterator last, + OutputIterator result, + BinaryFunction op, + command_queue &queue = system::default_queue()) +{ + typedef typename std::iterator_traits::value_type value_type; + + if(first == last) { + return result; + } + + if (first == result) { + vector temp(detail::iterator_range_size(first, last), + queue.get_context()); + copy(first, last, temp.begin(), queue); + + return ::boost::compute::detail::dispatch_adjacent_difference( + temp.begin(), temp.end(), result, op, queue + ); + } + else { + return ::boost::compute::detail::dispatch_adjacent_difference( + first, last, result, op, queue + ); + } +} + +/// \overload +template +inline OutputIterator +adjacent_difference(InputIterator first, + InputIterator last, + OutputIterator result, + command_queue &queue = system::default_queue()) +{ + typedef typename std::iterator_traits::value_type value_type; + + return ::boost::compute::adjacent_difference( + first, last, result, ::boost::compute::minus(), queue + ); +} + +} // end compute namespace +} // end boost namespace + +#endif // BOOST_COMPUTE_ALGORITHM_ADJACENT_DIFFERENCE_HPP diff --git a/3party/boost/boost/compute/algorithm/adjacent_find.hpp b/3party/boost/boost/compute/algorithm/adjacent_find.hpp new file mode 100644 index 0000000000..992a01eddc --- /dev/null +++ b/3party/boost/boost/compute/algorithm/adjacent_find.hpp @@ -0,0 +1,162 @@ +//---------------------------------------------------------------------------// +// Copyright (c) 2013-2014 Kyle Lutz +// +// 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 +// +// See http://boostorg.github.com/compute for more information. +//---------------------------------------------------------------------------// + +#ifndef BOOST_COMPUTE_ALGORITHM_ADJACENT_FIND_HPP +#define BOOST_COMPUTE_ALGORITHM_ADJACENT_FIND_HPP + +#include + +#include +#include +#include +#include +#include +#include +#include +#include + +namespace boost { +namespace compute { +namespace detail { + +template +inline InputIterator +serial_adjacent_find(InputIterator first, + InputIterator last, + Compare compare, + command_queue &queue) +{ + if(first == last){ + return last; + } + + const context &context = queue.get_context(); + + detail::scalar output(context); + + detail::meta_kernel k("serial_adjacent_find"); + + size_t size_arg = k.add_arg("size"); + size_t output_arg = k.add_arg(memory_object::global_memory, "output"); + + k << k.decl("result") << " = size;\n" + << "for(uint i = 0; i < size - 1; i++){\n" + << " if(" << compare(first[k.expr("i")], + first[k.expr("i+1")]) << "){\n" + << " result = i;\n" + << " break;\n" + << " }\n" + << "}\n" + << "*output = result;\n"; + + k.set_arg( + size_arg, static_cast(detail::iterator_range_size(first, last)) + ); + k.set_arg(output_arg, output.get_buffer()); + + k.exec_1d(queue, 0, 1, 1); + + return first + output.read(queue); +} + +template +inline InputIterator +adjacent_find_with_atomics(InputIterator first, + InputIterator last, + Compare compare, + command_queue &queue) +{ + if(first == last){ + return last; + } + + const context &context = queue.get_context(); + size_t count = detail::iterator_range_size(first, last); + + // initialize output to the last index + detail::scalar output(context); + output.write(static_cast(count), queue); + + detail::meta_kernel k("adjacent_find_with_atomics"); + + size_t output_arg = k.add_arg(memory_object::global_memory, "output"); + + k << "const uint i = get_global_id(0);\n" + << "if(" << compare(first[k.expr("i")], + first[k.expr("i+1")]) << "){\n" + << " atomic_min(output, i);\n" + << "}\n"; + + k.set_arg(output_arg, output.get_buffer()); + + k.exec_1d(queue, 0, count - 1, 1); + + return first + output.read(queue); +} + +} // end detail namespace + +/// Searches the range [\p first, \p last) for two identical adjacent +/// elements and returns an iterator pointing to the first. +/// +/// \param first first element in the range to search +/// \param last last element in the range to search +/// \param compare binary comparison function +/// \param queue command queue to perform the operation +/// +/// \return \c InputIteratorm to the first element which compares equal +/// to the following element. If none are equal, returns \c last. +/// +/// \see find(), adjacent_difference() +template +inline InputIterator +adjacent_find(InputIterator first, + InputIterator last, + Compare compare, + command_queue &queue = system::default_queue()) +{ + size_t count = detail::iterator_range_size(first, last); + if(count < 32){ + return detail::serial_adjacent_find(first, last, compare, queue); + } + else { + return detail::adjacent_find_with_atomics(first, last, compare, queue); + } +} + +/// \overload +template +inline InputIterator +adjacent_find(InputIterator first, + InputIterator last, + command_queue &queue = system::default_queue()) +{ + typedef typename std::iterator_traits::value_type value_type; + + using ::boost::compute::lambda::_1; + using ::boost::compute::lambda::_2; + using ::boost::compute::lambda::all; + + if(vector_size::value == 1){ + return ::boost::compute::adjacent_find( + first, last, _1 == _2, queue + ); + } + else { + return ::boost::compute::adjacent_find( + first, last, all(_1 == _2), queue + ); + } +} + +} // end compute namespace +} // end boost namespace + +#endif // BOOST_COMPUTE_ALGORITHM_ADJACENT_FIND_HPP diff --git a/3party/boost/boost/compute/algorithm/all_of.hpp b/3party/boost/boost/compute/algorithm/all_of.hpp new file mode 100644 index 0000000000..34d7518f32 --- /dev/null +++ b/3party/boost/boost/compute/algorithm/all_of.hpp @@ -0,0 +1,36 @@ +//---------------------------------------------------------------------------// +// Copyright (c) 2013 Kyle Lutz +// +// 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 +// +// See http://boostorg.github.com/compute for more information. +//---------------------------------------------------------------------------// + +#ifndef BOOST_COMPUTE_ALGORITHM_ALL_OF_HPP +#define BOOST_COMPUTE_ALGORITHM_ALL_OF_HPP + +#include +#include + +namespace boost { +namespace compute { + +/// Returns \c true if \p predicate returns \c true for all of the elements in +/// the range [\p first, \p last). +/// +/// \see any_of(), none_of() +template +inline bool all_of(InputIterator first, + InputIterator last, + UnaryPredicate predicate, + command_queue &queue = system::default_queue()) +{ + return ::boost::compute::find_if_not(first, last, predicate, queue) == last; +} + +} // end compute namespace +} // end boost namespace + +#endif // BOOST_COMPUTE_ALGORITHM_ALL_OF_HPP diff --git a/3party/boost/boost/compute/algorithm/any_of.hpp b/3party/boost/boost/compute/algorithm/any_of.hpp new file mode 100644 index 0000000000..b07779597c --- /dev/null +++ b/3party/boost/boost/compute/algorithm/any_of.hpp @@ -0,0 +1,40 @@ +//---------------------------------------------------------------------------// +// Copyright (c) 2013 Kyle Lutz +// +// 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 +// +// See http://boostorg.github.com/compute for more information. +//---------------------------------------------------------------------------// + +#ifndef BOOST_COMPUTE_ALGORITHM_ANY_OF_HPP +#define BOOST_COMPUTE_ALGORITHM_ANY_OF_HPP + +#include +#include + +namespace boost { +namespace compute { + +/// Returns \c true if \p predicate returns \c true for any of the elements in +/// the range [\p first, \p last). +/// +/// For example, to test if a vector contains any negative values: +/// +/// \snippet test/test_any_all_none_of.cpp any_of +/// +/// \see all_of(), none_of() +template +inline bool any_of(InputIterator first, + InputIterator last, + UnaryPredicate predicate, + command_queue &queue = system::default_queue()) +{ + return ::boost::compute::find_if(first, last, predicate, queue) != last; +} + +} // end compute namespace +} // end boost namespace + +#endif // BOOST_COMPUTE_ALGORITHM_ANY_OF_HPP diff --git a/3party/boost/boost/compute/algorithm/binary_search.hpp b/3party/boost/boost/compute/algorithm/binary_search.hpp new file mode 100644 index 0000000000..6e19498790 --- /dev/null +++ b/3party/boost/boost/compute/algorithm/binary_search.hpp @@ -0,0 +1,37 @@ +//---------------------------------------------------------------------------// +// Copyright (c) 2013 Kyle Lutz +// +// 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 +// +// See http://boostorg.github.com/compute for more information. +//---------------------------------------------------------------------------// + +#ifndef BOOST_COMPUTE_ALGORITHM_BINARY_SEARCH_HPP +#define BOOST_COMPUTE_ALGORITHM_BINARY_SEARCH_HPP + +#include +#include +#include + +namespace boost { +namespace compute { + +/// Returns \c true if \p value is in the sorted range [\p first, +/// \p last). +template +inline bool binary_search(InputIterator first, + InputIterator last, + const T &value, + command_queue &queue = system::default_queue()) +{ + InputIterator position = lower_bound(first, last, value, queue); + + return position != last && position.read(queue) == value; +} + +} // end compute namespace +} // end boost namespace + +#endif // BOOST_COMPUTE_ALGORITHM_BINARY_SEARCH_HPP diff --git a/3party/boost/boost/compute/algorithm/copy.hpp b/3party/boost/boost/compute/algorithm/copy.hpp new file mode 100644 index 0000000000..7779277b82 --- /dev/null +++ b/3party/boost/boost/compute/algorithm/copy.hpp @@ -0,0 +1,856 @@ +//---------------------------------------------------------------------------// +// Copyright (c) 2013 Kyle Lutz +// +// 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 +// +// See http://boostorg.github.com/compute for more information. +//---------------------------------------------------------------------------// + +#ifndef BOOST_COMPUTE_ALGORITHM_COPY_HPP +#define BOOST_COMPUTE_ALGORITHM_COPY_HPP + +#include +#include + +#include + +#include +#include +#include + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +namespace boost { +namespace compute { +namespace detail { + +namespace mpl = boost::mpl; + +// meta-function returning true if copy() between InputIterator and +// OutputIterator can be implemented with clEnqueueCopyBuffer(). +template +struct can_copy_with_copy_buffer : + mpl::and_< + mpl::or_< + boost::is_same< + InputIterator, + buffer_iterator + >, + boost::is_same< + InputIterator, + detail::device_ptr + > + >, + mpl::or_< + boost::is_same< + OutputIterator, + buffer_iterator + >, + boost::is_same< + OutputIterator, + detail::device_ptr + > + >, + boost::is_same< + typename InputIterator::value_type, + typename OutputIterator::value_type + > + >::type {}; + +// meta-function returning true if value_types of HostIterator and +// DeviceIterator are same +template +struct is_same_value_type : + boost::is_same< + typename boost::remove_cv< + typename std::iterator_traits::value_type + >::type, + typename boost::remove_cv< + typename DeviceIterator::value_type + >::type + >::type {}; + +// meta-function returning true if value_type of HostIterator is bool +template +struct is_bool_value_type : + boost::is_same< + typename boost::remove_cv< + typename std::iterator_traits::value_type + >::type, + bool + >::type {}; + +// host -> device (async) +template +inline future +dispatch_copy_async(InputIterator first, + InputIterator last, + OutputIterator result, + command_queue &queue, + typename boost::enable_if< + mpl::and_< + mpl::not_< + is_device_iterator + >, + is_device_iterator, + is_same_value_type + > + >::type* = 0) +{ + BOOST_STATIC_ASSERT_MSG( + is_contiguous_iterator::value, + "copy_async() is only supported for contiguous host iterators" + ); + + return copy_to_device_async(first, last, result, queue); +} + +// host -> device (async) +// Type mismatch between InputIterator and OutputIterator value_types +template +inline future +dispatch_copy_async(InputIterator first, + InputIterator last, + OutputIterator result, + command_queue &queue, + typename boost::enable_if< + mpl::and_< + mpl::not_< + is_device_iterator + >, + is_device_iterator, + mpl::not_< + is_same_value_type + > + > + >::type* = 0) +{ + BOOST_STATIC_ASSERT_MSG( + is_contiguous_iterator::value, + "copy_async() is only supported for contiguous host iterators" + ); + + typedef typename std::iterator_traits::value_type input_type; + + const context &context = queue.get_context(); + size_t count = iterator_range_size(first, last); + + if(count < size_t(1)) { + return future(); + } + + // map [first; last) to device and run copy kernel + // on device for copying & casting + ::boost::compute::mapped_view mapped_host( + // make sure it's a pointer to constant data + // to force read only mapping + const_cast( + ::boost::addressof(*first) + ), + count, + context + ); + return copy_on_device_async( + mapped_host.begin(), mapped_host.end(), result, queue + ); +} + +// host -> device +// InputIterator is a contiguous iterator +template +inline OutputIterator +dispatch_copy(InputIterator first, + InputIterator last, + OutputIterator result, + command_queue &queue, + typename boost::enable_if< + mpl::and_< + mpl::not_< + is_device_iterator + >, + is_device_iterator, + is_same_value_type, + is_contiguous_iterator + > + >::type* = 0) +{ + return copy_to_device(first, last, result, queue); +} + +// host -> device +// Type mismatch between InputIterator and OutputIterator value_types +// InputIterator is a contiguous iterator +template +inline OutputIterator +dispatch_copy(InputIterator first, + InputIterator last, + OutputIterator result, + command_queue &queue, + typename boost::enable_if< + mpl::and_< + mpl::not_< + is_device_iterator + >, + is_device_iterator, + mpl::not_< + is_same_value_type + >, + is_contiguous_iterator + > + >::type* = 0) +{ + typedef typename OutputIterator::value_type output_type; + typedef typename std::iterator_traits::value_type input_type; + + const device &device = queue.get_device(); + + // loading parameters + std::string cache_key = + std::string("__boost_compute_copy_to_device_") + + type_name() + "_" + type_name(); + boost::shared_ptr parameters = + detail::parameter_cache::get_global_cache(device); + + size_t map_copy_threshold; + size_t direct_copy_threshold; + + // calculate default values of thresholds + if (device.type() & device::gpu) { + // GPUs + map_copy_threshold = 524288; // 0.5 MB + direct_copy_threshold = 52428800; // 50 MB + } + else { + // CPUs and other devices + map_copy_threshold = 134217728; // 128 MB + direct_copy_threshold = 0; // it's never efficient for CPUs + } + + // load thresholds + map_copy_threshold = + parameters->get( + cache_key, "map_copy_threshold", map_copy_threshold + ); + direct_copy_threshold = + parameters->get( + cache_key, "direct_copy_threshold", direct_copy_threshold + ); + + // select copy method based on thresholds & input_size_bytes + size_t count = iterator_range_size(first, last); + size_t input_size_bytes = count * sizeof(input_type); + + // [0; map_copy_threshold) -> copy_to_device_map() + if(input_size_bytes < map_copy_threshold) { + return copy_to_device_map(first, last, result, queue); + } + // [map_copy_threshold; direct_copy_threshold) -> convert [first; last) + // on host and then perform copy_to_device() + else if(input_size_bytes < direct_copy_threshold) { + std::vector vector(first, last); + return copy_to_device(vector.begin(), vector.end(), result, queue); + } + + // [direct_copy_threshold; inf) -> map [first; last) to device and + // run copy kernel on device for copying & casting + // At this point we are sure that count > 1 (first != last). + + // Perform async copy to device, wait for it to be finished and + // return the result. + // At this point we are sure that count > 1 (first != last), so event + // returned by dispatch_copy_async() must be valid. + return dispatch_copy_async(first, last, result, queue).get(); +} + +// host -> device +// InputIterator is NOT a contiguous iterator +template +inline OutputIterator +dispatch_copy(InputIterator first, + InputIterator last, + OutputIterator result, + command_queue &queue, + typename boost::enable_if< + mpl::and_< + mpl::not_< + is_device_iterator + >, + is_device_iterator, + mpl::not_< + is_contiguous_iterator + > + > + >::type* = 0) +{ + typedef typename OutputIterator::value_type output_type; + typedef typename std::iterator_traits::value_type input_type; + + const device &device = queue.get_device(); + + // loading parameters + std::string cache_key = + std::string("__boost_compute_copy_to_device_") + + type_name() + "_" + type_name(); + boost::shared_ptr parameters = + detail::parameter_cache::get_global_cache(device); + + size_t map_copy_threshold; + size_t direct_copy_threshold; + + // calculate default values of thresholds + if (device.type() & device::gpu) { + // GPUs + map_copy_threshold = 524288; // 0.5 MB + direct_copy_threshold = 52428800; // 50 MB + } + else { + // CPUs and other devices + map_copy_threshold = 134217728; // 128 MB + direct_copy_threshold = 0; // it's never efficient for CPUs + } + + // load thresholds + map_copy_threshold = + parameters->get( + cache_key, "map_copy_threshold", map_copy_threshold + ); + direct_copy_threshold = + parameters->get( + cache_key, "direct_copy_threshold", direct_copy_threshold + ); + + // select copy method based on thresholds & input_size_bytes + size_t input_size = iterator_range_size(first, last); + size_t input_size_bytes = input_size * sizeof(input_type); + + // [0; map_copy_threshold) -> copy_to_device_map() + // + // if direct_copy_threshold is less than map_copy_threshold + // copy_to_device_map() is used for every input + if(input_size_bytes < map_copy_threshold + || direct_copy_threshold <= map_copy_threshold) { + return copy_to_device_map(first, last, result, queue); + } + // [map_copy_threshold; inf) -> convert [first; last) + // on host and then perform copy_to_device() + std::vector vector(first, last); + return copy_to_device(vector.begin(), vector.end(), result, queue); +} + +// device -> host (async) +template +inline future +dispatch_copy_async(InputIterator first, + InputIterator last, + OutputIterator result, + command_queue &queue, + typename boost::enable_if< + mpl::and_< + is_device_iterator, + mpl::not_< + is_device_iterator + >, + is_same_value_type + > + >::type* = 0) +{ + BOOST_STATIC_ASSERT_MSG( + is_contiguous_iterator::value, + "copy_async() is only supported for contiguous host iterators" + ); + + return copy_to_host_async(first, last, result, queue); +} + +// device -> host (async) +// Type mismatch between InputIterator and OutputIterator value_types +template +inline future +dispatch_copy_async(InputIterator first, + InputIterator last, + OutputIterator result, + command_queue &queue, + typename boost::enable_if< + mpl::and_< + is_device_iterator, + mpl::not_< + is_device_iterator + >, + mpl::not_< + is_same_value_type + > + > + >::type* = 0) +{ + BOOST_STATIC_ASSERT_MSG( + is_contiguous_iterator::value, + "copy_async() is only supported for contiguous host iterators" + ); + + typedef typename std::iterator_traits::value_type output_type; + const context &context = queue.get_context(); + size_t count = iterator_range_size(first, last); + + if(count < size_t(1)) { + return future(); + } + + // map host memory to device + buffer mapped_host( + context, + count * sizeof(output_type), + buffer::write_only | buffer::use_host_ptr, + static_cast( + ::boost::addressof(*result) + ) + ); + // copy async on device + ::boost::compute::future > future = + copy_on_device_async( + first, + last, + make_buffer_iterator(mapped_host), + queue + ); + // update host memory asynchronously by maping and unmaping memory + event map_event; + void* ptr = queue.enqueue_map_buffer_async( + mapped_host, + CL_MAP_READ, + 0, + count * sizeof(output_type), + map_event, + future.get_event() + ); + event unmap_event = + queue.enqueue_unmap_buffer(mapped_host, ptr, map_event); + return make_future(result + count, unmap_event); +} + +// device -> host +// OutputIterator is a contiguous iterator +template +inline OutputIterator +dispatch_copy(InputIterator first, + InputIterator last, + OutputIterator result, + command_queue &queue, + typename boost::enable_if< + mpl::and_< + is_device_iterator, + mpl::not_< + is_device_iterator + >, + is_same_value_type, + is_contiguous_iterator, + mpl::not_< + is_bool_value_type + > + > + >::type* = 0) +{ + return copy_to_host(first, last, result, queue); +} + +// device -> host +// Type mismatch between InputIterator and OutputIterator value_types +// OutputIterator is NOT a contiguous iterator or value_type of OutputIterator +// is a boolean type. +template +inline OutputIterator +dispatch_copy(InputIterator first, + InputIterator last, + OutputIterator result, + command_queue &queue, + typename boost::enable_if< + mpl::and_< + is_device_iterator, + mpl::not_< + is_device_iterator + >, + mpl::or_< + mpl::not_< + is_contiguous_iterator + >, + is_bool_value_type + > + > + >::type* = 0) +{ + typedef typename std::iterator_traits::value_type output_type; + typedef typename InputIterator::value_type input_type; + + const device &device = queue.get_device(); + + // loading parameters + std::string cache_key = + std::string("__boost_compute_copy_to_host_") + + type_name() + "_" + type_name(); + boost::shared_ptr parameters = + detail::parameter_cache::get_global_cache(device); + + size_t map_copy_threshold; + size_t direct_copy_threshold; + + // calculate default values of thresholds + if (device.type() & device::gpu) { + // GPUs + map_copy_threshold = 33554432; // 30 MB + direct_copy_threshold = 0; // it's never efficient for GPUs + } + else { + // CPUs and other devices + map_copy_threshold = 134217728; // 128 MB + direct_copy_threshold = 0; // it's never efficient for CPUs + } + + // load thresholds + map_copy_threshold = + parameters->get( + cache_key, "map_copy_threshold", map_copy_threshold + ); + direct_copy_threshold = + parameters->get( + cache_key, "direct_copy_threshold", direct_copy_threshold + ); + + // select copy method based on thresholds & input_size_bytes + size_t count = iterator_range_size(first, last); + size_t input_size_bytes = count * sizeof(input_type); + + // [0; map_copy_threshold) -> copy_to_host_map() + // + // if direct_copy_threshold is less than map_copy_threshold + // copy_to_host_map() is used for every input + if(input_size_bytes < map_copy_threshold + || direct_copy_threshold <= map_copy_threshold) { + return copy_to_host_map(first, last, result, queue); + } + // [map_copy_threshold; inf) -> copy [first;last) to temporary vector + // then copy (and convert) to result using std::copy() + std::vector vector(count); + copy_to_host(first, last, vector.begin(), queue); + return std::copy(vector.begin(), vector.end(), result); +} + +// device -> host +// Type mismatch between InputIterator and OutputIterator value_types +// OutputIterator is a contiguous iterator +// value_type of OutputIterator is NOT a boolean type +template +inline OutputIterator +dispatch_copy(InputIterator first, + InputIterator last, + OutputIterator result, + command_queue &queue, + typename boost::enable_if< + mpl::and_< + is_device_iterator, + mpl::not_< + is_device_iterator + >, + mpl::not_< + is_same_value_type + >, + is_contiguous_iterator, + mpl::not_< + is_bool_value_type + > + > + >::type* = 0) +{ + typedef typename std::iterator_traits::value_type output_type; + typedef typename InputIterator::value_type input_type; + + const device &device = queue.get_device(); + + // loading parameters + std::string cache_key = + std::string("__boost_compute_copy_to_host_") + + type_name() + "_" + type_name(); + boost::shared_ptr parameters = + detail::parameter_cache::get_global_cache(device); + + size_t map_copy_threshold; + size_t direct_copy_threshold; + + // calculate default values of thresholds + if (device.type() & device::gpu) { + // GPUs + map_copy_threshold = 524288; // 0.5 MB + direct_copy_threshold = 52428800; // 50 MB + } + else { + // CPUs and other devices + map_copy_threshold = 134217728; // 128 MB + direct_copy_threshold = 0; // it's never efficient for CPUs + } + + // load thresholds + map_copy_threshold = + parameters->get( + cache_key, "map_copy_threshold", map_copy_threshold + ); + direct_copy_threshold = + parameters->get( + cache_key, "direct_copy_threshold", direct_copy_threshold + ); + + // select copy method based on thresholds & input_size_bytes + size_t count = iterator_range_size(first, last); + size_t input_size_bytes = count * sizeof(input_type); + + // [0; map_copy_threshold) -> copy_to_host_map() + if(input_size_bytes < map_copy_threshold) { + return copy_to_host_map(first, last, result, queue); + } + // [map_copy_threshold; direct_copy_threshold) -> copy [first;last) to + // temporary vector then copy (and convert) to result using std::copy() + else if(input_size_bytes < direct_copy_threshold) { + std::vector vector(count); + copy_to_host(first, last, vector.begin(), queue); + return std::copy(vector.begin(), vector.end(), result); + } + + // [direct_copy_threshold; inf) -> map [result; result + input_size) to + // device and run copy kernel on device for copying & casting + // map host memory to device. + + // Perform async copy to host, wait for it to be finished and + // return the result. + // At this point we are sure that count > 1 (first != last), so event + // returned by dispatch_copy_async() must be valid. + return dispatch_copy_async(first, last, result, queue).get(); +} + +// device -> device +template +inline OutputIterator +dispatch_copy(InputIterator first, + InputIterator last, + OutputIterator result, + command_queue &queue, + typename boost::enable_if< + mpl::and_< + is_device_iterator, + is_device_iterator, + mpl::not_< + can_copy_with_copy_buffer< + InputIterator, OutputIterator + > + > + > + >::type* = 0) +{ + return copy_on_device(first, last, result, queue); +} + +// device -> device (specialization for buffer iterators) +template +inline OutputIterator +dispatch_copy(InputIterator first, + InputIterator last, + OutputIterator result, + command_queue &queue, + typename boost::enable_if< + mpl::and_< + is_device_iterator, + is_device_iterator, + can_copy_with_copy_buffer< + InputIterator, OutputIterator + > + > + >::type* = 0) +{ + typedef typename std::iterator_traits::value_type value_type; + typedef typename std::iterator_traits::difference_type difference_type; + + difference_type n = std::distance(first, last); + if(n < 1){ + // nothing to copy + return result; + } + + queue.enqueue_copy_buffer(first.get_buffer(), + result.get_buffer(), + first.get_index() * sizeof(value_type), + result.get_index() * sizeof(value_type), + static_cast(n) * sizeof(value_type)); + return result + n; +} + +// device -> device (async) +template +inline future +dispatch_copy_async(InputIterator first, + InputIterator last, + OutputIterator result, + command_queue &queue, + typename boost::enable_if< + mpl::and_< + is_device_iterator, + is_device_iterator, + mpl::not_< + can_copy_with_copy_buffer< + InputIterator, OutputIterator + > + > + > + >::type* = 0) +{ + return copy_on_device_async(first, last, result, queue); +} + +// device -> device (async, specialization for buffer iterators) +template +inline future +dispatch_copy_async(InputIterator first, + InputIterator last, + OutputIterator result, + command_queue &queue, + typename boost::enable_if< + mpl::and_< + is_device_iterator, + is_device_iterator, + can_copy_with_copy_buffer< + InputIterator, OutputIterator + > + > + >::type* = 0) +{ + typedef typename std::iterator_traits::value_type value_type; + typedef typename std::iterator_traits::difference_type difference_type; + + difference_type n = std::distance(first, last); + if(n < 1){ + // nothing to copy + return make_future(result, event()); + } + + event event_ = + queue.enqueue_copy_buffer( + first.get_buffer(), + result.get_buffer(), + first.get_index() * sizeof(value_type), + result.get_index() * sizeof(value_type), + static_cast(n) * sizeof(value_type) + ); + + return make_future(result + n, event_); +} + +// host -> host +template +inline OutputIterator +dispatch_copy(InputIterator first, + InputIterator last, + OutputIterator result, + command_queue &queue, + typename boost::enable_if_c< + !is_device_iterator::value && + !is_device_iterator::value + >::type* = 0) +{ + (void) queue; + + return std::copy(first, last, result); +} + +} // end detail namespace + +/// Copies the values in the range [\p first, \p last) to the range +/// beginning at \p result. +/// +/// The generic copy() function can be used for a variety of data +/// transfer tasks and provides a standard interface to the following +/// OpenCL functions: +/// +/// \li \c clEnqueueReadBuffer() +/// \li \c clEnqueueWriteBuffer() +/// \li \c clEnqueueCopyBuffer() +/// +/// Unlike the aforementioned OpenCL functions, copy() will also work +/// with non-contiguous data-structures (e.g. \c std::list) as +/// well as with "fancy" iterators (e.g. transform_iterator). +/// +/// \param first first element in the range to copy +/// \param last last element in the range to copy +/// \param result first element in the result range +/// \param queue command queue to perform the operation +/// +/// \return \c OutputIterator to the end of the result range +/// +/// For example, to copy an array of \c int values on the host to a vector on +/// the device: +/// \code +/// // array on the host +/// int data[] = { 1, 2, 3, 4 }; +/// +/// // vector on the device +/// boost::compute::vector vec(4, context); +/// +/// // copy values to the device vector +/// boost::compute::copy(data, data + 4, vec.begin(), queue); +/// \endcode +/// +/// The copy algorithm can also be used with standard containers such as +/// \c std::vector: +/// \code +/// std::vector host_vector = ... +/// boost::compute::vector device_vector = ... +/// +/// // copy from the host to the device +/// boost::compute::copy( +/// host_vector.begin(), host_vector.end(), device_vector.begin(), queue +/// ); +/// +/// // copy from the device to the host +/// boost::compute::copy( +/// device_vector.begin(), device_vector.end(), host_vector.begin(), queue +/// ); +/// \endcode +/// +/// \see copy_n(), copy_if(), copy_async() +template +inline OutputIterator copy(InputIterator first, + InputIterator last, + OutputIterator result, + command_queue &queue = system::default_queue()) +{ + return detail::dispatch_copy(first, last, result, queue); +} + +/// Copies the values in the range [\p first, \p last) to the range +/// beginning at \p result. The copy is performed asynchronously. +/// +/// \see copy() +template +inline future +copy_async(InputIterator first, + InputIterator last, + OutputIterator result, + command_queue &queue = system::default_queue()) +{ + return detail::dispatch_copy_async(first, last, result, queue); +} + +} // end compute namespace +} // end boost namespace + +#endif // BOOST_COMPUTE_ALGORITHM_COPY_HPP diff --git a/3party/boost/boost/compute/algorithm/copy_if.hpp b/3party/boost/boost/compute/algorithm/copy_if.hpp new file mode 100644 index 0000000000..3cd08ef293 --- /dev/null +++ b/3party/boost/boost/compute/algorithm/copy_if.hpp @@ -0,0 +1,58 @@ +//---------------------------------------------------------------------------// +// Copyright (c) 2013 Kyle Lutz +// +// 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 +// +// See http://boostorg.github.com/compute for more information. +//---------------------------------------------------------------------------// + +#ifndef BOOST_COMPUTE_ALGORITHM_COPY_IF_HPP +#define BOOST_COMPUTE_ALGORITHM_COPY_IF_HPP + +#include +#include + +namespace boost { +namespace compute { +namespace detail { + +// like the copy_if() algorithm but writes the indices of the values for which +// predicate returns true. +template +inline OutputIterator copy_index_if(InputIterator first, + InputIterator last, + OutputIterator result, + Predicate predicate, + command_queue &queue = system::default_queue()) +{ + typedef typename std::iterator_traits::value_type T; + + return detail::transform_if_impl( + first, last, result, identity(), predicate, true, queue + ); +} + +} // end detail namespace + +/// Copies each element in the range [\p first, \p last) for which +/// \p predicate returns \c true to the range beginning at \p result. +template +inline OutputIterator copy_if(InputIterator first, + InputIterator last, + OutputIterator result, + Predicate predicate, + command_queue &queue = system::default_queue()) +{ + typedef typename std::iterator_traits::value_type T; + + return ::boost::compute::transform_if( + first, last, result, identity(), predicate, queue + ); +} + +} // end compute namespace +} // end boost namespace + +#endif // BOOST_COMPUTE_ALGORITHM_COPY_IF_HPP diff --git a/3party/boost/boost/compute/algorithm/copy_n.hpp b/3party/boost/boost/compute/algorithm/copy_n.hpp new file mode 100644 index 0000000000..f0989edc67 --- /dev/null +++ b/3party/boost/boost/compute/algorithm/copy_n.hpp @@ -0,0 +1,51 @@ +//---------------------------------------------------------------------------// +// Copyright (c) 2013 Kyle Lutz +// +// 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 +// +// See http://boostorg.github.com/compute for more information. +//---------------------------------------------------------------------------// + +#ifndef BOOST_COMPUTE_ALGORITHM_COPY_N_HPP +#define BOOST_COMPUTE_ALGORITHM_COPY_N_HPP + +#include +#include +#include + +namespace boost { +namespace compute { + +/// Copies \p count elements from \p first to \p result. +/// +/// For example, to copy four values from the host to the device: +/// \code +/// // values on the host and vector on the device +/// float values[4] = { 1.f, 2.f, 3.f, 4.f }; +/// boost::compute::vector vec(4, context); +/// +/// // copy from the host to the device +/// boost::compute::copy_n(values, 4, vec.begin(), queue); +/// \endcode +/// +/// \see copy() +template +inline OutputIterator copy_n(InputIterator first, + Size count, + OutputIterator result, + command_queue &queue = system::default_queue()) +{ + typedef typename std::iterator_traits::difference_type difference_type; + + return ::boost::compute::copy(first, + first + static_cast(count), + result, + queue); +} + +} // end compute namespace +} // end boost namespace + +#endif // BOOST_COMPUTE_ALGORITHM_COPY_N_HPP diff --git a/3party/boost/boost/compute/algorithm/count.hpp b/3party/boost/boost/compute/algorithm/count.hpp new file mode 100644 index 0000000000..140d67379f --- /dev/null +++ b/3party/boost/boost/compute/algorithm/count.hpp @@ -0,0 +1,55 @@ +//---------------------------------------------------------------------------// +// Copyright (c) 2013 Kyle Lutz +// +// 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 +// +// See http://boostorg.github.com/compute for more information. +//---------------------------------------------------------------------------// + +#ifndef BOOST_COMPUTE_ALGORITHM_COUNT_HPP +#define BOOST_COMPUTE_ALGORITHM_COUNT_HPP + +#include +#include +#include +#include +#include + +namespace boost { +namespace compute { + +/// Returns the number of occurrences of \p value in the range +/// [\p first, \p last). +/// +/// \see count_if() +template +inline size_t count(InputIterator first, + InputIterator last, + const T &value, + command_queue &queue = system::default_queue()) +{ + typedef typename std::iterator_traits::value_type value_type; + + using ::boost::compute::_1; + using ::boost::compute::lambda::all; + + if(vector_size::value == 1){ + return ::boost::compute::count_if(first, + last, + _1 == value, + queue); + } + else { + return ::boost::compute::count_if(first, + last, + all(_1 == value), + queue); + } +} + +} // end compute namespace +} // end boost namespace + +#endif // BOOST_COMPUTE_ALGORITHM_COUNT_HPP diff --git a/3party/boost/boost/compute/algorithm/count_if.hpp b/3party/boost/boost/compute/algorithm/count_if.hpp new file mode 100644 index 0000000000..c9381ce5d4 --- /dev/null +++ b/3party/boost/boost/compute/algorithm/count_if.hpp @@ -0,0 +1,62 @@ +//---------------------------------------------------------------------------// +// Copyright (c) 2013 Kyle Lutz +// +// 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 +// +// See http://boostorg.github.com/compute for more information. +//---------------------------------------------------------------------------// + +#ifndef BOOST_COMPUTE_ALGORITHM_COUNT_IF_HPP +#define BOOST_COMPUTE_ALGORITHM_COUNT_IF_HPP + +#include +#include +#include +#include +#include +#include +#include +#include + +namespace boost { +namespace compute { + +/// Returns the number of elements in the range [\p first, \p last) +/// for which \p predicate returns \c true. +template +inline size_t count_if(InputIterator first, + InputIterator last, + Predicate predicate, + command_queue &queue = system::default_queue()) +{ + const device &device = queue.get_device(); + + size_t input_size = detail::iterator_range_size(first, last); + if(input_size == 0){ + return 0; + } + + if(device.type() & device::cpu){ + if(input_size < 1024){ + return detail::serial_count_if(first, last, predicate, queue); + } + else { + return detail::count_if_with_threads(first, last, predicate, queue); + } + } + else { + if(input_size < 32){ + return detail::serial_count_if(first, last, predicate, queue); + } + else { + return detail::count_if_with_reduce(first, last, predicate, queue); + } + } +} + +} // end compute namespace +} // end boost namespace + +#endif // BOOST_COMPUTE_ALGORITHM_COUNT_IF_HPP diff --git a/3party/boost/boost/compute/algorithm/detail/balanced_path.hpp b/3party/boost/boost/compute/algorithm/detail/balanced_path.hpp new file mode 100644 index 0000000000..e5025532d3 --- /dev/null +++ b/3party/boost/boost/compute/algorithm/detail/balanced_path.hpp @@ -0,0 +1,162 @@ +//---------------------------------------------------------------------------// +// Copyright (c) 2014 Roshan +// +// 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 +// +// See http://boostorg.github.com/compute for more information. +//---------------------------------------------------------------------------// + +#ifndef BOOST_COMPUTE_ALGORITHM_DETAIL_BALANCED_PATH_HPP +#define BOOST_COMPUTE_ALGORITHM_DETAIL_BALANCED_PATH_HPP + +#include + +#include +#include +#include +#include +#include +#include + +namespace boost { +namespace compute { +namespace detail { + +/// +/// \brief Balanced Path kernel class +/// +/// Subclass of meta_kernel to break two sets into tiles according +/// to their balanced path. +/// +class balanced_path_kernel : public meta_kernel +{ +public: + unsigned int tile_size; + + balanced_path_kernel() : meta_kernel("balanced_path") + { + tile_size = 4; + } + + template + void set_range(InputIterator1 first1, + InputIterator1 last1, + InputIterator2 first2, + InputIterator2 last2, + OutputIterator1 result_a, + OutputIterator2 result_b, + Compare comp) + { + typedef typename std::iterator_traits::value_type value_type; + + m_a_count = iterator_range_size(first1, last1); + m_a_count_arg = add_arg("a_count"); + + m_b_count = iterator_range_size(first2, last2); + m_b_count_arg = add_arg("b_count"); + + *this << + "uint i = get_global_id(0);\n" << + "uint target = (i+1)*" << tile_size << ";\n" << + "uint start = max(convert_int(0),convert_int(target)-convert_int(b_count));\n" << + "uint end = min(target,a_count);\n" << + "uint a_index, b_index;\n" << + "while(start("b_index")], + first1[expr("a_index")]) << "))\n" << + " start = a_index + 1;\n" << + " else end = a_index;\n" << + "}\n" << + "a_index = start;\n" << + "b_index = target - start;\n" << + "if(b_index < b_count)\n" << + "{\n" << + " " << decl("x") << " = " << + first2[expr("b_index")] << ";\n" << + " uint a_start = 0, a_end = a_index, a_mid;\n" << + " uint b_start = 0, b_end = b_index, b_mid;\n" << + " while(a_start("a_mid")], expr("x")) << ")\n" << + " a_start = a_mid+1;\n" << + " else a_end = a_mid;\n" << + " }\n" << + " while(b_start("b_mid")], expr("x")) << ")\n" << + " b_start = b_mid+1;\n" << + " else b_end = b_mid;\n" << + " }\n" << + " uint a_run = a_index - a_start;\n" << + " uint b_run = b_index - b_start;\n" << + " uint x_count = a_run + b_run;\n" << + " uint b_advance = max(x_count / 2, x_count - a_run);\n" << + " b_end = min(b_count, b_start + b_advance + 1);\n" << + " uint temp_start = b_index, temp_end = b_end, temp_mid;" << + " while(temp_start < temp_end)\n" << + " {\n" << + " temp_mid = (temp_start + temp_end + 1)/2;\n" << + " if(" << comp(expr("x"), first2[expr("temp_mid")]) << ")\n" << + " temp_end = temp_mid-1;\n" << + " else temp_start = temp_mid;\n" << + " }\n" << + " b_run = temp_start - b_start + 1;\n" << + " b_advance = min(b_advance, b_run);\n" << + " uint a_advance = x_count - b_advance;\n" << + " uint star = convert_uint((a_advance == b_advance + 1) " << + "&& (b_advance < b_run));\n" << + " a_index = a_start + a_advance;\n" << + " b_index = target - a_index + star;\n" << + "}\n" << + result_a[expr("i")] << " = a_index;\n" << + result_b[expr("i")] << " = b_index;\n"; + + } + + template + void set_range(InputIterator1 first1, + InputIterator1 last1, + InputIterator2 first2, + InputIterator2 last2, + OutputIterator1 result_a, + OutputIterator2 result_b) + { + typedef typename std::iterator_traits::value_type value_type; + ::boost::compute::less less_than; + set_range(first1, last1, first2, last2, result_a, result_b, less_than); + } + + event exec(command_queue &queue) + { + if((m_a_count + m_b_count)/tile_size == 0) { + return event(); + } + + set_arg(m_a_count_arg, uint_(m_a_count)); + set_arg(m_b_count_arg, uint_(m_b_count)); + + return exec_1d(queue, 0, (m_a_count + m_b_count)/tile_size); + } + +private: + size_t m_a_count; + size_t m_a_count_arg; + size_t m_b_count; + size_t m_b_count_arg; +}; + +} //end detail namespace +} //end compute namespace +} //end boost namespace + +#endif // BOOST_COMPUTE_ALGORITHM_DETAIL_BALANCED_PATH_HPP diff --git a/3party/boost/boost/compute/algorithm/detail/binary_find.hpp b/3party/boost/boost/compute/algorithm/detail/binary_find.hpp new file mode 100644 index 0000000000..27fa11fbaf --- /dev/null +++ b/3party/boost/boost/compute/algorithm/detail/binary_find.hpp @@ -0,0 +1,133 @@ +//---------------------------------------------------------------------------// +// Copyright (c) 2014 Roshan +// +// 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 +// +// See http://boostorg.github.com/compute for more information. +//---------------------------------------------------------------------------// + +#ifndef BOOST_COMPUTE_ALGORITHM_DETAIL_BINARY_FIND_HPP +#define BOOST_COMPUTE_ALGORITHM_DETAIL_BINARY_FIND_HPP + +#include +#include +#include +#include +#include + +namespace boost { +namespace compute { +namespace detail{ + +/// +/// \brief Binary find kernel class +/// +/// Subclass of meta_kernel to perform single step in binary find. +/// +template +class binary_find_kernel : public meta_kernel +{ +public: + binary_find_kernel(InputIterator first, + InputIterator last, + UnaryPredicate predicate) + : meta_kernel("binary_find") + { + typedef typename std::iterator_traits::value_type value_type; + + m_index_arg = add_arg(memory_object::global_memory, "index"); + m_block_arg = add_arg("block"); + + atomic_min atomic_min_uint; + + *this << + "uint i = get_global_id(0) * block;\n" << + decl("value") << "=" << first[var("i")] << ";\n" << + "if(" << predicate(var("value")) << ") {\n" << + atomic_min_uint(var("index"), var("i")) << ";\n" << + "}\n"; + } + + size_t m_index_arg; + size_t m_block_arg; +}; + +/// +/// \brief Binary find algorithm +/// +/// Finds the end of true values in the partitioned range [first, last). +/// \return Iterator pointing to end of true values +/// +/// \param first Iterator pointing to start of range +/// \param last Iterator pointing to end of range +/// \param predicate Predicate according to which the range is partitioned +/// \param queue Queue on which to execute +/// +template +inline InputIterator binary_find(InputIterator first, + InputIterator last, + UnaryPredicate predicate, + command_queue &queue = system::default_queue()) +{ + const device &device = queue.get_device(); + + boost::shared_ptr parameters = + detail::parameter_cache::get_global_cache(device); + + const std::string cache_key = "__boost_binary_find"; + + size_t find_if_limit = 128; + size_t threads = parameters->get(cache_key, "tpb", 128); + size_t count = iterator_range_size(first, last); + + InputIterator search_first = first; + InputIterator search_last = last; + + scalar index(queue.get_context()); + + // construct and compile binary_find kernel + binary_find_kernel + binary_find_kernel(search_first, search_last, predicate); + ::boost::compute::kernel kernel = binary_find_kernel.compile(queue.get_context()); + + // set buffer for index + kernel.set_arg(binary_find_kernel.m_index_arg, index.get_buffer()); + + while(count > find_if_limit) { + index.write(static_cast(count), queue); + + // set block and run binary_find kernel + uint_ block = static_cast((count - 1)/(threads - 1)); + kernel.set_arg(binary_find_kernel.m_block_arg, block); + queue.enqueue_1d_range_kernel(kernel, 0, threads, 0); + + size_t i = index.read(queue); + + if(i == count) { + search_first = search_last - ((count - 1)%(threads - 1)); + break; + } else { + search_last = search_first + i; + search_first = search_last - ((count - 1)/(threads - 1)); + } + + // Make sure that first and last stay within the input range + search_last = (std::min)(search_last, last); + search_last = (std::max)(search_last, first); + + search_first = (std::max)(search_first, first); + search_first = (std::min)(search_first, last); + + count = iterator_range_size(search_first, search_last); + } + + return find_if(search_first, search_last, predicate, queue); +} + +} // end detail namespace +} // end compute namespace +} // end boost namespace + +#endif // BOOST_COMPUTE_ALGORITHM_DETAIL_BINARY_FIND_HPP diff --git a/3party/boost/boost/compute/algorithm/detail/compact.hpp b/3party/boost/boost/compute/algorithm/detail/compact.hpp new file mode 100644 index 0000000000..983352d543 --- /dev/null +++ b/3party/boost/boost/compute/algorithm/detail/compact.hpp @@ -0,0 +1,77 @@ +//---------------------------------------------------------------------------// +// Copyright (c) 2014 Roshan +// +// 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 +// +// See http://boostorg.github.com/compute for more information. +//---------------------------------------------------------------------------// + +#ifndef BOOST_COMPUTE_ALGORITHM_DETAIL_COMPACT_HPP +#define BOOST_COMPUTE_ALGORITHM_DETAIL_COMPACT_HPP + +#include + +#include +#include +#include +#include + +namespace boost { +namespace compute { +namespace detail { + +/// +/// \brief Compact kernel class +/// +/// Subclass of meta_kernel to compact the result of set kernels to +/// get actual sets +/// +class compact_kernel : public meta_kernel +{ +public: + unsigned int tile_size; + + compact_kernel() : meta_kernel("compact") + { + tile_size = 4; + } + + template + void set_range(InputIterator1 start, + InputIterator2 counts_begin, + InputIterator2 counts_end, + OutputIterator result) + { + m_count = iterator_range_size(counts_begin, counts_end) - 1; + + *this << + "uint i = get_global_id(0);\n" << + "uint count = i*" << tile_size << ";\n" << + "for(uint j = " << counts_begin[expr("i")] << "; j<" << + counts_begin[expr("i+1")] << "; j++, count++)\n" << + "{\n" << + result[expr("j")] << " = " << start[expr("count")] + << ";\n" << + "}\n"; + } + + event exec(command_queue &queue) + { + if(m_count == 0) { + return event(); + } + + return exec_1d(queue, 0, m_count); + } + +private: + size_t m_count; +}; + +} //end detail namespace +} //end compute namespace +} //end boost namespace + +#endif // BOOST_COMPUTE_ALGORITHM_DETAIL_COMPACT_HPP diff --git a/3party/boost/boost/compute/algorithm/detail/copy_on_device.hpp b/3party/boost/boost/compute/algorithm/detail/copy_on_device.hpp new file mode 100644 index 0000000000..8738c8c0b4 --- /dev/null +++ b/3party/boost/boost/compute/algorithm/detail/copy_on_device.hpp @@ -0,0 +1,190 @@ +//---------------------------------------------------------------------------// +// Copyright (c) 2013 Kyle Lutz +// +// 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 +// +// See http://boostorg.github.com/compute for more information. +//---------------------------------------------------------------------------// + +#ifndef BOOST_COMPUTE_ALGORITHM_DETAIL_COPY_ON_DEVICE_HPP +#define BOOST_COMPUTE_ALGORITHM_DETAIL_COPY_ON_DEVICE_HPP + +#include + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +namespace boost { +namespace compute { +namespace detail { + +template +inline event copy_on_device_cpu(InputIterator first, + OutputIterator result, + size_t count, + command_queue &queue) +{ + meta_kernel k("copy"); + const device& device = queue.get_device(); + + k << + "uint block = " << + "(uint)ceil(((float)count)/get_global_size(0));\n" << + "uint index = get_global_id(0) * block;\n" << + "uint end = min(count, index + block);\n" << + "while(index < end){\n" << + result[k.var("index")] << '=' << + first[k.var("index")] << ";\n" << + "index++;\n" << + "}\n"; + + k.add_set_arg("count", static_cast(count)); + + size_t global_work_size = device.compute_units(); + if(count <= 1024) global_work_size = 1; + return k.exec_1d(queue, 0, global_work_size); +} + +template +inline event copy_on_device_gpu(InputIterator first, + OutputIterator result, + size_t count, + command_queue &queue) +{ + typedef typename std::iterator_traits::value_type input_type; + + const device& device = queue.get_device(); + boost::shared_ptr parameters = + detail::parameter_cache::get_global_cache(device); + std::string cache_key = + "__boost_copy_kernel_" + boost::lexical_cast(sizeof(input_type)); + + uint_ vpt = parameters->get(cache_key, "vpt", 4); + uint_ tpb = parameters->get(cache_key, "tpb", 128); + + meta_kernel k("copy"); + k << + "uint index = get_local_id(0) + " << + "(" << vpt * tpb << " * get_group_id(0));\n" << + "for(uint i = 0; i < " << vpt << "; i++){\n" << + " if(index < count){\n" << + result[k.var("index")] << '=' << + first[k.var("index")] << ";\n" << + " index += " << tpb << ";\n" + " }\n" + "}\n"; + + k.add_set_arg("count", static_cast(count)); + size_t global_work_size = calculate_work_size(count, vpt, tpb); + return k.exec_1d(queue, 0, global_work_size, tpb); +} + +template +inline event dispatch_copy_on_device(InputIterator first, + InputIterator last, + OutputIterator result, + command_queue &queue) +{ + const size_t count = detail::iterator_range_size(first, last); + + if(count == 0){ + // nothing to do + return event(); + } + + const device& device = queue.get_device(); + // copy_on_device_cpu() does not work for CPU on Apple platform + // due to bug in its compiler. + // See https://github.com/boostorg/compute/pull/626 + if((device.type() & device::cpu) && !is_apple_platform_device(device)) + { + return copy_on_device_cpu(first, result, count, queue); + } + return copy_on_device_gpu(first, result, count, queue); +} + +template +inline OutputIterator copy_on_device(InputIterator first, + InputIterator last, + OutputIterator result, + command_queue &queue) +{ + dispatch_copy_on_device(first, last, result, queue); + return result + std::distance(first, last); +} + +template +inline discard_iterator copy_on_device(InputIterator first, + InputIterator last, + discard_iterator result, + command_queue &queue) +{ + (void) queue; + + return result + std::distance(first, last); +} + +template +inline future copy_on_device_async(InputIterator first, + InputIterator last, + OutputIterator result, + command_queue &queue) +{ + event event_ = dispatch_copy_on_device(first, last, result, queue); + return make_future(result + std::distance(first, last), event_); +} + +#ifdef CL_VERSION_2_0 +// copy_on_device() specialization for svm_ptr +template +inline svm_ptr copy_on_device(svm_ptr first, + svm_ptr last, + svm_ptr result, + command_queue &queue) +{ + size_t count = iterator_range_size(first, last); + if(count == 0){ + return result; + } + + queue.enqueue_svm_memcpy( + result.get(), first.get(), count * sizeof(T) + ); + + return result + count; +} + +template +inline future > copy_on_device_async(svm_ptr first, + svm_ptr last, + svm_ptr result, + command_queue &queue) +{ + size_t count = iterator_range_size(first, last); + if(count == 0){ + return future >(); + } + + event event_ = queue.enqueue_svm_memcpy_async( + result.get(), first.get(), count * sizeof(T) + ); + + return make_future(result + count, event_); +} +#endif // CL_VERSION_2_0 + +} // end detail namespace +} // end compute namespace +} // end boost namespace + +#endif // BOOST_COMPUTE_ALGORITHM_DETAIL_COPY_ON_DEVICE_HPP diff --git a/3party/boost/boost/compute/algorithm/detail/copy_to_device.hpp b/3party/boost/boost/compute/algorithm/detail/copy_to_device.hpp new file mode 100644 index 0000000000..bce5975f53 --- /dev/null +++ b/3party/boost/boost/compute/algorithm/detail/copy_to_device.hpp @@ -0,0 +1,193 @@ +//---------------------------------------------------------------------------// +// Copyright (c) 2013 Kyle Lutz +// +// 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 +// +// See http://boostorg.github.com/compute for more information. +//---------------------------------------------------------------------------// + +#ifndef BOOST_COMPUTE_ALGORITHM_DETAIL_COPY_TO_DEVICE_HPP +#define BOOST_COMPUTE_ALGORITHM_DETAIL_COPY_TO_DEVICE_HPP + +#include + +#include + +#include +#include +#include +#include + +namespace boost { +namespace compute { +namespace detail { + +template +inline DeviceIterator copy_to_device(HostIterator first, + HostIterator last, + DeviceIterator result, + command_queue &queue) +{ + typedef typename + std::iterator_traits::value_type + value_type; + typedef typename + std::iterator_traits::difference_type + difference_type; + + size_t count = iterator_range_size(first, last); + if(count == 0){ + return result; + } + + size_t offset = result.get_index(); + + queue.enqueue_write_buffer(result.get_buffer(), + offset * sizeof(value_type), + count * sizeof(value_type), + ::boost::addressof(*first)); + + return result + static_cast(count); +} + +template +inline DeviceIterator copy_to_device_map(HostIterator first, + HostIterator last, + DeviceIterator result, + command_queue &queue) +{ + typedef typename + std::iterator_traits::value_type + value_type; + typedef typename + std::iterator_traits::difference_type + difference_type; + + size_t count = iterator_range_size(first, last); + if(count == 0){ + return result; + } + + size_t offset = result.get_index(); + + // map result buffer to host + value_type *pointer = static_cast( + queue.enqueue_map_buffer( + result.get_buffer(), + CL_MAP_WRITE, + offset * sizeof(value_type), + count * sizeof(value_type) + ) + ); + + // copy [first; last) to result buffer + std::copy(first, last, pointer); + + // unmap result buffer + boost::compute::event unmap_event = queue.enqueue_unmap_buffer( + result.get_buffer(), + static_cast(pointer) + ); + unmap_event.wait(); + + return result + static_cast(count); +} + +template +inline future copy_to_device_async(HostIterator first, + HostIterator last, + DeviceIterator result, + command_queue &queue) +{ + typedef typename + std::iterator_traits::value_type + value_type; + typedef typename + std::iterator_traits::difference_type + difference_type; + + size_t count = iterator_range_size(first, last); + if(count == 0){ + return future(); + } + + size_t offset = result.get_index(); + + event event_ = + queue.enqueue_write_buffer_async(result.get_buffer(), + offset * sizeof(value_type), + count * sizeof(value_type), + ::boost::addressof(*first)); + + return make_future(result + static_cast(count), event_); +} + +#ifdef CL_VERSION_2_0 +// copy_to_device() specialization for svm_ptr +template +inline svm_ptr copy_to_device(HostIterator first, + HostIterator last, + svm_ptr result, + command_queue &queue) +{ + size_t count = iterator_range_size(first, last); + if(count == 0){ + return result; + } + + queue.enqueue_svm_memcpy( + result.get(), ::boost::addressof(*first), count * sizeof(T) + ); + + return result + count; +} + +template +inline future > copy_to_device_async(HostIterator first, + HostIterator last, + svm_ptr result, + command_queue &queue) +{ + size_t count = iterator_range_size(first, last); + if(count == 0){ + return future >(); + } + + event event_ = queue.enqueue_svm_memcpy_async( + result.get(), ::boost::addressof(*first), count * sizeof(T) + ); + + return make_future(result + count, event_); +} + +template +inline svm_ptr copy_to_device_map(HostIterator first, + HostIterator last, + svm_ptr result, + command_queue &queue) +{ + size_t count = iterator_range_size(first, last); + if(count == 0){ + return result; + } + + // map + queue.enqueue_svm_map(result.get(), count * sizeof(T), CL_MAP_WRITE); + + // copy [first; last) to result buffer + std::copy(first, last, static_cast(result.get())); + + // unmap result + queue.enqueue_svm_unmap(result.get()).wait(); + + return result + count; +} +#endif // CL_VERSION_2_0 + +} // end detail namespace +} // end compute namespace +} // end boost namespace + +#endif // BOOST_COMPUTE_ALGORITHM_DETAIL_COPY_TO_DEVICE_HPP diff --git a/3party/boost/boost/compute/algorithm/detail/copy_to_host.hpp b/3party/boost/boost/compute/algorithm/detail/copy_to_host.hpp new file mode 100644 index 0000000000..d770a996ef --- /dev/null +++ b/3party/boost/boost/compute/algorithm/detail/copy_to_host.hpp @@ -0,0 +1,198 @@ +//---------------------------------------------------------------------------// +// Copyright (c) 2013 Kyle Lutz +// +// 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 +// +// See http://boostorg.github.com/compute for more information. +//---------------------------------------------------------------------------// + +#ifndef BOOST_COMPUTE_ALGORITHM_DETAIL_COPY_TO_HOST_HPP +#define BOOST_COMPUTE_ALGORITHM_DETAIL_COPY_TO_HOST_HPP + +#include + +#include + +#include +#include +#include +#include +#include + +namespace boost { +namespace compute { +namespace detail { + +template +inline HostIterator copy_to_host(DeviceIterator first, + DeviceIterator last, + HostIterator result, + command_queue &queue) +{ + typedef typename + std::iterator_traits::value_type + value_type; + + size_t count = iterator_range_size(first, last); + if(count == 0){ + return result; + } + + const buffer &buffer = first.get_buffer(); + size_t offset = first.get_index(); + + queue.enqueue_read_buffer(buffer, + offset * sizeof(value_type), + count * sizeof(value_type), + ::boost::addressof(*result)); + + return iterator_plus_distance(result, count); +} + +template +inline HostIterator copy_to_host_map(DeviceIterator first, + DeviceIterator last, + HostIterator result, + command_queue &queue) +{ + typedef typename + std::iterator_traits::value_type + value_type; + typedef typename + std::iterator_traits::difference_type + difference_type; + + size_t count = iterator_range_size(first, last); + if(count == 0){ + return result; + } + + size_t offset = first.get_index(); + + // map [first; last) buffer to host + value_type *pointer = static_cast( + queue.enqueue_map_buffer( + first.get_buffer(), + CL_MAP_READ, + offset * sizeof(value_type), + count * sizeof(value_type) + ) + ); + + // copy [first; last) to result buffer + std::copy( + pointer, + pointer + static_cast(count), + result + ); + + // unmap [first; last) + boost::compute::event unmap_event = queue.enqueue_unmap_buffer( + first.get_buffer(), + static_cast(pointer) + ); + unmap_event.wait(); + + return iterator_plus_distance(result, count); +} + +template +inline future copy_to_host_async(DeviceIterator first, + DeviceIterator last, + HostIterator result, + command_queue &queue) +{ + typedef typename + std::iterator_traits::value_type + value_type; + + size_t count = iterator_range_size(first, last); + if(count == 0){ + return future(); + } + + const buffer &buffer = first.get_buffer(); + size_t offset = first.get_index(); + + event event_ = + queue.enqueue_read_buffer_async(buffer, + offset * sizeof(value_type), + count * sizeof(value_type), + ::boost::addressof(*result)); + + return make_future(iterator_plus_distance(result, count), event_); +} + +#ifdef CL_VERSION_2_0 +// copy_to_host() specialization for svm_ptr +template +inline HostIterator copy_to_host(svm_ptr first, + svm_ptr last, + HostIterator result, + command_queue &queue) +{ + size_t count = iterator_range_size(first, last); + if(count == 0){ + return result; + } + + queue.enqueue_svm_memcpy( + ::boost::addressof(*result), first.get(), count * sizeof(T) + ); + + return result + count; +} + +template +inline future copy_to_host_async(svm_ptr first, + svm_ptr last, + HostIterator result, + command_queue &queue) +{ + size_t count = iterator_range_size(first, last); + if(count == 0){ + return future(); + } + + event event_ = queue.enqueue_svm_memcpy_async( + ::boost::addressof(*result), first.get(), count * sizeof(T) + ); + + return make_future(iterator_plus_distance(result, count), event_); +} + +template +inline HostIterator copy_to_host_map(svm_ptr first, + svm_ptr last, + HostIterator result, + command_queue &queue) +{ + size_t count = iterator_range_size(first, last); + if(count == 0){ + return result; + } + + // map + queue.enqueue_svm_map(first.get(), count * sizeof(T), CL_MAP_READ); + + // copy [first; last) to result + std::copy( + static_cast(first.get()), + static_cast(last.get()), + result + ); + + // unmap [first; last) + queue.enqueue_svm_unmap(first.get()).wait(); + + return iterator_plus_distance(result, count); +} +#endif // CL_VERSION_2_0 + +} // end detail namespace +} // end compute namespace +} // end boost namespace + +#endif // BOOST_COMPUTE_ALGORITHM_DETAIL_COPY_TO_HOST_HPP diff --git a/3party/boost/boost/compute/algorithm/detail/count_if_with_ballot.hpp b/3party/boost/boost/compute/algorithm/detail/count_if_with_ballot.hpp new file mode 100644 index 0000000000..584ef37ab9 --- /dev/null +++ b/3party/boost/boost/compute/algorithm/detail/count_if_with_ballot.hpp @@ -0,0 +1,78 @@ +//---------------------------------------------------------------------------// +// Copyright (c) 2013 Kyle Lutz +// +// 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 +// +// See http://boostorg.github.com/compute for more information. +//---------------------------------------------------------------------------// + +#ifndef BOOST_COMPUTE_ALGORITHM_DETAIL_COUNT_IF_WITH_BALLOT_HPP +#define BOOST_COMPUTE_ALGORITHM_DETAIL_COUNT_IF_WITH_BALLOT_HPP + +#include +#include +#include +#include +#include +#include +#include + +namespace boost { +namespace compute { +namespace detail { + +template +inline size_t count_if_with_ballot(InputIterator first, + InputIterator last, + Predicate predicate, + command_queue &queue) +{ + size_t count = iterator_range_size(first, last); + size_t block_size = 32; + size_t block_count = count / block_size; + if(block_count * block_size != count){ + block_count++; + } + + const ::boost::compute::context &context = queue.get_context(); + + ::boost::compute::vector counts(block_count, context); + + ::boost::compute::detail::nvidia_popcount popc; + ::boost::compute::detail::nvidia_ballot ballot; + + meta_kernel k("count_if_with_ballot"); + k << + "const uint gid = get_global_id(0);\n" << + + "bool value = false;\n" << + "if(gid < count)\n" << + " value = " << predicate(first[k.var("gid")]) << ";\n" << + + "uint bits = " << ballot(k.var("value")) << ";\n" << + + "if(get_local_id(0) == 0)\n" << + counts.begin()[k.var("get_group_id(0)") ] + << " = " << popc(k.var("bits")) << ";\n"; + + k.add_set_arg("count", count); + + k.exec_1d(queue, 0, block_size * block_count, block_size); + + uint_ result; + ::boost::compute::reduce( + counts.begin(), + counts.end(), + &result, + queue + ); + return result; +} + +} // end detail namespace +} // end compute namespace +} // end boost namespace + +#endif // BOOST_COMPUTE_ALGORITHM_DETAIL_COUNT_IF_WITH_BALLOT_HPP diff --git a/3party/boost/boost/compute/algorithm/detail/count_if_with_reduce.hpp b/3party/boost/boost/compute/algorithm/detail/count_if_with_reduce.hpp new file mode 100644 index 0000000000..f9449f4a41 --- /dev/null +++ b/3party/boost/boost/compute/algorithm/detail/count_if_with_reduce.hpp @@ -0,0 +1,87 @@ +//---------------------------------------------------------------------------// +// Copyright (c) 2013 Kyle Lutz +// +// 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 +// +// See http://boostorg.github.com/compute for more information. +//---------------------------------------------------------------------------// + +#ifndef BOOST_COMPUTE_ALGORITHM_DETAIL_COUNT_IF_WITH_REDUCE_HPP +#define BOOST_COMPUTE_ALGORITHM_DETAIL_COUNT_IF_WITH_REDUCE_HPP + +#include +#include +#include + +namespace boost { +namespace compute { +namespace detail { + +template +struct invoked_countable_predicate +{ + invoked_countable_predicate(Predicate p, Arg a) + : predicate(p), arg(a) + { + } + + Predicate predicate; + Arg arg; +}; + +template +inline meta_kernel& operator<<(meta_kernel &kernel, + const invoked_countable_predicate &expr) +{ + return kernel << "(" << expr.predicate(expr.arg) << " ? 1 : 0)"; +} + +// the countable_predicate wraps Predicate and converts its result from +// bool to ulong so that it can be used with reduce() +template +struct countable_predicate +{ + typedef ulong_ result_type; + + countable_predicate(Predicate predicate) + : m_predicate(predicate) + { + } + + template + invoked_countable_predicate operator()(const Arg &arg) const + { + return invoked_countable_predicate(m_predicate, arg); + } + + Predicate m_predicate; +}; + +// counts the number of elements matching predicate using reduce() +template +inline size_t count_if_with_reduce(InputIterator first, + InputIterator last, + Predicate predicate, + command_queue &queue) +{ + countable_predicate reduce_predicate(predicate); + + ulong_ count = 0; + ::boost::compute::reduce( + ::boost::compute::make_transform_iterator(first, reduce_predicate), + ::boost::compute::make_transform_iterator(last, reduce_predicate), + &count, + ::boost::compute::plus(), + queue + ); + + return static_cast(count); +} + +} // end detail namespace +} // end compute namespace +} // end boost namespace + +#endif // BOOST_COMPUTE_ALGORITHM_DETAIL_COUNT_IF_WITH_REDUCE_HPP diff --git a/3party/boost/boost/compute/algorithm/detail/count_if_with_threads.hpp b/3party/boost/boost/compute/algorithm/detail/count_if_with_threads.hpp new file mode 100644 index 0000000000..6f282982e0 --- /dev/null +++ b/3party/boost/boost/compute/algorithm/detail/count_if_with_threads.hpp @@ -0,0 +1,129 @@ +//---------------------------------------------------------------------------// +// Copyright (c) 2013 Kyle Lutz +// +// 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 +// +// See http://boostorg.github.com/compute for more information. +//---------------------------------------------------------------------------// + +#ifndef BOOST_COMPUTE_ALGORITHM_DETAIL_COUNT_IF_WITH_THREADS_HPP +#define BOOST_COMPUTE_ALGORITHM_DETAIL_COUNT_IF_WITH_THREADS_HPP + +#include + +#include +#include + +namespace boost { +namespace compute { +namespace detail { + +template +class count_if_with_threads_kernel : meta_kernel +{ +public: + typedef typename + std::iterator_traits::value_type + value_type; + + count_if_with_threads_kernel() + : meta_kernel("count_if_with_threads") + { + } + + void set_args(InputIterator first, + InputIterator last, + Predicate predicate) + + { + typedef typename std::iterator_traits::value_type T; + + m_size = detail::iterator_range_size(first, last); + + m_size_arg = add_arg("size"); + m_counts_arg = add_arg(memory_object::global_memory, "counts"); + + *this << + // thread parameters + "const uint gid = get_global_id(0);\n" << + "const uint block_size = size / get_global_size(0);\n" << + "const uint start = block_size * gid;\n" << + "uint end = 0;\n" << + "if(gid == get_global_size(0) - 1)\n" << + " end = size;\n" << + "else\n" << + " end = block_size * gid + block_size;\n" << + + // count values + "uint count = 0;\n" << + "for(uint i = start; i < end; i++){\n" << + decl("value") << "=" + << first[expr("i")] << ";\n" << + if_(predicate(var("value"))) << "{\n" << + "count++;\n" << + "}\n" << + "}\n" << + + // write count + "counts[gid] = count;\n"; + } + + size_t exec(command_queue &queue) + { + const device &device = queue.get_device(); + const context &context = queue.get_context(); + + size_t threads = device.compute_units(); + + const size_t minimum_block_size = 2048; + if(m_size / threads < minimum_block_size){ + threads = static_cast( + (std::max)( + std::ceil(float(m_size) / minimum_block_size), + 1.0f + ) + ); + } + + // storage for counts + ::boost::compute::vector counts(threads, context); + + // exec kernel + set_arg(m_size_arg, static_cast(m_size)); + set_arg(m_counts_arg, counts.get_buffer()); + exec_1d(queue, 0, threads, 1); + + // copy counts to the host + std::vector host_counts(threads); + ::boost::compute::copy(counts.begin(), counts.end(), host_counts.begin(), queue); + + // return sum of counts + return std::accumulate(host_counts.begin(), host_counts.end(), size_t(0)); + } + +private: + size_t m_size; + size_t m_size_arg; + size_t m_counts_arg; +}; + +// counts values that match the predicate using one thread per block. this is +// optimized for cpu-type devices with a small number of compute units. +template +inline size_t count_if_with_threads(InputIterator first, + InputIterator last, + Predicate predicate, + command_queue &queue) +{ + count_if_with_threads_kernel kernel; + kernel.set_args(first, last, predicate); + return kernel.exec(queue); +} + +} // end detail namespace +} // end compute namespace +} // end boost namespace + +#endif // BOOST_COMPUTE_ALGORITHM_DETAIL_COUNT_IF_WITH_THREADS_HPP diff --git a/3party/boost/boost/compute/algorithm/detail/find_extrema.hpp b/3party/boost/boost/compute/algorithm/detail/find_extrema.hpp new file mode 100644 index 0000000000..eef2e36c3c --- /dev/null +++ b/3party/boost/boost/compute/algorithm/detail/find_extrema.hpp @@ -0,0 +1,70 @@ +//---------------------------------------------------------------------------// +// Copyright (c) 2013 Kyle Lutz +// +// 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 +// +// See http://boostorg.github.com/compute for more information. +//---------------------------------------------------------------------------// + +#ifndef BOOST_COMPUTE_ALGORITHM_DETAIL_FIND_EXTREMA_HPP +#define BOOST_COMPUTE_ALGORITHM_DETAIL_FIND_EXTREMA_HPP + +#include +#include +#include +#include +#include + +namespace boost { +namespace compute { +namespace detail { + +template +inline InputIterator find_extrema(InputIterator first, + InputIterator last, + Compare compare, + const bool find_minimum, + command_queue &queue) +{ + size_t count = iterator_range_size(first, last); + + // handle trivial cases + if(count == 0 || count == 1){ + return first; + } + + const device &device = queue.get_device(); + + // CPU + if(device.type() & device::cpu) { + return find_extrema_on_cpu(first, last, compare, find_minimum, queue); + } + + // GPU + // use serial method for small inputs + if(count < 512) + { + return serial_find_extrema(first, last, compare, find_minimum, queue); + } + // find_extrema_with_reduce() is used only if requirements are met + if(find_extrema_with_reduce_requirements_met(first, last, queue)) + { + return find_extrema_with_reduce(first, last, compare, find_minimum, queue); + } + + // use serial method for OpenCL version 1.0 due to + // problems with atomic_cmpxchg() + #ifndef CL_VERSION_1_1 + return serial_find_extrema(first, last, compare, find_minimum, queue); + #endif + + return find_extrema_with_atomics(first, last, compare, find_minimum, queue); +} + +} // end detail namespace +} // end compute namespace +} // end boost namespace + +#endif // BOOST_COMPUTE_ALGORITHM_DETAIL_FIND_EXTREMA_HPP diff --git a/3party/boost/boost/compute/algorithm/detail/find_extrema_on_cpu.hpp b/3party/boost/boost/compute/algorithm/detail/find_extrema_on_cpu.hpp new file mode 100644 index 0000000000..9363ad5837 --- /dev/null +++ b/3party/boost/boost/compute/algorithm/detail/find_extrema_on_cpu.hpp @@ -0,0 +1,138 @@ +//---------------------------------------------------------------------------// +// Copyright (c) 2016 Jakub Szuppe +// +// 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 +// +// See http://boostorg.github.com/compute for more information. +//---------------------------------------------------------------------------// + +#ifndef BOOST_COMPUTE_ALGORITHM_DETAIL_FIND_EXTREMA_ON_CPU_HPP +#define BOOST_COMPUTE_ALGORITHM_DETAIL_FIND_EXTREMA_ON_CPU_HPP + +#include + +#include +#include +#include +#include +#include + +namespace boost { +namespace compute { +namespace detail { + +template +inline InputIterator find_extrema_on_cpu(InputIterator first, + InputIterator last, + Compare compare, + const bool find_minimum, + command_queue &queue) +{ + typedef typename std::iterator_traits::value_type input_type; + typedef typename std::iterator_traits::difference_type difference_type; + size_t count = iterator_range_size(first, last); + + const device &device = queue.get_device(); + const uint_ compute_units = queue.get_device().compute_units(); + + boost::shared_ptr parameters = + detail::parameter_cache::get_global_cache(device); + std::string cache_key = + "__boost_find_extrema_cpu_" + + boost::lexical_cast(sizeof(input_type)); + + // for inputs smaller than serial_find_extrema_threshold + // serial_find_extrema algorithm is used + uint_ serial_find_extrema_threshold = parameters->get( + cache_key, + "serial_find_extrema_threshold", + 16384 * sizeof(input_type) + ); + serial_find_extrema_threshold = + (std::max)(serial_find_extrema_threshold, uint_(2 * compute_units)); + + const context &context = queue.get_context(); + if(count < serial_find_extrema_threshold) { + return serial_find_extrema(first, last, compare, find_minimum, queue); + } + + meta_kernel k("find_extrema_on_cpu"); + buffer output(context, sizeof(input_type) * compute_units); + buffer output_idx( + context, sizeof(uint_) * compute_units, + buffer::read_write | buffer::alloc_host_ptr + ); + + size_t count_arg = k.add_arg("count"); + size_t output_arg = + k.add_arg(memory_object::global_memory, "output"); + size_t output_idx_arg = + k.add_arg(memory_object::global_memory, "output_idx"); + + k << + "uint block = " << + "(uint)ceil(((float)count)/get_global_size(0));\n" << + "uint index = get_global_id(0) * block;\n" << + "uint end = min(count, index + block);\n" << + + "uint value_index = index;\n" << + k.decl("value") << " = " << first[k.var("index")] << ";\n" << + + "index++;\n" << + "while(index < end){\n" << + k.decl("candidate") << + " = " << first[k.var("index")] << ";\n" << + "#ifndef BOOST_COMPUTE_FIND_MAXIMUM\n" << + "bool compare = " << compare(k.var("candidate"), + k.var("value")) << ";\n" << + "#else\n" << + "bool compare = " << compare(k.var("value"), + k.var("candidate")) << ";\n" << + "#endif\n" << + "value = compare ? candidate : value;\n" << + "value_index = compare ? index : value_index;\n" << + "index++;\n" << + "}\n" << + "output[get_global_id(0)] = value;\n" << + "output_idx[get_global_id(0)] = value_index;\n"; + + size_t global_work_size = compute_units; + std::string options; + if(!find_minimum){ + options = "-DBOOST_COMPUTE_FIND_MAXIMUM"; + } + kernel kernel = k.compile(context, options); + + kernel.set_arg(count_arg, static_cast(count)); + kernel.set_arg(output_arg, output); + kernel.set_arg(output_idx_arg, output_idx); + queue.enqueue_1d_range_kernel(kernel, 0, global_work_size, 0); + + buffer_iterator result = serial_find_extrema( + make_buffer_iterator(output), + make_buffer_iterator(output, global_work_size), + compare, + find_minimum, + queue + ); + + uint_* output_idx_host_ptr = + static_cast( + queue.enqueue_map_buffer( + output_idx, command_queue::map_read, + 0, global_work_size * sizeof(uint_) + ) + ); + + difference_type extremum_idx = + static_cast(*(output_idx_host_ptr + result.get_index())); + return first + extremum_idx; +} + +} // end detail namespace +} // end compute namespace +} // end boost namespace + +#endif // BOOST_COMPUTE_ALGORITHM_DETAIL_FIND_EXTREMA_ON_CPU_HPP diff --git a/3party/boost/boost/compute/algorithm/detail/find_extrema_with_atomics.hpp b/3party/boost/boost/compute/algorithm/detail/find_extrema_with_atomics.hpp new file mode 100644 index 0000000000..406d1becb7 --- /dev/null +++ b/3party/boost/boost/compute/algorithm/detail/find_extrema_with_atomics.hpp @@ -0,0 +1,108 @@ +//---------------------------------------------------------------------------// +// Copyright (c) 2013 Kyle Lutz +// +// 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 +// +// See http://boostorg.github.com/compute for more information. +//---------------------------------------------------------------------------// + +#ifndef BOOST_COMPUTE_ALGORITHM_DETAIL_FIND_EXTREMA_WITH_ATOMICS_HPP +#define BOOST_COMPUTE_ALGORITHM_DETAIL_FIND_EXTREMA_WITH_ATOMICS_HPP + +#include +#include +#include +#include +#include +#include + +namespace boost { +namespace compute { +namespace detail { + +template +inline InputIterator find_extrema_with_atomics(InputIterator first, + InputIterator last, + Compare compare, + const bool find_minimum, + command_queue &queue) +{ + typedef typename std::iterator_traits::value_type value_type; + typedef typename std::iterator_traits::difference_type difference_type; + + const context &context = queue.get_context(); + + meta_kernel k("find_extrema"); + atomic_cmpxchg atomic_cmpxchg_uint; + + k << + "const uint gid = get_global_id(0);\n" << + "uint old_index = *index;\n" << + + k.decl("old") << + " = " << first[k.var("old_index")] << ";\n" << + k.decl("new") << + " = " << first[k.var("gid")] << ";\n" << + + k.decl("compare_result") << ";\n" << + "#ifdef BOOST_COMPUTE_FIND_MAXIMUM\n" << + "while(" << + "(compare_result = " << compare(k.var("old"), + k.var("new")) << ")" << + " || (!(compare_result" << + " || " << compare(k.var("new"), + k.var("old")) << ") " + "&& gid < old_index)){\n" << + "#else\n" << + // while condition explained for minimum case with less (<) + // as comparison function: + // while(new_value < old_value + // OR (new_value == old_value AND new_index < old_index)) + "while(" << + "(compare_result = " << compare(k.var("new"), + k.var("old")) << ")" << + " || (!(compare_result" << + " || " << compare(k.var("old"), + k.var("new")) << ") " + "&& gid < old_index)){\n" << + "#endif\n" << + + " if(" << atomic_cmpxchg_uint(k.var("index"), + k.var("old_index"), + k.var("gid")) << " == old_index)\n" << + " break;\n" << + " else\n" << + " old_index = *index;\n" << + "old = " << first[k.var("old_index")] << ";\n" << + "}\n"; + + size_t index_arg_index = k.add_arg(memory_object::global_memory, "index"); + + std::string options; + if(!find_minimum){ + options = "-DBOOST_COMPUTE_FIND_MAXIMUM"; + } + kernel kernel = k.compile(context, options); + + // setup index buffer + scalar index(context); + kernel.set_arg(index_arg_index, index.get_buffer()); + + // initialize index + index.write(0, queue); + + // run kernel + size_t count = iterator_range_size(first, last); + queue.enqueue_1d_range_kernel(kernel, 0, count, 0); + + // read index and return iterator + return first + static_cast(index.read(queue)); +} + +} // end detail namespace +} // end compute namespace +} // end boost namespace + +#endif // BOOST_COMPUTE_ALGORITHM_DETAIL_FIND_EXTREMA_WITH_ATOMICS_HPP diff --git a/3party/boost/boost/compute/algorithm/detail/find_extrema_with_reduce.hpp b/3party/boost/boost/compute/algorithm/detail/find_extrema_with_reduce.hpp new file mode 100644 index 0000000000..8f2a83c38b --- /dev/null +++ b/3party/boost/boost/compute/algorithm/detail/find_extrema_with_reduce.hpp @@ -0,0 +1,443 @@ +//---------------------------------------------------------------------------// +// Copyright (c) 2015 Jakub Szuppe +// +// 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 +// +// See http://boostorg.github.com/compute for more information. +//---------------------------------------------------------------------------// + +#ifndef BOOST_COMPUTE_ALGORITHM_DETAIL_FIND_EXTREMA_WITH_REDUCE_HPP +#define BOOST_COMPUTE_ALGORITHM_DETAIL_FIND_EXTREMA_WITH_REDUCE_HPP + +#include + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +namespace boost { +namespace compute { +namespace detail { + +template +bool find_extrema_with_reduce_requirements_met(InputIterator first, + InputIterator last, + command_queue &queue) +{ + typedef typename std::iterator_traits::value_type input_type; + + const device &device = queue.get_device(); + + // device must have dedicated local memory storage + // otherwise reduction would be highly inefficient + if(device.get_info() != CL_LOCAL) + { + return false; + } + + const size_t max_work_group_size = device.get_info(); + // local memory size in bytes (per compute unit) + const size_t local_mem_size = device.get_info(); + + std::string cache_key = std::string("__boost_find_extrema_reduce_") + + type_name(); + // load parameters + boost::shared_ptr parameters = + detail::parameter_cache::get_global_cache(device); + + // Get preferred work group size + size_t work_group_size = parameters->get(cache_key, "wgsize", 256); + + work_group_size = (std::min)(max_work_group_size, work_group_size); + + // local memory size needed to perform parallel reduction + size_t required_local_mem_size = 0; + // indices size + required_local_mem_size += sizeof(uint_) * work_group_size; + // values size + required_local_mem_size += sizeof(input_type) * work_group_size; + + // at least 4 work groups per compute unit otherwise reduction + // would be highly inefficient + return ((required_local_mem_size * 4) <= local_mem_size); +} + +/// \internal_ +/// Algorithm finds the first extremum in given range, i.e., with the lowest +/// index. +/// +/// If \p use_input_idx is false, it's assumed that input data is ordered by +/// increasing index and \p input_idx is not used in the algorithm. +template +inline void find_extrema_with_reduce(InputIterator input, + vector::iterator input_idx, + size_t count, + ResultIterator result, + vector::iterator result_idx, + size_t work_groups_no, + size_t work_group_size, + Compare compare, + const bool find_minimum, + const bool use_input_idx, + command_queue &queue) +{ + typedef typename std::iterator_traits::value_type input_type; + + const context &context = queue.get_context(); + + meta_kernel k("find_extrema_reduce"); + size_t count_arg = k.add_arg("count"); + size_t block_arg = k.add_arg(memory_object::local_memory, "block"); + size_t block_idx_arg = k.add_arg(memory_object::local_memory, "block_idx"); + + k << + // Work item global id + k.decl("gid") << " = get_global_id(0);\n" << + + // Index of element that will be read from input buffer + k.decl("idx") << " = gid;\n" << + + k.decl("acc") << ";\n" << + k.decl("acc_idx") << ";\n" << + "if(gid < count) {\n" << + // Real index of currently best element + "#ifdef BOOST_COMPUTE_USE_INPUT_IDX\n" << + k.var("acc_idx") << " = " << input_idx[k.var("idx")] << ";\n" << + "#else\n" << + k.var("acc_idx") << " = idx;\n" << + "#endif\n" << + + // Init accumulator with first[get_global_id(0)] + "acc = " << input[k.var("idx")] << ";\n" << + "idx += get_global_size(0);\n" << + "}\n" << + + k.decl("compare_result") << ";\n" << + k.decl("equal") << ";\n\n" << + "while( idx < count ){\n" << + // Next element + k.decl("next") << " = " << input[k.var("idx")] << ";\n" << + "#ifdef BOOST_COMPUTE_USE_INPUT_IDX\n" << + k.decl("next_idx") << " = " << input_idx[k.var("idx")] << ";\n" << + "#endif\n" << + + // Comparison between currently best element (acc) and next element + "#ifdef BOOST_COMPUTE_FIND_MAXIMUM\n" << + "compare_result = " << compare(k.var("next"), + k.var("acc")) << ";\n" << + "# ifdef BOOST_COMPUTE_USE_INPUT_IDX\n" << + "equal = !compare_result && !" << + compare(k.var("acc"), + k.var("next")) << ";\n" << + "# endif\n" << + "#else\n" << + "compare_result = " << compare(k.var("acc"), + k.var("next")) << ";\n" << + "# ifdef BOOST_COMPUTE_USE_INPUT_IDX\n" << + "equal = !compare_result && !" << + compare(k.var("next"), + k.var("acc")) << ";\n" << + "# endif\n" << + "#endif\n" << + + // save the winner + "acc = compare_result ? acc : next;\n" << + "#ifdef BOOST_COMPUTE_USE_INPUT_IDX\n" << + "acc_idx = compare_result ? " << + "acc_idx : " << + "(equal ? min(acc_idx, next_idx) : next_idx);\n" << + "#else\n" << + "acc_idx = compare_result ? acc_idx : idx;\n" << + "#endif\n" << + "idx += get_global_size(0);\n" << + "}\n\n" << + + // Work item local id + k.decl("lid") << " = get_local_id(0);\n" << + "block[lid] = acc;\n" << + "block_idx[lid] = acc_idx;\n" << + "barrier(CLK_LOCAL_MEM_FENCE);\n" << + + k.decl("group_offset") << + " = count - (get_local_size(0) * get_group_id(0));\n\n"; + + k << + "#pragma unroll\n" + "for(" << k.decl("offset") << " = " << uint_(work_group_size) << " / 2; offset > 0; " << + "offset = offset / 2) {\n" << + "if((lid < offset) && ((lid + offset) < group_offset)) { \n" << + k.decl("mine") << " = block[lid];\n" << + k.decl("other") << " = block[lid+offset];\n" << + "#ifdef BOOST_COMPUTE_FIND_MAXIMUM\n" << + "compare_result = " << compare(k.var("other"), + k.var("mine")) << ";\n" << + "equal = !compare_result && !" << + compare(k.var("mine"), + k.var("other")) << ";\n" << + "#else\n" << + "compare_result = " << compare(k.var("mine"), + k.var("other")) << ";\n" << + "equal = !compare_result && !" << + compare(k.var("other"), + k.var("mine")) << ";\n" << + "#endif\n" << + "block[lid] = compare_result ? mine : other;\n" << + k.decl("mine_idx") << " = block_idx[lid];\n" << + k.decl("other_idx") << " = block_idx[lid+offset];\n" << + "block_idx[lid] = compare_result ? " << + "mine_idx : " << + "(equal ? min(mine_idx, other_idx) : other_idx);\n" << + "}\n" + "barrier(CLK_LOCAL_MEM_FENCE);\n" << + "}\n\n" << + + // write block result to global output + "if(lid == 0){\n" << + result[k.var("get_group_id(0)")] << " = block[0];\n" << + result_idx[k.var("get_group_id(0)")] << " = block_idx[0];\n" << + "}"; + + std::string options; + if(!find_minimum){ + options = "-DBOOST_COMPUTE_FIND_MAXIMUM"; + } + if(use_input_idx){ + options += " -DBOOST_COMPUTE_USE_INPUT_IDX"; + } + + kernel kernel = k.compile(context, options); + + kernel.set_arg(count_arg, static_cast(count)); + kernel.set_arg(block_arg, local_buffer(work_group_size)); + kernel.set_arg(block_idx_arg, local_buffer(work_group_size)); + + queue.enqueue_1d_range_kernel(kernel, + 0, + work_groups_no * work_group_size, + work_group_size); +} + +template +inline void find_extrema_with_reduce(InputIterator input, + size_t count, + ResultIterator result, + vector::iterator result_idx, + size_t work_groups_no, + size_t work_group_size, + Compare compare, + const bool find_minimum, + command_queue &queue) +{ + // dummy will not be used + buffer_iterator dummy = result_idx; + return find_extrema_with_reduce( + input, dummy, count, result, result_idx, work_groups_no, + work_group_size, compare, find_minimum, false, queue + ); +} + +template +InputIterator find_extrema_with_reduce(InputIterator first, + InputIterator last, + Compare compare, + const bool find_minimum, + command_queue &queue) +{ + typedef typename std::iterator_traits::difference_type difference_type; + typedef typename std::iterator_traits::value_type input_type; + + const context &context = queue.get_context(); + const device &device = queue.get_device(); + + // Getting information about used queue and device + const size_t compute_units_no = device.get_info(); + const size_t max_work_group_size = device.get_info(); + + const size_t count = detail::iterator_range_size(first, last); + + std::string cache_key = std::string("__boost_find_extrema_with_reduce_") + + type_name(); + + // load parameters + boost::shared_ptr parameters = + detail::parameter_cache::get_global_cache(device); + + // get preferred work group size and preferred number + // of work groups per compute unit + size_t work_group_size = parameters->get(cache_key, "wgsize", 256); + size_t work_groups_per_cu = parameters->get(cache_key, "wgpcu", 100); + + // calculate work group size and number of work groups + work_group_size = (std::min)(max_work_group_size, work_group_size); + size_t work_groups_no = compute_units_no * work_groups_per_cu; + work_groups_no = (std::min)( + work_groups_no, + static_cast(std::ceil(float(count) / work_group_size)) + ); + + // phase I: finding candidates for extremum + + // device buffors for extremum candidates and their indices + // each work-group computes its candidate + vector candidates(work_groups_no, context); + vector candidates_idx(work_groups_no, context); + + // finding candidates for first extremum and their indices + find_extrema_with_reduce( + first, count, candidates.begin(), candidates_idx.begin(), + work_groups_no, work_group_size, compare, find_minimum, queue + ); + + // phase II: finding extremum from among the candidates + + // zero-copy buffers for final result (value and index) + vector > + result(1, context); + vector > + result_idx(1, context); + + // get extremum from among the candidates + find_extrema_with_reduce( + candidates.begin(), candidates_idx.begin(), work_groups_no, result.begin(), + result_idx.begin(), 1, work_group_size, compare, find_minimum, true, queue + ); + + // mapping extremum index to host + uint_* result_idx_host_ptr = + static_cast( + queue.enqueue_map_buffer( + result_idx.get_buffer(), command_queue::map_read, + 0, sizeof(uint_) + ) + ); + + return first + static_cast(*result_idx_host_ptr); +} + +template +InputIterator find_extrema_with_reduce(InputIterator first, + InputIterator last, + ::boost::compute::less< + typename std::iterator_traits< + InputIterator + >::value_type + > + compare, + const bool find_minimum, + command_queue &queue) +{ + typedef typename std::iterator_traits::difference_type difference_type; + typedef typename std::iterator_traits::value_type input_type; + + const context &context = queue.get_context(); + const device &device = queue.get_device(); + + // Getting information about used queue and device + const size_t compute_units_no = device.get_info(); + const size_t max_work_group_size = device.get_info(); + + const size_t count = detail::iterator_range_size(first, last); + + std::string cache_key = std::string("__boost_find_extrema_with_reduce_") + + type_name(); + + // load parameters + boost::shared_ptr parameters = + detail::parameter_cache::get_global_cache(device); + + // get preferred work group size and preferred number + // of work groups per compute unit + size_t work_group_size = parameters->get(cache_key, "wgsize", 256); + size_t work_groups_per_cu = parameters->get(cache_key, "wgpcu", 64); + + // calculate work group size and number of work groups + work_group_size = (std::min)(max_work_group_size, work_group_size); + size_t work_groups_no = compute_units_no * work_groups_per_cu; + work_groups_no = (std::min)( + work_groups_no, + static_cast(std::ceil(float(count) / work_group_size)) + ); + + // phase I: finding candidates for extremum + + // device buffors for extremum candidates and their indices + // each work-group computes its candidate + // zero-copy buffers are used to eliminate copying data back to host + vector > + candidates(work_groups_no, context); + vector > + candidates_idx(work_groups_no, context); + + // finding candidates for first extremum and their indices + find_extrema_with_reduce( + first, count, candidates.begin(), candidates_idx.begin(), + work_groups_no, work_group_size, compare, find_minimum, queue + ); + + // phase II: finding extremum from among the candidates + + // mapping candidates and their indices to host + input_type* candidates_host_ptr = + static_cast( + queue.enqueue_map_buffer( + candidates.get_buffer(), command_queue::map_read, + 0, work_groups_no * sizeof(input_type) + ) + ); + + uint_* candidates_idx_host_ptr = + static_cast( + queue.enqueue_map_buffer( + candidates_idx.get_buffer(), command_queue::map_read, + 0, work_groups_no * sizeof(uint_) + ) + ); + + input_type* i = candidates_host_ptr; + uint_* idx = candidates_idx_host_ptr; + uint_* extremum_idx = idx; + input_type extremum = *candidates_host_ptr; + i++; idx++; + + // find extremum (serial) from among the candidates on host + if(!find_minimum) { + while(idx != (candidates_idx_host_ptr + work_groups_no)) { + input_type next = *i; + bool compare_result = next > extremum; + bool equal = next == extremum; + extremum = compare_result ? next : extremum; + extremum_idx = compare_result ? idx : extremum_idx; + extremum_idx = equal ? ((*extremum_idx < *idx) ? extremum_idx : idx) : extremum_idx; + idx++, i++; + } + } + else { + while(idx != (candidates_idx_host_ptr + work_groups_no)) { + input_type next = *i; + bool compare_result = next < extremum; + bool equal = next == extremum; + extremum = compare_result ? next : extremum; + extremum_idx = compare_result ? idx : extremum_idx; + extremum_idx = equal ? ((*extremum_idx < *idx) ? extremum_idx : idx) : extremum_idx; + idx++, i++; + } + } + + return first + static_cast(*extremum_idx); +} + +} // end detail namespace +} // end compute namespace +} // end boost namespace + +#endif // BOOST_COMPUTE_ALGORITHM_DETAIL_FIND_EXTREMA_WITH_REDUCE_HPP diff --git a/3party/boost/boost/compute/algorithm/detail/find_if_with_atomics.hpp b/3party/boost/boost/compute/algorithm/detail/find_if_with_atomics.hpp new file mode 100644 index 0000000000..112c34cf00 --- /dev/null +++ b/3party/boost/boost/compute/algorithm/detail/find_if_with_atomics.hpp @@ -0,0 +1,212 @@ +//---------------------------------------------------------------------------// +// Copyright (c) 2013 Kyle Lutz +// +// 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 +// +// See http://boostorg.github.com/compute for more information. +//---------------------------------------------------------------------------// + +#ifndef BOOST_COMPUTE_ALGORITHM_DETAIL_FIND_IF_WITH_ATOMICS_HPP +#define BOOST_COMPUTE_ALGORITHM_DETAIL_FIND_IF_WITH_ATOMICS_HPP + +#include + +#include +#include +#include +#include +#include +#include +#include +#include +#include + +namespace boost { +namespace compute { +namespace detail { + +template +inline InputIterator find_if_with_atomics_one_vpt(InputIterator first, + InputIterator last, + UnaryPredicate predicate, + const size_t count, + command_queue &queue) +{ + typedef typename std::iterator_traits::value_type value_type; + typedef typename std::iterator_traits::difference_type difference_type; + + const context &context = queue.get_context(); + + detail::meta_kernel k("find_if"); + size_t index_arg = k.add_arg(memory_object::global_memory, "index"); + atomic_min atomic_min_uint; + + k << k.decl("i") << " = get_global_id(0);\n" + << k.decl("value") << "=" + << first[k.var("i")] << ";\n" + << "if(" << predicate(k.var("value")) << "){\n" + << " " << atomic_min_uint(k.var("index"), k.var("i")) << ";\n" + << "}\n"; + + kernel kernel = k.compile(context); + + scalar index(context); + kernel.set_arg(index_arg, index.get_buffer()); + + // initialize index to the last iterator's index + index.write(static_cast(count), queue); + queue.enqueue_1d_range_kernel(kernel, 0, count, 0); + + // read index and return iterator + return first + static_cast(index.read(queue)); +} + +template +inline InputIterator find_if_with_atomics_multiple_vpt(InputIterator first, + InputIterator last, + UnaryPredicate predicate, + const size_t count, + const size_t vpt, + command_queue &queue) +{ + typedef typename std::iterator_traits::value_type value_type; + typedef typename std::iterator_traits::difference_type difference_type; + + const context &context = queue.get_context(); + const device &device = queue.get_device(); + + detail::meta_kernel k("find_if"); + size_t index_arg = k.add_arg(memory_object::global_memory, "index"); + size_t count_arg = k.add_arg("count"); + size_t vpt_arg = k.add_arg("vpt"); + atomic_min atomic_min_uint; + + // for GPUs reads from global memory are coalesced + if(device.type() & device::gpu) { + k << + k.decl("lsize") << " = get_local_size(0);\n" << + k.decl("id") << " = get_local_id(0) + get_group_id(0) * lsize * vpt;\n" << + k.decl("end") << " = min(" << + "id + (lsize *" << k.var("vpt") << ")," << + "count" << + ");\n" << + + // checking if the index is already found + "__local uint local_index;\n" << + "if(get_local_id(0) == 0){\n" << + " local_index = *index;\n " << + "};\n" << + "barrier(CLK_LOCAL_MEM_FENCE);\n" << + "if(local_index < id){\n" << + " return;\n" << + "}\n" << + + "while(id < end){\n" << + " " << k.decl("value") << " = " << + first[k.var("id")] << ";\n" + " if(" << predicate(k.var("value")) << "){\n" << + " " << atomic_min_uint(k.var("index"), + k.var("id")) << ";\n" << + " return;\n" + " }\n" << + " id+=lsize;\n" << + "}\n"; + // for CPUs (and other devices) reads are ordered so the big cache is + // efficiently used. + } else { + k << + k.decl("id") << " = get_global_id(0) * " << k.var("vpt") << ";\n" << + k.decl("end") << " = min(" << + "id + " << k.var("vpt") << "," << + "count" << + ");\n" << + "while(id < end && (*index) > id){\n" << + " " << k.decl("value") << " = " << + first[k.var("id")] << ";\n" + " if(" << predicate(k.var("value")) << "){\n" << + " " << atomic_min_uint(k.var("index"), + k.var("id")) << ";\n" << + " return;\n" << + " }\n" << + " id++;\n" << + "}\n"; + } + + kernel kernel = k.compile(context); + + scalar index(context); + kernel.set_arg(index_arg, index.get_buffer()); + kernel.set_arg(count_arg, static_cast(count)); + kernel.set_arg(vpt_arg, static_cast(vpt)); + + // initialize index to the last iterator's index + index.write(static_cast(count), queue); + + const size_t global_wg_size = static_cast( + std::ceil(float(count) / vpt) + ); + queue.enqueue_1d_range_kernel(kernel, 0, global_wg_size, 0); + + // read index and return iterator + return first + static_cast(index.read(queue)); +} + +template +inline InputIterator find_if_with_atomics(InputIterator first, + InputIterator last, + UnaryPredicate predicate, + command_queue &queue) +{ + typedef typename std::iterator_traits::value_type value_type; + + size_t count = detail::iterator_range_size(first, last); + if(count == 0){ + return last; + } + + const device &device = queue.get_device(); + + // load cached parameters + std::string cache_key = std::string("__boost_find_if_with_atomics_") + + type_name(); + boost::shared_ptr parameters = + detail::parameter_cache::get_global_cache(device); + + // for relatively small inputs on GPUs kernel checking one value per thread + // (work-item) is more efficient than its multiple values per thread version + if(device.type() & device::gpu){ + const size_t one_vpt_threshold = + parameters->get(cache_key, "one_vpt_threshold", 1048576); + if(count <= one_vpt_threshold){ + return find_if_with_atomics_one_vpt( + first, last, predicate, count, queue + ); + } + } + + // values per thread + size_t vpt; + if(device.type() & device::gpu){ + // get vpt parameter + vpt = parameters->get(cache_key, "vpt", 32); + } else { + // for CPUs work is split equally between compute units + const size_t max_compute_units = + device.get_info(); + vpt = static_cast( + std::ceil(float(count) / max_compute_units) + ); + } + + return find_if_with_atomics_multiple_vpt( + first, last, predicate, count, vpt, queue + ); +} + +} // end detail namespace +} // end compute namespace +} // end boost namespace + +#endif // BOOST_COMPUTE_ALGORITHM_DETAIL_FIND_IF_WITH_ATOMICS_HPP diff --git a/3party/boost/boost/compute/algorithm/detail/inplace_reduce.hpp b/3party/boost/boost/compute/algorithm/detail/inplace_reduce.hpp new file mode 100644 index 0000000000..60c61e83fe --- /dev/null +++ b/3party/boost/boost/compute/algorithm/detail/inplace_reduce.hpp @@ -0,0 +1,136 @@ +//---------------------------------------------------------------------------// +// Copyright (c) 2013 Kyle Lutz +// +// 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 +// +// See http://boostorg.github.com/compute for more information. +//---------------------------------------------------------------------------// + +#ifndef BOOST_COMPUTE_ALGORITHM_DETAIL_INPLACE_REDUCE_HPP +#define BOOST_COMPUTE_ALGORITHM_DETAIL_INPLACE_REDUCE_HPP + +#include + +#include + +#include +#include +#include +#include + +namespace boost { +namespace compute { +namespace detail { + +template +inline void inplace_reduce(Iterator first, + Iterator last, + BinaryFunction function, + command_queue &queue) +{ + typedef typename + std::iterator_traits::value_type + value_type; + + size_t input_size = iterator_range_size(first, last); + if(input_size < 2){ + return; + } + + const context &context = queue.get_context(); + + size_t block_size = 64; + size_t values_per_thread = 8; + size_t block_count = input_size / (block_size * values_per_thread); + if(block_count * block_size * values_per_thread != input_size) + block_count++; + + vector output(block_count, context); + + meta_kernel k("inplace_reduce"); + size_t input_arg = k.add_arg(memory_object::global_memory, "input"); + size_t input_size_arg = k.add_arg("input_size"); + size_t output_arg = k.add_arg(memory_object::global_memory, "output"); + size_t scratch_arg = k.add_arg(memory_object::local_memory, "scratch"); + k << + "const uint gid = get_global_id(0);\n" << + "const uint lid = get_local_id(0);\n" << + "const uint values_per_thread =\n" + << uint_(values_per_thread) << ";\n" << + + // thread reduce + "const uint index = gid * values_per_thread;\n" << + "if(index < input_size){\n" << + k.decl("sum") << " = input[index];\n" << + "for(uint i = 1;\n" << + "i < values_per_thread && (index + i) < input_size;\n" << + "i++){\n" << + " sum = " << + function(k.var("sum"), + k.var("input[index+i]")) << ";\n" << + "}\n" << + "scratch[lid] = sum;\n" << + "}\n" << + + // local reduce + "for(uint i = 1; i < get_local_size(0); i <<= 1){\n" << + " barrier(CLK_LOCAL_MEM_FENCE);\n" << + " uint mask = (i << 1) - 1;\n" << + " uint next_index = (gid + i) * values_per_thread;\n" + " if((lid & mask) == 0 && next_index < input_size){\n" << + " scratch[lid] = " << + function(k.var("scratch[lid]"), + k.var("scratch[lid+i]")) << ";\n" << + " }\n" << + "}\n" << + + // write output for block + "if(lid == 0){\n" << + " output[get_group_id(0)] = scratch[0];\n" << + "}\n" + ; + + const buffer *input_buffer = &first.get_buffer(); + const buffer *output_buffer = &output.get_buffer(); + + kernel kernel = k.compile(context); + + while(input_size > 1){ + kernel.set_arg(input_arg, *input_buffer); + kernel.set_arg(input_size_arg, static_cast(input_size)); + kernel.set_arg(output_arg, *output_buffer); + kernel.set_arg(scratch_arg, local_buffer(block_size)); + + queue.enqueue_1d_range_kernel(kernel, + 0, + block_count * block_size, + block_size); + + input_size = + static_cast( + std::ceil(float(input_size) / (block_size * values_per_thread) + ) + ); + + block_count = input_size / (block_size * values_per_thread); + if(block_count * block_size * values_per_thread != input_size) + block_count++; + + std::swap(input_buffer, output_buffer); + } + + if(input_buffer != &first.get_buffer()){ + ::boost::compute::copy(output.begin(), + output.begin() + 1, + first, + queue); + } +} + +} // end detail namespace +} // end compute namespace +} // end boost namespace + +#endif // BOOST_COMPUTE_ALGORITHM_DETAIL_INPLACE_REDUCE_HPP diff --git a/3party/boost/boost/compute/algorithm/detail/insertion_sort.hpp b/3party/boost/boost/compute/algorithm/detail/insertion_sort.hpp new file mode 100644 index 0000000000..4b5b95139a --- /dev/null +++ b/3party/boost/boost/compute/algorithm/detail/insertion_sort.hpp @@ -0,0 +1,165 @@ +//---------------------------------------------------------------------------// +// Copyright (c) 2013 Kyle Lutz +// +// 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 +// +// See http://boostorg.github.com/compute for more information. +//---------------------------------------------------------------------------// + +#ifndef BOOST_COMPUTE_ALGORITHM_DETAIL_INSERTION_SORT_HPP +#define BOOST_COMPUTE_ALGORITHM_DETAIL_INSERTION_SORT_HPP + +#include +#include +#include +#include +#include +#include + +namespace boost { +namespace compute { +namespace detail { + +template +inline void serial_insertion_sort(Iterator first, + Iterator last, + Compare compare, + command_queue &queue) +{ + typedef typename std::iterator_traits::value_type T; + + size_t count = iterator_range_size(first, last); + if(count < 2){ + return; + } + + meta_kernel k("serial_insertion_sort"); + size_t local_data_arg = k.add_arg(memory_object::local_memory, "data"); + size_t count_arg = k.add_arg("n"); + + k << + // copy data to local memory + "for(uint i = 0; i < n; i++){\n" << + " data[i] = " << first[k.var("i")] << ";\n" + "}\n" + + // sort data in local memory + "for(uint i = 1; i < n; i++){\n" << + " " << k.decl("value") << " = data[i];\n" << + " uint pos = i;\n" << + " while(pos > 0 && " << + compare(k.var("value"), + k.var("data[pos-1]")) << "){\n" << + " data[pos] = data[pos-1];\n" << + " pos--;\n" << + " }\n" << + " data[pos] = value;\n" << + "}\n" << + + // copy sorted data to output + "for(uint i = 0; i < n; i++){\n" << + " " << first[k.var("i")] << " = data[i];\n" + "}\n"; + + const context &context = queue.get_context(); + ::boost::compute::kernel kernel = k.compile(context); + kernel.set_arg(local_data_arg, local_buffer(count)); + kernel.set_arg(count_arg, static_cast(count)); + + queue.enqueue_task(kernel); +} + +template +inline void serial_insertion_sort(Iterator first, + Iterator last, + command_queue &queue) +{ + typedef typename std::iterator_traits::value_type T; + + ::boost::compute::less less; + + return serial_insertion_sort(first, last, less, queue); +} + +template +inline void serial_insertion_sort_by_key(KeyIterator keys_first, + KeyIterator keys_last, + ValueIterator values_first, + Compare compare, + command_queue &queue) +{ + typedef typename std::iterator_traits::value_type key_type; + typedef typename std::iterator_traits::value_type value_type; + + size_t count = iterator_range_size(keys_first, keys_last); + if(count < 2){ + return; + } + + meta_kernel k("serial_insertion_sort_by_key"); + size_t local_keys_arg = k.add_arg(memory_object::local_memory, "keys"); + size_t local_data_arg = k.add_arg(memory_object::local_memory, "data"); + size_t count_arg = k.add_arg("n"); + + k << + // copy data to local memory + "for(uint i = 0; i < n; i++){\n" << + " keys[i] = " << keys_first[k.var("i")] << ";\n" + " data[i] = " << values_first[k.var("i")] << ";\n" + "}\n" + + // sort data in local memory + "for(uint i = 1; i < n; i++){\n" << + " " << k.decl("key") << " = keys[i];\n" << + " " << k.decl("value") << " = data[i];\n" << + " uint pos = i;\n" << + " while(pos > 0 && " << + compare(k.var("key"), + k.var("keys[pos-1]")) << "){\n" << + " keys[pos] = keys[pos-1];\n" << + " data[pos] = data[pos-1];\n" << + " pos--;\n" << + " }\n" << + " keys[pos] = key;\n" << + " data[pos] = value;\n" << + "}\n" << + + // copy sorted data to output + "for(uint i = 0; i < n; i++){\n" << + " " << keys_first[k.var("i")] << " = keys[i];\n" + " " << values_first[k.var("i")] << " = data[i];\n" + "}\n"; + + const context &context = queue.get_context(); + ::boost::compute::kernel kernel = k.compile(context); + kernel.set_arg(local_keys_arg, static_cast(count * sizeof(key_type)), 0); + kernel.set_arg(local_data_arg, static_cast(count * sizeof(value_type)), 0); + kernel.set_arg(count_arg, static_cast(count)); + + queue.enqueue_task(kernel); +} + +template +inline void serial_insertion_sort_by_key(KeyIterator keys_first, + KeyIterator keys_last, + ValueIterator values_first, + command_queue &queue) +{ + typedef typename std::iterator_traits::value_type key_type; + + serial_insertion_sort_by_key( + keys_first, + keys_last, + values_first, + boost::compute::less(), + queue + ); +} + +} // end detail namespace +} // end compute namespace +} // end boost namespace + +#endif // BOOST_COMPUTE_ALGORITHM_DETAIL_INSERTION_SORT_HPP diff --git a/3party/boost/boost/compute/algorithm/detail/merge_path.hpp b/3party/boost/boost/compute/algorithm/detail/merge_path.hpp new file mode 100644 index 0000000000..bc2c8fa88c --- /dev/null +++ b/3party/boost/boost/compute/algorithm/detail/merge_path.hpp @@ -0,0 +1,116 @@ +//---------------------------------------------------------------------------// +// Copyright (c) 2014 Roshan +// +// 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 +// +// See http://boostorg.github.com/compute for more information. +//---------------------------------------------------------------------------// + +#ifndef BOOST_COMPUTE_ALGORITHM_DETAIL_MERGE_PATH_HPP +#define BOOST_COMPUTE_ALGORITHM_DETAIL_MERGE_PATH_HPP + +#include + +#include +#include +#include +#include +#include +#include + +namespace boost { +namespace compute { +namespace detail { + +/// +/// \brief Merge Path kernel class +/// +/// Subclass of meta_kernel to break two sets into tiles according +/// to their merge path +/// +class merge_path_kernel : public meta_kernel +{ +public: + unsigned int tile_size; + + merge_path_kernel() : meta_kernel("merge_path") + { + tile_size = 4; + } + + template + void set_range(InputIterator1 first1, + InputIterator1 last1, + InputIterator2 first2, + InputIterator2 last2, + OutputIterator1 result_a, + OutputIterator2 result_b, + Compare comp) + { + m_a_count = iterator_range_size(first1, last1); + m_a_count_arg = add_arg("a_count"); + + m_b_count = iterator_range_size(first2, last2); + m_b_count_arg = add_arg("b_count"); + + *this << + "uint i = get_global_id(0);\n" << + "uint target = (i+1)*" << tile_size << ";\n" << + "uint start = max(convert_int(0),convert_int(target)-convert_int(b_count));\n" << + "uint end = min(target,a_count);\n" << + "uint a_index, b_index;\n" << + "while(start("b_index")], + first1[expr("a_index")]) << "))\n" << + " start = a_index + 1;\n" << + " else end = a_index;\n" << + "}\n" << + result_a[expr("i")] << " = start;\n" << + result_b[expr("i")] << " = target - start;\n"; + } + + template + void set_range(InputIterator1 first1, + InputIterator1 last1, + InputIterator2 first2, + InputIterator2 last2, + OutputIterator1 result_a, + OutputIterator2 result_b) + { + typedef typename std::iterator_traits::value_type value_type; + ::boost::compute::less less_than; + set_range(first1, last1, first2, last2, result_a, result_b, less_than); + } + + event exec(command_queue &queue) + { + if((m_a_count + m_b_count)/tile_size == 0) { + return event(); + } + + set_arg(m_a_count_arg, uint_(m_a_count)); + set_arg(m_b_count_arg, uint_(m_b_count)); + + return exec_1d(queue, 0, (m_a_count + m_b_count)/tile_size); + } + +private: + size_t m_a_count; + size_t m_a_count_arg; + size_t m_b_count; + size_t m_b_count_arg; +}; + +} //end detail namespace +} //end compute namespace +} //end boost namespace + +#endif // BOOST_COMPUTE_ALGORITHM_DETAIL_MERGE_PATH_HPP diff --git a/3party/boost/boost/compute/algorithm/detail/merge_sort_on_cpu.hpp b/3party/boost/boost/compute/algorithm/detail/merge_sort_on_cpu.hpp new file mode 100644 index 0000000000..f4b53f10ae --- /dev/null +++ b/3party/boost/boost/compute/algorithm/detail/merge_sort_on_cpu.hpp @@ -0,0 +1,366 @@ +//---------------------------------------------------------------------------// +// Copyright (c) 2015 Jakub Szuppe +// +// 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 +// +// See http://boostorg.github.com/compute for more information. +//---------------------------------------------------------------------------// + +#ifndef BOOST_COMPUTE_ALGORITHM_DETAIL_MERGE_SORT_ON_CPU_HPP +#define BOOST_COMPUTE_ALGORITHM_DETAIL_MERGE_SORT_ON_CPU_HPP + +#include +#include +#include +#include +#include +#include +#include + +namespace boost { +namespace compute { +namespace detail { + +template +inline void merge_blocks(KeyIterator keys_first, + ValueIterator values_first, + KeyIterator keys_result, + ValueIterator values_result, + Compare compare, + size_t count, + const size_t block_size, + const bool sort_by_key, + command_queue &queue) +{ + (void) values_result; + (void) values_first; + + meta_kernel k("merge_sort_on_cpu_merge_blocks"); + size_t count_arg = k.add_arg("count"); + size_t block_size_arg = k.add_arg("block_size"); + + k << + k.decl("b1_start") << " = get_global_id(0) * block_size * 2;\n" << + k.decl("b1_end") << " = min(count, b1_start + block_size);\n" << + k.decl("b2_start") << " = min(count, b1_start + block_size);\n" << + k.decl("b2_end") << " = min(count, b2_start + block_size);\n" << + k.decl("result_idx") << " = b1_start;\n" << + + // merging block 1 and block 2 (stable) + "while(b1_start < b1_end && b2_start < b2_end){\n" << + " if( " << compare(keys_first[k.var("b2_start")], + keys_first[k.var("b1_start")]) << "){\n" << + " " << keys_result[k.var("result_idx")] << " = " << + keys_first[k.var("b2_start")] << ";\n"; + if(sort_by_key){ + k << + " " << values_result[k.var("result_idx")] << " = " << + values_first[k.var("b2_start")] << ";\n"; + } + k << + " b2_start++;\n" << + " }\n" << + " else {\n" << + " " << keys_result[k.var("result_idx")] << " = " << + keys_first[k.var("b1_start")] << ";\n"; + if(sort_by_key){ + k << + " " << values_result[k.var("result_idx")] << " = " << + values_first[k.var("b1_start")] << ";\n"; + } + k << + " b1_start++;\n" << + " }\n" << + " result_idx++;\n" << + "}\n" << + "while(b1_start < b1_end){\n" << + " " << keys_result[k.var("result_idx")] << " = " << + keys_first[k.var("b1_start")] << ";\n"; + if(sort_by_key){ + k << + " " << values_result[k.var("result_idx")] << " = " << + values_first[k.var("b1_start")] << ";\n"; + } + k << + " b1_start++;\n" << + " result_idx++;\n" << + "}\n" << + "while(b2_start < b2_end){\n" << + " " << keys_result[k.var("result_idx")] << " = " << + keys_first[k.var("b2_start")] << ";\n"; + if(sort_by_key){ + k << + " " << values_result[k.var("result_idx")] << " = " << + values_first[k.var("b2_start")] << ";\n"; + } + k << + " b2_start++;\n" << + " result_idx++;\n" << + "}\n"; + + const context &context = queue.get_context(); + ::boost::compute::kernel kernel = k.compile(context); + kernel.set_arg(count_arg, static_cast(count)); + kernel.set_arg(block_size_arg, static_cast(block_size)); + + const size_t global_size = static_cast( + std::ceil(float(count) / (2 * block_size)) + ); + queue.enqueue_1d_range_kernel(kernel, 0, global_size, 0); +} + +template +inline void merge_blocks(Iterator first, + Iterator result, + Compare compare, + size_t count, + const size_t block_size, + const bool sort_by_key, + command_queue &queue) +{ + // dummy iterator as it's not sort by key + Iterator dummy; + merge_blocks(first, dummy, result, dummy, compare, count, block_size, false, queue); +} + +template +inline void dispatch_merge_blocks(Iterator first, + Iterator result, + Compare compare, + size_t count, + const size_t block_size, + const size_t input_size_threshold, + const size_t blocks_no_threshold, + command_queue &queue) +{ + const size_t blocks_no = static_cast( + std::ceil(float(count) / block_size) + ); + // merge with merge path should used only for the large arrays and at the + // end of merging part when there are only a few big blocks left to be merged + if(blocks_no <= blocks_no_threshold && count >= input_size_threshold){ + Iterator last = first + count; + for(size_t i = 0; i < count; i+= 2*block_size) + { + Iterator first1 = (std::min)(first + i, last); + Iterator last1 = (std::min)(first1 + block_size, last); + Iterator first2 = last1; + Iterator last2 = (std::min)(first2 + block_size, last); + Iterator block_result = (std::min)(result + i, result + count); + merge_with_merge_path(first1, last1, first2, last2, + block_result, compare, queue); + } + } + else { + merge_blocks(first, result, compare, count, block_size, false, queue); + } +} + +template +inline void block_insertion_sort(KeyIterator keys_first, + ValueIterator values_first, + Compare compare, + const size_t count, + const size_t block_size, + const bool sort_by_key, + command_queue &queue) +{ + (void) values_first; + + typedef typename std::iterator_traits::value_type K; + typedef typename std::iterator_traits::value_type T; + + meta_kernel k("merge_sort_on_cpu_block_insertion_sort"); + size_t count_arg = k.add_arg("count"); + size_t block_size_arg = k.add_arg("block_size"); + + k << + k.decl("start") << " = get_global_id(0) * block_size;\n" << + k.decl("end") << " = min(count, start + block_size);\n" << + + // block insertion sort (stable) + "for(uint i = start+1; i < end; i++){\n" << + " " << k.decl("key") << " = " << + keys_first[k.var("i")] << ";\n"; + if(sort_by_key){ + k << + " " << k.decl("value") << " = " << + values_first[k.var("i")] << ";\n"; + } + k << + " uint pos = i;\n" << + " while(pos > start && " << + compare(k.var("key"), + keys_first[k.var("pos-1")]) << "){\n" << + " " << keys_first[k.var("pos")] << " = " << + keys_first[k.var("pos-1")] << ";\n"; + if(sort_by_key){ + k << + " " << values_first[k.var("pos")] << " = " << + values_first[k.var("pos-1")] << ";\n"; + } + k << + " pos--;\n" << + " }\n" << + " " << keys_first[k.var("pos")] << " = key;\n"; + if(sort_by_key) { + k << + " " << values_first[k.var("pos")] << " = value;\n"; + } + k << + "}\n"; // block insertion sort + + const context &context = queue.get_context(); + ::boost::compute::kernel kernel = k.compile(context); + kernel.set_arg(count_arg, static_cast(count)); + kernel.set_arg(block_size_arg, static_cast(block_size)); + + const size_t global_size = static_cast(std::ceil(float(count) / block_size)); + queue.enqueue_1d_range_kernel(kernel, 0, global_size, 0); +} + +template +inline void block_insertion_sort(Iterator first, + Compare compare, + const size_t count, + const size_t block_size, + command_queue &queue) +{ + // dummy iterator as it's not sort by key + Iterator dummy; + block_insertion_sort(first, dummy, compare, count, block_size, false, queue); +} + +// This sort is stable. +template +inline void merge_sort_on_cpu(Iterator first, + Iterator last, + Compare compare, + command_queue &queue) +{ + typedef typename std::iterator_traits::value_type value_type; + + size_t count = iterator_range_size(first, last); + if(count < 2){ + return; + } + // for small input size only insertion sort is performed + else if(count <= 512){ + block_insertion_sort(first, compare, count, count, queue); + return; + } + + const context &context = queue.get_context(); + const device &device = queue.get_device(); + + // loading parameters + std::string cache_key = + std::string("__boost_merge_sort_on_cpu_") + type_name(); + boost::shared_ptr parameters = + detail::parameter_cache::get_global_cache(device); + + // When there is merge_with_path_blocks_no_threshold or less blocks left to + // merge AND input size is merge_with_merge_path_input_size_threshold or more + // merge_with_merge_path() algorithm is used to merge sorted blocks; + // otherwise merge_blocks() is used. + const size_t merge_with_path_blocks_no_threshold = + parameters->get(cache_key, "merge_with_merge_path_blocks_no_threshold", 8); + const size_t merge_with_path_input_size_threshold = + parameters->get(cache_key, "merge_with_merge_path_input_size_threshold", 2097152); + + const size_t block_size = + parameters->get(cache_key, "insertion_sort_block_size", 64); + block_insertion_sort(first, compare, count, block_size, queue); + + // temporary buffer for merge result + vector temp(count, context); + bool result_in_temporary_buffer = false; + + for(size_t i = block_size; i < count; i *= 2){ + result_in_temporary_buffer = !result_in_temporary_buffer; + if(result_in_temporary_buffer) { + dispatch_merge_blocks(first, temp.begin(), compare, count, i, + merge_with_path_input_size_threshold, + merge_with_path_blocks_no_threshold, + queue); + } else { + dispatch_merge_blocks(temp.begin(), first, compare, count, i, + merge_with_path_input_size_threshold, + merge_with_path_blocks_no_threshold, + queue); + } + } + + if(result_in_temporary_buffer) { + copy(temp.begin(), temp.end(), first, queue); + } +} + +// This sort is stable. +template +inline void merge_sort_by_key_on_cpu(KeyIterator keys_first, + KeyIterator keys_last, + ValueIterator values_first, + Compare compare, + command_queue &queue) +{ + typedef typename std::iterator_traits::value_type key_type; + typedef typename std::iterator_traits::value_type value_type; + + size_t count = iterator_range_size(keys_first, keys_last); + if(count < 2){ + return; + } + // for small input size only insertion sort is performed + else if(count <= 512){ + block_insertion_sort(keys_first, values_first, compare, + count, count, true, queue); + return; + } + + const context &context = queue.get_context(); + const device &device = queue.get_device(); + + // loading parameters + std::string cache_key = + std::string("__boost_merge_sort_by_key_on_cpu_") + type_name() + + "_with_" + type_name(); + boost::shared_ptr parameters = + detail::parameter_cache::get_global_cache(device); + + const size_t block_size = + parameters->get(cache_key, "insertion_sort_by_key_block_size", 64); + block_insertion_sort(keys_first, values_first, compare, + count, block_size, true, queue); + + // temporary buffer for merge results + vector values_temp(count, context); + vector keys_temp(count, context); + bool result_in_temporary_buffer = false; + + for(size_t i = block_size; i < count; i *= 2){ + result_in_temporary_buffer = !result_in_temporary_buffer; + if(result_in_temporary_buffer) { + merge_blocks(keys_first, values_first, + keys_temp.begin(), values_temp.begin(), + compare, count, i, true, queue); + } else { + merge_blocks(keys_temp.begin(), values_temp.begin(), + keys_first, values_first, + compare, count, i, true, queue); + } + } + + if(result_in_temporary_buffer) { + copy(keys_temp.begin(), keys_temp.end(), keys_first, queue); + copy(values_temp.begin(), values_temp.end(), values_first, queue); + } +} + +} // end detail namespace +} // end compute namespace +} // end boost namespace + +#endif // BOOST_COMPUTE_ALGORITHM_DETAIL_MERGE_SORT_ON_CPU_HPP diff --git a/3party/boost/boost/compute/algorithm/detail/merge_sort_on_gpu.hpp b/3party/boost/boost/compute/algorithm/detail/merge_sort_on_gpu.hpp new file mode 100644 index 0000000000..e62c6beb8d --- /dev/null +++ b/3party/boost/boost/compute/algorithm/detail/merge_sort_on_gpu.hpp @@ -0,0 +1,590 @@ +//---------------------------------------------------------------------------// +// Copyright (c) 2016 Jakub Szuppe +// +// 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 +// +// See http://boostorg.github.com/compute for more information. +//---------------------------------------------------------------------------// + +#ifndef BOOST_COMPUTE_ALGORITHM_DETAIL_MERGE_SORT_ON_GPU_HPP_ +#define BOOST_COMPUTE_ALGORITHM_DETAIL_MERGE_SORT_ON_GPU_HPP_ + +#include + +#include +#include +#include +#include +#include +#include +#include + +namespace boost { +namespace compute { +namespace detail { + +template +inline size_t pick_bitonic_block_sort_block_size(size_t proposed_wg, + size_t lmem_size, + bool sort_by_key) +{ + size_t n = proposed_wg; + + size_t lmem_required = n * sizeof(KeyType); + if(sort_by_key) { + lmem_required += n * sizeof(ValueType); + } + + // try to force at least 4 work-groups of >64 elements + // for better occupancy + while(lmem_size < (lmem_required * 4) && (n > 64)) { + n /= 2; + lmem_required = n * sizeof(KeyType); + } + while(lmem_size < lmem_required && (n != 1)) { + n /= 2; + if(n < 1) n = 1; + lmem_required = n * sizeof(KeyType); + } + + if(n < 2) { return 1; } + else if(n < 4) { return 2; } + else if(n < 8) { return 4; } + else if(n < 16) { return 8; } + else if(n < 32) { return 16; } + else if(n < 64) { return 32; } + else if(n < 128) { return 64; } + else if(n < 256) { return 128; } + else { return 256; } +} + + +/// Performs bitonic block sort according to \p compare. +/// +/// Since bitonic sort can be only performed when input size is equal to 2^n, +/// in this case input size is block size (\p work_group_size), we would have +/// to require \p count be a exact multiple of block size. That would not be +/// great. +/// Instead, bitonic sort kernel is merged with odd-even merge sort so if the +/// last block is not equal to 2^n (where n is some natural number) the odd-even +/// sort is performed for that block. That way bitonic_block_sort() works for +/// input of any size. Block size (\p work_group_size) still have to be equal +/// to 2^n. +/// +/// This is NOT stable. +/// +/// \param keys_first first key element in the range to sort +/// \param values_first first value element in the range to sort +/// \param compare comparison function for keys +/// \param count number of elements in the range; count > 0 +/// \param work_group_size size of the work group, also the block size; must be +/// equal to n^2 where n is natural number +/// \param queue command queue to perform the operation +template +inline size_t bitonic_block_sort(KeyIterator keys_first, + ValueIterator values_first, + Compare compare, + const size_t count, + const bool sort_by_key, + command_queue &queue) +{ + typedef typename std::iterator_traits::value_type key_type; + + meta_kernel k("bitonic_block_sort"); + size_t count_arg = k.add_arg("count"); + + size_t local_keys_arg = k.add_arg(memory_object::local_memory, "lkeys"); + size_t local_vals_arg = 0; + if(sort_by_key) { + local_vals_arg = k.add_arg(memory_object::local_memory, "lidx"); + } + + k << + // Work item global and local ids + k.decl("gid") << " = get_global_id(0);\n" << + k.decl("lid") << " = get_local_id(0);\n"; + + // declare my_key and my_value + k << + k.decl("my_key") << ";\n"; + // Instead of copying values (my_value) in local memory with keys + // we save local index (uchar) and copy my_value at the end at + // final index. This saves local memory. + if(sort_by_key) + { + k << + k.decl("my_index") << " = (uchar)(lid);\n"; + } + + // load key + k << + "if(gid < count) {\n" << + k.var("my_key") << " = " << + keys_first[k.var("gid")] << ";\n" << + "}\n"; + + // load key and index to local memory + k << + "lkeys[lid] = my_key;\n"; + if(sort_by_key) + { + k << + "lidx[lid] = my_index;\n"; + } + k << + k.decl("offset") << " = get_group_id(0) * get_local_size(0);\n" << + k.decl("n") << " = min((uint)(get_local_size(0)),(count - offset));\n"; + + // When work group size is a power of 2 bitonic sorter can be used; + // otherwise, slower odd-even sort is used. + + k << + // check if n is power of 2 + "if(((n != 0) && ((n & (~n + 1)) == n))) {\n"; + + // bitonic sort, not stable + k << + // wait for keys and vals to be stored in local memory + "barrier(CLK_LOCAL_MEM_FENCE);\n" << + + "#pragma unroll\n" << + "for(" << + k.decl("length") << " = 1; " << + "length < n; " << + "length <<= 1" << + ") {\n" << + // direction of sort: false -> asc, true -> desc + k.decl("direction") << "= ((lid & (length<<1)) != 0);\n" << + "for(" << + k.decl("k") << " = length; " << + "k > 0; " << + "k >>= 1" << + ") {\n" << + + // sibling to compare with my key + k.decl("sibling_idx") << " = lid ^ k;\n" << + k.decl("sibling_key") << " = lkeys[sibling_idx];\n" << + k.decl("compare") << " = " << + compare(k.var("sibling_key"), + k.var("my_key")) << ";\n" << + k.decl("swap") << + " = compare ^ (sibling_idx < lid) ^ direction;\n" << + "my_key = swap ? sibling_key : my_key;\n"; + if(sort_by_key) + { + k << + "my_index = swap ? lidx[sibling_idx] : my_index;\n"; + } + k << + "barrier(CLK_LOCAL_MEM_FENCE);\n" << + "lkeys[lid] = my_key;\n"; + if(sort_by_key) + { + k << + "lidx[lid] = my_index;\n"; + } + k << + "barrier(CLK_LOCAL_MEM_FENCE);\n" << + "}\n" << + "}\n"; + + // end of bitonic sort + + // odd-even sort, not stable + k << + "}\n" << + "else { \n"; + + k << + k.decl("lid_is_even") << " = (lid%2) == 0;\n" << + k.decl("oddsibling_idx") << " = " << + "(lid_is_even) ? max(lid,(uint)(1)) - 1 : min(lid+1,n-1);\n" << + k.decl("evensibling_idx") << " = " << + "(lid_is_even) ? min(lid+1,n-1) : max(lid,(uint)(1)) - 1;\n" << + + // wait for keys and vals to be stored in local memory + "barrier(CLK_LOCAL_MEM_FENCE);\n" << + + "#pragma unroll\n" << + "for(" << + k.decl("i") << " = 0; " << + "i < n; " << + "i++" << + ") {\n" << + k.decl("sibling_idx") << + " = i%2 == 0 ? evensibling_idx : oddsibling_idx;\n" << + k.decl("sibling_key") << " = lkeys[sibling_idx];\n" << + k.decl("compare") << " = " << + compare(k.var("sibling_key"), + k.var("my_key")) << ";\n" << + k.decl("swap") << + " = compare ^ (sibling_idx < lid);\n" << + "my_key = swap ? sibling_key : my_key;\n"; + if(sort_by_key) + { + k << + "my_index = swap ? lidx[sibling_idx] : my_index;\n"; + } + k << + "barrier(CLK_LOCAL_MEM_FENCE);\n" << + "lkeys[lid] = my_key;\n"; + if(sort_by_key) + { + k << + "lidx[lid] = my_index;\n"; + } + k << + "barrier(CLK_LOCAL_MEM_FENCE);\n" + "}\n" << // for + + "}\n"; // else + // end of odd-even sort + + // save key and value + k << + "if(gid < count) {\n" << + keys_first[k.var("gid")] << " = " << + k.var("my_key") << ";\n"; + if(sort_by_key) + { + k << values_first[k.var("gid")] << " = " << + values_first[k.var("offset + my_index")] << ";\n"; + } + k << + // end if + "}\n"; + + const context &context = queue.get_context(); + const device &device = queue.get_device(); + ::boost::compute::kernel kernel = k.compile(context); + + const size_t work_group_size = + pick_bitonic_block_sort_block_size( + kernel.get_work_group_info( + device, CL_KERNEL_WORK_GROUP_SIZE + ), + device.get_info(CL_DEVICE_LOCAL_MEM_SIZE), + sort_by_key + ); + + const size_t global_size = + work_group_size * static_cast( + std::ceil(float(count) / work_group_size) + ); + + kernel.set_arg(count_arg, static_cast(count)); + kernel.set_arg(local_keys_arg, local_buffer(work_group_size)); + if(sort_by_key) { + kernel.set_arg(local_vals_arg, local_buffer(work_group_size)); + } + + queue.enqueue_1d_range_kernel(kernel, 0, global_size, work_group_size); + // return size of the block + return work_group_size; +} + +template +inline size_t block_sort(KeyIterator keys_first, + ValueIterator values_first, + Compare compare, + const size_t count, + const bool sort_by_key, + const bool stable, + command_queue &queue) +{ + if(stable) { + // TODO: Implement stable block sort (stable odd-even merge sort) + return size_t(1); + } + return bitonic_block_sort( + keys_first, values_first, + compare, count, + sort_by_key, queue + ); +} + +/// space: O(n + m); n - number of keys, m - number of values +template +inline void merge_blocks_on_gpu(KeyIterator keys_first, + ValueIterator values_first, + KeyIterator out_keys_first, + ValueIterator out_values_first, + Compare compare, + const size_t count, + const size_t block_size, + const bool sort_by_key, + command_queue &queue) +{ + typedef typename std::iterator_traits::value_type key_type; + typedef typename std::iterator_traits::value_type value_type; + + meta_kernel k("merge_blocks"); + size_t count_arg = k.add_arg("count"); + size_t block_size_arg = k.add_arg("block_size"); + + k << + // get global id + k.decl("gid") << " = get_global_id(0);\n" << + "if(gid >= count) {\n" << + "return;\n" << + "}\n" << + + k.decl("my_key") << " = " << + keys_first[k.var("gid")] << ";\n"; + + if(sort_by_key) { + k << + k.decl("my_value") << " = " << + values_first[k.var("gid")] << ";\n"; + } + + k << + // get my block idx + k.decl("my_block_idx") << " = gid / block_size;\n" << + k.decl("my_block_idx_is_odd") << " = " << + "my_block_idx & 0x1;\n" << + + k.decl("other_block_idx") << " = " << + // if(my_block_idx is odd) {} else {} + "my_block_idx_is_odd ? my_block_idx - 1 : my_block_idx + 1;\n" << + + // get ranges of my block and the other block + // [my_block_start; my_block_end) + // [other_block_start; other_block_end) + k.decl("my_block_start") << " = " << + "min(my_block_idx * block_size, count);\n" << // including + k.decl("my_block_end") << " = " << + "min((my_block_idx + 1) * block_size, count);\n" << // excluding + + k.decl("other_block_start") << " = " << + "min(other_block_idx * block_size, count);\n" << // including + k.decl("other_block_end") << " = " << + "min((other_block_idx + 1) * block_size, count);\n" << // excluding + + // other block is empty, nothing to merge here + "if(other_block_start == count){\n" << + out_keys_first[k.var("gid")] << " = my_key;\n"; + if(sort_by_key) { + k << + out_values_first[k.var("gid")] << " = my_value;\n"; + } + + k << + "return;\n" << + "}\n" << + + // lower bound + // left_idx - lower bound + k.decl("left_idx") << " = other_block_start;\n" << + k.decl("right_idx") << " = other_block_end;\n" << + "while(left_idx < right_idx) {\n" << + k.decl("mid_idx") << " = (left_idx + right_idx) / 2;\n" << + k.decl("mid_key") << " = " << + keys_first[k.var("mid_idx")] << ";\n" << + k.decl("smaller") << " = " << + compare(k.var("mid_key"), + k.var("my_key")) << ";\n" << + "left_idx = smaller ? mid_idx + 1 : left_idx;\n" << + "right_idx = smaller ? right_idx : mid_idx;\n" << + "}\n" << + // left_idx is found position in other block + + // if my_block is odd we need to get the upper bound + "right_idx = other_block_end;\n" << + "if(my_block_idx_is_odd && left_idx != right_idx) {\n" << + k.decl("upper_key") << " = " << + keys_first[k.var("left_idx")] << ";\n" << + "while(" << + "!(" << compare(k.var("upper_key"), + k.var("my_key")) << + ") && " << + "!(" << compare(k.var("my_key"), + k.var("upper_key")) << + ") && " << + "left_idx < right_idx" << + ")" << + "{\n" << + k.decl("mid_idx") << " = (left_idx + right_idx) / 2;\n" << + k.decl("mid_key") << " = " << + keys_first[k.var("mid_idx")] << ";\n" << + k.decl("equal") << " = " << + "!(" << compare(k.var("mid_key"), + k.var("my_key")) << + ") && " << + "!(" << compare(k.var("my_key"), + k.var("mid_key")) << + ");\n" << + "left_idx = equal ? mid_idx + 1 : left_idx + 1;\n" << + "right_idx = equal ? right_idx : mid_idx;\n" << + "upper_key = equal ? upper_key : " << + keys_first[k.var("left_idx")] << ";\n" << + "}\n" << + "}\n" << + + k.decl("offset") << " = 0;\n" << + "offset += gid - my_block_start;\n" << + "offset += left_idx - other_block_start;\n" << + "offset += min(my_block_start, other_block_start);\n" << + out_keys_first[k.var("offset")] << " = my_key;\n"; + if(sort_by_key) { + k << + out_values_first[k.var("offset")] << " = my_value;\n"; + } + + const context &context = queue.get_context(); + ::boost::compute::kernel kernel = k.compile(context); + + const size_t work_group_size = (std::min)( + size_t(256), + kernel.get_work_group_info( + queue.get_device(), CL_KERNEL_WORK_GROUP_SIZE + ) + ); + const size_t global_size = + work_group_size * static_cast( + std::ceil(float(count) / work_group_size) + ); + + kernel.set_arg(count_arg, static_cast(count)); + kernel.set_arg(block_size_arg, static_cast(block_size)); + queue.enqueue_1d_range_kernel(kernel, 0, global_size, work_group_size); +} + +template +inline void merge_sort_by_key_on_gpu(KeyIterator keys_first, + KeyIterator keys_last, + ValueIterator values_first, + Compare compare, + bool stable, + command_queue &queue) +{ + typedef typename std::iterator_traits::value_type key_type; + typedef typename std::iterator_traits::value_type value_type; + + size_t count = iterator_range_size(keys_first, keys_last); + if(count < 2){ + return; + } + + size_t block_size = + block_sort( + keys_first, values_first, + compare, count, + true /* sort_by_key */, stable /* stable */, + queue + ); + + // for small input size only block sort is performed + if(count <= block_size) { + return; + } + + const context &context = queue.get_context(); + + bool result_in_temporary_buffer = false; + ::boost::compute::vector temp_keys(count, context); + ::boost::compute::vector temp_values(count, context); + + for(; block_size < count; block_size *= 2) { + result_in_temporary_buffer = !result_in_temporary_buffer; + if(result_in_temporary_buffer) { + merge_blocks_on_gpu(keys_first, values_first, + temp_keys.begin(), temp_values.begin(), + compare, count, block_size, + true /* sort_by_key */, queue); + } else { + merge_blocks_on_gpu(temp_keys.begin(), temp_values.begin(), + keys_first, values_first, + compare, count, block_size, + true /* sort_by_key */, queue); + } + } + + if(result_in_temporary_buffer) { + copy_async(temp_keys.begin(), temp_keys.end(), keys_first, queue); + copy_async(temp_values.begin(), temp_values.end(), values_first, queue); + } +} + +template +inline void merge_sort_on_gpu(Iterator first, + Iterator last, + Compare compare, + bool stable, + command_queue &queue) +{ + typedef typename std::iterator_traits::value_type key_type; + + size_t count = iterator_range_size(first, last); + if(count < 2){ + return; + } + + Iterator dummy; + size_t block_size = + block_sort( + first, dummy, + compare, count, + false /* sort_by_key */, stable /* stable */, + queue + ); + + // for small input size only block sort is performed + if(count <= block_size) { + return; + } + + const context &context = queue.get_context(); + + bool result_in_temporary_buffer = false; + ::boost::compute::vector temp_keys(count, context); + + for(; block_size < count; block_size *= 2) { + result_in_temporary_buffer = !result_in_temporary_buffer; + if(result_in_temporary_buffer) { + merge_blocks_on_gpu(first, dummy, temp_keys.begin(), dummy, + compare, count, block_size, + false /* sort_by_key */, queue); + } else { + merge_blocks_on_gpu(temp_keys.begin(), dummy, first, dummy, + compare, count, block_size, + false /* sort_by_key */, queue); + } + } + + if(result_in_temporary_buffer) { + copy_async(temp_keys.begin(), temp_keys.end(), first, queue); + } +} + +template +inline void merge_sort_by_key_on_gpu(KeyIterator keys_first, + KeyIterator keys_last, + ValueIterator values_first, + Compare compare, + command_queue &queue) +{ + merge_sort_by_key_on_gpu( + keys_first, keys_last, values_first, + compare, false /* not stable */, queue + ); +} + +template +inline void merge_sort_on_gpu(Iterator first, + Iterator last, + Compare compare, + command_queue &queue) +{ + merge_sort_on_gpu( + first, last, compare, false /* not stable */, queue + ); +} + +} // end detail namespace +} // end compute namespace +} // end boost namespace + +#endif /* BOOST_COMPUTE_ALGORITHM_DETAIL_MERGE_SORT_ON_GPU_HPP_ */ diff --git a/3party/boost/boost/compute/algorithm/detail/merge_with_merge_path.hpp b/3party/boost/boost/compute/algorithm/detail/merge_with_merge_path.hpp new file mode 100644 index 0000000000..c3cc5e8e9c --- /dev/null +++ b/3party/boost/boost/compute/algorithm/detail/merge_with_merge_path.hpp @@ -0,0 +1,203 @@ +//---------------------------------------------------------------------------// +// Copyright (c) 2014 Roshan +// +// 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 +// +// See http://boostorg.github.com/compute for more information. +//---------------------------------------------------------------------------// + +#ifndef BOOST_COMPUTE_ALGORITHM_DETAIL_MERGE_WIH_MERGE_PATH_HPP +#define BOOST_COMPUTE_ALGORITHM_DETAIL_MERGE_WIH_MERGE_PATH_HPP + +#include + +#include +#include +#include +#include +#include +#include + +namespace boost { +namespace compute { +namespace detail { + +/// +/// \brief Serial merge kernel class +/// +/// Subclass of meta_kernel to perform serial merge after tiling +/// +class serial_merge_kernel : meta_kernel +{ +public: + unsigned int tile_size; + + serial_merge_kernel() : meta_kernel("merge") + { + tile_size = 4; + } + + template + void set_range(InputIterator1 first1, + InputIterator2 first2, + InputIterator3 tile_first1, + InputIterator3 tile_last1, + InputIterator4 tile_first2, + OutputIterator result, + Compare comp) + { + m_count = iterator_range_size(tile_first1, tile_last1) - 1; + + *this << + "uint i = get_global_id(0);\n" << + "uint start1 = " << tile_first1[expr("i")] << ";\n" << + "uint end1 = " << tile_first1[expr("i+1")] << ";\n" << + "uint start2 = " << tile_first2[expr("i")] << ";\n" << + "uint end2 = " << tile_first2[expr("i+1")] << ";\n" << + "uint index = i*" << tile_size << ";\n" << + "while(start1("start2")], + first1[expr("start1")]) << "))\n" << + " {\n" << + result[expr("index")] << + " = " << first1[expr("start1")] << ";\n" << + " index++;\n" << + " start1++;\n" << + " }\n" << + " else\n" << + " {\n" << + result[expr("index")] << + " = " << first2[expr("start2")] << ";\n" << + " index++;\n" << + " start2++;\n" << + " }\n" << + "}\n" << + "while(start1("index")] << + " = " << first1[expr("start1")] << ";\n" << + " index++;\n" << + " start1++;\n" << + "}\n" << + "while(start2("index")] << + " = " << first2[expr("start2")] << ";\n" << + " index++;\n" << + " start2++;\n" << + "}\n"; + } + + template + void set_range(InputIterator1 first1, + InputIterator2 first2, + InputIterator3 tile_first1, + InputIterator3 tile_last1, + InputIterator4 tile_first2, + OutputIterator result) + { + typedef typename std::iterator_traits::value_type value_type; + ::boost::compute::less less_than; + set_range(first1, first2, tile_first1, tile_last1, tile_first2, result, less_than); + } + + event exec(command_queue &queue) + { + if(m_count == 0) { + return event(); + } + + return exec_1d(queue, 0, m_count); + } + +private: + size_t m_count; +}; + +/// +/// \brief Merge algorithm with merge path +/// +/// Merges the sorted values in the range [\p first1, \p last1) with +/// the sorted values in the range [\p first2, last2) and stores the +/// result in the range beginning at \p result +/// +/// \param first1 Iterator pointing to start of first set +/// \param last1 Iterator pointing to end of first set +/// \param first2 Iterator pointing to start of second set +/// \param last2 Iterator pointing to end of second set +/// \param result Iterator pointing to start of range in which the result +/// will be stored +/// \param comp Comparator which performs less than function +/// \param queue Queue on which to execute +/// +template +inline OutputIterator +merge_with_merge_path(InputIterator1 first1, + InputIterator1 last1, + InputIterator2 first2, + InputIterator2 last2, + OutputIterator result, + Compare comp, + command_queue &queue = system::default_queue()) +{ + typedef typename + std::iterator_traits::difference_type result_difference_type; + + size_t tile_size = 1024; + + size_t count1 = iterator_range_size(first1, last1); + size_t count2 = iterator_range_size(first2, last2); + + vector tile_a((count1+count2+tile_size-1)/tile_size+1, queue.get_context()); + vector tile_b((count1+count2+tile_size-1)/tile_size+1, queue.get_context()); + + // Tile the sets + merge_path_kernel tiling_kernel; + tiling_kernel.tile_size = static_cast(tile_size); + tiling_kernel.set_range(first1, last1, first2, last2, + tile_a.begin()+1, tile_b.begin()+1, comp); + fill_n(tile_a.begin(), 1, uint_(0), queue); + fill_n(tile_b.begin(), 1, uint_(0), queue); + tiling_kernel.exec(queue); + + fill_n(tile_a.end()-1, 1, static_cast(count1), queue); + fill_n(tile_b.end()-1, 1, static_cast(count2), queue); + + // Merge + serial_merge_kernel merge_kernel; + merge_kernel.tile_size = static_cast(tile_size); + merge_kernel.set_range(first1, first2, tile_a.begin(), tile_a.end(), + tile_b.begin(), result, comp); + + merge_kernel.exec(queue); + + return result + static_cast(count1 + count2); +} + +/// \overload +template +inline OutputIterator +merge_with_merge_path(InputIterator1 first1, + InputIterator1 last1, + InputIterator2 first2, + InputIterator2 last2, + OutputIterator result, + command_queue &queue = system::default_queue()) +{ + typedef typename std::iterator_traits::value_type value_type; + ::boost::compute::less less_than; + return merge_with_merge_path(first1, last1, first2, last2, result, less_than, queue); +} + +} //end detail namespace +} //end compute namespace +} //end boost namespace + +#endif // BOOST_COMPUTE_ALGORITHM_DETAIL_MERGE_WIH_MERGE_PATH_HPP diff --git a/3party/boost/boost/compute/algorithm/detail/radix_sort.hpp b/3party/boost/boost/compute/algorithm/detail/radix_sort.hpp new file mode 100644 index 0000000000..8e6d5f9c0a --- /dev/null +++ b/3party/boost/boost/compute/algorithm/detail/radix_sort.hpp @@ -0,0 +1,461 @@ +//---------------------------------------------------------------------------// +// Copyright (c) 2013 Kyle Lutz +// +// 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 +// +// See http://boostorg.github.com/compute for more information. +//---------------------------------------------------------------------------// + +#ifndef BOOST_COMPUTE_ALGORITHM_DETAIL_RADIX_SORT_HPP +#define BOOST_COMPUTE_ALGORITHM_DETAIL_RADIX_SORT_HPP + +#include + +#include +#include +#include + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +namespace boost { +namespace compute { +namespace detail { + +// meta-function returning true if type T is radix-sortable +template +struct is_radix_sortable : + boost::mpl::and_< + typename ::boost::compute::is_fundamental::type, + typename boost::mpl::not_::type>::type + > +{ +}; + +template +struct radix_sort_value_type +{ +}; + +template<> +struct radix_sort_value_type<1> +{ + typedef uchar_ type; +}; + +template<> +struct radix_sort_value_type<2> +{ + typedef ushort_ type; +}; + +template<> +struct radix_sort_value_type<4> +{ + typedef uint_ type; +}; + +template<> +struct radix_sort_value_type<8> +{ + typedef ulong_ type; +}; + +template +inline const char* enable_double() +{ + return " -DT2_double=0"; +} + +template<> +inline const char* enable_double() +{ + return " -DT2_double=1"; +} + +const char radix_sort_source[] = +"#if T2_double\n" +"#pragma OPENCL EXTENSION cl_khr_fp64 : enable\n" +"#endif\n" +"#define K2_BITS (1 << K_BITS)\n" +"#define RADIX_MASK ((((T)(1)) << K_BITS) - 1)\n" +"#define SIGN_BIT ((sizeof(T) * CHAR_BIT) - 1)\n" + +"#if defined(ASC)\n" // asc order + +"inline uint radix(const T x, const uint low_bit)\n" +"{\n" +"#if defined(IS_FLOATING_POINT)\n" +" const T mask = -(x >> SIGN_BIT) | (((T)(1)) << SIGN_BIT);\n" +" return ((x ^ mask) >> low_bit) & RADIX_MASK;\n" +"#elif defined(IS_SIGNED)\n" +" return ((x ^ (((T)(1)) << SIGN_BIT)) >> low_bit) & RADIX_MASK;\n" +"#else\n" +" return (x >> low_bit) & RADIX_MASK;\n" +"#endif\n" +"}\n" + +"#else\n" // desc order + +// For signed types we just negate the x and for unsigned types we +// subtract the x from max value of its type ((T)(-1) is a max value +// of type T when T is an unsigned type). +"inline uint radix(const T x, const uint low_bit)\n" +"{\n" +"#if defined(IS_FLOATING_POINT)\n" +" const T mask = -(x >> SIGN_BIT) | (((T)(1)) << SIGN_BIT);\n" +" return (((-x) ^ mask) >> low_bit) & RADIX_MASK;\n" +"#elif defined(IS_SIGNED)\n" +" return (((-x) ^ (((T)(1)) << SIGN_BIT)) >> low_bit) & RADIX_MASK;\n" +"#else\n" +" return (((T)(-1) - x) >> low_bit) & RADIX_MASK;\n" +"#endif\n" +"}\n" + +"#endif\n" // #if defined(ASC) + +"__kernel void count(__global const T *input,\n" +" const uint input_offset,\n" +" const uint input_size,\n" +" __global uint *global_counts,\n" +" __global uint *global_offsets,\n" +" __local uint *local_counts,\n" +" const uint low_bit)\n" +"{\n" + // work-item parameters +" const uint gid = get_global_id(0);\n" +" const uint lid = get_local_id(0);\n" + + // zero local counts +" if(lid < K2_BITS){\n" +" local_counts[lid] = 0;\n" +" }\n" +" barrier(CLK_LOCAL_MEM_FENCE);\n" + + // reduce local counts +" if(gid < input_size){\n" +" T value = input[input_offset+gid];\n" +" uint bucket = radix(value, low_bit);\n" +" atomic_inc(local_counts + bucket);\n" +" }\n" +" barrier(CLK_LOCAL_MEM_FENCE);\n" + + // write block-relative offsets +" if(lid < K2_BITS){\n" +" global_counts[K2_BITS*get_group_id(0) + lid] = local_counts[lid];\n" + + // write global offsets +" if(get_group_id(0) == (get_num_groups(0) - 1)){\n" +" global_offsets[lid] = local_counts[lid];\n" +" }\n" +" }\n" +"}\n" + +"__kernel void scan(__global const uint *block_offsets,\n" +" __global uint *global_offsets,\n" +" const uint block_count)\n" +"{\n" +" __global const uint *last_block_offsets =\n" +" block_offsets + K2_BITS * (block_count - 1);\n" + + // calculate and scan global_offsets +" uint sum = 0;\n" +" for(uint i = 0; i < K2_BITS; i++){\n" +" uint x = global_offsets[i] + last_block_offsets[i];\n" +" global_offsets[i] = sum;\n" +" sum += x;\n" +" }\n" +"}\n" + +"__kernel void scatter(__global const T *input,\n" +" const uint input_offset,\n" +" const uint input_size,\n" +" const uint low_bit,\n" +" __global const uint *counts,\n" +" __global const uint *global_offsets,\n" +"#ifndef SORT_BY_KEY\n" +" __global T *output,\n" +" const uint output_offset)\n" +"#else\n" +" __global T *keys_output,\n" +" const uint keys_output_offset,\n" +" __global T2 *values_input,\n" +" const uint values_input_offset,\n" +" __global T2 *values_output,\n" +" const uint values_output_offset)\n" +"#endif\n" +"{\n" + // work-item parameters +" const uint gid = get_global_id(0);\n" +" const uint lid = get_local_id(0);\n" + + // copy input to local memory +" T value;\n" +" uint bucket;\n" +" __local uint local_input[BLOCK_SIZE];\n" +" if(gid < input_size){\n" +" value = input[input_offset+gid];\n" +" bucket = radix(value, low_bit);\n" +" local_input[lid] = bucket;\n" +" }\n" + + // copy block counts to local memory +" __local uint local_counts[(1 << K_BITS)];\n" +" if(lid < K2_BITS){\n" +" local_counts[lid] = counts[get_group_id(0) * K2_BITS + lid];\n" +" }\n" + + // wait until local memory is ready +" barrier(CLK_LOCAL_MEM_FENCE);\n" + +" if(gid >= input_size){\n" +" return;\n" +" }\n" + + // get global offset +" uint offset = global_offsets[bucket] + local_counts[bucket];\n" + + // calculate local offset +" uint local_offset = 0;\n" +" for(uint i = 0; i < lid; i++){\n" +" if(local_input[i] == bucket)\n" +" local_offset++;\n" +" }\n" + +"#ifndef SORT_BY_KEY\n" + // write value to output +" output[output_offset + offset + local_offset] = value;\n" +"#else\n" + // write key and value if doing sort_by_key +" keys_output[keys_output_offset+offset + local_offset] = value;\n" +" values_output[values_output_offset+offset + local_offset] =\n" +" values_input[values_input_offset+gid];\n" +"#endif\n" +"}\n"; + +template +inline void radix_sort_impl(const buffer_iterator first, + const buffer_iterator last, + const buffer_iterator values_first, + const bool ascending, + command_queue &queue) +{ + + typedef T value_type; + typedef typename radix_sort_value_type::type sort_type; + + const device &device = queue.get_device(); + const context &context = queue.get_context(); + + + // if we have a valid values iterator then we are doing a + // sort by key and have to set up the values buffer + bool sort_by_key = (values_first.get_buffer().get() != 0); + + // load (or create) radix sort program + std::string cache_key = + std::string("__boost_radix_sort_") + type_name(); + + if(sort_by_key){ + cache_key += std::string("_with_") + type_name(); + } + + boost::shared_ptr cache = + program_cache::get_global_cache(context); + boost::shared_ptr parameters = + detail::parameter_cache::get_global_cache(device); + + // sort parameters + const uint_ k = parameters->get(cache_key, "k", 4); + const uint_ k2 = 1 << k; + const uint_ block_size = parameters->get(cache_key, "tpb", 128); + + // sort program compiler options + std::stringstream options; + options << "-DK_BITS=" << k; + options << " -DT=" << type_name(); + options << " -DBLOCK_SIZE=" << block_size; + + if(boost::is_floating_point::value){ + options << " -DIS_FLOATING_POINT"; + } + + if(boost::is_signed::value){ + options << " -DIS_SIGNED"; + } + + if(sort_by_key){ + options << " -DSORT_BY_KEY"; + options << " -DT2=" << type_name(); + options << enable_double(); + } + + if(ascending){ + options << " -DASC"; + } + + // load radix sort program + program radix_sort_program = cache->get_or_build( + cache_key, options.str(), radix_sort_source, context + ); + + kernel count_kernel(radix_sort_program, "count"); + kernel scan_kernel(radix_sort_program, "scan"); + kernel scatter_kernel(radix_sort_program, "scatter"); + + size_t count = detail::iterator_range_size(first, last); + + uint_ block_count = static_cast(count / block_size); + if(block_count * block_size != count){ + block_count++; + } + + // setup temporary buffers + vector output(count, context); + vector values_output(sort_by_key ? count : 0, context); + vector offsets(k2, context); + vector counts(block_count * k2, context); + + const buffer *input_buffer = &first.get_buffer(); + uint_ input_offset = static_cast(first.get_index()); + const buffer *output_buffer = &output.get_buffer(); + uint_ output_offset = 0; + const buffer *values_input_buffer = &values_first.get_buffer(); + uint_ values_input_offset = static_cast(values_first.get_index()); + const buffer *values_output_buffer = &values_output.get_buffer(); + uint_ values_output_offset = 0; + + for(uint_ i = 0; i < sizeof(sort_type) * CHAR_BIT / k; i++){ + // write counts + count_kernel.set_arg(0, *input_buffer); + count_kernel.set_arg(1, input_offset); + count_kernel.set_arg(2, static_cast(count)); + count_kernel.set_arg(3, counts); + count_kernel.set_arg(4, offsets); + count_kernel.set_arg(5, block_size * sizeof(uint_), 0); + count_kernel.set_arg(6, i * k); + queue.enqueue_1d_range_kernel(count_kernel, + 0, + block_count * block_size, + block_size); + + // scan counts + if(k == 1){ + typedef uint2_ counter_type; + ::boost::compute::exclusive_scan( + make_buffer_iterator(counts.get_buffer(), 0), + make_buffer_iterator(counts.get_buffer(), counts.size() / 2), + make_buffer_iterator(counts.get_buffer()), + queue + ); + } + else if(k == 2){ + typedef uint4_ counter_type; + ::boost::compute::exclusive_scan( + make_buffer_iterator(counts.get_buffer(), 0), + make_buffer_iterator(counts.get_buffer(), counts.size() / 4), + make_buffer_iterator(counts.get_buffer()), + queue + ); + } + else if(k == 4){ + typedef uint16_ counter_type; + ::boost::compute::exclusive_scan( + make_buffer_iterator(counts.get_buffer(), 0), + make_buffer_iterator(counts.get_buffer(), counts.size() / 16), + make_buffer_iterator(counts.get_buffer()), + queue + ); + } + else { + BOOST_ASSERT(false && "unknown k"); + break; + } + + // scan global offsets + scan_kernel.set_arg(0, counts); + scan_kernel.set_arg(1, offsets); + scan_kernel.set_arg(2, block_count); + queue.enqueue_task(scan_kernel); + + // scatter values + scatter_kernel.set_arg(0, *input_buffer); + scatter_kernel.set_arg(1, input_offset); + scatter_kernel.set_arg(2, static_cast(count)); + scatter_kernel.set_arg(3, i * k); + scatter_kernel.set_arg(4, counts); + scatter_kernel.set_arg(5, offsets); + scatter_kernel.set_arg(6, *output_buffer); + scatter_kernel.set_arg(7, output_offset); + if(sort_by_key){ + scatter_kernel.set_arg(8, *values_input_buffer); + scatter_kernel.set_arg(9, values_input_offset); + scatter_kernel.set_arg(10, *values_output_buffer); + scatter_kernel.set_arg(11, values_output_offset); + } + queue.enqueue_1d_range_kernel(scatter_kernel, + 0, + block_count * block_size, + block_size); + + // swap buffers + std::swap(input_buffer, output_buffer); + std::swap(values_input_buffer, values_output_buffer); + std::swap(input_offset, output_offset); + std::swap(values_input_offset, values_output_offset); + } +} + +template +inline void radix_sort(Iterator first, + Iterator last, + command_queue &queue) +{ + radix_sort_impl(first, last, buffer_iterator(), true, queue); +} + +template +inline void radix_sort_by_key(KeyIterator keys_first, + KeyIterator keys_last, + ValueIterator values_first, + command_queue &queue) +{ + radix_sort_impl(keys_first, keys_last, values_first, true, queue); +} + +template +inline void radix_sort(Iterator first, + Iterator last, + const bool ascending, + command_queue &queue) +{ + radix_sort_impl(first, last, buffer_iterator(), ascending, queue); +} + +template +inline void radix_sort_by_key(KeyIterator keys_first, + KeyIterator keys_last, + ValueIterator values_first, + const bool ascending, + command_queue &queue) +{ + radix_sort_impl(keys_first, keys_last, values_first, ascending, queue); +} + + +} // end detail namespace +} // end compute namespace +} // end boost namespace + +#endif // BOOST_COMPUTE_ALGORITHM_DETAIL_RADIX_SORT_HPP diff --git a/3party/boost/boost/compute/algorithm/detail/random_fill.hpp b/3party/boost/boost/compute/algorithm/detail/random_fill.hpp new file mode 100644 index 0000000000..5c3827a9f8 --- /dev/null +++ b/3party/boost/boost/compute/algorithm/detail/random_fill.hpp @@ -0,0 +1,57 @@ +//---------------------------------------------------------------------------// +// Copyright (c) 2013 Kyle Lutz +// +// 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 +// +// See http://boostorg.github.com/compute for more information. +//---------------------------------------------------------------------------// + +#ifndef BOOST_COMPUTE_ALGORITHM_DETAIL_RANDOM_FILL_HPP +#define BOOST_COMPUTE_ALGORITHM_DETAIL_RANDOM_FILL_HPP + +#include + +#include +#include +#include + +namespace boost { +namespace compute { +namespace detail { + +template +inline void random_fill(OutputIterator first, + OutputIterator last, + Generator &g, + command_queue &queue) +{ + g.fill(first, last, queue); +} + +template +inline void +random_fill(OutputIterator first, + OutputIterator last, + typename std::iterator_traits::value_type lo, + typename std::iterator_traits::value_type hi, + command_queue &queue) +{ + typedef typename + std::iterator_traits::value_type value_type; + typedef typename + boost::compute::default_random_engine engine_type; + typedef typename + boost::compute::uniform_real_distribution distribution_type; + + engine_type engine(queue); + distribution_type generator(lo, hi); + generator.fill(first, last, engine, queue); +} + +} // end detail namespace +} // end compute namespace +} // end boost namespace + +#endif // BOOST_COMPUTE_ALGORITHM_DETAIL_RANDOM_FILL_HPP diff --git a/3party/boost/boost/compute/algorithm/detail/reduce_by_key.hpp b/3party/boost/boost/compute/algorithm/detail/reduce_by_key.hpp new file mode 100644 index 0000000000..65844c9ebf --- /dev/null +++ b/3party/boost/boost/compute/algorithm/detail/reduce_by_key.hpp @@ -0,0 +1,119 @@ +//---------------------------------------------------------------------------// +// Copyright (c) 2015 Jakub Szuppe +// +// 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 +// +// See http://boostorg.github.com/compute for more information. +//---------------------------------------------------------------------------// + +#ifndef BOOST_COMPUTE_ALGORITHM_DETAIL_REDUCE_BY_KEY_HPP +#define BOOST_COMPUTE_ALGORITHM_DETAIL_REDUCE_BY_KEY_HPP + +#include +#include + +#include +#include +#include +#include +#include +#include +#include + +namespace boost { +namespace compute { +namespace detail { + +template +size_t reduce_by_key_on_gpu(InputKeyIterator keys_first, + InputKeyIterator keys_last, + InputValueIterator values_first, + OutputKeyIterator keys_result, + OutputValueIterator values_result, + BinaryFunction function, + BinaryPredicate predicate, + command_queue &queue) +{ + return detail::reduce_by_key_with_scan(keys_first, keys_last, values_first, + keys_result, values_result, function, + predicate, queue); +} + +template +bool reduce_by_key_on_gpu_requirements_met(InputKeyIterator keys_first, + InputValueIterator values_first, + OutputKeyIterator keys_result, + OutputValueIterator values_result, + const size_t count, + command_queue &queue) +{ + const device &device = queue.get_device(); + return (count > 256) + && !(device.type() & device::cpu) + && reduce_by_key_with_scan_requirements_met(keys_first, values_first, + keys_result,values_result, + count, queue); + return true; +} + +template +inline std::pair +dispatch_reduce_by_key(InputKeyIterator keys_first, + InputKeyIterator keys_last, + InputValueIterator values_first, + OutputKeyIterator keys_result, + OutputValueIterator values_result, + BinaryFunction function, + BinaryPredicate predicate, + command_queue &queue) +{ + typedef typename + std::iterator_traits::difference_type key_difference_type; + typedef typename + std::iterator_traits::difference_type value_difference_type; + + const size_t count = detail::iterator_range_size(keys_first, keys_last); + if (count < 2) { + boost::compute::copy_n(keys_first, count, keys_result, queue); + boost::compute::copy_n(values_first, count, values_result, queue); + return + std::make_pair( + keys_result + static_cast(count), + values_result + static_cast(count) + ); + } + + size_t result_size = 0; + if(reduce_by_key_on_gpu_requirements_met(keys_first, values_first, keys_result, + values_result, count, queue)){ + result_size = + detail::reduce_by_key_on_gpu(keys_first, keys_last, values_first, + keys_result, values_result, function, + predicate, queue); + } + else { + result_size = + detail::serial_reduce_by_key(keys_first, keys_last, values_first, + keys_result, values_result, function, + predicate, queue); + } + + return + std::make_pair( + keys_result + static_cast(result_size), + values_result + static_cast(result_size) + ); +} + +} // end detail namespace +} // end compute namespace +} // end boost namespace + +#endif // BOOST_COMPUTE_ALGORITHM_DETAIL_REDUCE_BY_KEY_HPP diff --git a/3party/boost/boost/compute/algorithm/detail/reduce_by_key_with_scan.hpp b/3party/boost/boost/compute/algorithm/detail/reduce_by_key_with_scan.hpp new file mode 100644 index 0000000000..e6852a67eb --- /dev/null +++ b/3party/boost/boost/compute/algorithm/detail/reduce_by_key_with_scan.hpp @@ -0,0 +1,541 @@ +//---------------------------------------------------------------------------// +// Copyright (c) 2015 Jakub Szuppe +// +// 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 +// +// See http://boostorg.github.com/compute for more information. +//---------------------------------------------------------------------------// + +#ifndef BOOST_COMPUTE_ALGORITHM_DETAIL_REDUCE_BY_KEY_WITH_SCAN_HPP +#define BOOST_COMPUTE_ALGORITHM_DETAIL_REDUCE_BY_KEY_WITH_SCAN_HPP + +#include +#include + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +namespace boost { +namespace compute { +namespace detail { + +/// \internal_ +/// +/// Fills \p new_keys_first with unsigned integer keys generated from vector +/// of original keys \p keys_first. New keys can be distinguish by simple equality +/// predicate. +/// +/// \param keys_first iterator pointing to the first key +/// \param number_of_keys number of keys +/// \param predicate binary predicate for key comparison +/// \param new_keys_first iterator pointing to the new keys vector +/// \param preferred_work_group_size preferred work group size +/// \param queue command queue to perform the operation +/// +/// Binary function \p predicate must take two keys as arguments and +/// return true only if they are considered the same. +/// +/// The first new key equals zero and the last equals number of unique keys +/// minus one. +/// +/// No local memory usage. +template +inline void generate_uint_keys(InputKeyIterator keys_first, + size_t number_of_keys, + BinaryPredicate predicate, + vector::iterator new_keys_first, + size_t preferred_work_group_size, + command_queue &queue) +{ + typedef typename + std::iterator_traits::value_type key_type; + + detail::meta_kernel k("reduce_by_key_new_key_flags"); + k.add_set_arg("count", uint_(number_of_keys)); + + k << + k.decl("gid") << " = get_global_id(0);\n" << + k.decl("value") << " = 0;\n" << + "if(gid >= count){\n return;\n}\n" << + "if(gid > 0){ \n" << + k.decl("key") << " = " << + keys_first[k.var("gid")] << ";\n" << + k.decl("previous_key") << " = " << + keys_first[k.var("gid - 1")] << ";\n" << + " value = " << predicate(k.var("previous_key"), + k.var("key")) << + " ? 0 : 1;\n" << + "}\n else {\n" << + " value = 0;\n" << + "}\n" << + new_keys_first[k.var("gid")] << " = value;\n"; + + const context &context = queue.get_context(); + kernel kernel = k.compile(context); + + size_t work_group_size = preferred_work_group_size; + size_t work_groups_no = static_cast( + std::ceil(float(number_of_keys) / work_group_size) + ); + + queue.enqueue_1d_range_kernel(kernel, + 0, + work_groups_no * work_group_size, + work_group_size); + + inclusive_scan(new_keys_first, new_keys_first + number_of_keys, + new_keys_first, queue); +} + +/// \internal_ +/// Calculate carry-out for each work group. +/// Carry-out is a pair of the last key processed by a work group and sum of all +/// values under this key in this work group. +template +inline void carry_outs(vector::iterator keys_first, + InputValueIterator values_first, + size_t count, + vector::iterator carry_out_keys_first, + OutputValueIterator carry_out_values_first, + BinaryFunction function, + size_t work_group_size, + command_queue &queue) +{ + typedef typename + std::iterator_traits::value_type value_out_type; + + detail::meta_kernel k("reduce_by_key_with_scan_carry_outs"); + k.add_set_arg("count", uint_(count)); + size_t local_keys_arg = k.add_arg(memory_object::local_memory, "lkeys"); + size_t local_vals_arg = k.add_arg(memory_object::local_memory, "lvals"); + + k << + k.decl("gid") << " = get_global_id(0);\n" << + k.decl("wg_size") << " = get_local_size(0);\n" << + k.decl("lid") << " = get_local_id(0);\n" << + k.decl("group_id") << " = get_group_id(0);\n" << + + k.decl("key") << ";\n" << + k.decl("value") << ";\n" << + "if(gid < count){\n" << + k.var("key") << " = " << + keys_first[k.var("gid")] << ";\n" << + k.var("value") << " = " << + values_first[k.var("gid")] << ";\n" << + "lkeys[lid] = key;\n" << + "lvals[lid] = value;\n" << + "}\n" << + + // Calculate carry out for each work group by performing Hillis/Steele scan + // where only last element (key-value pair) is saved + k.decl("result") << " = value;\n" << + k.decl("other_key") << ";\n" << + k.decl("other_value") << ";\n" << + + "for(" << k.decl("offset") << " = 1; " << + "offset < wg_size; offset *= 2){\n" + " barrier(CLK_LOCAL_MEM_FENCE);\n" << + " if(lid >= offset){\n" + " other_key = lkeys[lid - offset];\n" << + " if(other_key == key){\n" << + " other_value = lvals[lid - offset];\n" << + " result = " << function(k.var("result"), + k.var("other_value")) << ";\n" << + " }\n" << + " }\n" << + " barrier(CLK_LOCAL_MEM_FENCE);\n" << + " lvals[lid] = result;\n" << + "}\n" << + + // save carry out + "if(lid == (wg_size - 1)){\n" << + carry_out_keys_first[k.var("group_id")] << " = key;\n" << + carry_out_values_first[k.var("group_id")] << " = result;\n" << + "}\n"; + + size_t work_groups_no = static_cast( + std::ceil(float(count) / work_group_size) + ); + + const context &context = queue.get_context(); + kernel kernel = k.compile(context); + kernel.set_arg(local_keys_arg, local_buffer(work_group_size)); + kernel.set_arg(local_vals_arg, local_buffer(work_group_size)); + + queue.enqueue_1d_range_kernel(kernel, + 0, + work_groups_no * work_group_size, + work_group_size); +} + +/// \internal_ +/// Calculate carry-in by performing inclusive scan by key on carry-outs vector. +template +inline void carry_ins(vector::iterator carry_out_keys_first, + OutputValueIterator carry_out_values_first, + OutputValueIterator carry_in_values_first, + size_t carry_out_size, + BinaryFunction function, + size_t work_group_size, + command_queue &queue) +{ + typedef typename + std::iterator_traits::value_type value_out_type; + + uint_ values_pre_work_item = static_cast( + std::ceil(float(carry_out_size) / work_group_size) + ); + + detail::meta_kernel k("reduce_by_key_with_scan_carry_ins"); + k.add_set_arg("carry_out_size", uint_(carry_out_size)); + k.add_set_arg("values_per_work_item", values_pre_work_item); + size_t local_keys_arg = k.add_arg(memory_object::local_memory, "lkeys"); + size_t local_vals_arg = k.add_arg(memory_object::local_memory, "lvals"); + + k << + k.decl("id") << " = get_global_id(0) * values_per_work_item;\n" << + k.decl("idx") << " = id;\n" << + k.decl("wg_size") << " = get_local_size(0);\n" << + k.decl("lid") << " = get_local_id(0);\n" << + k.decl("group_id") << " = get_group_id(0);\n" << + + k.decl("key") << ";\n" << + k.decl("value") << ";\n" << + k.decl("previous_key") << ";\n" << + k.decl("result") << ";\n" << + + "if(id < carry_out_size){\n" << + k.var("previous_key") << " = " << + carry_out_keys_first[k.var("id")] << ";\n" << + k.var("result") << " = " << + carry_out_values_first[k.var("id")] << ";\n" << + carry_in_values_first[k.var("id")] << " = result;\n" << + "}\n" << + + k.decl("end") << " = (id + values_per_work_item) <= carry_out_size" << + " ? (values_per_work_item + id) : carry_out_size;\n" << + + "for(idx = idx + 1; idx < end; idx += 1){\n" << + " key = " << carry_out_keys_first[k.var("idx")] << ";\n" << + " value = " << carry_out_values_first[k.var("idx")] << ";\n" << + " if(previous_key == key){\n" << + " result = " << function(k.var("result"), + k.var("value")) << ";\n" << + " }\n else { \n" << + " result = value;\n" + " }\n" << + " " << carry_in_values_first[k.var("idx")] << " = result;\n" << + " previous_key = key;\n" + "}\n" << + + // save the last key and result to local memory + "lkeys[lid] = previous_key;\n" << + "lvals[lid] = result;\n" << + + // Hillis/Steele scan + "for(" << k.decl("offset") << " = 1; " << + "offset < wg_size; offset *= 2){\n" + " barrier(CLK_LOCAL_MEM_FENCE);\n" << + " if(lid >= offset){\n" + " key = lkeys[lid - offset];\n" << + " if(previous_key == key){\n" << + " value = lvals[lid - offset];\n" << + " result = " << function(k.var("result"), + k.var("value")) << ";\n" << + " }\n" << + " }\n" << + " barrier(CLK_LOCAL_MEM_FENCE);\n" << + " lvals[lid] = result;\n" << + "}\n" << + "barrier(CLK_LOCAL_MEM_FENCE);\n" << + + "if(lid > 0){\n" << + // load key-value reduced by previous work item + " previous_key = lkeys[lid - 1];\n" << + " result = lvals[lid - 1];\n" << + "}\n" << + + // add key-value reduced by previous work item + "for(idx = id; idx < id + values_per_work_item; idx += 1){\n" << + // make sure all carry-ins are saved in global memory + " barrier( CLK_GLOBAL_MEM_FENCE );\n" << + " if(lid > 0 && idx < carry_out_size) {\n" + " key = " << carry_out_keys_first[k.var("idx")] << ";\n" << + " value = " << carry_in_values_first[k.var("idx")] << ";\n" << + " if(previous_key == key){\n" << + " value = " << function(k.var("result"), + k.var("value")) << ";\n" << + " }\n" << + " " << carry_in_values_first[k.var("idx")] << " = value;\n" << + " }\n" << + "}\n"; + + + const context &context = queue.get_context(); + kernel kernel = k.compile(context); + kernel.set_arg(local_keys_arg, local_buffer(work_group_size)); + kernel.set_arg(local_vals_arg, local_buffer(work_group_size)); + + queue.enqueue_1d_range_kernel(kernel, + 0, + work_group_size, + work_group_size); +} + +/// \internal_ +/// +/// Perform final reduction by key. Each work item: +/// 1. Perform local work-group reduction (Hillis/Steele scan) +/// 2. Add carry-in (if keys are right) +/// 3. Save reduced value if next key is different than processed one +template +inline void final_reduction(InputKeyIterator keys_first, + InputValueIterator values_first, + OutputKeyIterator keys_result, + OutputValueIterator values_result, + size_t count, + BinaryFunction function, + vector::iterator new_keys_first, + vector::iterator carry_in_keys_first, + OutputValueIterator carry_in_values_first, + size_t carry_in_size, + size_t work_group_size, + command_queue &queue) +{ + typedef typename + std::iterator_traits::value_type value_out_type; + + detail::meta_kernel k("reduce_by_key_with_scan_final_reduction"); + k.add_set_arg("count", uint_(count)); + size_t local_keys_arg = k.add_arg(memory_object::local_memory, "lkeys"); + size_t local_vals_arg = k.add_arg(memory_object::local_memory, "lvals"); + + k << + k.decl("gid") << " = get_global_id(0);\n" << + k.decl("wg_size") << " = get_local_size(0);\n" << + k.decl("lid") << " = get_local_id(0);\n" << + k.decl("group_id") << " = get_group_id(0);\n" << + + k.decl("key") << ";\n" << + k.decl("value") << ";\n" + + "if(gid < count){\n" << + k.var("key") << " = " << + new_keys_first[k.var("gid")] << ";\n" << + k.var("value") << " = " << + values_first[k.var("gid")] << ";\n" << + "lkeys[lid] = key;\n" << + "lvals[lid] = value;\n" << + "}\n" << + + // Hillis/Steele scan + k.decl("result") << " = value;\n" << + k.decl("other_key") << ";\n" << + k.decl("other_value") << ";\n" << + + "for(" << k.decl("offset") << " = 1; " << + "offset < wg_size ; offset *= 2){\n" + " barrier(CLK_LOCAL_MEM_FENCE);\n" << + " if(lid >= offset) {\n" << + " other_key = lkeys[lid - offset];\n" << + " if(other_key == key){\n" << + " other_value = lvals[lid - offset];\n" << + " result = " << function(k.var("result"), + k.var("other_value")) << ";\n" << + " }\n" << + " }\n" << + " barrier(CLK_LOCAL_MEM_FENCE);\n" << + " lvals[lid] = result;\n" << + "}\n" << + + "if(gid >= count) {\n return;\n};\n" << + + k.decl("save") << " = (gid < (count - 1)) ?" + << new_keys_first[k.var("gid + 1")] << " != key" << + ": true;\n" << + + // Add carry in + k.decl("carry_in_key") << ";\n" << + "if(group_id > 0 && save) {\n" << + " carry_in_key = " << carry_in_keys_first[k.var("group_id - 1")] << ";\n" << + " if(key == carry_in_key){\n" << + " other_value = " << carry_in_values_first[k.var("group_id - 1")] << ";\n" << + " result = " << function(k.var("result"), + k.var("other_value")) << ";\n" << + " }\n" << + "}\n" << + + // Save result only if the next key is different or it's the last element. + "if(save){\n" << + keys_result[k.var("key")] << " = " << keys_first[k.var("gid")] << ";\n" << + values_result[k.var("key")] << " = result;\n" << + "}\n" + ; + + size_t work_groups_no = static_cast( + std::ceil(float(count) / work_group_size) + ); + + const context &context = queue.get_context(); + kernel kernel = k.compile(context); + kernel.set_arg(local_keys_arg, local_buffer(work_group_size)); + kernel.set_arg(local_vals_arg, local_buffer(work_group_size)); + + queue.enqueue_1d_range_kernel(kernel, + 0, + work_groups_no * work_group_size, + work_group_size); +} + +/// \internal_ +/// Returns preferred work group size for reduce by key with scan algorithm. +template +inline size_t get_work_group_size(const device& device) +{ + std::string cache_key = std::string("__boost_reduce_by_key_with_scan") + + "k_" + type_name() + "_v_" + type_name(); + + // load parameters + boost::shared_ptr parameters = + detail::parameter_cache::get_global_cache(device); + + return (std::max)( + static_cast(parameters->get(cache_key, "wgsize", 256)), + static_cast(device.get_info()) + ); +} + +/// \internal_ +/// +/// 1. For each work group carry-out value is calculated (it's done by key-oriented +/// Hillis/Steele scan). Carry-out is a pair of the last key processed by work +/// group and sum of all values under this key in work group. +/// 2. From every carry-out carry-in is calculated by performing inclusive scan +/// by key. +/// 3. Final reduction by key is performed (key-oriented Hillis/Steele scan), +/// carry-in values are added where needed. +template +inline size_t reduce_by_key_with_scan(InputKeyIterator keys_first, + InputKeyIterator keys_last, + InputValueIterator values_first, + OutputKeyIterator keys_result, + OutputValueIterator values_result, + BinaryFunction function, + BinaryPredicate predicate, + command_queue &queue) +{ + typedef typename + std::iterator_traits::value_type value_type; + typedef typename + std::iterator_traits::value_type key_type; + typedef typename + std::iterator_traits::value_type value_out_type; + + const context &context = queue.get_context(); + size_t count = detail::iterator_range_size(keys_first, keys_last); + + if(count == 0){ + return size_t(0); + } + + const device &device = queue.get_device(); + size_t work_group_size = get_work_group_size(device); + + // Replace original key with unsigned integer keys generated based on given + // predicate. New key is also an index for keys_result and values_result vectors, + // which points to place where reduced value should be saved. + vector new_keys(count, context); + vector::iterator new_keys_first = new_keys.begin(); + generate_uint_keys(keys_first, count, predicate, new_keys_first, + work_group_size, queue); + + // Calculate carry-out and carry-in vectors size + const size_t carry_out_size = static_cast( + std::ceil(float(count) / work_group_size) + ); + vector carry_out_keys(carry_out_size, context); + vector carry_out_values(carry_out_size, context); + carry_outs(new_keys_first, values_first, count, carry_out_keys.begin(), + carry_out_values.begin(), function, work_group_size, queue); + + vector carry_in_values(carry_out_size, context); + carry_ins(carry_out_keys.begin(), carry_out_values.begin(), + carry_in_values.begin(), carry_out_size, function, work_group_size, + queue); + + final_reduction(keys_first, values_first, keys_result, values_result, + count, function, new_keys_first, carry_out_keys.begin(), + carry_in_values.begin(), carry_out_size, work_group_size, + queue); + + const size_t result = read_single_value(new_keys.get_buffer(), + count - 1, queue); + return result + 1; +} + +/// \internal_ +/// Return true if requirements for running reduce by key with scan on given +/// device are met (at least one work group of preferred size can be run). +template +bool reduce_by_key_with_scan_requirements_met(InputKeyIterator keys_first, + InputValueIterator values_first, + OutputKeyIterator keys_result, + OutputValueIterator values_result, + const size_t count, + command_queue &queue) +{ + typedef typename + std::iterator_traits::value_type value_type; + typedef typename + std::iterator_traits::value_type key_type; + typedef typename + std::iterator_traits::value_type value_out_type; + + (void) keys_first; + (void) values_first; + (void) keys_result; + (void) values_result; + + const device &device = queue.get_device(); + // device must have dedicated local memory storage + if(device.get_info() != CL_LOCAL) + { + return false; + } + + // local memory size in bytes (per compute unit) + const size_t local_mem_size = device.get_info(); + + // preferred work group size + size_t work_group_size = get_work_group_size(device); + + // local memory size needed to perform parallel reduction + size_t required_local_mem_size = 0; + // keys size + required_local_mem_size += sizeof(uint_) * work_group_size; + // reduced values size + required_local_mem_size += sizeof(value_out_type) * work_group_size; + + return (required_local_mem_size <= local_mem_size); +} + +} // end detail namespace +} // end compute namespace +} // end boost namespace + +#endif // BOOST_COMPUTE_ALGORITHM_DETAIL_REDUCE_BY_KEY_WITH_SCAN_HPP diff --git a/3party/boost/boost/compute/algorithm/detail/reduce_on_cpu.hpp b/3party/boost/boost/compute/algorithm/detail/reduce_on_cpu.hpp new file mode 100644 index 0000000000..490d7d538e --- /dev/null +++ b/3party/boost/boost/compute/algorithm/detail/reduce_on_cpu.hpp @@ -0,0 +1,110 @@ +//---------------------------------------------------------------------------// +// Copyright (c) 2016 Jakub Szuppe +// +// 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 +// +// See http://boostorg.github.com/compute for more information. +//---------------------------------------------------------------------------// + +#ifndef BOOST_COMPUTE_ALGORITHM_DETAIL_REDUCE_ON_CPU_HPP +#define BOOST_COMPUTE_ALGORITHM_DETAIL_REDUCE_ON_CPU_HPP + +#include + +#include +#include +#include +#include +#include +#include +#include +#include + +namespace boost { +namespace compute { +namespace detail { + +template +inline void reduce_on_cpu(InputIterator first, + InputIterator last, + OutputIterator result, + BinaryFunction function, + command_queue &queue) +{ + typedef typename + std::iterator_traits::value_type T; + typedef typename + ::boost::compute::result_of::type result_type; + + const device &device = queue.get_device(); + const uint_ compute_units = queue.get_device().compute_units(); + + boost::shared_ptr parameters = + detail::parameter_cache::get_global_cache(device); + + std::string cache_key = + "__boost_reduce_cpu_" + boost::lexical_cast(sizeof(T)); + + // for inputs smaller than serial_reduce_threshold + // serial_reduce algorithm is used + uint_ serial_reduce_threshold = + parameters->get(cache_key, "serial_reduce_threshold", 16384 * sizeof(T)); + serial_reduce_threshold = + (std::max)(serial_reduce_threshold, uint_(compute_units)); + + const context &context = queue.get_context(); + size_t count = detail::iterator_range_size(first, last); + if(count == 0){ + return; + } + else if(count < serial_reduce_threshold) { + return serial_reduce(first, last, result, function, queue); + } + + meta_kernel k("reduce_on_cpu"); + buffer output(context, sizeof(result_type) * compute_units); + + size_t count_arg = k.add_arg("count"); + size_t output_arg = + k.add_arg(memory_object::global_memory, "output"); + + k << + "uint block = " << + "(uint)ceil(((float)count)/get_global_size(0));\n" << + "uint index = get_global_id(0) * block;\n" << + "uint end = min(count, index + block);\n" << + + k.decl("result") << " = " << first[k.var("index")] << ";\n" << + "index++;\n" << + "while(index < end){\n" << + "result = " << function(k.var("result"), + first[k.var("index")]) << ";\n" << + "index++;\n" << + "}\n" << + "output[get_global_id(0)] = result;\n"; + + size_t global_work_size = compute_units; + kernel kernel = k.compile(context); + + // reduction to global_work_size elements + kernel.set_arg(count_arg, static_cast(count)); + kernel.set_arg(output_arg, output); + queue.enqueue_1d_range_kernel(kernel, 0, global_work_size, 0); + + // final reduction + reduce_on_cpu( + make_buffer_iterator(output), + make_buffer_iterator(output, global_work_size), + result, + function, + queue + ); +} + +} // end detail namespace +} // end compute namespace +} // end boost namespace + +#endif // BOOST_COMPUTE_ALGORITHM_DETAIL_REDUCE_ON_CPU_HPP diff --git a/3party/boost/boost/compute/algorithm/detail/reduce_on_gpu.hpp b/3party/boost/boost/compute/algorithm/detail/reduce_on_gpu.hpp new file mode 100644 index 0000000000..335fba8724 --- /dev/null +++ b/3party/boost/boost/compute/algorithm/detail/reduce_on_gpu.hpp @@ -0,0 +1,286 @@ +//---------------------------------------------------------------------------// +// Copyright (c) 2013 Kyle Lutz +// +// 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 +// +// See http://boostorg.github.com/compute for more information. +//---------------------------------------------------------------------------// + +#ifndef BOOST_COMPUTE_ALGORITHM_DETAIL_REDUCE_ON_GPU_HPP +#define BOOST_COMPUTE_ALGORITHM_DETAIL_REDUCE_ON_GPU_HPP + +#include + +#include +#include +#include +#include +#include +#include +#include +#include +#include + +namespace boost { +namespace compute { +namespace detail { + +/// \internal +/// body reduction inside a warp +template +struct ReduceBody +{ + static std::string body() + { + std::stringstream k; + // local reduction + k << "for(int i = 1; i < TPB; i <<= 1){\n" << + " barrier(CLK_LOCAL_MEM_FENCE);\n" << + " uint mask = (i << 1) - 1;\n" << + " if((lid & mask) == 0){\n" << + " scratch[lid] += scratch[lid+i];\n" << + " }\n" << + "}\n"; + return k.str(); + } +}; + +/// \internal +/// body reduction inside a warp +/// for nvidia device we can use the "unsafe" +/// memory optimisation +template +struct ReduceBody +{ + static std::string body() + { + std::stringstream k; + // local reduction + // we use TPB to compile only useful instruction + // local reduction when size is greater than warp size + k << "barrier(CLK_LOCAL_MEM_FENCE);\n" << + "if(TPB >= 1024){\n" << + "if(lid < 512) { sum += scratch[lid + 512]; scratch[lid] = sum;} barrier(CLK_LOCAL_MEM_FENCE);}\n" << + "if(TPB >= 512){\n" << + "if(lid < 256) { sum += scratch[lid + 256]; scratch[lid] = sum;} barrier(CLK_LOCAL_MEM_FENCE);}\n" << + "if(TPB >= 256){\n" << + "if(lid < 128) { sum += scratch[lid + 128]; scratch[lid] = sum;} barrier(CLK_LOCAL_MEM_FENCE);}\n" << + "if(TPB >= 128){\n" << + "if(lid < 64) { sum += scratch[lid + 64]; scratch[lid] = sum;} barrier(CLK_LOCAL_MEM_FENCE);} \n" << + + // warp reduction + "if(lid < 32){\n" << + // volatile this way we don't need any barrier + "volatile __local " << type_name() << " *lmem = scratch;\n" << + "if(TPB >= 64) { lmem[lid] = sum = sum + lmem[lid+32];} \n" << + "if(TPB >= 32) { lmem[lid] = sum = sum + lmem[lid+16];} \n" << + "if(TPB >= 16) { lmem[lid] = sum = sum + lmem[lid+ 8];} \n" << + "if(TPB >= 8) { lmem[lid] = sum = sum + lmem[lid+ 4];} \n" << + "if(TPB >= 4) { lmem[lid] = sum = sum + lmem[lid+ 2];} \n" << + "if(TPB >= 2) { lmem[lid] = sum = sum + lmem[lid+ 1];} \n" << + "}\n"; + return k.str(); + } +}; + +template +inline void initial_reduce(InputIterator first, + InputIterator last, + buffer result, + const Function &function, + kernel &reduce_kernel, + const uint_ vpt, + const uint_ tpb, + command_queue &queue) +{ + (void) function; + (void) reduce_kernel; + + typedef typename std::iterator_traits::value_type Arg; + typedef typename boost::tr1_result_of::type T; + + size_t count = std::distance(first, last); + detail::meta_kernel k("initial_reduce"); + k.add_set_arg("count", uint_(count)); + size_t output_arg = k.add_arg(memory_object::global_memory, "output"); + + k << + k.decl("offset") << " = get_group_id(0) * VPT * TPB;\n" << + k.decl("lid") << " = get_local_id(0);\n" << + + "__local " << type_name() << " scratch[TPB];\n" << + + // private reduction + k.decl("sum") << " = 0;\n" << + "for(uint i = 0; i < VPT; i++){\n" << + " if(offset + lid + i*TPB < count){\n" << + " sum = sum + " << first[k.var("offset+lid+i*TPB")] << ";\n" << + " }\n" << + "}\n" << + + "scratch[lid] = sum;\n" << + + // local reduction + ReduceBody::body() << + + // write sum to output + "if(lid == 0){\n" << + " output[get_group_id(0)] = scratch[0];\n" << + "}\n"; + + const context &context = queue.get_context(); + std::stringstream options; + options << "-DVPT=" << vpt << " -DTPB=" << tpb; + kernel generic_reduce_kernel = k.compile(context, options.str()); + generic_reduce_kernel.set_arg(output_arg, result); + + size_t work_size = calculate_work_size(count, vpt, tpb); + + queue.enqueue_1d_range_kernel(generic_reduce_kernel, 0, work_size, tpb); +} + +template +inline void initial_reduce(const buffer_iterator &first, + const buffer_iterator &last, + const buffer &result, + const plus &function, + kernel &reduce_kernel, + const uint_ vpt, + const uint_ tpb, + command_queue &queue) +{ + (void) function; + + size_t count = std::distance(first, last); + + reduce_kernel.set_arg(0, first.get_buffer()); + reduce_kernel.set_arg(1, uint_(first.get_index())); + reduce_kernel.set_arg(2, uint_(count)); + reduce_kernel.set_arg(3, result); + reduce_kernel.set_arg(4, uint_(0)); + + size_t work_size = calculate_work_size(count, vpt, tpb); + + queue.enqueue_1d_range_kernel(reduce_kernel, 0, work_size, tpb); +} + +template +inline void reduce_on_gpu(InputIterator first, + InputIterator last, + buffer_iterator result, + Function function, + command_queue &queue) +{ + const device &device = queue.get_device(); + const context &context = queue.get_context(); + + detail::meta_kernel k("reduce"); + k.add_arg(memory_object::global_memory, "input"); + k.add_arg("offset"); + k.add_arg("count"); + k.add_arg(memory_object::global_memory, "output"); + k.add_arg("output_offset"); + + k << + k.decl("block_offset") << " = get_group_id(0) * VPT * TPB;\n" << + "__global const " << type_name() << " *block = input + offset + block_offset;\n" << + k.decl("lid") << " = get_local_id(0);\n" << + + "__local " << type_name() << " scratch[TPB];\n" << + // private reduction + k.decl("sum") << " = 0;\n" << + "for(uint i = 0; i < VPT; i++){\n" << + " if(block_offset + lid + i*TPB < count){\n" << + " sum = sum + block[lid+i*TPB]; \n" << + " }\n" << + "}\n" << + + "scratch[lid] = sum;\n"; + + // discrimination on vendor name + if(is_nvidia_device(device)) + k << ReduceBody::body(); + else + k << ReduceBody::body(); + + k << + // write sum to output + "if(lid == 0){\n" << + " output[output_offset + get_group_id(0)] = scratch[0];\n" << + "}\n"; + + std::string cache_key = std::string("__boost_reduce_on_gpu_") + type_name(); + + // load parameters + boost::shared_ptr parameters = + detail::parameter_cache::get_global_cache(device); + + uint_ vpt = parameters->get(cache_key, "vpt", 8); + uint_ tpb = parameters->get(cache_key, "tpb", 128); + + // reduce program compiler flags + std::stringstream options; + options << "-DT=" << type_name() + << " -DVPT=" << vpt + << " -DTPB=" << tpb; + + // load program + boost::shared_ptr cache = + program_cache::get_global_cache(context); + + program reduce_program = cache->get_or_build( + cache_key, options.str(), k.source(), context + ); + + // create reduce kernel + kernel reduce_kernel(reduce_program, "reduce"); + + size_t count = std::distance(first, last); + + // first pass, reduce from input to ping + buffer ping(context, std::ceil(float(count) / vpt / tpb) * sizeof(T)); + initial_reduce(first, last, ping, function, reduce_kernel, vpt, tpb, queue); + + // update count after initial reduce + count = static_cast(std::ceil(float(count) / vpt / tpb)); + + // middle pass(es), reduce between ping and pong + const buffer *input_buffer = &ping; + buffer pong(context, static_cast(count / vpt / tpb * sizeof(T))); + const buffer *output_buffer = &pong; + if(count > vpt * tpb){ + while(count > vpt * tpb){ + reduce_kernel.set_arg(0, *input_buffer); + reduce_kernel.set_arg(1, uint_(0)); + reduce_kernel.set_arg(2, uint_(count)); + reduce_kernel.set_arg(3, *output_buffer); + reduce_kernel.set_arg(4, uint_(0)); + + size_t work_size = static_cast(std::ceil(float(count) / vpt)); + if(work_size % tpb != 0){ + work_size += tpb - work_size % tpb; + } + queue.enqueue_1d_range_kernel(reduce_kernel, 0, work_size, tpb); + + std::swap(input_buffer, output_buffer); + count = static_cast(std::ceil(float(count) / vpt / tpb)); + } + } + + // final pass, reduce from ping/pong to result + reduce_kernel.set_arg(0, *input_buffer); + reduce_kernel.set_arg(1, uint_(0)); + reduce_kernel.set_arg(2, uint_(count)); + reduce_kernel.set_arg(3, result.get_buffer()); + reduce_kernel.set_arg(4, uint_(result.get_index())); + + queue.enqueue_1d_range_kernel(reduce_kernel, 0, tpb, tpb); +} + +} // end detail namespace +} // end compute namespace +} // end boost namespace + +#endif // BOOST_COMPUTE_ALGORITHM_DETAIL_REDUCE_ON_GPU_HPP diff --git a/3party/boost/boost/compute/algorithm/detail/scan.hpp b/3party/boost/boost/compute/algorithm/detail/scan.hpp new file mode 100644 index 0000000000..154b6001be --- /dev/null +++ b/3party/boost/boost/compute/algorithm/detail/scan.hpp @@ -0,0 +1,45 @@ +//---------------------------------------------------------------------------// +// Copyright (c) 2013 Kyle Lutz +// +// 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 +// +// See http://boostorg.github.com/compute for more information. +//---------------------------------------------------------------------------// + +#ifndef BOOST_COMPUTE_ALGORITHM_DETAIL_SCAN_HPP +#define BOOST_COMPUTE_ALGORITHM_DETAIL_SCAN_HPP + +#include +#include +#include + +namespace boost { +namespace compute { +namespace detail { + +template +inline OutputIterator scan(InputIterator first, + InputIterator last, + OutputIterator result, + bool exclusive, + T init, + BinaryOperator op, + command_queue &queue) +{ + const device &device = queue.get_device(); + + if(device.type() & device::cpu){ + return scan_on_cpu(first, last, result, exclusive, init, op, queue); + } + else { + return scan_on_gpu(first, last, result, exclusive, init, op, queue); + } +} + +} // end detail namespace +} // end compute namespace +} // end boost namespace + +#endif // BOOST_COMPUTE_ALGORITHM_DETAIL_SCAN_HPP diff --git a/3party/boost/boost/compute/algorithm/detail/scan_on_cpu.hpp b/3party/boost/boost/compute/algorithm/detail/scan_on_cpu.hpp new file mode 100644 index 0000000000..d81117c65f --- /dev/null +++ b/3party/boost/boost/compute/algorithm/detail/scan_on_cpu.hpp @@ -0,0 +1,207 @@ +//---------------------------------------------------------------------------// +// Copyright (c) 2016 Jakub Szuppe +// +// 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 +// +// See http://boostorg.github.com/compute for more information. +//---------------------------------------------------------------------------// + +#ifndef BOOST_COMPUTE_ALGORITHM_DETAIL_SCAN_ON_CPU_HPP +#define BOOST_COMPUTE_ALGORITHM_DETAIL_SCAN_ON_CPU_HPP + +#include + +#include +#include +#include +#include +#include +#include +#include + +namespace boost { +namespace compute { +namespace detail { + +template +inline OutputIterator scan_on_cpu(InputIterator first, + InputIterator last, + OutputIterator result, + bool exclusive, + T init, + BinaryOperator op, + command_queue &queue) +{ + typedef typename + std::iterator_traits::value_type input_type; + typedef typename + std::iterator_traits::value_type output_type; + + const context &context = queue.get_context(); + const device &device = queue.get_device(); + const size_t compute_units = queue.get_device().compute_units(); + + boost::shared_ptr parameters = + detail::parameter_cache::get_global_cache(device); + + std::string cache_key = + "__boost_scan_cpu_" + boost::lexical_cast(sizeof(T)); + + // for inputs smaller than serial_scan_threshold + // serial_scan algorithm is used + uint_ serial_scan_threshold = + parameters->get(cache_key, "serial_scan_threshold", 16384 * sizeof(T)); + serial_scan_threshold = + (std::max)(serial_scan_threshold, uint_(compute_units)); + + size_t count = detail::iterator_range_size(first, last); + if(count == 0){ + return result; + } + else if(count < serial_scan_threshold) { + return serial_scan(first, last, result, exclusive, init, op, queue); + } + + buffer block_partial_sums(context, sizeof(output_type) * compute_units ); + + // create scan kernel + meta_kernel k("scan_on_cpu_block_scan"); + + // Arguments + size_t count_arg = k.add_arg("count"); + size_t init_arg = k.add_arg("initial_value"); + size_t block_partial_sums_arg = + k.add_arg(memory_object::global_memory, "block_partial_sums"); + + k << + "uint block = " << + "(uint)ceil(((float)count)/(get_global_size(0) + 1));\n" << + "uint index = get_global_id(0) * block;\n" << + "uint end = min(count, index + block);\n"; + + if(!exclusive){ + k << + k.decl("sum") << " = " << + first[k.var("index")] << ";\n" << + result[k.var("index")] << " = sum;\n" << + "index++;\n"; + } + else { + k << + k.decl("sum") << ";\n" << + "if(index == 0){\n" << + "sum = initial_value;\n" << + "}\n" << + "else {\n" << + "sum = " << first[k.var("index")] << ";\n" << + "index++;\n" << + "}\n"; + } + + k << + "while(index < end){\n" << + // load next value + k.decl("value") << " = " + << first[k.var("index")] << ";\n"; + + if(exclusive){ + k << + "if(get_global_id(0) == 0){\n" << + result[k.var("index")] << " = sum;\n" << + "}\n"; + } + k << + "sum = " << op(k.var("sum"), + k.var("value")) << ";\n"; + + if(!exclusive){ + k << + "if(get_global_id(0) == 0){\n" << + result[k.var("index")] << " = sum;\n" << + "}\n"; + } + + k << + "index++;\n" << + "}\n" << // end while + "block_partial_sums[get_global_id(0)] = sum;\n"; + + // compile scan kernel + kernel block_scan_kernel = k.compile(context); + + // setup kernel arguments + block_scan_kernel.set_arg(count_arg, static_cast(count)); + block_scan_kernel.set_arg(init_arg, static_cast(init)); + block_scan_kernel.set_arg(block_partial_sums_arg, block_partial_sums); + + // execute the kernel + size_t global_work_size = compute_units; + queue.enqueue_1d_range_kernel(block_scan_kernel, 0, global_work_size, 0); + + // scan is done + if(compute_units < 2) { + return result + count; + } + + // final scan kernel + meta_kernel l("scan_on_cpu_final_scan"); + + // Arguments + count_arg = l.add_arg("count"); + block_partial_sums_arg = + l.add_arg(memory_object::global_memory, "block_partial_sums"); + + l << + "uint block = " << + "(uint)ceil(((float)count)/(get_global_size(0) + 1));\n" << + "uint index = block + get_global_id(0) * block;\n" << + "uint end = min(count, index + block);\n" << + + k.decl("sum") << " = block_partial_sums[0];\n" << + "for(uint i = 0; i < get_global_id(0); i++) {\n" << + "sum = " << op(k.var("sum"), + k.var("block_partial_sums[i + 1]")) << ";\n" << + "}\n" << + + "while(index < end){\n"; + if(exclusive){ + l << + l.decl("value") << " = " + << first[k.var("index")] << ";\n" << + result[k.var("index")] << " = sum;\n" << + "sum = " << op(k.var("sum"), + k.var("value")) << ";\n"; + } + else { + l << + "sum = " << op(k.var("sum"), + first[k.var("index")]) << ";\n" << + result[k.var("index")] << " = sum;\n"; + } + l << + "index++;\n" << + "}\n"; + + + // compile scan kernel + kernel final_scan_kernel = l.compile(context); + + // setup kernel arguments + final_scan_kernel.set_arg(count_arg, static_cast(count)); + final_scan_kernel.set_arg(block_partial_sums_arg, block_partial_sums); + + // execute the kernel + global_work_size = compute_units; + queue.enqueue_1d_range_kernel(final_scan_kernel, 0, global_work_size, 0); + + // return iterator pointing to the end of the result range + return result + count; +} + +} // end detail namespace +} // end compute namespace +} // end boost namespace + +#endif // BOOST_COMPUTE_ALGORITHM_DETAIL_SCAN_ON_CPU_HPP diff --git a/3party/boost/boost/compute/algorithm/detail/scan_on_gpu.hpp b/3party/boost/boost/compute/algorithm/detail/scan_on_gpu.hpp new file mode 100644 index 0000000000..dcaff2cdf3 --- /dev/null +++ b/3party/boost/boost/compute/algorithm/detail/scan_on_gpu.hpp @@ -0,0 +1,330 @@ +//---------------------------------------------------------------------------// +// Copyright (c) 2013 Kyle Lutz +// +// 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 +// +// See http://boostorg.github.com/compute for more information. +//---------------------------------------------------------------------------// + +#ifndef BOOST_COMPUTE_ALGORITHM_DETAIL_SCAN_ON_GPU_HPP +#define BOOST_COMPUTE_ALGORITHM_DETAIL_SCAN_ON_GPU_HPP + +#include +#include +#include +#include +#include +#include +#include + +namespace boost { +namespace compute { +namespace detail { + +template +class local_scan_kernel : public meta_kernel +{ +public: + local_scan_kernel(InputIterator first, + InputIterator last, + OutputIterator result, + bool exclusive, + BinaryOperator op) + : meta_kernel("local_scan") + { + typedef typename std::iterator_traits::value_type T; + + (void) last; + + bool checked = true; + + m_block_sums_arg = add_arg(memory_object::global_memory, "block_sums"); + m_scratch_arg = add_arg(memory_object::local_memory, "scratch"); + m_block_size_arg = add_arg("block_size"); + m_count_arg = add_arg("count"); + m_init_value_arg = add_arg("init"); + + // work-item parameters + *this << + "const uint gid = get_global_id(0);\n" << + "const uint lid = get_local_id(0);\n"; + + // check against data size + if(checked){ + *this << + "if(gid < count){\n"; + } + + // copy values from input to local memory + if(exclusive){ + *this << + decl("local_init") << "= (gid == 0) ? init : 0;\n" << + "if(lid == 0){ scratch[lid] = local_init; }\n" << + "else { scratch[lid] = " << first[expr("gid-1")] << "; }\n"; + } + else{ + *this << + "scratch[lid] = " << first[expr("gid")] << ";\n"; + } + + if(checked){ + *this << + "}\n" + "else {\n" << + " scratch[lid] = 0;\n" << + "}\n"; + } + + // wait for all threads to read from input + *this << + "barrier(CLK_LOCAL_MEM_FENCE);\n"; + + // perform scan + *this << + "for(uint i = 1; i < block_size; i <<= 1){\n" << + " " << decl("x") << " = lid >= i ? scratch[lid-i] : 0;\n" << + " barrier(CLK_LOCAL_MEM_FENCE);\n" << + " if(lid >= i){\n" << + " scratch[lid] = " << op(var("scratch[lid]"), var("x")) << ";\n" << + " }\n" << + " barrier(CLK_LOCAL_MEM_FENCE);\n" << + "}\n"; + + // copy results to output + if(checked){ + *this << + "if(gid < count){\n"; + } + + *this << + result[expr("gid")] << " = scratch[lid];\n"; + + if(checked){ + *this << "}\n"; + } + + // store sum for the block + if(exclusive){ + *this << + "if(lid == block_size - 1){\n" << + " block_sums[get_group_id(0)] = " << + op(first[expr("gid")], var("scratch[lid]")) << + ";\n" << + "}\n"; + } + else { + *this << + "if(lid == block_size - 1){\n" << + " block_sums[get_group_id(0)] = scratch[lid];\n" << + "}\n"; + } + } + + size_t m_block_sums_arg; + size_t m_scratch_arg; + size_t m_block_size_arg; + size_t m_count_arg; + size_t m_init_value_arg; +}; + +template +class write_scanned_output_kernel : public meta_kernel +{ +public: + write_scanned_output_kernel(BinaryOperator op) + : meta_kernel("write_scanned_output") + { + bool checked = true; + + m_output_arg = add_arg(memory_object::global_memory, "output"); + m_block_sums_arg = add_arg(memory_object::global_memory, "block_sums"); + m_count_arg = add_arg("count"); + + // work-item parameters + *this << + "const uint gid = get_global_id(0);\n" << + "const uint block_id = get_group_id(0);\n"; + + // check against data size + if(checked){ + *this << "if(gid < count){\n"; + } + + // write output + *this << + "output[gid] = " << + op(var("block_sums[block_id]"), var("output[gid] ")) << ";\n"; + + if(checked){ + *this << "}\n"; + } + } + + size_t m_output_arg; + size_t m_block_sums_arg; + size_t m_count_arg; +}; + +template +inline size_t pick_scan_block_size(InputIterator first, InputIterator last) +{ + size_t count = iterator_range_size(first, last); + + if(count == 0) { return 0; } + else if(count <= 1) { return 1; } + else if(count <= 2) { return 2; } + else if(count <= 4) { return 4; } + else if(count <= 8) { return 8; } + else if(count <= 16) { return 16; } + else if(count <= 32) { return 32; } + else if(count <= 64) { return 64; } + else if(count <= 128) { return 128; } + else { return 256; } +} + +template +inline OutputIterator scan_impl(InputIterator first, + InputIterator last, + OutputIterator result, + bool exclusive, + T init, + BinaryOperator op, + command_queue &queue) +{ + typedef typename + std::iterator_traits::value_type + input_type; + typedef typename + std::iterator_traits::difference_type + difference_type; + typedef typename + std::iterator_traits::value_type + output_type; + + const context &context = queue.get_context(); + const size_t count = detail::iterator_range_size(first, last); + + size_t block_size = pick_scan_block_size(first, last); + size_t block_count = count / block_size; + + if(block_count * block_size < count){ + block_count++; + } + + ::boost::compute::vector block_sums(block_count, context); + + // zero block sums + input_type zero; + std::memset(&zero, 0, sizeof(input_type)); + ::boost::compute::fill(block_sums.begin(), block_sums.end(), zero, queue); + + // local scan + local_scan_kernel + local_scan_kernel(first, last, result, exclusive, op); + + ::boost::compute::kernel kernel = local_scan_kernel.compile(context); + kernel.set_arg(local_scan_kernel.m_scratch_arg, local_buffer(block_size)); + kernel.set_arg(local_scan_kernel.m_block_sums_arg, block_sums); + kernel.set_arg(local_scan_kernel.m_block_size_arg, static_cast(block_size)); + kernel.set_arg(local_scan_kernel.m_count_arg, static_cast(count)); + kernel.set_arg(local_scan_kernel.m_init_value_arg, static_cast(init)); + + queue.enqueue_1d_range_kernel(kernel, + 0, + block_count * block_size, + block_size); + + // inclusive scan block sums + if(block_count > 1){ + scan_impl(block_sums.begin(), + block_sums.end(), + block_sums.begin(), + false, + init, + op, + queue + ); + } + + // add block sums to each block + if(block_count > 1){ + write_scanned_output_kernel + write_output_kernel(op); + kernel = write_output_kernel.compile(context); + kernel.set_arg(write_output_kernel.m_output_arg, result.get_buffer()); + kernel.set_arg(write_output_kernel.m_block_sums_arg, block_sums); + kernel.set_arg(write_output_kernel.m_count_arg, static_cast(count)); + + queue.enqueue_1d_range_kernel(kernel, + block_size, + block_count * block_size, + block_size); + } + + return result + static_cast(count); +} + +template +inline OutputIterator dispatch_scan(InputIterator first, + InputIterator last, + OutputIterator result, + bool exclusive, + T init, + BinaryOperator op, + command_queue &queue) +{ + return scan_impl(first, last, result, exclusive, init, op, queue); +} + +template +inline InputIterator dispatch_scan(InputIterator first, + InputIterator last, + InputIterator result, + bool exclusive, + T init, + BinaryOperator op, + command_queue &queue) +{ + typedef typename std::iterator_traits::value_type value_type; + + if(first == result){ + // scan input in-place + const context &context = queue.get_context(); + + // make a temporary copy the input + size_t count = iterator_range_size(first, last); + vector tmp(count, context); + copy(first, last, tmp.begin(), queue); + + // scan from temporary values + return scan_impl(tmp.begin(), tmp.end(), first, exclusive, init, op, queue); + } + else { + // scan input to output + return scan_impl(first, last, result, exclusive, init, op, queue); + } +} + +template +inline OutputIterator scan_on_gpu(InputIterator first, + InputIterator last, + OutputIterator result, + bool exclusive, + T init, + BinaryOperator op, + command_queue &queue) +{ + if(first == last){ + return result; + } + + return dispatch_scan(first, last, result, exclusive, init, op, queue); +} + +} // end detail namespace +} // end compute namespace +} // end boost namespace + +#endif // BOOST_COMPUTE_ALGORITHM_DETAIL_SCAN_ON_GPU_HPP diff --git a/3party/boost/boost/compute/algorithm/detail/search_all.hpp b/3party/boost/boost/compute/algorithm/detail/search_all.hpp new file mode 100644 index 0000000000..b091ec7de5 --- /dev/null +++ b/3party/boost/boost/compute/algorithm/detail/search_all.hpp @@ -0,0 +1,86 @@ +//---------------------------------------------------------------------------// +// Copyright (c) 2014 Roshan +// +// 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 +// +// See http://boostorg.github.com/compute for more information. +//---------------------------------------------------------------------------// + +#ifndef BOOST_COMPUTE_ALGORITHM_DETAIL_SEARCH_ALL_HPP +#define BOOST_COMPUTE_ALGORITHM_DETAIL_SEARCH_ALL_HPP + +#include +#include +#include +#include +#include +#include + +namespace boost { +namespace compute { +namespace detail { + +/// +/// \brief Search kernel class +/// +/// Subclass of meta_kernel which is capable of performing pattern matching +/// +template +class search_kernel : public meta_kernel +{ +public: + search_kernel() : meta_kernel("search") + {} + + void set_range(PatternIterator p_first, + PatternIterator p_last, + TextIterator t_first, + TextIterator t_last, + OutputIterator result) + { + m_p_count = iterator_range_size(p_first, p_last); + m_p_count_arg = add_arg("p_count"); + + m_count = iterator_range_size(t_first, t_last); + m_count = m_count + 1 - m_p_count; + + *this << + "uint i = get_global_id(0);\n" << + "const uint i1 = i;\n" << + "uint j;\n" << + "for(j = 0; j("j")] << " != " << + t_first[expr("i")] << ")\n" << + " j = p_count + 1;\n" << + "}\n" << + "if(j == p_count)\n" << + result[expr("i1")] << " = 1;\n" << + "else\n" << + result[expr("i1")] << " = 0;\n"; + } + + event exec(command_queue &queue) + { + if(m_count == 0) { + return event(); + } + + set_arg(m_p_count_arg, uint_(m_p_count)); + + return exec_1d(queue, 0, m_count); + } + +private: + size_t m_p_count; + size_t m_p_count_arg; + size_t m_count; +}; + +} //end detail namespace +} //end compute namespace +} //end boost namespace + +#endif // BOOST_COMPUTE_ALGORITHM_DETAIL_SEARCH_ALL_HPP diff --git a/3party/boost/boost/compute/algorithm/detail/serial_accumulate.hpp b/3party/boost/boost/compute/algorithm/detail/serial_accumulate.hpp new file mode 100644 index 0000000000..84f9910122 --- /dev/null +++ b/3party/boost/boost/compute/algorithm/detail/serial_accumulate.hpp @@ -0,0 +1,56 @@ +//---------------------------------------------------------------------------// +// Copyright (c) 2013 Kyle Lutz +// +// 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 +// +// See http://boostorg.github.com/compute for more information. +//---------------------------------------------------------------------------// + +#ifndef BOOST_COMPUTE_ALGORITHM_DETAIL_SERIAL_ACCUMULATE_HPP +#define BOOST_COMPUTE_ALGORITHM_DETAIL_SERIAL_ACCUMULATE_HPP + +#include +#include +#include + +namespace boost { +namespace compute { +namespace detail { + +template +inline void serial_accumulate(InputIterator first, + InputIterator last, + OutputIterator result, + T init, + BinaryFunction function, + command_queue &queue) +{ + const context &context = queue.get_context(); + size_t count = detail::iterator_range_size(first, last); + + meta_kernel k("serial_accumulate"); + size_t init_arg = k.add_arg("init"); + size_t count_arg = k.add_arg("count"); + + k << + k.decl("result") << " = init;\n" << + "for(uint i = 0; i < count; i++)\n" << + " result = " << function(k.var("result"), + first[k.var("i")]) << ";\n" << + result[0] << " = result;\n"; + + kernel kernel = k.compile(context); + + kernel.set_arg(init_arg, init); + kernel.set_arg(count_arg, static_cast(count)); + + queue.enqueue_task(kernel); +} + +} // end detail namespace +} // end compute namespace +} // end boost namespace + +#endif // BOOST_COMPUTE_ALGORITHM_DETAIL_SERIAL_ACCUMULATE_HPP diff --git a/3party/boost/boost/compute/algorithm/detail/serial_count_if.hpp b/3party/boost/boost/compute/algorithm/detail/serial_count_if.hpp new file mode 100644 index 0000000000..be6794c426 --- /dev/null +++ b/3party/boost/boost/compute/algorithm/detail/serial_count_if.hpp @@ -0,0 +1,68 @@ +//---------------------------------------------------------------------------// +// Copyright (c) 2013 Kyle Lutz +// +// 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 +// +// See http://boostorg.github.com/compute for more information. +//---------------------------------------------------------------------------// + +#ifndef BOOST_COMPUTE_ALGORITHM_DETAIL_SERIAL_COUNT_IF_HPP +#define BOOST_COMPUTE_ALGORITHM_DETAIL_SERIAL_COUNT_IF_HPP + +#include + +#include +#include +#include + +namespace boost { +namespace compute { +namespace detail { + +// counts values that match the predicate using a single thread +template +inline size_t serial_count_if(InputIterator first, + InputIterator last, + Predicate predicate, + command_queue &queue) +{ + typedef typename std::iterator_traits::value_type value_type; + + const context &context = queue.get_context(); + size_t size = iterator_range_size(first, last); + + meta_kernel k("serial_count_if"); + k.add_set_arg("size", static_cast(size)); + size_t result_arg = k.add_arg(memory_object::global_memory, "result"); + + k << + "uint count = 0;\n" << + "for(uint i = 0; i < size; i++){\n" << + k.decl("value") << "=" + << first[k.var("i")] << ";\n" << + "if(" << predicate(k.var("value")) << "){\n" << + "count++;\n" << + "}\n" + "}\n" + "*result = count;\n"; + + kernel kernel = k.compile(context); + + // setup result buffer + scalar result(context); + kernel.set_arg(result_arg, result.get_buffer()); + + // run kernel + queue.enqueue_task(kernel); + + // read index + return result.read(queue); +} + +} // end detail namespace +} // end compute namespace +} // end boost namespace + +#endif // BOOST_COMPUTE_ALGORITHM_DETAIL_SERIAL_COUNT_IF_HPP diff --git a/3party/boost/boost/compute/algorithm/detail/serial_find_extrema.hpp b/3party/boost/boost/compute/algorithm/detail/serial_find_extrema.hpp new file mode 100644 index 0000000000..8407c88129 --- /dev/null +++ b/3party/boost/boost/compute/algorithm/detail/serial_find_extrema.hpp @@ -0,0 +1,87 @@ +//---------------------------------------------------------------------------// +// Copyright (c) 2013 Kyle Lutz +// +// 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 +// +// See http://boostorg.github.com/compute for more information. +//---------------------------------------------------------------------------// + +#ifndef BOOST_COMPUTE_ALGORITHM_DETAIL_SERIAL_FIND_EXTREMA_HPP +#define BOOST_COMPUTE_ALGORITHM_DETAIL_SERIAL_FIND_EXTREMA_HPP + +#include +#include +#include +#include +#include + +namespace boost { +namespace compute { +namespace detail { + +template +inline InputIterator serial_find_extrema(InputIterator first, + InputIterator last, + Compare compare, + const bool find_minimum, + command_queue &queue) +{ + typedef typename std::iterator_traits::value_type value_type; + typedef typename std::iterator_traits::difference_type difference_type; + + const context &context = queue.get_context(); + + meta_kernel k("serial_find_extrema"); + + k << + k.decl("value") << " = " << first[k.expr("0")] << ";\n" << + k.decl("value_index") << " = 0;\n" << + "for(uint i = 1; i < size; i++){\n" << + " " << k.decl("candidate") << "=" + << first[k.expr("i")] << ";\n" << + + "#ifndef BOOST_COMPUTE_FIND_MAXIMUM\n" << + " if(" << compare(k.var("candidate"), + k.var("value")) << "){\n" << + "#else\n" << + " if(" << compare(k.var("value"), + k.var("candidate")) << "){\n" << + "#endif\n" << + + " value = candidate;\n" << + " value_index = i;\n" << + " }\n" << + "}\n" << + "*index = value_index;\n"; + + size_t index_arg_index = k.add_arg(memory_object::global_memory, "index"); + size_t size_arg_index = k.add_arg("size"); + + std::string options; + if(!find_minimum){ + options = "-DBOOST_COMPUTE_FIND_MAXIMUM"; + } + kernel kernel = k.compile(context, options); + + // setup index buffer + scalar index(context); + kernel.set_arg(index_arg_index, index.get_buffer()); + + // setup count + size_t count = iterator_range_size(first, last); + kernel.set_arg(size_arg_index, static_cast(count)); + + // run kernel + queue.enqueue_task(kernel); + + // read index and return iterator + return first + static_cast(index.read(queue)); +} + +} // end detail namespace +} // end compute namespace +} // end boost namespace + +#endif // BOOST_COMPUTE_ALGORITHM_DETAIL_SERIAL_FIND_EXTREMA_HPP diff --git a/3party/boost/boost/compute/algorithm/detail/serial_merge.hpp b/3party/boost/boost/compute/algorithm/detail/serial_merge.hpp new file mode 100644 index 0000000000..85e38f704c --- /dev/null +++ b/3party/boost/boost/compute/algorithm/detail/serial_merge.hpp @@ -0,0 +1,97 @@ +//---------------------------------------------------------------------------// +// Copyright (c) 2013 Kyle Lutz +// +// 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 +// +// See http://boostorg.github.com/compute for more information. +//---------------------------------------------------------------------------// + +#ifndef BOOST_COMPUTE_ALGORITHM_SERIAL_MERGE_HPP +#define BOOST_COMPUTE_ALGORITHM_SERIAL_MERGE_HPP + +#include + +#include +#include +#include + +namespace boost { +namespace compute { +namespace detail { + +template +inline OutputIterator serial_merge(InputIterator1 first1, + InputIterator1 last1, + InputIterator2 first2, + InputIterator2 last2, + OutputIterator result, + Compare comp, + command_queue &queue) +{ + typedef typename + std::iterator_traits::value_type + input_type1; + typedef typename + std::iterator_traits::value_type + input_type2; + typedef typename + std::iterator_traits::difference_type + result_difference_type; + + std::ptrdiff_t size1 = std::distance(first1, last1); + std::ptrdiff_t size2 = std::distance(first2, last2); + + meta_kernel k("serial_merge"); + k.add_set_arg("size1", static_cast(size1)); + k.add_set_arg("size2", static_cast(size2)); + + k << + "uint i = 0;\n" << // index in result range + "uint j = 0;\n" << // index in first input range + "uint k = 0;\n" << // index in second input range + + // fetch initial values from each range + k.decl("j_value") << " = " << first1[0] << ";\n" << + k.decl("k_value") << " = " << first2[0] << ";\n" << + + // merge values from both input ranges to the result range + "while(j < size1 && k < size2){\n" << + " if(" << comp(k.var("j_value"), + k.var("k_value")) << "){\n" << + " " << result[k.var("i++")] << " = j_value;\n" << + " j_value = " << first1[k.var("++j")] << ";\n" << + " }\n" << + " else{\n" + " " << result[k.var("i++")] << " = k_value;\n" + " k_value = " << first2[k.var("++k")] << ";\n" << + " }\n" + "}\n" + + // copy any remaining values from first range + "while(j < size1){\n" << + result[k.var("i++")] << " = " << + first1[k.var("j++")] << ";\n" << + "}\n" + + // copy any remaining values from second range + "while(k < size2){\n" << + result[k.var("i++")] << " = " << + first2[k.var("k++")] << ";\n" << + "}\n"; + + // run kernel + k.exec(queue); + + return result + static_cast(size1 + size2); +} + +} // end detail namespace +} // end compute namespace +} // end boost namespace + +#endif // BOOST_COMPUTE_ALGORITHM_SERIAL_MERGE_HPP diff --git a/3party/boost/boost/compute/algorithm/detail/serial_reduce.hpp b/3party/boost/boost/compute/algorithm/detail/serial_reduce.hpp new file mode 100644 index 0000000000..53aaf140fe --- /dev/null +++ b/3party/boost/boost/compute/algorithm/detail/serial_reduce.hpp @@ -0,0 +1,62 @@ +//---------------------------------------------------------------------------// +// Copyright (c) 2013 Kyle Lutz +// +// 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 +// +// See http://boostorg.github.com/compute for more information. +//---------------------------------------------------------------------------// + +#ifndef BOOST_COMPUTE_ALGORITHM_DETAIL_SERIAL_REDUCE_HPP +#define BOOST_COMPUTE_ALGORITHM_DETAIL_SERIAL_REDUCE_HPP + +#include +#include +#include +#include + +namespace boost { +namespace compute { +namespace detail { + +template +inline void serial_reduce(InputIterator first, + InputIterator last, + OutputIterator result, + BinaryFunction function, + command_queue &queue) +{ + typedef typename + std::iterator_traits::value_type T; + typedef typename + ::boost::compute::result_of::type result_type; + + const context &context = queue.get_context(); + size_t count = detail::iterator_range_size(first, last); + if(count == 0){ + return; + } + + meta_kernel k("serial_reduce"); + size_t count_arg = k.add_arg("count"); + + k << + k.decl("result") << " = " << first[0] << ";\n" << + "for(uint i = 1; i < count; i++)\n" << + " result = " << function(k.var("result"), + first[k.var("i")]) << ";\n" << + result[0] << " = result;\n"; + + kernel kernel = k.compile(context); + + kernel.set_arg(count_arg, static_cast(count)); + + queue.enqueue_task(kernel); +} + +} // end detail namespace +} // end compute namespace +} // end boost namespace + +#endif // BOOST_COMPUTE_ALGORITHM_DETAIL_SERIAL_REDUCE_HPP diff --git a/3party/boost/boost/compute/algorithm/detail/serial_reduce_by_key.hpp b/3party/boost/boost/compute/algorithm/detail/serial_reduce_by_key.hpp new file mode 100644 index 0000000000..f9bda8e476 --- /dev/null +++ b/3party/boost/boost/compute/algorithm/detail/serial_reduce_by_key.hpp @@ -0,0 +1,108 @@ +//---------------------------------------------------------------------------// +// Copyright (c) 2015 Jakub Szuppe +// +// 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 +// +// See http://boostorg.github.com/compute for more information. +//---------------------------------------------------------------------------// + +#ifndef BOOST_COMPUTE_ALGORITHM_DETAIL_SERIAL_REDUCE_BY_KEY_HPP +#define BOOST_COMPUTE_ALGORITHM_DETAIL_SERIAL_REDUCE_BY_KEY_HPP + +#include + +#include +#include +#include +#include +#include +#include +#include + +namespace boost { +namespace compute { +namespace detail { + +template +inline size_t serial_reduce_by_key(InputKeyIterator keys_first, + InputKeyIterator keys_last, + InputValueIterator values_first, + OutputKeyIterator keys_result, + OutputValueIterator values_result, + BinaryFunction function, + BinaryPredicate predicate, + command_queue &queue) +{ + typedef typename + std::iterator_traits::value_type value_type; + typedef typename + std::iterator_traits::value_type key_type; + typedef typename + ::boost::compute::result_of::type result_type; + + const context &context = queue.get_context(); + size_t count = detail::iterator_range_size(keys_first, keys_last); + if(count < 1){ + return count; + } + + meta_kernel k("serial_reduce_by_key"); + size_t count_arg = k.add_arg("count"); + size_t result_size_arg = k.add_arg(memory_object::global_memory, + "result_size"); + + convert to_result_type; + + k << + k.decl("result") << + " = " << to_result_type(values_first[0]) << ";\n" << + k.decl("previous_key") << " = " << keys_first[0] << ";\n" << + k.decl("value") << ";\n" << + k.decl("key") << ";\n" << + + k.decl("size") << " = 1;\n" << + + keys_result[0] << " = previous_key;\n" << + values_result[0] << " = result;\n" << + + "for(ulong i = 1; i < count; i++) {\n" << + " value = " << to_result_type(values_first[k.var("i")]) << ";\n" << + " key = " << keys_first[k.var("i")] << ";\n" << + " if (" << predicate(k.var("previous_key"), + k.var("key")) << ") {\n" << + + " result = " << function(k.var("result"), + k.var("value")) << ";\n" << + " }\n " << + " else { \n" << + keys_result[k.var("size - 1")] << " = previous_key;\n" << + values_result[k.var("size - 1")] << " = result;\n" << + " result = value;\n" << + " size++;\n" << + " } \n" << + " previous_key = key;\n" << + "}\n" << + keys_result[k.var("size - 1")] << " = previous_key;\n" << + values_result[k.var("size - 1")] << " = result;\n" << + "*result_size = size;"; + + kernel kernel = k.compile(context); + + scalar result_size(context); + kernel.set_arg(result_size_arg, result_size.get_buffer()); + kernel.set_arg(count_arg, static_cast(count)); + + queue.enqueue_task(kernel); + + return static_cast(result_size.read(queue)); +} + +} // end detail namespace +} // end compute namespace +} // end boost namespace + +#endif // BOOST_COMPUTE_ALGORITHM_DETAIL_SERIAL_REDUCE_BY_KEY_HPP diff --git a/3party/boost/boost/compute/algorithm/detail/serial_scan.hpp b/3party/boost/boost/compute/algorithm/detail/serial_scan.hpp new file mode 100644 index 0000000000..7590fd94fb --- /dev/null +++ b/3party/boost/boost/compute/algorithm/detail/serial_scan.hpp @@ -0,0 +1,103 @@ +//---------------------------------------------------------------------------// +// Copyright (c) 2013 Kyle Lutz +// +// 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 +// +// See http://boostorg.github.com/compute for more information. +//---------------------------------------------------------------------------// + +#ifndef BOOST_COMPUTE_ALGORITHM_DETAIL_SERIAL_SCAN_HPP +#define BOOST_COMPUTE_ALGORITHM_DETAIL_SERIAL_SCAN_HPP + +#include + +#include +#include +#include +#include +#include + +namespace boost { +namespace compute { +namespace detail { + +template +inline OutputIterator serial_scan(InputIterator first, + InputIterator last, + OutputIterator result, + bool exclusive, + T init, + BinaryOperator op, + command_queue &queue) +{ + if(first == last){ + return result; + } + + typedef typename + std::iterator_traits::value_type input_type; + typedef typename + std::iterator_traits::value_type output_type; + + const context &context = queue.get_context(); + + // create scan kernel + meta_kernel k("serial_scan"); + + // Arguments + size_t n_arg = k.add_arg("n"); + size_t init_arg = k.add_arg("initial_value"); + + if(!exclusive){ + k << + k.decl("start_idx") << " = 1;\n" << + k.decl("sum") << " = " << first[0] << ";\n" << + result[0] << " = sum;\n"; + } + else { + k << + k.decl("start_idx") << " = 0;\n" << + k.decl("sum") << " = initial_value;\n"; + } + + k << + "for(ulong i = start_idx; i < n; i++){\n" << + k.decl("x") << " = " + << first[k.var("i")] << ";\n"; + + if(exclusive){ + k << result[k.var("i")] << " = sum;\n"; + } + + k << " sum = " + << op(k.var("sum"), k.var("x")) + << ";\n"; + + if(!exclusive){ + k << result[k.var("i")] << " = sum;\n"; + } + + k << "}\n"; + + // compile scan kernel + kernel scan_kernel = k.compile(context); + + // setup kernel arguments + size_t n = detail::iterator_range_size(first, last); + scan_kernel.set_arg(n_arg, n); + scan_kernel.set_arg(init_arg, static_cast(init)); + + // execute the kernel + queue.enqueue_1d_range_kernel(scan_kernel, 0, 1, 1); + + // return iterator pointing to the end of the result range + return result + n; +} + +} // end detail namespace +} // end compute namespace +} // end boost namespace + +#endif // BOOST_COMPUTE_ALGORITHM_DETAIL_SERIAL_SCAN_HPP diff --git a/3party/boost/boost/compute/algorithm/equal.hpp b/3party/boost/boost/compute/algorithm/equal.hpp new file mode 100644 index 0000000000..35d0c5f0ea --- /dev/null +++ b/3party/boost/boost/compute/algorithm/equal.hpp @@ -0,0 +1,53 @@ +//---------------------------------------------------------------------------// +// Copyright (c) 2013 Kyle Lutz +// +// 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 +// +// See http://boostorg.github.com/compute for more information. +//---------------------------------------------------------------------------// + +#ifndef BOOST_COMPUTE_ALGORITHM_EQUAL_HPP +#define BOOST_COMPUTE_ALGORITHM_EQUAL_HPP + +#include +#include +#include + +namespace boost { +namespace compute { + +/// Returns \c true if the range [\p first1, \p last1) and the range +/// beginning at \p first2 are equal. +template +inline bool equal(InputIterator1 first1, + InputIterator1 last1, + InputIterator2 first2, + command_queue &queue = system::default_queue()) +{ + return ::boost::compute::mismatch(first1, + last1, + first2, + queue).first == last1; +} + +/// \overload +template +inline bool equal(InputIterator1 first1, + InputIterator1 last1, + InputIterator2 first2, + InputIterator2 last2, + command_queue &queue = system::default_queue()) +{ + if(std::distance(first1, last1) != std::distance(first2, last2)){ + return false; + } + + return ::boost::compute::equal(first1, last1, first2, queue); +} + +} // end compute namespace +} // end boost namespace + +#endif // BOOST_COMPUTE_ALGORITHM_EQUAL_HPP diff --git a/3party/boost/boost/compute/algorithm/equal_range.hpp b/3party/boost/boost/compute/algorithm/equal_range.hpp new file mode 100644 index 0000000000..fd82177324 --- /dev/null +++ b/3party/boost/boost/compute/algorithm/equal_range.hpp @@ -0,0 +1,42 @@ +//---------------------------------------------------------------------------// +// Copyright (c) 2013 Kyle Lutz +// +// 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 +// +// See http://boostorg.github.com/compute for more information. +//---------------------------------------------------------------------------// + +#ifndef BOOST_COMPUTE_ALGORITHM_EQUAL_RANGE_HPP +#define BOOST_COMPUTE_ALGORITHM_EQUAL_RANGE_HPP + +#include + +#include +#include +#include +#include + +namespace boost { +namespace compute { + +/// Returns a pair of iterators containing the range of values equal +/// to \p value in the sorted range [\p first, \p last). +template +inline std::pair +equal_range(InputIterator first, + InputIterator last, + const T &value, + command_queue &queue = system::default_queue()) +{ + return std::make_pair( + ::boost::compute::lower_bound(first, last, value, queue), + ::boost::compute::upper_bound(first, last, value, queue) + ); +} + +} // end compute namespace +} // end boost namespace + +#endif // BOOST_COMPUTE_ALGORITHM_EQUAL_RANGE_HPP diff --git a/3party/boost/boost/compute/algorithm/exclusive_scan.hpp b/3party/boost/boost/compute/algorithm/exclusive_scan.hpp new file mode 100644 index 0000000000..205d3de658 --- /dev/null +++ b/3party/boost/boost/compute/algorithm/exclusive_scan.hpp @@ -0,0 +1,96 @@ +//---------------------------------------------------------------------------// +// Copyright (c) 2013 Kyle Lutz +// +// 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 +// +// See http://boostorg.github.com/compute for more information. +//---------------------------------------------------------------------------// + +#ifndef BOOST_COMPUTE_ALGORITHM_EXCLUSIVE_SCAN_HPP +#define BOOST_COMPUTE_ALGORITHM_EXCLUSIVE_SCAN_HPP + +#include +#include +#include +#include + +namespace boost { +namespace compute { + +/// Performs an exclusive scan of the elements in the range [\p first, \p last) +/// and stores the results in the range beginning at \p result. +/// +/// Each element in the output is assigned to the sum of all the previous +/// values in the input. +/// +/// \param first first element in the range to scan +/// \param last last element in the range to scan +/// \param result first element in the result range +/// \param init value used to initialize the scan sequence +/// \param binary_op associative binary operator +/// \param queue command queue to perform the operation +/// +/// \return \c OutputIterator to the end of the result range +/// +/// The default operation is to add the elements up. +/// +/// \snippet test/test_scan.cpp exclusive_scan_int +/// +/// But different associative operation can be specified as \p binary_op +/// instead (e.g., multiplication, maximum, minimum). Also value used to +/// initialized the scan sequence can be specified. +/// +/// \snippet test/test_scan.cpp exclusive_scan_int_multiplies +/// +/// \see inclusive_scan() +template +inline OutputIterator +exclusive_scan(InputIterator first, + InputIterator last, + OutputIterator result, + T init, + BinaryOperator binary_op, + command_queue &queue = system::default_queue()) +{ + return detail::scan(first, last, result, true, init, binary_op, queue); +} + +/// \overload +template +inline OutputIterator +exclusive_scan(InputIterator first, + InputIterator last, + OutputIterator result, + T init, + command_queue &queue = system::default_queue()) +{ + typedef typename + std::iterator_traits::value_type output_type; + + return detail::scan(first, last, result, true, + init, boost::compute::plus(), + queue); +} + +/// \overload +template +inline OutputIterator +exclusive_scan(InputIterator first, + InputIterator last, + OutputIterator result, + command_queue &queue = system::default_queue()) +{ + typedef typename + std::iterator_traits::value_type output_type; + + return detail::scan(first, last, result, true, + output_type(0), boost::compute::plus(), + queue); +} + +} // end compute namespace +} // end boost namespace + +#endif // BOOST_COMPUTE_ALGORITHM_EXCLUSIVE_SCAN_HPP diff --git a/3party/boost/boost/compute/algorithm/fill.hpp b/3party/boost/boost/compute/algorithm/fill.hpp new file mode 100644 index 0000000000..c711f46b94 --- /dev/null +++ b/3party/boost/boost/compute/algorithm/fill.hpp @@ -0,0 +1,306 @@ +//---------------------------------------------------------------------------// +// Copyright (c) 2013 Kyle Lutz +// +// 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 +// +// See http://boostorg.github.com/compute for more information. +//---------------------------------------------------------------------------// + +#ifndef BOOST_COMPUTE_ALGORITHM_FILL_HPP +#define BOOST_COMPUTE_ALGORITHM_FILL_HPP + +#include + +#include +#include +#include +#include + +#include +#include +#include +#include +#include +#include +#include +#include +#include + +namespace boost { +namespace compute { +namespace detail { + +namespace mpl = boost::mpl; + +// fills the range [first, first + count) with value using copy() +template +inline void fill_with_copy(BufferIterator first, + size_t count, + const T &value, + command_queue &queue) +{ + ::boost::compute::copy( + ::boost::compute::make_constant_iterator(value, 0), + ::boost::compute::make_constant_iterator(value, count), + first, + queue + ); +} + +// fills the range [first, first + count) with value using copy_async() +template +inline future fill_async_with_copy(BufferIterator first, + size_t count, + const T &value, + command_queue &queue) +{ + return ::boost::compute::copy_async( + ::boost::compute::make_constant_iterator(value, 0), + ::boost::compute::make_constant_iterator(value, count), + first, + queue + ); +} + +#if defined(CL_VERSION_1_2) + +// meta-function returing true if Iterator points to a range of values +// that can be filled using clEnqueueFillBuffer(). to meet this criteria +// it must have a buffer accessible through iter.get_buffer() and the +// size of its value_type must by in {1, 2, 4, 8, 16, 32, 64, 128}. +template +struct is_valid_fill_buffer_iterator : + public mpl::and_< + is_buffer_iterator, + mpl::contains< + mpl::vector< + mpl::int_<1>, + mpl::int_<2>, + mpl::int_<4>, + mpl::int_<8>, + mpl::int_<16>, + mpl::int_<32>, + mpl::int_<64>, + mpl::int_<128> + >, + mpl::int_< + sizeof(typename std::iterator_traits::value_type) + > + > + >::type { }; + +template<> +struct is_valid_fill_buffer_iterator : public boost::false_type {}; + +// specialization which uses clEnqueueFillBuffer for buffer iterators +template +inline void +dispatch_fill(BufferIterator first, + size_t count, + const T &value, + command_queue &queue, + typename boost::enable_if< + is_valid_fill_buffer_iterator + >::type* = 0) +{ + typedef typename std::iterator_traits::value_type value_type; + + if(count == 0){ + // nothing to do + return; + } + + // check if the device supports OpenCL 1.2 (required for enqueue_fill_buffer) + if(!queue.check_device_version(1, 2)){ + return fill_with_copy(first, count, value, queue); + } + + value_type pattern = static_cast(value); + size_t offset = static_cast(first.get_index()); + + if(count == 1){ + // use clEnqueueWriteBuffer() directly when writing a single value + // to the device buffer. this is potentially more efficient and also + // works around a bug in the intel opencl driver. + queue.enqueue_write_buffer( + first.get_buffer(), + offset * sizeof(value_type), + sizeof(value_type), + &pattern + ); + } + else { + queue.enqueue_fill_buffer( + first.get_buffer(), + &pattern, + sizeof(value_type), + offset * sizeof(value_type), + count * sizeof(value_type) + ); + } +} + +template +inline future +dispatch_fill_async(BufferIterator first, + size_t count, + const T &value, + command_queue &queue, + typename boost::enable_if< + is_valid_fill_buffer_iterator + >::type* = 0) +{ + typedef typename std::iterator_traits::value_type value_type; + + // check if the device supports OpenCL 1.2 (required for enqueue_fill_buffer) + if(!queue.check_device_version(1, 2)){ + return fill_async_with_copy(first, count, value, queue); + } + + value_type pattern = static_cast(value); + size_t offset = static_cast(first.get_index()); + + event event_ = + queue.enqueue_fill_buffer(first.get_buffer(), + &pattern, + sizeof(value_type), + offset * sizeof(value_type), + count * sizeof(value_type)); + + return future(event_); +} + +#ifdef CL_VERSION_2_0 +// specializations for svm_ptr +template +inline void dispatch_fill(svm_ptr first, + size_t count, + const T &value, + command_queue &queue) +{ + if(count == 0){ + return; + } + + queue.enqueue_svm_fill( + first.get(), &value, sizeof(T), count * sizeof(T) + ); +} + +template +inline future dispatch_fill_async(svm_ptr first, + size_t count, + const T &value, + command_queue &queue) +{ + if(count == 0){ + return future(); + } + + event event_ = queue.enqueue_svm_fill( + first.get(), &value, sizeof(T), count * sizeof(T) + ); + + return future(event_); +} +#endif // CL_VERSION_2_0 + +// default implementations +template +inline void +dispatch_fill(BufferIterator first, + size_t count, + const T &value, + command_queue &queue, + typename boost::disable_if< + is_valid_fill_buffer_iterator + >::type* = 0) +{ + fill_with_copy(first, count, value, queue); +} + +template +inline future +dispatch_fill_async(BufferIterator first, + size_t count, + const T &value, + command_queue &queue, + typename boost::disable_if< + is_valid_fill_buffer_iterator + >::type* = 0) +{ + return fill_async_with_copy(first, count, value, queue); +} +#else +template +inline void dispatch_fill(BufferIterator first, + size_t count, + const T &value, + command_queue &queue) +{ + fill_with_copy(first, count, value, queue); +} + +template +inline future dispatch_fill_async(BufferIterator first, + size_t count, + const T &value, + command_queue &queue) +{ + return fill_async_with_copy(first, count, value, queue); +} +#endif // !defined(CL_VERSION_1_2) + +} // end detail namespace + +/// Fills the range [\p first, \p last) with \p value. +/// +/// \param first first element in the range to fill +/// \param last last element in the range to fill +/// \param value value to copy to each element +/// \param queue command queue to perform the operation +/// +/// For example, to fill a vector on the device with sevens: +/// \code +/// // vector on the device +/// boost::compute::vector vec(10, context); +/// +/// // fill vector with sevens +/// boost::compute::fill(vec.begin(), vec.end(), 7, queue); +/// \endcode +/// +/// \see boost::compute::fill_n() +template +inline void fill(BufferIterator first, + BufferIterator last, + const T &value, + command_queue &queue = system::default_queue()) +{ + size_t count = detail::iterator_range_size(first, last); + if(count == 0){ + return; + } + + detail::dispatch_fill(first, count, value, queue); +} + +template +inline future fill_async(BufferIterator first, + BufferIterator last, + const T &value, + command_queue &queue = system::default_queue()) +{ + size_t count = detail::iterator_range_size(first, last); + if(count == 0){ + return future(); + } + + return detail::dispatch_fill_async(first, count, value, queue); +} + +} // end compute namespace +} // end boost namespace + +#endif // BOOST_COMPUTE_ALGORITHM_FILL_HPP diff --git a/3party/boost/boost/compute/algorithm/fill_n.hpp b/3party/boost/boost/compute/algorithm/fill_n.hpp new file mode 100644 index 0000000000..18a8f706a5 --- /dev/null +++ b/3party/boost/boost/compute/algorithm/fill_n.hpp @@ -0,0 +1,36 @@ +//---------------------------------------------------------------------------// +// Copyright (c) 2013 Kyle Lutz +// +// 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 +// +// See http://boostorg.github.com/compute for more information. +//---------------------------------------------------------------------------// + +#ifndef BOOST_COMPUTE_ALGORITHM_FILL_N_HPP +#define BOOST_COMPUTE_ALGORITHM_FILL_N_HPP + +#include +#include +#include + +namespace boost { +namespace compute { + +/// Fills the range [\p first, \p first + count) with \p value. +/// +/// \see fill() +template +inline void fill_n(BufferIterator first, + Size count, + const T &value, + command_queue &queue = system::default_queue()) +{ + ::boost::compute::fill(first, first + count, value, queue); +} + +} // end compute namespace +} // end boost namespace + +#endif // BOOST_COMPUTE_ALGORITHM_FILL_N_HPP diff --git a/3party/boost/boost/compute/algorithm/find.hpp b/3party/boost/boost/compute/algorithm/find.hpp new file mode 100644 index 0000000000..ef3ebf0c47 --- /dev/null +++ b/3party/boost/boost/compute/algorithm/find.hpp @@ -0,0 +1,57 @@ +//---------------------------------------------------------------------------// +// Copyright (c) 2013 Kyle Lutz +// +// 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 +// +// See http://boostorg.github.com/compute for more information. +//---------------------------------------------------------------------------// + +#ifndef BOOST_COMPUTE_ALGORITHM_FIND_HPP +#define BOOST_COMPUTE_ALGORITHM_FIND_HPP + +#include +#include +#include +#include +#include + +namespace boost { +namespace compute { + +/// Returns an iterator pointing to the first element in the range +/// [\p first, \p last) that equals \p value. +template +inline InputIterator find(InputIterator first, + InputIterator last, + const T &value, + command_queue &queue = system::default_queue()) +{ + typedef typename std::iterator_traits::value_type value_type; + + using ::boost::compute::_1; + using ::boost::compute::lambda::all; + + if(vector_size::value == 1){ + return ::boost::compute::find_if( + first, + last, + _1 == value, + queue + ); + } + else { + return ::boost::compute::find_if( + first, + last, + all(_1 == value), + queue + ); + } +} + +} // end compute namespace +} // end boost namespace + +#endif // BOOST_COMPUTE_ALGORITHM_FIND_HPP diff --git a/3party/boost/boost/compute/algorithm/find_end.hpp b/3party/boost/boost/compute/algorithm/find_end.hpp new file mode 100644 index 0000000000..265a1da542 --- /dev/null +++ b/3party/boost/boost/compute/algorithm/find_end.hpp @@ -0,0 +1,136 @@ +//---------------------------------------------------------------------------// +// Copyright (c) 2014 Roshan +// +// 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 +// +// See http://boostorg.github.com/compute for more information. +//---------------------------------------------------------------------------// + +#ifndef BOOST_COMPUTE_ALGORITHM_FIND_END_HPP +#define BOOST_COMPUTE_ALGORITHM_FIND_END_HPP + +#include +#include +#include +#include +#include +#include +#include + +namespace boost { +namespace compute { +namespace detail { + +/// +/// \brief Helper function for find_end +/// +/// Basically a copy of find_if which returns last occurence +/// instead of first occurence +/// +template +inline InputIterator find_end_helper(InputIterator first, + InputIterator last, + UnaryPredicate predicate, + command_queue &queue) +{ + typedef typename std::iterator_traits::value_type value_type; + typedef typename std::iterator_traits::difference_type difference_type; + + size_t count = detail::iterator_range_size(first, last); + if(count == 0){ + return last; + } + + const context &context = queue.get_context(); + + detail::meta_kernel k("find_end"); + size_t index_arg = k.add_arg(memory_object::global_memory, "index"); + atomic_max atomic_max_int; + + k << k.decl("i") << " = get_global_id(0);\n" + << k.decl("value") << "=" + << first[k.var("i")] << ";\n" + << "if(" << predicate(k.var("value")) << "){\n" + << " " << atomic_max_int(k.var("index"), k.var("i")) << ";\n" + << "}\n"; + + kernel kernel = k.compile(context); + + scalar index(context); + kernel.set_arg(index_arg, index.get_buffer()); + + index.write(static_cast(-1), queue); + + queue.enqueue_1d_range_kernel(kernel, 0, count, 0); + + int result = static_cast(index.read(queue)); + + if(result == -1){ + return last; + } + else { + return first + static_cast(result); + } +} + +} // end detail namespace + +/// +/// \brief Substring matching algorithm +/// +/// Searches for the last match of the pattern [p_first, p_last) +/// in text [t_first, t_last). +/// \return Iterator pointing to beginning of last occurence +/// +/// \param t_first Iterator pointing to start of text +/// \param t_last Iterator pointing to end of text +/// \param p_first Iterator pointing to start of pattern +/// \param p_last Iterator pointing to end of pattern +/// \param queue Queue on which to execute +/// +template +inline TextIterator find_end(TextIterator t_first, + TextIterator t_last, + PatternIterator p_first, + PatternIterator p_last, + command_queue &queue = system::default_queue()) +{ + const context &context = queue.get_context(); + + // there is no need to check if pattern starts at last n - 1 indices + vector matching_indices( + detail::iterator_range_size(t_first, t_last) + + 1 - detail::iterator_range_size(p_first, p_last), + context + ); + + detail::search_kernel::iterator> kernel; + + kernel.set_range(p_first, p_last, t_first, t_last, matching_indices.begin()); + kernel.exec(queue); + + using boost::compute::_1; + + vector::iterator index = + detail::find_end_helper( + matching_indices.begin(), + matching_indices.end(), + _1 == 1, + queue + ); + + // pattern was not found + if(index == matching_indices.end()) + return t_last; + + return t_first + detail::iterator_range_size(matching_indices.begin(), index); +} + +} //end compute namespace +} //end boost namespace + +#endif // BOOST_COMPUTE_ALGORITHM_FIND_END_HPP diff --git a/3party/boost/boost/compute/algorithm/find_if.hpp b/3party/boost/boost/compute/algorithm/find_if.hpp new file mode 100644 index 0000000000..db99cc0396 --- /dev/null +++ b/3party/boost/boost/compute/algorithm/find_if.hpp @@ -0,0 +1,35 @@ +//---------------------------------------------------------------------------// +// Copyright (c) 2013 Kyle Lutz +// +// 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 +// +// See http://boostorg.github.com/compute for more information. +//---------------------------------------------------------------------------// + +#ifndef BOOST_COMPUTE_ALGORITHM_FIND_IF_HPP +#define BOOST_COMPUTE_ALGORITHM_FIND_IF_HPP + +#include +#include +#include + +namespace boost { +namespace compute { + +/// Returns an iterator pointing to the first element in the range +/// [\p first, \p last) for which \p predicate returns \c true. +template +inline InputIterator find_if(InputIterator first, + InputIterator last, + UnaryPredicate predicate, + command_queue &queue = system::default_queue()) +{ + return detail::find_if_with_atomics(first, last, predicate, queue); +} + +} // end compute namespace +} // end boost namespace + +#endif // BOOST_COMPUTE_ALGORITHM_FIND_IF_HPP diff --git a/3party/boost/boost/compute/algorithm/find_if_not.hpp b/3party/boost/boost/compute/algorithm/find_if_not.hpp new file mode 100644 index 0000000000..61de050d31 --- /dev/null +++ b/3party/boost/boost/compute/algorithm/find_if_not.hpp @@ -0,0 +1,43 @@ +//---------------------------------------------------------------------------// +// Copyright (c) 2013 Kyle Lutz +// +// 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 +// +// See http://boostorg.github.com/compute for more information. +//---------------------------------------------------------------------------// + +#ifndef BOOST_COMPUTE_ALGORITHM_FIND_IF_NOT_HPP +#define BOOST_COMPUTE_ALGORITHM_FIND_IF_NOT_HPP + +#include +#include +#include +#include + +namespace boost { +namespace compute { + +/// Returns an iterator pointing to the first element in the range +/// [\p first, \p last) for which \p predicate returns \c false. +/// +/// \see find_if() +template +inline InputIterator find_if_not(InputIterator first, + InputIterator last, + UnaryPredicate predicate, + command_queue &queue = system::default_queue()) +{ + return ::boost::compute::find_if( + first, + last, + not1(predicate), + queue + ); +} + +} // end compute namespace +} // end boost namespace + +#endif // BOOST_COMPUTE_ALGORITHM_FIND_IF_NOT_HPP diff --git a/3party/boost/boost/compute/algorithm/for_each.hpp b/3party/boost/boost/compute/algorithm/for_each.hpp new file mode 100644 index 0000000000..3ed399e6e9 --- /dev/null +++ b/3party/boost/boost/compute/algorithm/for_each.hpp @@ -0,0 +1,65 @@ +//---------------------------------------------------------------------------// +// Copyright (c) 2013 Kyle Lutz +// +// 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 +// +// See http://boostorg.github.com/compute for more information. +//---------------------------------------------------------------------------// + +#ifndef BOOST_COMPUTE_ALGORITHM_FOR_EACH_HPP +#define BOOST_COMPUTE_ALGORITHM_FOR_EACH_HPP + +#include +#include +#include +#include + +namespace boost { +namespace compute { +namespace detail { + +template +struct for_each_kernel : public meta_kernel +{ + for_each_kernel(InputIterator first, InputIterator last, Function function) + : meta_kernel("for_each") + { + // store range size + m_count = detail::iterator_range_size(first, last); + + // setup kernel source + *this << function(first[get_global_id(0)]) << ";\n"; + } + + void exec(command_queue &queue) + { + exec_1d(queue, 0, m_count); + } + + size_t m_count; +}; + +} // end detail namespace + +/// Calls \p function on each element in the range [\p first, \p last). +/// +/// \see transform() +template +inline UnaryFunction for_each(InputIterator first, + InputIterator last, + UnaryFunction function, + command_queue &queue = system::default_queue()) +{ + detail::for_each_kernel kernel(first, last, function); + + kernel.exec(queue); + + return function; +} + +} // end compute namespace +} // end boost namespace + +#endif // BOOST_COMPUTE_ALGORITHM_FOR_EACH_HPP diff --git a/3party/boost/boost/compute/algorithm/for_each_n.hpp b/3party/boost/boost/compute/algorithm/for_each_n.hpp new file mode 100644 index 0000000000..d0be784bf7 --- /dev/null +++ b/3party/boost/boost/compute/algorithm/for_each_n.hpp @@ -0,0 +1,35 @@ +//---------------------------------------------------------------------------// +// Copyright (c) 2013-2014 Kyle Lutz +// +// 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 +// +// See http://boostorg.github.com/compute for more information. +//---------------------------------------------------------------------------// + +#ifndef BOOST_COMPUTE_ALGORITHM_FOR_EACH_N_HPP +#define BOOST_COMPUTE_ALGORITHM_FOR_EACH_N_HPP + +#include + +namespace boost { +namespace compute { + +/// Calls \p function on each element in the range [\p first, \p first +/// \c + \p count). +/// +/// \see for_each() +template +inline UnaryFunction for_each_n(InputIterator first, + Size count, + UnaryFunction function, + command_queue &queue = system::default_queue()) +{ + return ::boost::compute::for_each(first, first + count, function, queue); +} + +} // end compute namespace +} // end boost namespace + +#endif // BOOST_COMPUTE_ALGORITHM_FOR_EACH_N_HPP diff --git a/3party/boost/boost/compute/algorithm/gather.hpp b/3party/boost/boost/compute/algorithm/gather.hpp new file mode 100644 index 0000000000..24c5c727ae --- /dev/null +++ b/3party/boost/boost/compute/algorithm/gather.hpp @@ -0,0 +1,82 @@ +//---------------------------------------------------------------------------// +// Copyright (c) 2013 Kyle Lutz +// +// 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 +// +// See http://boostorg.github.com/compute for more information. +//---------------------------------------------------------------------------// + +#ifndef BOOST_COMPUTE_ALGORITHM_GATHER_HPP +#define BOOST_COMPUTE_ALGORITHM_GATHER_HPP + +#include +#include +#include +#include +#include +#include +#include + +namespace boost { +namespace compute { +namespace detail { + +template +class gather_kernel : public meta_kernel +{ +public: + gather_kernel() : meta_kernel("gather") + {} + + void set_range(MapIterator first, + MapIterator last, + InputIterator input, + OutputIterator result) + { + m_count = iterator_range_size(first, last); + + *this << + "const uint i = get_global_id(0);\n" << + result[expr("i")] << "=" << + input[first[expr("i")]] << ";\n"; + } + + event exec(command_queue &queue) + { + if(m_count == 0) { + return event(); + } + + return exec_1d(queue, 0, m_count); + } + +private: + size_t m_count; +}; + +} // end detail namespace + +/// Copies the elements using the indices from the range [\p first, \p last) +/// to the range beginning at \p result using the input values from the range +/// beginning at \p input. +/// +/// \see scatter() +template +inline void gather(MapIterator first, + MapIterator last, + InputIterator input, + OutputIterator result, + command_queue &queue = system::default_queue()) +{ + detail::gather_kernel kernel; + + kernel.set_range(first, last, input, result); + kernel.exec(queue); +} + +} // end compute namespace +} // end boost namespace + +#endif // BOOST_COMPUTE_ALGORITHM_GATHER_HPP diff --git a/3party/boost/boost/compute/algorithm/generate.hpp b/3party/boost/boost/compute/algorithm/generate.hpp new file mode 100644 index 0000000000..c70a542683 --- /dev/null +++ b/3party/boost/boost/compute/algorithm/generate.hpp @@ -0,0 +1,49 @@ +//---------------------------------------------------------------------------// +// Copyright (c) 2013 Kyle Lutz +// +// 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 +// +// See http://boostorg.github.com/compute for more information. +//---------------------------------------------------------------------------// + +#ifndef BOOST_COMPUTE_ALGORITHM_GENERATE_HPP +#define BOOST_COMPUTE_ALGORITHM_GENERATE_HPP + +#include +#include +#include +#include +#include + +namespace boost { +namespace compute { + +/// Stores the result of \p generator for each element in the range +/// [\p first, \p last). +template +inline void generate(OutputIterator first, + OutputIterator last, + Generator generator, + command_queue &queue = system::default_queue()) +{ + size_t count = detail::iterator_range_size(first, last); + if(count == 0){ + return; + } + + ::boost::compute::copy( + ::boost::compute::make_function_input_iterator(generator, + first.get_index()), + ::boost::compute::make_function_input_iterator(generator, + last.get_index()), + first, + queue + ); +} + +} // end compute namespace +} // end boost namespace + +#endif // BOOST_COMPUTE_ALGORITHM_GENERATE_HPP diff --git a/3party/boost/boost/compute/algorithm/generate_n.hpp b/3party/boost/boost/compute/algorithm/generate_n.hpp new file mode 100644 index 0000000000..6d8e607b64 --- /dev/null +++ b/3party/boost/boost/compute/algorithm/generate_n.hpp @@ -0,0 +1,35 @@ +//---------------------------------------------------------------------------// +// Copyright (c) 2013 Kyle Lutz +// +// 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 +// +// See http://boostorg.github.com/compute for more information. +//---------------------------------------------------------------------------// + +#ifndef BOOST_COMPUTE_ALGORITHM_GENERATE_N_HPP +#define BOOST_COMPUTE_ALGORITHM_GENERATE_N_HPP + +#include +#include +#include + +namespace boost { +namespace compute { + +/// Stores the result of \p generator for each element in the range +/// [\p first, \p first + \p count). +template +inline void generate_n(OutputIterator first, + Size count, + Generator generator, + command_queue &queue = system::default_queue()) +{ + ::boost::compute::generate(first, first + count, generator, queue); +} + +} // end compute namespace +} // end boost namespace + +#endif // BOOST_COMPUTE_ALGORITHM_GENERATE_N_HPP diff --git a/3party/boost/boost/compute/algorithm/includes.hpp b/3party/boost/boost/compute/algorithm/includes.hpp new file mode 100644 index 0000000000..c4e7c793e7 --- /dev/null +++ b/3party/boost/boost/compute/algorithm/includes.hpp @@ -0,0 +1,155 @@ +//---------------------------------------------------------------------------// +// Copyright (c) 2014 Roshan +// +// 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 +// +// See http://boostorg.github.com/compute for more information. +//---------------------------------------------------------------------------// + +#ifndef BOOST_COMPUTE_ALGORITHM_INCLUDES_HPP +#define BOOST_COMPUTE_ALGORITHM_INCLUDES_HPP + +#include + +#include +#include +#include +#include +#include +#include +#include +#include + +namespace boost { +namespace compute { +namespace detail { + +/// +/// \brief Serial includes kernel class +/// +/// Subclass of meta_kernel to perform includes operation after tiling +/// +class serial_includes_kernel : meta_kernel +{ +public: + + serial_includes_kernel() : meta_kernel("includes") + { + + } + + template + void set_range(InputIterator1 first1, + InputIterator2 first2, + InputIterator3 tile_first1, + InputIterator3 tile_last1, + InputIterator4 tile_first2, + OutputIterator result) + { + m_count = iterator_range_size(tile_first1, tile_last1) - 1; + + *this << + "uint i = get_global_id(0);\n" << + "uint start1 = " << tile_first1[expr("i")] << ";\n" << + "uint end1 = " << tile_first1[expr("i+1")] << ";\n" << + "uint start2 = " << tile_first2[expr("i")] << ";\n" << + "uint end2 = " << tile_first2[expr("i+1")] << ";\n" << + "uint includes = 1;\n" << + "while(start1("start1")] << " == " << + first2[expr("start2")] << ")\n" << + " {\n" << + " start1++; start2++;\n" << + " }\n" << + " else if(" << first1[expr("start1")] << " < " << + first2[expr("start2")] << ")\n" << + " start1++;\n" << + " else\n" << + " {\n" << + " includes = 0;\n" << + " break;\n" << + " }\n" << + "}\n" << + "if(start2("i")] << " = includes;\n"; + } + + event exec(command_queue &queue) + { + if(m_count == 0) { + return event(); + } + + return exec_1d(queue, 0, m_count); + } + +private: + size_t m_count; +}; + +} //end detail namespace + +/// +/// \brief Includes algorithm +/// +/// Finds if the sorted range [first1, last1) includes the sorted +/// range [first2, last2). In other words, it checks if [first1, last1) is +/// a superset of [first2, last2). +/// +/// \return True, if [first1, last1) includes [first2, last2). False otherwise. +/// +/// \param first1 Iterator pointing to start of first set +/// \param last1 Iterator pointing to end of first set +/// \param first2 Iterator pointing to start of second set +/// \param last2 Iterator pointing to end of second set +/// \param queue Queue on which to execute +/// +template +inline bool includes(InputIterator1 first1, + InputIterator1 last1, + InputIterator2 first2, + InputIterator2 last2, + command_queue &queue = system::default_queue()) +{ + size_t tile_size = 1024; + + size_t count1 = detail::iterator_range_size(first1, last1); + size_t count2 = detail::iterator_range_size(first2, last2); + + vector tile_a((count1+count2+tile_size-1)/tile_size+1, queue.get_context()); + vector tile_b((count1+count2+tile_size-1)/tile_size+1, queue.get_context()); + + // Tile the sets + detail::balanced_path_kernel tiling_kernel; + tiling_kernel.tile_size = static_cast(tile_size); + tiling_kernel.set_range(first1, last1, first2, last2, + tile_a.begin()+1, tile_b.begin()+1); + fill_n(tile_a.begin(), 1, uint_(0), queue); + fill_n(tile_b.begin(), 1, uint_(0), queue); + tiling_kernel.exec(queue); + + fill_n(tile_a.end()-1, 1, static_cast(count1), queue); + fill_n(tile_b.end()-1, 1, static_cast(count2), queue); + + vector result((count1+count2+tile_size-1)/tile_size, queue.get_context()); + + // Find individually + detail::serial_includes_kernel includes_kernel; + includes_kernel.set_range(first1, first2, tile_a.begin(), tile_a.end(), + tile_b.begin(), result.begin()); + + includes_kernel.exec(queue); + + return find(result.begin(), result.end(), 0, queue) == result.end(); +} + +} //end compute namespace +} //end boost namespace + +#endif // BOOST_COMPUTE_ALGORITHM_SET_UNION_HPP diff --git a/3party/boost/boost/compute/algorithm/inclusive_scan.hpp b/3party/boost/boost/compute/algorithm/inclusive_scan.hpp new file mode 100644 index 0000000000..9f98beaf7c --- /dev/null +++ b/3party/boost/boost/compute/algorithm/inclusive_scan.hpp @@ -0,0 +1,81 @@ +//---------------------------------------------------------------------------// +// Copyright (c) 2013 Kyle Lutz +// +// 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 +// +// See http://boostorg.github.com/compute for more information. +//---------------------------------------------------------------------------// + +#ifndef BOOST_COMPUTE_ALGORITHM_INCLUSIVE_SCAN_HPP +#define BOOST_COMPUTE_ALGORITHM_INCLUSIVE_SCAN_HPP + +#include +#include +#include +#include + +namespace boost { +namespace compute { + +/// Performs an inclusive scan of the elements in the range [\p first, \p last) +/// and stores the results in the range beginning at \p result. +/// +/// Each element in the output is assigned to the sum of the current value in +/// the input with the sum of every previous value in the input. +/// +/// \param first first element in the range to scan +/// \param last last element in the range to scan +/// \param result first element in the result range +/// \param binary_op associative binary operator +/// \param queue command queue to perform the operation +/// +/// \return \c OutputIterator to the end of the result range +/// +/// The default operation is to add the elements up. +/// +/// \snippet test/test_scan.cpp inclusive_scan_int +/// +/// But different associative operation can be specified as \p binary_op +/// instead (e.g., multiplication, maximum, minimum). +/// +/// \snippet test/test_scan.cpp inclusive_scan_int_multiplies +/// +/// \see exclusive_scan() +template +inline OutputIterator +inclusive_scan(InputIterator first, + InputIterator last, + OutputIterator result, + BinaryOperator binary_op, + command_queue &queue = system::default_queue()) +{ + typedef typename + std::iterator_traits::value_type output_type; + + return detail::scan(first, last, result, false, + output_type(0), binary_op, + queue); +} + +/// \overload +template +inline OutputIterator +inclusive_scan(InputIterator first, + InputIterator last, + OutputIterator result, + command_queue &queue = system::default_queue()) +{ + typedef typename + std::iterator_traits::value_type output_type; + + return detail::scan(first, last, result, false, + output_type(0), boost::compute::plus(), + queue); +} + +} // end compute namespace +} // end boost namespace + +#endif // BOOST_COMPUTE_ALGORITHM_INCLUSIVE_SCAN_HPP diff --git a/3party/boost/boost/compute/algorithm/inner_product.hpp b/3party/boost/boost/compute/algorithm/inner_product.hpp new file mode 100644 index 0000000000..614611f91e --- /dev/null +++ b/3party/boost/boost/compute/algorithm/inner_product.hpp @@ -0,0 +1,93 @@ +//---------------------------------------------------------------------------// +// Copyright (c) 2013 Kyle Lutz +// +// 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 +// +// See http://boostorg.github.com/compute for more information. +//---------------------------------------------------------------------------// + +#ifndef BOOST_COMPUTE_ALGORITHM_INNER_PRODUCT_HPP +#define BOOST_COMPUTE_ALGORITHM_INNER_PRODUCT_HPP + +#include +#include +#include +#include +#include +#include +#include +#include + +namespace boost { +namespace compute { + +/// Returns the inner product of the elements in the range +/// [\p first1, \p last1) with the elements in the range beginning +/// at \p first2. +template +inline T inner_product(InputIterator1 first1, + InputIterator1 last1, + InputIterator2 first2, + T init, + command_queue &queue = system::default_queue()) +{ + typedef typename std::iterator_traits::value_type input_type; + + ptrdiff_t n = std::distance(first1, last1); + + return ::boost::compute::accumulate( + ::boost::compute::make_transform_iterator( + ::boost::compute::make_zip_iterator( + boost::make_tuple(first1, first2) + ), + detail::unpack(multiplies()) + ), + ::boost::compute::make_transform_iterator( + ::boost::compute::make_zip_iterator( + boost::make_tuple(last1, first2 + n) + ), + detail::unpack(multiplies()) + ), + init, + queue + ); +} + +/// \overload +template +inline T inner_product(InputIterator1 first1, + InputIterator1 last1, + InputIterator2 first2, + T init, + BinaryAccumulateFunction accumulate_function, + BinaryTransformFunction transform_function, + command_queue &queue = system::default_queue()) +{ + typedef typename std::iterator_traits::value_type value_type; + + size_t count = detail::iterator_range_size(first1, last1); + vector result(count, queue.get_context()); + transform(first1, + last1, + first2, + result.begin(), + transform_function, + queue); + + return ::boost::compute::accumulate(result.begin(), + result.end(), + init, + accumulate_function, + queue); +} + +} // end compute namespace +} // end boost namespace + +#endif // BOOST_COMPUTE_ALGORITHM_INNER_PRODUCT_HPP diff --git a/3party/boost/boost/compute/algorithm/inplace_merge.hpp b/3party/boost/boost/compute/algorithm/inplace_merge.hpp new file mode 100644 index 0000000000..3080950df5 --- /dev/null +++ b/3party/boost/boost/compute/algorithm/inplace_merge.hpp @@ -0,0 +1,60 @@ +//---------------------------------------------------------------------------// +// Copyright (c) 2013 Kyle Lutz +// +// 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 +// +// See http://boostorg.github.com/compute for more information. +//---------------------------------------------------------------------------// + +#ifndef BOOST_COMPUTE_ALGORITHM_INPLACE_MERGE_HPP +#define BOOST_COMPUTE_ALGORITHM_INPLACE_MERGE_HPP + +#include + +#include +#include +#include +#include + +namespace boost { +namespace compute { + +/// Merges the sorted values in the range [\p first, \p middle) with +/// the sorted values in the range [\p middle, \p last) in-place. +template +inline void inplace_merge(Iterator first, + Iterator middle, + Iterator last, + command_queue &queue = system::default_queue()) +{ + BOOST_ASSERT(first < middle && middle < last); + + typedef typename std::iterator_traits::value_type T; + + const context &context = queue.get_context(); + + ptrdiff_t left_size = std::distance(first, middle); + ptrdiff_t right_size = std::distance(middle, last); + + vector left(left_size, context); + vector right(right_size, context); + + copy(first, middle, left.begin(), queue); + copy(middle, last, right.begin(), queue); + + ::boost::compute::merge( + left.begin(), + left.end(), + right.begin(), + right.end(), + first, + queue + ); +} + +} // end compute namespace +} // end boost namespace + +#endif // BOOST_COMPUTE_ALGORITHM_INPLACE_MERGE_HPP diff --git a/3party/boost/boost/compute/algorithm/iota.hpp b/3party/boost/boost/compute/algorithm/iota.hpp new file mode 100644 index 0000000000..084c3d8d97 --- /dev/null +++ b/3party/boost/boost/compute/algorithm/iota.hpp @@ -0,0 +1,48 @@ +//---------------------------------------------------------------------------// +// Copyright (c) 2013 Kyle Lutz +// +// 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 +// +// See http://boostorg.github.com/compute for more information. +//---------------------------------------------------------------------------// + +#ifndef BOOST_COMPUTE_ALGORITHM_IOTA_HPP +#define BOOST_COMPUTE_ALGORITHM_IOTA_HPP + +#include +#include +#include +#include + +namespace boost { +namespace compute { + +/// Fills the range [\p first, \p last) with sequential values starting at +/// \p value. +/// +/// For example, the following code: +/// \snippet test/test_iota.cpp iota +/// +/// Will fill \c vec with the values (\c 0, \c 1, \c 2, \c ...). +template +inline void iota(BufferIterator first, + BufferIterator last, + const T &value, + command_queue &queue = system::default_queue()) +{ + T count = static_cast(detail::iterator_range_size(first, last)); + + copy( + ::boost::compute::make_counting_iterator(value), + ::boost::compute::make_counting_iterator(value + count), + first, + queue + ); +} + +} // end compute namespace +} // end boost namespace + +#endif // BOOST_COMPUTE_ALGORITHM_IOTA_HPP diff --git a/3party/boost/boost/compute/algorithm/is_partitioned.hpp b/3party/boost/boost/compute/algorithm/is_partitioned.hpp new file mode 100644 index 0000000000..3916825057 --- /dev/null +++ b/3party/boost/boost/compute/algorithm/is_partitioned.hpp @@ -0,0 +1,43 @@ +//---------------------------------------------------------------------------// +// Copyright (c) 2013 Kyle Lutz +// +// 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 +// +// See http://boostorg.github.com/compute for more information. +//---------------------------------------------------------------------------// + +#ifndef BOOST_COMPUTE_ALGORITHM_IS_PARTITIONED_HPP +#define BOOST_COMPUTE_ALGORITHM_IS_PARTITIONED_HPP + +#include +#include +#include +#include + +namespace boost { +namespace compute { + +/// Returns \c true if the values in the range [\p first, \p last) +/// are partitioned according to \p predicate. +template +inline bool is_partitioned(InputIterator first, + InputIterator last, + UnaryPredicate predicate, + command_queue &queue = system::default_queue()) +{ + return ::boost::compute::find_if( + ::boost::compute::find_if_not(first, + last, + predicate, + queue), + last, + predicate, + queue) == last; +} + +} // end compute namespace +} // end boost namespace + +#endif // BOOST_COMPUTE_ALGORITHM_PARTITION_HPP diff --git a/3party/boost/boost/compute/algorithm/is_permutation.hpp b/3party/boost/boost/compute/algorithm/is_permutation.hpp new file mode 100644 index 0000000000..1e502efb37 --- /dev/null +++ b/3party/boost/boost/compute/algorithm/is_permutation.hpp @@ -0,0 +1,67 @@ +//---------------------------------------------------------------------------// +// Copyright (c) 2014 Roshan +// +// 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 +// +// See http://boostorg.github.com/compute for more information. +//---------------------------------------------------------------------------// + +#ifndef BOOST_COMPUTE_ALGORITHM_IS_PERMUTATION_HPP +#define BOOST_COMPUTE_ALGORITHM_IS_PERMUTATION_HPP + +#include + +#include +#include +#include +#include +#include +#include + +namespace boost { +namespace compute { + +/// +/// \brief Permutation checking algorithm +/// +/// Checks if the range [first1, last1) can be permuted into the +/// range [first2, last2) +/// \return True, if it can be permuted. False, otherwise. +/// +/// \param first1 Iterator pointing to start of first range +/// \param last1 Iterator pointing to end of first range +/// \param first2 Iterator pointing to start of second range +/// \param last2 Iterator pointing to end of second range +/// \param queue Queue on which to execute +/// +template +inline bool is_permutation(InputIterator1 first1, + InputIterator1 last1, + InputIterator2 first2, + InputIterator2 last2, + command_queue &queue = system::default_queue()) +{ + typedef typename std::iterator_traits::value_type value_type1; + typedef typename std::iterator_traits::value_type value_type2; + + size_t count1 = detail::iterator_range_size(first1, last1); + size_t count2 = detail::iterator_range_size(first2, last2); + + if(count1 != count2) return false; + + vector temp1(first1, last1, queue); + vector temp2(first2, last2, queue); + + sort(temp1.begin(), temp1.end(), queue); + sort(temp2.begin(), temp2.end(), queue); + + return equal(temp1.begin(), temp1.end(), + temp2.begin(), queue); +} + +} // end compute namespace +} // end boost namespace + +#endif // BOOST_COMPUTE_ALGORITHM_IS_PERMUTATION_HPP diff --git a/3party/boost/boost/compute/algorithm/is_sorted.hpp b/3party/boost/boost/compute/algorithm/is_sorted.hpp new file mode 100644 index 0000000000..a605159ac3 --- /dev/null +++ b/3party/boost/boost/compute/algorithm/is_sorted.hpp @@ -0,0 +1,64 @@ +//---------------------------------------------------------------------------// +// Copyright (c) 2013-2014 Kyle Lutz +// +// 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 +// +// See http://boostorg.github.com/compute for more information. +//---------------------------------------------------------------------------// + +#ifndef BOOST_COMPUTE_ALGORITHM_IS_SORTED_HPP +#define BOOST_COMPUTE_ALGORITHM_IS_SORTED_HPP + +#include +#include +#include +#include +#include + +namespace boost { +namespace compute { + +/// Returns \c true if the values in the range [\p first, \p last) +/// are in sorted order. +/// +/// \param first first element in the range to check +/// \param last last element in the range to check +/// \param compare comparison function (by default \c less) +/// \param queue command queue to perform the operation +/// +/// \return \c true if the range [\p first, \p last) is sorted +/// +/// \see sort() +template +inline bool is_sorted(InputIterator first, + InputIterator last, + Compare compare, + command_queue &queue = system::default_queue()) +{ + using ::boost::compute::placeholders::_1; + using ::boost::compute::placeholders::_2; + + return ::boost::compute::adjacent_find( + first, last, ::boost::compute::bind(compare, _2, _1), queue + ) == last; +} + +/// \overload +template +inline bool is_sorted(InputIterator first, + InputIterator last, + command_queue &queue = system::default_queue()) +{ + typedef typename std::iterator_traits::value_type value_type; + + return ::boost::compute::is_sorted( + first, last, ::boost::compute::less(), queue + ); +} + +} // end compute namespace +} // end boost namespace + +#endif // BOOST_COMPUTE_ALGORITHM_IS_SORTED_HPP diff --git a/3party/boost/boost/compute/algorithm/lexicographical_compare.hpp b/3party/boost/boost/compute/algorithm/lexicographical_compare.hpp new file mode 100644 index 0000000000..c4f7120807 --- /dev/null +++ b/3party/boost/boost/compute/algorithm/lexicographical_compare.hpp @@ -0,0 +1,117 @@ +//---------------------------------------------------------------------------// +// Copyright (c) 2014 Mageswaran.D +// +// 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 +// +// See http://boostorg.github.com/compute for more information. +//---------------------------------------------------------------------------// + +#include +#include +#include +#include +#include +#include + +namespace boost { +namespace compute { + +namespace detail { + +const char lexicographical_compare_source[] = +"__kernel void lexicographical_compare(const uint size1,\n" +" const uint size2,\n" +" __global const T1 *range1,\n" +" __global const T2 *range2,\n" +" __global bool *result_buf)\n" +"{\n" +" const uint i = get_global_id(0);\n" +" if((i != size1) && (i != size2)){\n" + //Individual elements are compared and results are stored in parallel. + //0 is true +" if(range1[i] < range2[i])\n" +" result_buf[i] = 0;\n" +" else\n" +" result_buf[i] = 1;\n" +" }\n" +" else\n" +" result_buf[i] = !((i == size1) && (i != size2));\n" +"}\n"; + +template +inline bool dispatch_lexicographical_compare(InputIterator1 first1, + InputIterator1 last1, + InputIterator2 first2, + InputIterator2 last2, + command_queue &queue) +{ + const boost::compute::context &context = queue.get_context(); + + boost::shared_ptr cache = + program_cache::get_global_cache(context); + + size_t iterator_size1 = iterator_range_size(first1, last1); + size_t iterator_size2 = iterator_range_size(first2, last2); + size_t max_size = (std::max)(iterator_size1, iterator_size2); + + if(max_size == 0){ + return false; + } + + boost::compute::vector result_vector(max_size, context); + + + typedef typename std::iterator_traits::value_type value_type1; + typedef typename std::iterator_traits::value_type value_type2; + + // load (or create) lexicographical compare program + std::string cache_key = + std::string("__boost_lexicographical_compare") + + type_name() + type_name(); + + std::stringstream options; + options << " -DT1=" << type_name(); + options << " -DT2=" << type_name(); + + program lexicographical_compare_program = cache->get_or_build( + cache_key, options.str(), lexicographical_compare_source, context + ); + + kernel lexicographical_compare_kernel(lexicographical_compare_program, + "lexicographical_compare"); + + lexicographical_compare_kernel.set_arg(0, iterator_size1); + lexicographical_compare_kernel.set_arg(1, iterator_size2); + lexicographical_compare_kernel.set_arg(2, first1.get_buffer()); + lexicographical_compare_kernel.set_arg(3, first2.get_buffer()); + lexicographical_compare_kernel.set_arg(4, result_vector.get_buffer()); + + queue.enqueue_1d_range_kernel(lexicographical_compare_kernel, + 0, + max_size, + 0); + + return boost::compute::any_of(result_vector.begin(), + result_vector.end(), + _1 == 0, + queue); +} + +} // end detail namespace + +/// Checks if the first range [first1, last1) is lexicographically +/// less than the second range [first2, last2). +template +inline bool lexicographical_compare(InputIterator1 first1, + InputIterator1 last1, + InputIterator2 first2, + InputIterator2 last2, + command_queue &queue = system::default_queue()) +{ + return detail::dispatch_lexicographical_compare(first1, last1, first2, last2, queue); +} + +} // end compute namespace +} // end boost namespac diff --git a/3party/boost/boost/compute/algorithm/lower_bound.hpp b/3party/boost/boost/compute/algorithm/lower_bound.hpp new file mode 100644 index 0000000000..b2011c66ef --- /dev/null +++ b/3party/boost/boost/compute/algorithm/lower_bound.hpp @@ -0,0 +1,44 @@ +//---------------------------------------------------------------------------// +// Copyright (c) 2013 Kyle Lutz +// +// 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 +// +// See http://boostorg.github.com/compute for more information. +//---------------------------------------------------------------------------// + +#ifndef BOOST_COMPUTE_ALGORITHM_LOWER_BOUND_HPP +#define BOOST_COMPUTE_ALGORITHM_LOWER_BOUND_HPP + +#include +#include +#include +#include + +namespace boost { +namespace compute { + +/// Returns an iterator pointing to the first element in the sorted +/// range [\p first, \p last) that is not less than \p value. +/// +/// \see upper_bound() +template +inline InputIterator +lower_bound(InputIterator first, + InputIterator last, + const T &value, + command_queue &queue = system::default_queue()) +{ + using ::boost::compute::_1; + + InputIterator position = + detail::binary_find(first, last, _1 >= value, queue); + + return position; +} + +} // end compute namespace +} // end boost namespace + +#endif // BOOST_COMPUTE_ALGORITHM_LOWER_BOUND_HPP diff --git a/3party/boost/boost/compute/algorithm/max_element.hpp b/3party/boost/boost/compute/algorithm/max_element.hpp new file mode 100644 index 0000000000..55f2f7ffbf --- /dev/null +++ b/3party/boost/boost/compute/algorithm/max_element.hpp @@ -0,0 +1,74 @@ +//---------------------------------------------------------------------------// +// Copyright (c) 2013 Kyle Lutz +// +// 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 +// +// See http://boostorg.github.com/compute for more information. +//---------------------------------------------------------------------------// + +#ifndef BOOST_COMPUTE_ALGORITHM_MAX_ELEMENT_HPP +#define BOOST_COMPUTE_ALGORITHM_MAX_ELEMENT_HPP + +#include +#include +#include +#include + +namespace boost { +namespace compute { + +/// Returns an iterator pointing to the element in the range +/// [\p first, \p last) with the maximum value. +/// +/// \param first first element in the input range +/// \param last last element in the input range +/// \param compare comparison function object which returns true if the first +/// argument is less than (i.e. is ordered before) the second. +/// \param queue command queue to perform the operation +/// +/// For example, to find \c int2 value with maximum first component in given vector: +/// \code +/// // comparison function object +/// BOOST_COMPUTE_FUNCTION(bool, compare_first, (const int2_ &a, const int2_ &b), +/// { +/// return a.x < b.x; +/// }); +/// +/// // create vector +/// boost::compute::vector data = ... +/// +/// boost::compute::vector::iterator max = +/// boost::compute::max_element(data.begin(), data.end(), compare_first, queue); +/// \endcode +/// +/// \see min_element() +template +inline InputIterator +max_element(InputIterator first, + InputIterator last, + Compare compare, + command_queue &queue = system::default_queue()) +{ + return detail::find_extrema(first, last, compare, false, queue); +} + +///\overload +template +inline InputIterator +max_element(InputIterator first, + InputIterator last, + command_queue &queue = system::default_queue()) +{ + typedef typename std::iterator_traits::value_type value_type; + + return ::boost::compute::max_element( + first, last, ::boost::compute::less(), queue + ); +} + +} // end compute namespace +} // end boost namespace + +#endif // BOOST_COMPUTE_ALGORITHM_MAX_ELEMENT_HPP diff --git a/3party/boost/boost/compute/algorithm/merge.hpp b/3party/boost/boost/compute/algorithm/merge.hpp new file mode 100644 index 0000000000..875a283044 --- /dev/null +++ b/3party/boost/boost/compute/algorithm/merge.hpp @@ -0,0 +1,105 @@ +//---------------------------------------------------------------------------// +// Copyright (c) 2013 Kyle Lutz +// +// 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 +// +// See http://boostorg.github.com/compute for more information. +//---------------------------------------------------------------------------// + +#ifndef BOOST_COMPUTE_ALGORITHM_MERGE_HPP +#define BOOST_COMPUTE_ALGORITHM_MERGE_HPP + +#include +#include +#include +#include +#include +#include +#include + +namespace boost { +namespace compute { + +/// Merges the sorted values in the range [\p first1, \p last1) with the sorted +/// values in the range [\p first2, last2) and stores the result in the range +/// beginning at \p result. Values are compared using the \p comp function. If +/// no comparision function is given, \c less is used. +/// +/// \param first1 first element in the first range to merge +/// \param last1 last element in the first range to merge +/// \param first2 first element in the second range to merge +/// \param last2 last element in the second range to merge +/// \param result first element in the result range +/// \param comp comparison function (by default \c less) +/// \param queue command queue to perform the operation +/// +/// \return \c OutputIterator to the end of the result range +/// +/// \see inplace_merge() +template +inline OutputIterator merge(InputIterator1 first1, + InputIterator1 last1, + InputIterator2 first2, + InputIterator2 last2, + OutputIterator result, + Compare comp, + command_queue &queue = system::default_queue()) +{ + typedef typename std::iterator_traits::value_type input1_type; + typedef typename std::iterator_traits::value_type input2_type; + typedef typename std::iterator_traits::value_type output_type; + + const device &device = queue.get_device(); + + std::string cache_key = + std::string("__boost_merge_") + type_name() + "_" + + type_name() + "_" + type_name(); + boost::shared_ptr parameters = + detail::parameter_cache::get_global_cache(device); + + // default serial merge threshold depends on device type + size_t default_serial_merge_threshold = 32768; + if(device.type() & device::gpu) { + default_serial_merge_threshold = 2048; + } + + // loading serial merge threshold parameter + const size_t serial_merge_threshold = + parameters->get(cache_key, "serial_merge_threshold", + static_cast(default_serial_merge_threshold)); + + // choosing merge algorithm + const size_t total_count = + detail::iterator_range_size(first1, last1) + + detail::iterator_range_size(first2, last2); + // for small inputs serial merge turns out to outperform + // merge with merge path algorithm + if(total_count <= serial_merge_threshold){ + return detail::serial_merge(first1, last1, first2, last2, result, comp, queue); + } + return detail::merge_with_merge_path(first1, last1, first2, last2, result, comp, queue); +} + +/// \overload +template +inline OutputIterator merge(InputIterator1 first1, + InputIterator1 last1, + InputIterator2 first2, + InputIterator2 last2, + OutputIterator result, + command_queue &queue = system::default_queue()) +{ + typedef typename std::iterator_traits::value_type value_type; + less less_than; + return merge(first1, last1, first2, last2, result, less_than, queue); +} + +} // end compute namespace +} // end boost namespace + +#endif // BOOST_COMPUTE_ALGORITHM_MERGE_HPP diff --git a/3party/boost/boost/compute/algorithm/min_element.hpp b/3party/boost/boost/compute/algorithm/min_element.hpp new file mode 100644 index 0000000000..62744efb98 --- /dev/null +++ b/3party/boost/boost/compute/algorithm/min_element.hpp @@ -0,0 +1,74 @@ +//---------------------------------------------------------------------------// +// Copyright (c) 2013 Kyle Lutz +// +// 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 +// +// See http://boostorg.github.com/compute for more information. +//---------------------------------------------------------------------------// + +#ifndef BOOST_COMPUTE_ALGORITHM_MIN_ELEMENT_HPP +#define BOOST_COMPUTE_ALGORITHM_MIN_ELEMENT_HPP + +#include +#include +#include +#include + +namespace boost { +namespace compute { + +/// Returns an iterator pointing to the element in range +/// [\p first, \p last) with the minimum value. +/// +/// \param first first element in the input range +/// \param last last element in the input range +/// \param compare comparison function object which returns true if the first +/// argument is less than (i.e. is ordered before) the second. +/// \param queue command queue to perform the operation +/// +/// For example, to find \c int2 value with minimum first component in given vector: +/// \code +/// // comparison function object +/// BOOST_COMPUTE_FUNCTION(bool, compare_first, (const int2_ &a, const int2_ &b), +/// { +/// return a.x < b.x; +/// }); +/// +/// // create vector +/// boost::compute::vector data = ... +/// +/// boost::compute::vector::iterator min = +/// boost::compute::min_element(data.begin(), data.end(), compare_first, queue); +/// \endcode +/// +/// \see max_element() +template +inline InputIterator +min_element(InputIterator first, + InputIterator last, + Compare compare, + command_queue &queue = system::default_queue()) +{ + return detail::find_extrema(first, last, compare, true, queue); +} + +///\overload +template +inline InputIterator +min_element(InputIterator first, + InputIterator last, + command_queue &queue = system::default_queue()) +{ + typedef typename std::iterator_traits::value_type value_type; + + return ::boost::compute::min_element( + first, last, ::boost::compute::less(), queue + ); +} + +} // end compute namespace +} // end boost namespace + +#endif // BOOST_COMPUTE_ALGORITHM_MIN_ELEMENT_HPP diff --git a/3party/boost/boost/compute/algorithm/minmax_element.hpp b/3party/boost/boost/compute/algorithm/minmax_element.hpp new file mode 100644 index 0000000000..3f44c09eaf --- /dev/null +++ b/3party/boost/boost/compute/algorithm/minmax_element.hpp @@ -0,0 +1,70 @@ +//---------------------------------------------------------------------------// +// Copyright (c) 2013 Kyle Lutz +// +// 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 +// +// See http://boostorg.github.com/compute for more information. +//---------------------------------------------------------------------------// + +#ifndef BOOST_COMPUTE_ALGORITHM_MINMAX_ELEMENT_HPP +#define BOOST_COMPUTE_ALGORITHM_MINMAX_ELEMENT_HPP + +#include + +#include +#include +#include +#include + +namespace boost { +namespace compute { + +/// Returns a pair of iterators with the first pointing to the minimum +/// element and the second pointing to the maximum element in the range +/// [\p first, \p last). +/// +/// \param first first element in the input range +/// \param last last element in the input range +/// \param compare comparison function object which returns true if the first +/// argument is less than (i.e. is ordered before) the second. +/// \param queue command queue to perform the operation +/// +/// \see max_element(), min_element() +template +inline std::pair +minmax_element(InputIterator first, + InputIterator last, + Compare compare, + command_queue &queue = system::default_queue()) +{ + if(first == last){ + // empty range + return std::make_pair(first, first); + } + + return std::make_pair(min_element(first, last, compare, queue), + max_element(first, last, compare, queue)); +} + +///\overload +template +inline std::pair +minmax_element(InputIterator first, + InputIterator last, + command_queue &queue = system::default_queue()) +{ + if(first == last){ + // empty range + return std::make_pair(first, first); + } + + return std::make_pair(min_element(first, last, queue), + max_element(first, last, queue)); +} + +} // end compute namespace +} // end boost namespace + +#endif // BOOST_COMPUTE_ALGORITHM_MINMAX_ELEMENT_HPP diff --git a/3party/boost/boost/compute/algorithm/mismatch.hpp b/3party/boost/boost/compute/algorithm/mismatch.hpp new file mode 100644 index 0000000000..e7db883004 --- /dev/null +++ b/3party/boost/boost/compute/algorithm/mismatch.hpp @@ -0,0 +1,89 @@ +//---------------------------------------------------------------------------// +// Copyright (c) 2013 Kyle Lutz +// +// 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 +// +// See http://boostorg.github.com/compute for more information. +//---------------------------------------------------------------------------// + +#ifndef BOOST_COMPUTE_ALGORITHM_MISMATCH_HPP +#define BOOST_COMPUTE_ALGORITHM_MISMATCH_HPP + +#include +#include + +#include +#include +#include +#include +#include +#include +#include + +namespace boost { +namespace compute { + +/// Returns a pair of iterators pointing to the first position where the +/// range [\p first1, \p last1) and the range starting at \p first2 +/// differ. +template +inline std::pair +mismatch(InputIterator1 first1, + InputIterator1 last1, + InputIterator2 first2, + command_queue &queue = system::default_queue()) +{ + typedef typename std::iterator_traits::value_type value_type; + + ::boost::compute::equal_to op; + + InputIterator2 last2 = first2 + std::distance(first1, last1); + + InputIterator1 iter = + boost::get<0>( + ::boost::compute::find( + ::boost::compute::make_transform_iterator( + ::boost::compute::make_zip_iterator( + boost::make_tuple(first1, first2) + ), + detail::unpack(op) + ), + ::boost::compute::make_transform_iterator( + ::boost::compute::make_zip_iterator( + boost::make_tuple(last1, last2) + ), + detail::unpack(op) + ), + false, + queue + ).base().get_iterator_tuple() + ); + + return std::make_pair(iter, first2 + std::distance(first1, iter)); +} + +/// \overload +template +inline std::pair +mismatch(InputIterator1 first1, + InputIterator1 last1, + InputIterator2 first2, + InputIterator2 last2, + command_queue &queue = system::default_queue()) +{ + if(std::distance(first1, last1) < std::distance(first2, last2)){ + return ::boost::compute::mismatch(first1, last1, first2, queue); + } + else { + return ::boost::compute::mismatch( + first1, first1 + std::distance(first2, last2), first2, queue + ); + } +} + +} // end compute namespace +} // end boost namespace + +#endif // BOOST_COMPUTE_ALGORITHM_MISMATCH_HPP diff --git a/3party/boost/boost/compute/algorithm/next_permutation.hpp b/3party/boost/boost/compute/algorithm/next_permutation.hpp new file mode 100644 index 0000000000..e81fbd2ee8 --- /dev/null +++ b/3party/boost/boost/compute/algorithm/next_permutation.hpp @@ -0,0 +1,170 @@ +//---------------------------------------------------------------------------// +// Copyright (c) 2014 Roshan +// +// 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 +// +// See http://boostorg.github.com/compute for more information. +//---------------------------------------------------------------------------// + +#ifndef BOOST_COMPUTE_ALGORITHM_NEXT_PERMUTATION_HPP +#define BOOST_COMPUTE_ALGORITHM_NEXT_PERMUTATION_HPP + +#include + +#include +#include +#include +#include + +namespace boost { +namespace compute { +namespace detail { + +/// +/// \brief Helper function for next_permutation +/// +/// To find rightmost element which is smaller +/// than its next element +/// +template +inline InputIterator next_permutation_helper(InputIterator first, + InputIterator last, + command_queue &queue) +{ + typedef typename std::iterator_traits::value_type value_type; + + size_t count = detail::iterator_range_size(first, last); + if(count == 0 || count == 1){ + return last; + } + count = count - 1; + const context &context = queue.get_context(); + + detail::meta_kernel k("next_permutation"); + size_t index_arg = k.add_arg(memory_object::global_memory, "index"); + atomic_max atomic_max_int; + + k << k.decl("i") << " = get_global_id(0);\n" + << k.decl("cur_value") << "=" + << first[k.var("i")] << ";\n" + << k.decl("next_value") << "=" + << first[k.expr("i+1")] << ";\n" + << "if(cur_value < next_value){\n" + << " " << atomic_max_int(k.var("index"), k.var("i")) << ";\n" + << "}\n"; + + kernel kernel = k.compile(context); + + scalar index(context); + kernel.set_arg(index_arg, index.get_buffer()); + + index.write(static_cast(-1), queue); + + queue.enqueue_1d_range_kernel(kernel, 0, count, 0); + + int result = static_cast(index.read(queue)); + if(result == -1) return last; + else return first + result; +} + +/// +/// \brief Helper function for next_permutation +/// +/// To find the smallest element to the right of the element found above +/// that is greater than it +/// +template +inline InputIterator np_ceiling(InputIterator first, + InputIterator last, + ValueType value, + command_queue &queue) +{ + typedef typename std::iterator_traits::value_type value_type; + + size_t count = detail::iterator_range_size(first, last); + if(count == 0){ + return last; + } + const context &context = queue.get_context(); + + detail::meta_kernel k("np_ceiling"); + size_t index_arg = k.add_arg(memory_object::global_memory, "index"); + size_t value_arg = k.add_arg(memory_object::private_memory, "value"); + atomic_max atomic_max_int; + + k << k.decl("i") << " = get_global_id(0);\n" + << k.decl("cur_value") << "=" + << first[k.var("i")] << ";\n" + << "if(cur_value <= " << first[k.expr("*index")] + << " && cur_value > value){\n" + << " " << atomic_max_int(k.var("index"), k.var("i")) << ";\n" + << "}\n"; + + kernel kernel = k.compile(context); + + scalar index(context); + kernel.set_arg(index_arg, index.get_buffer()); + + index.write(static_cast(0), queue); + + kernel.set_arg(value_arg, value); + + queue.enqueue_1d_range_kernel(kernel, 0, count, 0); + + int result = static_cast(index.read(queue)); + return first + result; +} + +} // end detail namespace + +/// +/// \brief Permutation generating algorithm +/// +/// Transforms the range [first, last) into the next permutation from the +/// set of all permutations arranged in lexicographic order +/// \return Boolean value signifying if the last permutation was crossed +/// and the range was reset +/// +/// \param first Iterator pointing to start of range +/// \param last Iterator pointing to end of range +/// \param queue Queue on which to execute +/// +template +inline bool next_permutation(InputIterator first, + InputIterator last, + command_queue &queue = system::default_queue()) +{ + typedef typename std::iterator_traits::value_type value_type; + + if(first == last) return false; + + InputIterator first_element = + detail::next_permutation_helper(first, last, queue); + + if(first_element == last) + { + reverse(first, last, queue); + return false; + } + + value_type first_value = first_element.read(queue); + + InputIterator ceiling_element = + detail::np_ceiling(first_element + 1, last, first_value, queue); + + value_type ceiling_value = ceiling_element.read(queue); + + first_element.write(ceiling_value, queue); + ceiling_element.write(first_value, queue); + + reverse(first_element + 1, last, queue); + + return true; +} + +} // end compute namespace +} // end boost namespace + +#endif // BOOST_COMPUTE_ALGORITHM_NEXT_PERMUTATION_HPP diff --git a/3party/boost/boost/compute/algorithm/none_of.hpp b/3party/boost/boost/compute/algorithm/none_of.hpp new file mode 100644 index 0000000000..c25dd12a87 --- /dev/null +++ b/3party/boost/boost/compute/algorithm/none_of.hpp @@ -0,0 +1,36 @@ +//---------------------------------------------------------------------------// +// Copyright (c) 2013 Kyle Lutz +// +// 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 +// +// See http://boostorg.github.com/compute for more information. +//---------------------------------------------------------------------------// + +#ifndef BOOST_COMPUTE_ALGORITHM_NONE_OF_HPP +#define BOOST_COMPUTE_ALGORITHM_NONE_OF_HPP + +#include +#include + +namespace boost { +namespace compute { + +/// Returns \c true if \p predicate returns \c true for none of the elements in +/// the range [\p first, \p last). +/// +/// \see all_of(), any_of() +template +inline bool none_of(InputIterator first, + InputIterator last, + UnaryPredicate predicate, + command_queue &queue = system::default_queue()) +{ + return ::boost::compute::find_if(first, last, predicate, queue) == last; +} + +} // end compute namespace +} // end boost namespace + +#endif // BOOST_COMPUTE_ALGORITHM_NONE_OF_HPP diff --git a/3party/boost/boost/compute/algorithm/nth_element.hpp b/3party/boost/boost/compute/algorithm/nth_element.hpp new file mode 100644 index 0000000000..68f7a3dbc0 --- /dev/null +++ b/3party/boost/boost/compute/algorithm/nth_element.hpp @@ -0,0 +1,87 @@ +//---------------------------------------------------------------------------// +// Copyright (c) 2013 Kyle Lutz +// +// 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 +// +// See http://boostorg.github.com/compute for more information. +//---------------------------------------------------------------------------// + +#ifndef BOOST_COMPUTE_ALGORITHM_NTH_ELEMENT_HPP +#define BOOST_COMPUTE_ALGORITHM_NTH_ELEMENT_HPP + +#include +#include +#include +#include +#include +#include + +namespace boost { +namespace compute { + +/// Rearranges the elements in the range [\p first, \p last) such that +/// the \p nth element would be in that position in a sorted sequence. +template +inline void nth_element(Iterator first, + Iterator nth, + Iterator last, + Compare compare, + command_queue &queue = system::default_queue()) +{ + if(nth == last) return; + + typedef typename std::iterator_traits::value_type value_type; + + while(1) + { + value_type value = nth.read(queue); + + using boost::compute::placeholders::_1; + Iterator new_nth = partition( + first, last, ::boost::compute::bind(compare, _1, value), queue + ); + + Iterator old_nth = find(new_nth, last, value, queue); + + value_type new_value = new_nth.read(queue); + + fill_n(new_nth, 1, value, queue); + fill_n(old_nth, 1, new_value, queue); + + new_value = nth.read(queue); + + if(value == new_value) break; + + if(std::distance(first, nth) < std::distance(first, new_nth)) + { + last = new_nth; + } + else + { + first = new_nth; + } + } +} + +/// \overload +template +inline void nth_element(Iterator first, + Iterator nth, + Iterator last, + command_queue &queue = system::default_queue()) +{ + if(nth == last) return; + + typedef typename std::iterator_traits::value_type value_type; + + less less_than; + + return nth_element(first, nth, last, less_than, queue); +} + +} // end compute namespace +} // end boost namespace + +#endif // BOOST_COMPUTE_ALGORITHM_NTH_ELEMENT_HPP diff --git a/3party/boost/boost/compute/algorithm/partial_sum.hpp b/3party/boost/boost/compute/algorithm/partial_sum.hpp new file mode 100644 index 0000000000..d440369a5a --- /dev/null +++ b/3party/boost/boost/compute/algorithm/partial_sum.hpp @@ -0,0 +1,37 @@ +//---------------------------------------------------------------------------// +// Copyright (c) 2013 Kyle Lutz +// +// 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 +// +// See http://boostorg.github.com/compute for more information. +//---------------------------------------------------------------------------// + +#ifndef BOOST_COMPUTE_ALGORITHM_PARTIAL_SUM_HPP +#define BOOST_COMPUTE_ALGORITHM_PARTIAL_SUM_HPP + +#include +#include +#include + +namespace boost { +namespace compute { + +/// Calculates the cumulative sum of the elements in the range [\p first, +/// \p last) and writes the resulting values to the range beginning at +/// \p result. +template +inline OutputIterator +partial_sum(InputIterator first, + InputIterator last, + OutputIterator result, + command_queue &queue = system::default_queue()) +{ + return ::boost::compute::inclusive_scan(first, last, result, queue); +} + +} // end compute namespace +} // end boost namespace + +#endif // BOOST_COMPUTE_ALGORITHM_PARTIAL_SUM_HPP diff --git a/3party/boost/boost/compute/algorithm/partition.hpp b/3party/boost/boost/compute/algorithm/partition.hpp new file mode 100644 index 0000000000..7860350e0d --- /dev/null +++ b/3party/boost/boost/compute/algorithm/partition.hpp @@ -0,0 +1,39 @@ +//---------------------------------------------------------------------------// +// Copyright (c) 2013 Kyle Lutz +// +// 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 +// +// See http://boostorg.github.com/compute for more information. +//---------------------------------------------------------------------------// + +#ifndef BOOST_COMPUTE_ALGORITHM_PARTITION_HPP +#define BOOST_COMPUTE_ALGORITHM_PARTITION_HPP + +#include +#include +#include + +namespace boost { +namespace compute { + +/// +/// Partitions the elements in the range [\p first, \p last) according to +/// \p predicate. Order of the elements need not be preserved. +/// +/// \see is_partitioned() and stable_partition() +/// +template +inline Iterator partition(Iterator first, + Iterator last, + UnaryPredicate predicate, + command_queue &queue = system::default_queue()) +{ + return stable_partition(first, last, predicate, queue); +} + +} // end compute namespace +} // end boost namespace + +#endif // BOOST_COMPUTE_ALGORITHM_PARTITION_HPP diff --git a/3party/boost/boost/compute/algorithm/partition_copy.hpp b/3party/boost/boost/compute/algorithm/partition_copy.hpp new file mode 100644 index 0000000000..80a2c6475f --- /dev/null +++ b/3party/boost/boost/compute/algorithm/partition_copy.hpp @@ -0,0 +1,63 @@ +//---------------------------------------------------------------------------// +// Copyright (c) 2013 Kyle Lutz +// +// 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 +// +// See http://boostorg.github.com/compute for more information. +//---------------------------------------------------------------------------// + +#ifndef BOOST_COMPUTE_ALGORITHM_PARTITION_COPY_HPP +#define BOOST_COMPUTE_ALGORITHM_PARTITION_COPY_HPP + +#include +#include +#include +#include + +namespace boost { +namespace compute { + +/// Copies all of the elements in the range [\p first, \p last) for which +/// \p predicate returns \c true to the range beginning at \p first_true +/// and all of the elements for which \p predicate returns \c false to +/// the range beginning at \p first_false. +/// +/// \see partition() +template +inline std::pair +partition_copy(InputIterator first, + InputIterator last, + OutputIterator1 first_true, + OutputIterator2 first_false, + UnaryPredicate predicate, + command_queue &queue = system::default_queue()) +{ + // copy true values + OutputIterator1 last_true = + ::boost::compute::copy_if(first, + last, + first_true, + predicate, + queue); + + // copy false values + OutputIterator2 last_false = + ::boost::compute::copy_if(first, + last, + first_false, + not1(predicate), + queue); + + // return iterators to the end of the true and the false ranges + return std::make_pair(last_true, last_false); +} + +} // end compute namespace +} // end boost namespace + +#endif // BOOST_COMPUTE_ALGORITHM_PARTITION_COPY_HPP diff --git a/3party/boost/boost/compute/algorithm/partition_point.hpp b/3party/boost/boost/compute/algorithm/partition_point.hpp new file mode 100644 index 0000000000..3cc2bc0ca6 --- /dev/null +++ b/3party/boost/boost/compute/algorithm/partition_point.hpp @@ -0,0 +1,46 @@ +//---------------------------------------------------------------------------// +// Copyright (c) 2014 Roshan +// +// 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 +// +// See http://boostorg.github.com/compute for more information. +//---------------------------------------------------------------------------// + +#ifndef BOOST_COMPUTE_ALGORITHM_PARTITION_POINT_HPP +#define BOOST_COMPUTE_ALGORITHM_PARTITION_POINT_HPP + +#include +#include +#include + +namespace boost { +namespace compute { + +/// +/// \brief Partition point algorithm +/// +/// Finds the end of true values in the partitioned range [first, last) +/// \return Iterator pointing to end of true values +/// +/// \param first Iterator pointing to start of range +/// \param last Iterator pointing to end of range +/// \param predicate Unary predicate to be applied on each element +/// \param queue Queue on which to execute +/// +/// \see partition() and stable_partition() +/// +template +inline InputIterator partition_point(InputIterator first, + InputIterator last, + UnaryPredicate predicate, + command_queue &queue = system::default_queue()) +{ + return detail::binary_find(first, last, not1(predicate), queue); +} + +} // end compute namespace +} // end boost namespace + +#endif // BOOST_COMPUTE_ALGORITHM_PARTITION_POINT_HPP diff --git a/3party/boost/boost/compute/algorithm/prev_permutation.hpp b/3party/boost/boost/compute/algorithm/prev_permutation.hpp new file mode 100644 index 0000000000..03c01bf8f4 --- /dev/null +++ b/3party/boost/boost/compute/algorithm/prev_permutation.hpp @@ -0,0 +1,170 @@ +//---------------------------------------------------------------------------// +// Copyright (c) 2014 Roshan +// +// 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 +// +// See http://boostorg.github.com/compute for more information. +//---------------------------------------------------------------------------// + +#ifndef BOOST_COMPUTE_ALGORITHM_PREV_PERMUTATION_HPP +#define BOOST_COMPUTE_ALGORITHM_PREV_PERMUTATION_HPP + +#include + +#include +#include +#include +#include + +namespace boost { +namespace compute { +namespace detail { + +/// +/// \brief Helper function for prev_permutation +/// +/// To find rightmost element which is greater +/// than its next element +/// +template +inline InputIterator prev_permutation_helper(InputIterator first, + InputIterator last, + command_queue &queue) +{ + typedef typename std::iterator_traits::value_type value_type; + + size_t count = detail::iterator_range_size(first, last); + if(count == 0 || count == 1){ + return last; + } + count = count - 1; + const context &context = queue.get_context(); + + detail::meta_kernel k("prev_permutation"); + size_t index_arg = k.add_arg(memory_object::global_memory, "index"); + atomic_max atomic_max_int; + + k << k.decl("i") << " = get_global_id(0);\n" + << k.decl("cur_value") << "=" + << first[k.var("i")] << ";\n" + << k.decl("next_value") << "=" + << first[k.expr("i+1")] << ";\n" + << "if(cur_value > next_value){\n" + << " " << atomic_max_int(k.var("index"), k.var("i")) << ";\n" + << "}\n"; + + kernel kernel = k.compile(context); + + scalar index(context); + kernel.set_arg(index_arg, index.get_buffer()); + + index.write(static_cast(-1), queue); + + queue.enqueue_1d_range_kernel(kernel, 0, count, 0); + + int result = static_cast(index.read(queue)); + if(result == -1) return last; + else return first + result; +} + +/// +/// \brief Helper function for prev_permutation +/// +/// To find the largest element to the right of the element found above +/// that is smaller than it +/// +template +inline InputIterator pp_floor(InputIterator first, + InputIterator last, + ValueType value, + command_queue &queue) +{ + typedef typename std::iterator_traits::value_type value_type; + + size_t count = detail::iterator_range_size(first, last); + if(count == 0){ + return last; + } + const context &context = queue.get_context(); + + detail::meta_kernel k("pp_floor"); + size_t index_arg = k.add_arg(memory_object::global_memory, "index"); + size_t value_arg = k.add_arg(memory_object::private_memory, "value"); + atomic_max atomic_max_int; + + k << k.decl("i") << " = get_global_id(0);\n" + << k.decl("cur_value") << "=" + << first[k.var("i")] << ";\n" + << "if(cur_value >= " << first[k.expr("*index")] + << " && cur_value < value){\n" + << " " << atomic_max_int(k.var("index"), k.var("i")) << ";\n" + << "}\n"; + + kernel kernel = k.compile(context); + + scalar index(context); + kernel.set_arg(index_arg, index.get_buffer()); + + index.write(static_cast(0), queue); + + kernel.set_arg(value_arg, value); + + queue.enqueue_1d_range_kernel(kernel, 0, count, 0); + + int result = static_cast(index.read(queue)); + return first + result; +} + +} // end detail namespace + +/// +/// \brief Permutation generating algorithm +/// +/// Transforms the range [first, last) into the previous permutation from +/// the set of all permutations arranged in lexicographic order +/// \return Boolean value signifying if the first permutation was crossed +/// and the range was reset +/// +/// \param first Iterator pointing to start of range +/// \param last Iterator pointing to end of range +/// \param queue Queue on which to execute +/// +template +inline bool prev_permutation(InputIterator first, + InputIterator last, + command_queue &queue = system::default_queue()) +{ + typedef typename std::iterator_traits::value_type value_type; + + if(first == last) return false; + + InputIterator first_element = + detail::prev_permutation_helper(first, last, queue); + + if(first_element == last) + { + reverse(first, last, queue); + return false; + } + + value_type first_value = first_element.read(queue); + + InputIterator ceiling_element = + detail::pp_floor(first_element + 1, last, first_value, queue); + + value_type ceiling_value = ceiling_element.read(queue); + + first_element.write(ceiling_value, queue); + ceiling_element.write(first_value, queue); + + reverse(first_element + 1, last, queue); + + return true; +} + +} // end compute namespace +} // end boost namespace + +#endif // BOOST_COMPUTE_ALGORITHM_PREV_PERMUTATION_HPP diff --git a/3party/boost/boost/compute/algorithm/random_shuffle.hpp b/3party/boost/boost/compute/algorithm/random_shuffle.hpp new file mode 100644 index 0000000000..7d2d46a133 --- /dev/null +++ b/3party/boost/boost/compute/algorithm/random_shuffle.hpp @@ -0,0 +1,75 @@ +//---------------------------------------------------------------------------// +// Copyright (c) 2013 Kyle Lutz +// +// 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 +// +// See http://boostorg.github.com/compute for more information. +//---------------------------------------------------------------------------// + +#ifndef BOOST_COMPUTE_ALGORITHM_RANDOM_SHUFFLE_HPP +#define BOOST_COMPUTE_ALGORITHM_RANDOM_SHUFFLE_HPP + +#include +#include + +#include + +#include +#include +#include +#include +#include +#include + +namespace boost { +namespace compute { + +/// Randomly shuffles the elements in the range [\p first, \p last). +/// +/// \see scatter() +template +inline void random_shuffle(Iterator first, + Iterator last, + command_queue &queue = system::default_queue()) +{ + typedef typename std::iterator_traits::value_type value_type; + + size_t count = detail::iterator_range_size(first, last); + if(count == 0){ + return; + } + + // generate shuffled indices on the host + std::vector random_indices(count); + boost::iota(random_indices, 0); + std::random_shuffle(random_indices.begin(), random_indices.end()); + + // copy random indices to the device + const context &context = queue.get_context(); + vector indices(count, context); + ::boost::compute::copy(random_indices.begin(), + random_indices.end(), + indices.begin(), + queue); + + // make a copy of the values on the device + vector tmp(count, context); + ::boost::compute::copy(first, + last, + tmp.begin(), + queue); + + // write values to their new locations + ::boost::compute::scatter(tmp.begin(), + tmp.end(), + indices.begin(), + first, + queue); +} + +} // end compute namespace +} // end boost namespace + +#endif // BOOST_COMPUTE_ALGORITHM_RANDOM_SHUFFLE_HPP diff --git a/3party/boost/boost/compute/algorithm/reduce.hpp b/3party/boost/boost/compute/algorithm/reduce.hpp new file mode 100644 index 0000000000..19d070019f --- /dev/null +++ b/3party/boost/boost/compute/algorithm/reduce.hpp @@ -0,0 +1,301 @@ +//---------------------------------------------------------------------------// +// Copyright (c) 2013 Kyle Lutz +// +// 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 +// +// See http://boostorg.github.com/compute for more information. +//---------------------------------------------------------------------------// + +#ifndef BOOST_COMPUTE_ALGORITHM_REDUCE_HPP +#define BOOST_COMPUTE_ALGORITHM_REDUCE_HPP + +#include + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +namespace boost { +namespace compute { +namespace detail { + +template +size_t reduce(InputIterator first, + size_t count, + OutputIterator result, + size_t block_size, + BinaryFunction function, + command_queue &queue) +{ + typedef typename + std::iterator_traits::value_type + input_type; + typedef typename + boost::compute::result_of::type + result_type; + + const context &context = queue.get_context(); + size_t block_count = count / 2 / block_size; + size_t total_block_count = + static_cast(std::ceil(float(count) / 2.f / float(block_size))); + + if(block_count != 0){ + meta_kernel k("block_reduce"); + size_t output_arg = k.add_arg(memory_object::global_memory, "output"); + size_t block_arg = k.add_arg(memory_object::local_memory, "block"); + + k << + "const uint gid = get_global_id(0);\n" << + "const uint lid = get_local_id(0);\n" << + + // copy values to local memory + "block[lid] = " << + function(first[k.make_var("gid*2+0")], + first[k.make_var("gid*2+1")]) << ";\n" << + + // perform reduction + "for(uint i = 1; i < " << uint_(block_size) << "; i <<= 1){\n" << + " barrier(CLK_LOCAL_MEM_FENCE);\n" << + " uint mask = (i << 1) - 1;\n" << + " if((lid & mask) == 0){\n" << + " block[lid] = " << + function(k.expr("block[lid]"), + k.expr("block[lid+i]")) << ";\n" << + " }\n" << + "}\n" << + + // write block result to global output + "if(lid == 0)\n" << + " output[get_group_id(0)] = block[0];\n"; + + kernel kernel = k.compile(context); + kernel.set_arg(output_arg, result.get_buffer()); + kernel.set_arg(block_arg, local_buffer(block_size)); + + queue.enqueue_1d_range_kernel(kernel, + 0, + block_count * block_size, + block_size); + } + + // serially reduce any leftovers + if(block_count * block_size * 2 < count){ + size_t last_block_start = block_count * block_size * 2; + + meta_kernel k("extra_serial_reduce"); + size_t count_arg = k.add_arg("count"); + size_t offset_arg = k.add_arg("offset"); + size_t output_arg = k.add_arg(memory_object::global_memory, "output"); + size_t output_offset_arg = k.add_arg("output_offset"); + + k << + k.decl("result") << " = \n" << + first[k.expr("offset")] << ";\n" << + "for(uint i = offset + 1; i < count; i++)\n" << + " result = " << + function(k.var("result"), + first[k.var("i")]) << ";\n" << + "output[output_offset] = result;\n"; + + kernel kernel = k.compile(context); + kernel.set_arg(count_arg, static_cast(count)); + kernel.set_arg(offset_arg, static_cast(last_block_start)); + kernel.set_arg(output_arg, result.get_buffer()); + kernel.set_arg(output_offset_arg, static_cast(block_count)); + + queue.enqueue_task(kernel); + } + + return total_block_count; +} + +template +inline vector< + typename boost::compute::result_of< + BinaryFunction( + typename std::iterator_traits::value_type, + typename std::iterator_traits::value_type + ) + >::type +> +block_reduce(InputIterator first, + size_t count, + size_t block_size, + BinaryFunction function, + command_queue &queue) +{ + typedef typename + std::iterator_traits::value_type + input_type; + typedef typename + boost::compute::result_of::type + result_type; + + const context &context = queue.get_context(); + size_t total_block_count = + static_cast(std::ceil(float(count) / 2.f / float(block_size))); + vector result_vector(total_block_count, context); + + reduce(first, count, result_vector.begin(), block_size, function, queue); + + return result_vector; +} + +template +inline void generic_reduce(InputIterator first, + InputIterator last, + OutputIterator result, + BinaryFunction function, + command_queue &queue) +{ + typedef typename + std::iterator_traits::value_type + input_type; + typedef typename + boost::compute::result_of::type + result_type; + + const device &device = queue.get_device(); + const context &context = queue.get_context(); + + size_t count = detail::iterator_range_size(first, last); + + if(device.type() & device::cpu){ + array value(context); + detail::reduce_on_cpu(first, last, value.begin(), function, queue); + boost::compute::copy_n(value.begin(), 1, result, queue); + } + else { + size_t block_size = 256; + + // first pass + vector results = detail::block_reduce(first, + count, + block_size, + function, + queue); + + if(results.size() > 1){ + detail::inplace_reduce(results.begin(), + results.end(), + function, + queue); + } + + boost::compute::copy_n(results.begin(), 1, result, queue); + } +} + +template +inline void dispatch_reduce(InputIterator first, + InputIterator last, + OutputIterator result, + const plus &function, + command_queue &queue) +{ + const context &context = queue.get_context(); + const device &device = queue.get_device(); + + // reduce to temporary buffer on device + array value(context); + if(device.type() & device::cpu){ + detail::reduce_on_cpu(first, last, value.begin(), function, queue); + } + else { + reduce_on_gpu(first, last, value.begin(), function, queue); + } + + // copy to result iterator + copy_n(value.begin(), 1, result, queue); +} + +template +inline void dispatch_reduce(InputIterator first, + InputIterator last, + OutputIterator result, + BinaryFunction function, + command_queue &queue) +{ + generic_reduce(first, last, result, function, queue); +} + +} // end detail namespace + +/// Returns the result of applying \p function to the elements in the +/// range [\p first, \p last). +/// +/// If no function is specified, \c plus will be used. +/// +/// \param first first element in the input range +/// \param last last element in the input range +/// \param result iterator pointing to the output +/// \param function binary reduction function +/// \param queue command queue to perform the operation +/// +/// The \c reduce() algorithm assumes that the binary reduction function is +/// associative. When used with non-associative functions the result may +/// be non-deterministic and vary in precision. Notably this affects the +/// \c plus() function as floating-point addition is not associative +/// and may produce slightly different results than a serial algorithm. +/// +/// This algorithm supports both host and device iterators for the +/// result argument. This allows for values to be reduced and copied +/// to the host all with a single function call. +/// +/// For example, to calculate the sum of the values in a device vector and +/// copy the result to a value on the host: +/// +/// \snippet test/test_reduce.cpp sum_int +/// +/// Note that while the the \c reduce() algorithm is conceptually identical to +/// the \c accumulate() algorithm, its implementation is substantially more +/// efficient on parallel hardware. For more information, see the documentation +/// on the \c accumulate() algorithm. +/// +/// \see accumulate() +template +inline void reduce(InputIterator first, + InputIterator last, + OutputIterator result, + BinaryFunction function, + command_queue &queue = system::default_queue()) +{ + if(first == last){ + return; + } + + detail::dispatch_reduce(first, last, result, function, queue); +} + +/// \overload +template +inline void reduce(InputIterator first, + InputIterator last, + OutputIterator result, + command_queue &queue = system::default_queue()) +{ + typedef typename std::iterator_traits::value_type T; + + if(first == last){ + return; + } + + detail::dispatch_reduce(first, last, result, plus(), queue); +} + +} // end compute namespace +} // end boost namespace + +#endif // BOOST_COMPUTE_ALGORITHM_REDUCE_HPP diff --git a/3party/boost/boost/compute/algorithm/reduce_by_key.hpp b/3party/boost/boost/compute/algorithm/reduce_by_key.hpp new file mode 100644 index 0000000000..87c73e887f --- /dev/null +++ b/3party/boost/boost/compute/algorithm/reduce_by_key.hpp @@ -0,0 +1,118 @@ +//---------------------------------------------------------------------------// +// Copyright (c) 2015 Jakub Szuppe +// +// 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 +// +// See http://boostorg.github.com/compute for more information. +//---------------------------------------------------------------------------// + +#ifndef BOOST_COMPUTE_ALGORITHM_REDUCE_BY_KEY_HPP +#define BOOST_COMPUTE_ALGORITHM_REDUCE_BY_KEY_HPP + +#include +#include + +#include +#include +#include +#include +#include + +namespace boost { +namespace compute { + +/// The \c reduce_by_key() algorithm performs reduction for each contiguous +/// subsequence of values determinate by equivalent keys. +/// +/// Returns a pair of iterators at the end of the ranges [\p keys_result, keys_result_last) +/// and [\p values_result, \p values_result_last). +/// +/// If no function is specified, \c plus will be used. +/// If no predicate is specified, \c equal_to will be used. +/// +/// \param keys_first the first key +/// \param keys_last the last key +/// \param values_first the first input value +/// \param keys_result iterator pointing to the key output +/// \param values_result iterator pointing to the reduced value output +/// \param function binary reduction function +/// \param predicate binary predicate which returns true only if two keys are equal +/// \param queue command queue to perform the operation +/// +/// The \c reduce_by_key() algorithm assumes that the binary reduction function +/// is associative. When used with non-associative functions the result may +/// be non-deterministic and vary in precision. Notably this affects the +/// \c plus() function as floating-point addition is not associative +/// and may produce slightly different results than a serial algorithm. +/// +/// For example, to calculate the sum of the values for each key: +/// +/// \snippet test/test_reduce_by_key.cpp reduce_by_key_int +/// +/// \see reduce() +template +inline std::pair +reduce_by_key(InputKeyIterator keys_first, + InputKeyIterator keys_last, + InputValueIterator values_first, + OutputKeyIterator keys_result, + OutputValueIterator values_result, + BinaryFunction function, + BinaryPredicate predicate, + command_queue &queue = system::default_queue()) +{ + return detail::dispatch_reduce_by_key(keys_first, keys_last, values_first, + keys_result, values_result, + function, predicate, + queue); +} + +/// \overload +template +inline std::pair +reduce_by_key(InputKeyIterator keys_first, + InputKeyIterator keys_last, + InputValueIterator values_first, + OutputKeyIterator keys_result, + OutputValueIterator values_result, + BinaryFunction function, + command_queue &queue = system::default_queue()) +{ + typedef typename std::iterator_traits::value_type key_type; + + return reduce_by_key(keys_first, keys_last, values_first, + keys_result, values_result, + function, equal_to(), + queue); +} + +/// \overload +template +inline std::pair +reduce_by_key(InputKeyIterator keys_first, + InputKeyIterator keys_last, + InputValueIterator values_first, + OutputKeyIterator keys_result, + OutputValueIterator values_result, + command_queue &queue = system::default_queue()) +{ + typedef typename std::iterator_traits::value_type key_type; + typedef typename std::iterator_traits::value_type value_type; + + return reduce_by_key(keys_first, keys_last, values_first, + keys_result, values_result, + plus(), equal_to(), + queue); +} + +} // end compute namespace +} // end boost namespace + +#endif // BOOST_COMPUTE_ALGORITHM_REDUCE_BY_KEY_HPP diff --git a/3party/boost/boost/compute/algorithm/remove.hpp b/3party/boost/boost/compute/algorithm/remove.hpp new file mode 100644 index 0000000000..98feb1f9d8 --- /dev/null +++ b/3party/boost/boost/compute/algorithm/remove.hpp @@ -0,0 +1,54 @@ +//---------------------------------------------------------------------------// +// Copyright (c) 2013 Kyle Lutz +// +// 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 +// +// See http://boostorg.github.com/compute for more information. +//---------------------------------------------------------------------------// + +#ifndef BOOST_COMPUTE_ALGORITHM_REMOVE_HPP +#define BOOST_COMPUTE_ALGORITHM_REMOVE_HPP + +#include +#include +#include +#include + +namespace boost { +namespace compute { + +/// Removes each element equal to \p value in the range [\p first, +/// \p last). +/// +/// \see remove_if() +template +inline Iterator remove(Iterator first, + Iterator last, + const T &value, + command_queue &queue = system::default_queue()) +{ + typedef typename std::iterator_traits::value_type value_type; + + using ::boost::compute::_1; + using ::boost::compute::lambda::all; + + if(vector_size::value == 1){ + return ::boost::compute::remove_if(first, + last, + _1 == value, + queue); + } + else { + return ::boost::compute::remove_if(first, + last, + all(_1 == value), + queue); + } +} + +} // end compute namespace +} // end boost namespace + +#endif // BOOST_COMPUTE_ALGORITHM_REMOVE_HPP diff --git a/3party/boost/boost/compute/algorithm/remove_if.hpp b/3party/boost/boost/compute/algorithm/remove_if.hpp new file mode 100644 index 0000000000..5e416bef88 --- /dev/null +++ b/3party/boost/boost/compute/algorithm/remove_if.hpp @@ -0,0 +1,47 @@ +//---------------------------------------------------------------------------// +// Copyright (c) 2013 Kyle Lutz +// +// 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 +// +// See http://boostorg.github.com/compute for more information. +//---------------------------------------------------------------------------// + +#ifndef BOOST_COMPUTE_ALGORITHM_REMOVE_IF_HPP +#define BOOST_COMPUTE_ALGORITHM_REMOVE_IF_HPP + +#include +#include +#include +#include + +namespace boost { +namespace compute { + +/// Removes each element for which \p predicate returns \c true in the +/// range [\p first, \p last). +/// +/// \see remove() +template +inline Iterator remove_if(Iterator first, + Iterator last, + Predicate predicate, + command_queue &queue = system::default_queue()) +{ + typedef typename std::iterator_traits::value_type value_type; + + // temporary storage for the input data + ::boost::compute::vector tmp(first, last, queue); + + return ::boost::compute::copy_if(tmp.begin(), + tmp.end(), + first, + not1(predicate), + queue); +} + +} // end compute namespace +} // end boost namespace + +#endif // BOOST_COMPUTE_ALGORITHM_REMOVE_IF_HPP diff --git a/3party/boost/boost/compute/algorithm/replace.hpp b/3party/boost/boost/compute/algorithm/replace.hpp new file mode 100644 index 0000000000..fd649a2fad --- /dev/null +++ b/3party/boost/boost/compute/algorithm/replace.hpp @@ -0,0 +1,90 @@ +//---------------------------------------------------------------------------// +// Copyright (c) 2013 Kyle Lutz +// +// 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 +// +// See http://boostorg.github.com/compute for more information. +//---------------------------------------------------------------------------// + +#ifndef BOOST_COMPUTE_ALGORITHM_REPLACE_HPP +#define BOOST_COMPUTE_ALGORITHM_REPLACE_HPP + +#include +#include +#include +#include + +namespace boost { +namespace compute { +namespace detail { + +template +class replace_kernel : public meta_kernel +{ +public: + replace_kernel() + : meta_kernel("replace") + { + m_count = 0; + } + + void set_range(Iterator first, Iterator last) + { + m_count = detail::iterator_range_size(first, last); + + *this << + "const uint i = get_global_id(0);\n" << + "if(" << first[var("i")] << " == " << var("old_value") << ")\n" << + " " << first[var("i")] << '=' << var("new_value") << ";\n"; + } + + void set_old_value(const T &old_value) + { + add_set_arg("old_value", old_value); + } + + void set_new_value(const T &new_value) + { + add_set_arg("new_value", new_value); + } + + void exec(command_queue &queue) + { + if(m_count == 0){ + // nothing to do + return; + } + + exec_1d(queue, 0, m_count); + } + +private: + size_t m_count; +}; + +} // end detail namespace + +/// Replaces each instance of \p old_value in the range [\p first, +/// \p last) with \p new_value. +template +inline void replace(Iterator first, + Iterator last, + const T &old_value, + const T &new_value, + command_queue &queue = system::default_queue()) +{ + detail::replace_kernel kernel; + + kernel.set_range(first, last); + kernel.set_old_value(old_value); + kernel.set_new_value(new_value); + + kernel.exec(queue); +} + +} // end compute namespace +} // end boost namespace + +#endif // BOOST_COMPUTE_ALGORITHM_REPLACE_HPP diff --git a/3party/boost/boost/compute/algorithm/replace_copy.hpp b/3party/boost/boost/compute/algorithm/replace_copy.hpp new file mode 100644 index 0000000000..7224bd3ae6 --- /dev/null +++ b/3party/boost/boost/compute/algorithm/replace_copy.hpp @@ -0,0 +1,62 @@ +//---------------------------------------------------------------------------// +// Copyright (c) 2013 Kyle Lutz +// +// 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 +// +// See http://boostorg.github.com/compute for more information. +//---------------------------------------------------------------------------// + +#ifndef BOOST_COMPUTE_ALGORITHM_REPLACE_COPY_HPP +#define BOOST_COMPUTE_ALGORITHM_REPLACE_COPY_HPP + +#include + +#include +#include +#include +#include + +namespace boost { +namespace compute { + +/// Copies the value in the range [\p first, \p last) to the range +/// beginning at \p result while replacing each instance of \p old_value +/// with \p new_value. +/// +/// \see replace() +template +inline OutputIterator +replace_copy(InputIterator first, + InputIterator last, + OutputIterator result, + const T &old_value, + const T &new_value, + command_queue &queue = system::default_queue()) +{ + typedef typename std::iterator_traits::difference_type difference_type; + + difference_type count = std::distance(first, last); + if(count == 0){ + return result; + } + + // copy data to result + ::boost::compute::copy(first, last, result, queue); + + // replace in result + ::boost::compute::replace(result, + result + count, + old_value, + new_value, + queue); + + // return iterator to the end of result + return result + count; +} + +} // end compute namespace +} // end boost namespace + +#endif // BOOST_COMPUTE_ALGORITHM_REPLACE_COPY_HPP diff --git a/3party/boost/boost/compute/algorithm/reverse.hpp b/3party/boost/boost/compute/algorithm/reverse.hpp new file mode 100644 index 0000000000..b6a9e8098c --- /dev/null +++ b/3party/boost/boost/compute/algorithm/reverse.hpp @@ -0,0 +1,74 @@ +//---------------------------------------------------------------------------// +// Copyright (c) 2013 Kyle Lutz +// +// 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 +// +// See http://boostorg.github.com/compute for more information. +//---------------------------------------------------------------------------// + +#ifndef BOOST_COMPUTE_ALGORITHM_REVERSE_HPP +#define BOOST_COMPUTE_ALGORITHM_REVERSE_HPP + +#include +#include +#include +#include + +namespace boost { +namespace compute { +namespace detail { + +template +struct reverse_kernel : public meta_kernel +{ + reverse_kernel(Iterator first, Iterator last) + : meta_kernel("reverse") + { + typedef typename std::iterator_traits::value_type value_type; + + // store size of the range + m_size = detail::iterator_range_size(first, last); + add_set_arg("size", static_cast(m_size)); + + *this << + decl("i") << " = get_global_id(0);\n" << + decl("j") << " = size - get_global_id(0) - 1;\n" << + decl("tmp") << "=" << first[var("i")] << ";\n" << + first[var("i")] << "=" << first[var("j")] << ";\n" << + first[var("j")] << "= tmp;\n"; + } + + void exec(command_queue &queue) + { + exec_1d(queue, 0, m_size / 2); + } + + size_t m_size; +}; + +} // end detail namespace + +/// Reverses the elements in the range [\p first, \p last). +/// +/// \see reverse_copy() +template +inline void reverse(Iterator first, + Iterator last, + command_queue &queue = system::default_queue()) +{ + size_t count = detail::iterator_range_size(first, last); + if(count < 2){ + return; + } + + detail::reverse_kernel kernel(first, last); + + kernel.exec(queue); +} + +} // end compute namespace +} // end boost namespace + +#endif // BOOST_COMPUTE_ALGORITHM_REVERSE_HPP diff --git a/3party/boost/boost/compute/algorithm/reverse_copy.hpp b/3party/boost/boost/compute/algorithm/reverse_copy.hpp new file mode 100644 index 0000000000..c839f44651 --- /dev/null +++ b/3party/boost/boost/compute/algorithm/reverse_copy.hpp @@ -0,0 +1,79 @@ +//---------------------------------------------------------------------------// +// Copyright (c) 2013 Kyle Lutz +// +// 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 +// +// See http://boostorg.github.com/compute for more information. +//---------------------------------------------------------------------------// + +#ifndef BOOST_COMPUTE_ALGORITHM_REVERSE_COPY_HPP +#define BOOST_COMPUTE_ALGORITHM_REVERSE_COPY_HPP + +#include + +#include +#include +#include +#include + +namespace boost { +namespace compute { +namespace detail { + +template +struct reverse_copy_kernel : public meta_kernel +{ + reverse_copy_kernel(Iterator first, Iterator last, OutputIterator result) + : meta_kernel("reverse_copy") + { + // store size of the range + m_size = detail::iterator_range_size(first, last); + add_set_arg("size", static_cast(m_size)); + + *this << + decl("i") << " = get_global_id(0);\n" << + decl("j") << " = size - get_global_id(0) - 1;\n" << + result[var("j")] << "=" << first[var("i")] << ";\n"; + } + + void exec(command_queue &queue) + { + exec_1d(queue, 0, m_size); + } + + size_t m_size; +}; + +} // end detail namespace + +/// Copies the elements in the range [\p first, \p last) in reversed +/// order to the range beginning at \p result. +/// +/// \see reverse() +template +inline OutputIterator +reverse_copy(InputIterator first, + InputIterator last, + OutputIterator result, + command_queue &queue = system::default_queue()) +{ + typedef typename std::iterator_traits::difference_type difference_type; + + difference_type count = std::distance(first, last); + + detail::reverse_copy_kernel + kernel(first, last, result); + + // run kernel + kernel.exec(queue); + + // return iterator to the end of result + return result + count; +} + +} // end compute namespace +} // end boost namespace + +#endif // BOOST_COMPUTE_ALGORITHM_REVERSE_COPY_HPP diff --git a/3party/boost/boost/compute/algorithm/rotate.hpp b/3party/boost/boost/compute/algorithm/rotate.hpp new file mode 100644 index 0000000000..54cb073cc2 --- /dev/null +++ b/3party/boost/boost/compute/algorithm/rotate.hpp @@ -0,0 +1,54 @@ +//---------------------------------------------------------------------------// +// Copyright (c) 2014 Roshan +// +// 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 +// +// See http://boostorg.github.com/compute for more information. +//---------------------------------------------------------------------------// + +#ifndef BOOST_COMPUTE_ALGORITHM_ROTATE_HPP +#define BOOST_COMPUTE_ALGORITHM_ROTATE_HPP + +#include +#include +#include + +namespace boost { +namespace compute { + +/// Performs left rotation such that element at \p n_first comes to the +/// beginning. +/// +/// \see rotate_copy() +template +inline void rotate(InputIterator first, + InputIterator n_first, + InputIterator last, + command_queue &queue = system::default_queue()) +{ + //Handle trivial cases + if (n_first==first || n_first==last) + { + return; + } + + //Handle others + typedef typename std::iterator_traits::value_type T; + + size_t count = detail::iterator_range_size(first, n_first); + size_t count2 = detail::iterator_range_size(first, last); + + const context &context = queue.get_context(); + vector temp(count2, context); + ::boost::compute::copy(first, last, temp.begin(), queue); + + ::boost::compute::copy(temp.begin()+count, temp.end(), first, queue); + ::boost::compute::copy(temp.begin(), temp.begin()+count, last-count, queue); +} + +} //end compute namespace +} //end boost namespace + +#endif // BOOST_COMPUTE_ALGORITHM_ROTATE_HPP diff --git a/3party/boost/boost/compute/algorithm/rotate_copy.hpp b/3party/boost/boost/compute/algorithm/rotate_copy.hpp new file mode 100644 index 0000000000..fa1b44c5e5 --- /dev/null +++ b/3party/boost/boost/compute/algorithm/rotate_copy.hpp @@ -0,0 +1,41 @@ +//---------------------------------------------------------------------------// +// Copyright (c) 2014 Roshan +// +// 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 +// +// See http://boostorg.github.com/compute for more information. +//---------------------------------------------------------------------------// + +#ifndef BOOST_COMPUTE_ALGORITHM_ROTATE_COPY_HPP +#define BOOST_COMPUTE_ALGORITHM_ROTATE_COPY_HPP + +#include +#include + +namespace boost { +namespace compute { + +/// Performs left rotation such that element at n_first comes to the +/// beginning and the output is stored in range starting at result. +/// +/// \see rotate() +template +inline void rotate_copy(InputIterator first, + InputIterator n_first, + InputIterator last, + OutputIterator result, + command_queue &queue = system::default_queue()) +{ + size_t count = detail::iterator_range_size(first, n_first); + size_t count2 = detail::iterator_range_size(n_first, last); + + ::boost::compute::copy(first+count, last, result, queue); + ::boost::compute::copy(first, first+count, result+count2, queue); +} + +} //end compute namespace +} //end boost namespace + +#endif // BOOST_COMPUTE_ALGORITHM_ROTATE_COPY_HPP diff --git a/3party/boost/boost/compute/algorithm/scatter.hpp b/3party/boost/boost/compute/algorithm/scatter.hpp new file mode 100644 index 0000000000..bea4201628 --- /dev/null +++ b/3party/boost/boost/compute/algorithm/scatter.hpp @@ -0,0 +1,99 @@ +//---------------------------------------------------------------------------// +// Copyright (c) 2013 Kyle Lutz +// +// 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 +// +// See http://boostorg.github.com/compute for more information. +//---------------------------------------------------------------------------// + +#ifndef BOOST_COMPUTE_ALGORITHM_SCATTER_HPP +#define BOOST_COMPUTE_ALGORITHM_SCATTER_HPP + +#include + +#include +#include +#include +#include +#include +#include +#include + +namespace boost { +namespace compute { +namespace detail { + +template +class scatter_kernel : meta_kernel +{ +public: + scatter_kernel() : meta_kernel("scatter") + {} + + void set_range(InputIterator first, + InputIterator last, + MapIterator map, + OutputIterator result) + { + m_count = iterator_range_size(first, last); + m_input_offset = first.get_index(); + m_output_offset = result.get_index(); + + m_input_offset_arg = add_arg("input_offset"); + m_output_offset_arg = add_arg("output_offset"); + + *this << + "const uint i = get_global_id(0);\n" << + "uint i1 = " << map[expr("i")] << + " + output_offset;\n" << + "uint i2 = i + input_offset;\n" << + result[expr("i1")] << "=" << + first[expr("i2")] << ";\n"; + } + + event exec(command_queue &queue) + { + if(m_count == 0) { + return event(); + } + + set_arg(m_input_offset_arg, uint_(m_input_offset)); + set_arg(m_output_offset_arg, uint_(m_output_offset)); + + return exec_1d(queue, 0, m_count); + } + +private: + size_t m_count; + size_t m_input_offset; + size_t m_input_offset_arg; + size_t m_output_offset; + size_t m_output_offset_arg; +}; + +} // end detail namespace + +/// Copies the elements from the range [\p first, \p last) to the range +/// beginning at \p result using the output indices from the range beginning +/// at \p map. +/// +/// \see gather() +template +inline void scatter(InputIterator first, + InputIterator last, + MapIterator map, + OutputIterator result, + command_queue &queue = system::default_queue()) +{ + detail::scatter_kernel kernel; + + kernel.set_range(first, last, map, result); + kernel.exec(queue); +} + +} // end compute namespace +} // end boost namespace + +#endif // BOOST_COMPUTE_ALGORITHM_SCATTER_HPP diff --git a/3party/boost/boost/compute/algorithm/scatter_if.hpp b/3party/boost/boost/compute/algorithm/scatter_if.hpp new file mode 100644 index 0000000000..159edd8c86 --- /dev/null +++ b/3party/boost/boost/compute/algorithm/scatter_if.hpp @@ -0,0 +1,119 @@ +//---------------------------------------------------------------------------// +// Copyright (c) 2015 Jakub Pola +// +// 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 +// +// See http://boostorg.github.com/compute for more information. +//---------------------------------------------------------------------------// + +#ifndef BOOST_COMPUTE_ALGORITHM_SCATTER_IF_HPP +#define BOOST_COMPUTE_ALGORITHM_SCATTER_IF_HPP + +#include + +#include +#include +#include +#include +#include +#include +#include + +namespace boost { +namespace compute { +namespace detail { + +template +class scatter_if_kernel : meta_kernel +{ +public: + scatter_if_kernel() : meta_kernel("scatter_if") + {} + + void set_range(InputIterator first, + InputIterator last, + MapIterator map, + StencilIterator stencil, + OutputIterator result, + Predicate predicate) + { + m_count = iterator_range_size(first, last); + m_input_offset = first.get_index(); + m_output_offset = result.get_index(); + + m_input_offset_arg = add_arg("input_offset"); + m_output_offset_arg = add_arg("output_offset"); + + *this << + "const uint i = get_global_id(0);\n" << + "uint i1 = " << map[expr("i")] << + " + output_offset;\n" << + "uint i2 = i + input_offset;\n" << + if_(predicate(stencil[expr("i")])) << "\n" << + result[expr("i1")] << "=" << + first[expr("i2")] << ";\n"; + } + + event exec(command_queue &queue) + { + if(m_count == 0) { + return event(); + } + + set_arg(m_input_offset_arg, uint_(m_input_offset)); + set_arg(m_output_offset_arg, uint_(m_output_offset)); + + return exec_1d(queue, 0, m_count); + } + +private: + size_t m_count; + size_t m_input_offset; + size_t m_input_offset_arg; + size_t m_output_offset; + size_t m_output_offset_arg; +}; + +} // end detail namespace + +/// Copies the elements from the range [\p first, \p last) to the range +/// beginning at \p result using the output indices from the range beginning +/// at \p map if stencil is resolved to true. By default the predicate is +/// an identity +/// +/// +template +inline void scatter_if(InputIterator first, + InputIterator last, + MapIterator map, + StencilIterator stencil, + OutputIterator result, + Predicate predicate, + command_queue &queue = system::default_queue()) +{ + detail::scatter_if_kernel kernel; + + kernel.set_range(first, last, map, stencil, result, predicate); + kernel.exec(queue); +} + +template +inline void scatter_if(InputIterator first, + InputIterator last, + MapIterator map, + StencilIterator stencil, + OutputIterator result, + command_queue &queue = system::default_queue()) +{ + typedef typename std::iterator_traits::value_type T; + + scatter_if(first, last, map, stencil, result, identity(), queue); +} + +} // end compute namespace +} // end boost namespace + +#endif // BOOST_COMPUTE_ALGORITHM_SCATTER_IF_HPP diff --git a/3party/boost/boost/compute/algorithm/search.hpp b/3party/boost/boost/compute/algorithm/search.hpp new file mode 100644 index 0000000000..3d3d035b3c --- /dev/null +++ b/3party/boost/boost/compute/algorithm/search.hpp @@ -0,0 +1,73 @@ +//---------------------------------------------------------------------------// +// Copyright (c) 2014 Roshan +// +// 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 +// +// See http://boostorg.github.com/compute for more information. +//---------------------------------------------------------------------------// + +#ifndef BOOST_COMPUTE_ALGORITHM_SEARCH_HPP +#define BOOST_COMPUTE_ALGORITHM_SEARCH_HPP + +#include +#include +#include +#include +#include +#include + +namespace boost { +namespace compute { + +/// +/// \brief Substring matching algorithm +/// +/// Searches for the first match of the pattern [p_first, p_last) +/// in text [t_first, t_last). +/// \return Iterator pointing to beginning of first occurrence +/// +/// \param t_first Iterator pointing to start of text +/// \param t_last Iterator pointing to end of text +/// \param p_first Iterator pointing to start of pattern +/// \param p_last Iterator pointing to end of pattern +/// \param queue Queue on which to execute +/// +template +inline TextIterator search(TextIterator t_first, + TextIterator t_last, + PatternIterator p_first, + PatternIterator p_last, + command_queue &queue = system::default_queue()) +{ + // there is no need to check if pattern starts at last n - 1 indices + vector matching_indices( + detail::iterator_range_size(t_first, t_last) + - detail::iterator_range_size(p_first, p_last) + 1, + queue.get_context() + ); + + // search_kernel puts value 1 at every index in vector where pattern starts at + detail::search_kernel::iterator> kernel; + + kernel.set_range(p_first, p_last, t_first, t_last, matching_indices.begin()); + kernel.exec(queue); + + vector::iterator index = ::boost::compute::find( + matching_indices.begin(), matching_indices.end(), uint_(1), queue + ); + + // pattern was not found + if(index == matching_indices.end()) + return t_last; + + return t_first + detail::iterator_range_size(matching_indices.begin(), index); +} + +} //end compute namespace +} //end boost namespace + +#endif // BOOST_COMPUTE_ALGORITHM_SEARCH_HPP diff --git a/3party/boost/boost/compute/algorithm/search_n.hpp b/3party/boost/boost/compute/algorithm/search_n.hpp new file mode 100644 index 0000000000..9e03111bb0 --- /dev/null +++ b/3party/boost/boost/compute/algorithm/search_n.hpp @@ -0,0 +1,140 @@ +//---------------------------------------------------------------------------// +// Copyright (c) 2014 Roshan +// +// 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 +// +// See http://boostorg.github.com/compute for more information. +//---------------------------------------------------------------------------// + +#ifndef BOOST_COMPUTE_ALGORITHM_DETAIL_SEARCH_N_HPP +#define BOOST_COMPUTE_ALGORITHM_DETAIL_SEARCH_N_HPP + +#include + +#include +#include +#include +#include +#include + +namespace boost { +namespace compute { +namespace detail { + +/// +/// \brief Search kernel class +/// +/// Subclass of meta_kernel which is capable of performing search_n +/// +template +class search_n_kernel : public meta_kernel +{ +public: + typedef typename std::iterator_traits::value_type value_type; + + search_n_kernel() : meta_kernel("search_n") + {} + + void set_range(TextIterator t_first, + TextIterator t_last, + value_type value, + size_t n, + OutputIterator result) + { + m_n = n; + m_n_arg = add_arg("n"); + + m_value = value; + m_value_arg = add_arg("value"); + + m_count = iterator_range_size(t_first, t_last); + m_count = m_count + 1 - m_n; + + *this << + "uint i = get_global_id(0);\n" << + "uint i1 = i;\n" << + "uint j;\n" << + "for(j = 0; j("i1")] << " = 1;\n" << + "else\n" << + result[expr("i1")] << " = 0;\n"; + } + + event exec(command_queue &queue) + { + if(m_count == 0) { + return event(); + } + + set_arg(m_n_arg, uint_(m_n)); + set_arg(m_value_arg, m_value); + + return exec_1d(queue, 0, m_count); + } + +private: + size_t m_n; + size_t m_n_arg; + size_t m_count; + value_type m_value; + size_t m_value_arg; +}; + +} //end detail namespace + +/// +/// \brief Substring matching algorithm +/// +/// Searches for the first occurrence of n consecutive occurrences of +/// value in text [t_first, t_last). +/// \return Iterator pointing to beginning of first occurrence +/// +/// \param t_first Iterator pointing to start of text +/// \param t_last Iterator pointing to end of text +/// \param n Number of times value repeats +/// \param value Value which repeats +/// \param queue Queue on which to execute +/// +template +inline TextIterator search_n(TextIterator t_first, + TextIterator t_last, + size_t n, + ValueType value, + command_queue &queue = system::default_queue()) +{ + // there is no need to check if pattern starts at last n - 1 indices + vector matching_indices( + detail::iterator_range_size(t_first, t_last) + 1 - n, + queue.get_context() + ); + + // search_n_kernel puts value 1 at every index in vector where pattern + // of n values starts at + detail::search_n_kernel::iterator> kernel; + + kernel.set_range(t_first, t_last, value, n, matching_indices.begin()); + kernel.exec(queue); + + vector::iterator index = ::boost::compute::find( + matching_indices.begin(), matching_indices.end(), uint_(1), queue + ); + + // pattern was not found + if(index == matching_indices.end()) + return t_last; + + return t_first + detail::iterator_range_size(matching_indices.begin(), index); +} + +} //end compute namespace +} //end boost namespace + +#endif // BOOST_COMPUTE_ALGORITHM_DETAIL_SEARCH_N_HPP diff --git a/3party/boost/boost/compute/algorithm/set_difference.hpp b/3party/boost/boost/compute/algorithm/set_difference.hpp new file mode 100644 index 0000000000..17ce7bd3f6 --- /dev/null +++ b/3party/boost/boost/compute/algorithm/set_difference.hpp @@ -0,0 +1,182 @@ +//---------------------------------------------------------------------------// +// Copyright (c) 2014 Roshan +// +// 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 +// +// See http://boostorg.github.com/compute for more information. +//---------------------------------------------------------------------------// + +#ifndef BOOST_COMPUTE_ALGORITHM_SET_DIFFERENCE_HPP +#define BOOST_COMPUTE_ALGORITHM_SET_DIFFERENCE_HPP + +#include + +#include +#include +#include +#include +#include +#include +#include +#include + +namespace boost { +namespace compute { +namespace detail { + +/// +/// \brief Serial set difference kernel class +/// +/// Subclass of meta_kernel to perform serial set difference after tiling +/// +class serial_set_difference_kernel : meta_kernel +{ +public: + unsigned int tile_size; + + serial_set_difference_kernel() : meta_kernel("set_difference") + { + tile_size = 4; + } + + template + void set_range(InputIterator1 first1, + InputIterator2 first2, + InputIterator3 tile_first1, + InputIterator3 tile_last1, + InputIterator4 tile_first2, + OutputIterator1 result, + OutputIterator2 counts) + { + m_count = iterator_range_size(tile_first1, tile_last1) - 1; + + *this << + "uint i = get_global_id(0);\n" << + "uint start1 = " << tile_first1[expr("i")] << ";\n" << + "uint end1 = " << tile_first1[expr("i+1")] << ";\n" << + "uint start2 = " << tile_first2[expr("i")] << ";\n" << + "uint end2 = " << tile_first2[expr("i+1")] << ";\n" << + "uint index = i*" << tile_size << ";\n" << + "uint count = 0;\n" << + "while(start1("start1")] << " == " << + first2[expr("start2")] << ")\n" << + " {\n" << + " start1++; start2++;\n" << + " }\n" << + " else if(" << first1[expr("start1")] << " < " << + first2[expr("start2")] << ")\n" << + " {\n" << + result[expr("index")] << + " = " << first1[expr("start1")] << ";\n" << + " index++; count++;\n" << + " start1++;\n" << + " }\n" << + " else\n" << + " {\n" << + " start2++;\n" << + " }\n" << + "}\n" << + "while(start1("index")] << + " = " << first1[expr("start1")] << ";\n" << + " index++; count++;\n" << + " start1++;\n" << + "}\n" << + counts[expr("i")] << " = count;\n"; + } + + event exec(command_queue &queue) + { + if(m_count == 0) { + return event(); + } + + return exec_1d(queue, 0, m_count); + } + +private: + size_t m_count; +}; + +} //end detail namespace + +/// +/// \brief Set difference algorithm +/// +/// Finds the difference of the sorted range [first2, last2) from the sorted +/// range [first1, last1) and stores it in range starting at result +/// \return Iterator pointing to end of difference +/// +/// \param first1 Iterator pointing to start of first set +/// \param last1 Iterator pointing to end of first set +/// \param first2 Iterator pointing to start of second set +/// \param last2 Iterator pointing to end of second set +/// \param result Iterator pointing to start of range in which the difference +/// will be stored +/// \param queue Queue on which to execute +/// +template +inline OutputIterator set_difference(InputIterator1 first1, + InputIterator1 last1, + InputIterator2 first2, + InputIterator2 last2, + OutputIterator result, + command_queue &queue = system::default_queue()) +{ + typedef typename std::iterator_traits::value_type value_type; + + int tile_size = 1024; + + int count1 = detail::iterator_range_size(first1, last1); + int count2 = detail::iterator_range_size(first2, last2); + + vector tile_a((count1+count2+tile_size-1)/tile_size+1, queue.get_context()); + vector tile_b((count1+count2+tile_size-1)/tile_size+1, queue.get_context()); + + // Tile the sets + detail::balanced_path_kernel tiling_kernel; + tiling_kernel.tile_size = tile_size; + tiling_kernel.set_range(first1, last1, first2, last2, + tile_a.begin()+1, tile_b.begin()+1); + fill_n(tile_a.begin(), 1, 0, queue); + fill_n(tile_b.begin(), 1, 0, queue); + tiling_kernel.exec(queue); + + fill_n(tile_a.end()-1, 1, count1, queue); + fill_n(tile_b.end()-1, 1, count2, queue); + + vector temp_result(count1+count2, queue.get_context()); + vector counts((count1+count2+tile_size-1)/tile_size + 1, queue.get_context()); + fill_n(counts.end()-1, 1, 0, queue); + + // Find individual differences + detail::serial_set_difference_kernel difference_kernel; + difference_kernel.tile_size = tile_size; + difference_kernel.set_range(first1, first2, tile_a.begin(), tile_a.end(), + tile_b.begin(), temp_result.begin(), counts.begin()); + + difference_kernel.exec(queue); + + exclusive_scan(counts.begin(), counts.end(), counts.begin(), queue); + + // Compact the results + detail::compact_kernel compact_kernel; + compact_kernel.tile_size = tile_size; + compact_kernel.set_range(temp_result.begin(), counts.begin(), counts.end(), result); + + compact_kernel.exec(queue); + + return result + (counts.end() - 1).read(queue); +} + +} //end compute namespace +} //end boost namespace + +#endif // BOOST_COMPUTE_ALGORITHM_SET_DIFFERENCE_HPP diff --git a/3party/boost/boost/compute/algorithm/set_intersection.hpp b/3party/boost/boost/compute/algorithm/set_intersection.hpp new file mode 100644 index 0000000000..50f291e84a --- /dev/null +++ b/3party/boost/boost/compute/algorithm/set_intersection.hpp @@ -0,0 +1,170 @@ +//---------------------------------------------------------------------------// +// Copyright (c) 2014 Roshan +// +// 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 +// +// See http://boostorg.github.com/compute for more information. +//---------------------------------------------------------------------------// + +#ifndef BOOST_COMPUTE_ALGORITHM_SET_INTERSECTION_HPP +#define BOOST_COMPUTE_ALGORITHM_SET_INTERSECTION_HPP + +#include + +#include +#include +#include +#include +#include +#include +#include +#include + +namespace boost { +namespace compute { +namespace detail { + +/// +/// \brief Serial set intersection kernel class +/// +/// Subclass of meta_kernel to perform serial set intersection after tiling +/// +class serial_set_intersection_kernel : meta_kernel +{ +public: + unsigned int tile_size; + + serial_set_intersection_kernel() : meta_kernel("set_intersection") + { + tile_size = 4; + } + + template + void set_range(InputIterator1 first1, + InputIterator2 first2, + InputIterator3 tile_first1, + InputIterator3 tile_last1, + InputIterator4 tile_first2, + OutputIterator1 result, + OutputIterator2 counts) + { + m_count = iterator_range_size(tile_first1, tile_last1) - 1; + + *this << + "uint i = get_global_id(0);\n" << + "uint start1 = " << tile_first1[expr("i")] << ";\n" << + "uint end1 = " << tile_first1[expr("i+1")] << ";\n" << + "uint start2 = " << tile_first2[expr("i")] << ";\n" << + "uint end2 = " << tile_first2[expr("i+1")] << ";\n" << + "uint index = i*" << tile_size << ";\n" << + "uint count = 0;\n" << + "while(start1("start1")] << " == " << + first2[expr("start2")] << ")\n" << + " {\n" << + result[expr("index")] << + " = " << first1[expr("start1")] << ";\n" << + " index++; count++;\n" << + " start1++; start2++;\n" << + " }\n" << + " else if(" << first1[expr("start1")] << " < " << + first2[expr("start2")] << ")\n" << + " start1++;\n" << + " else start2++;\n" << + "}\n" << + counts[expr("i")] << " = count;\n"; + } + + event exec(command_queue &queue) + { + if(m_count == 0) { + return event(); + } + + return exec_1d(queue, 0, m_count); + } + +private: + size_t m_count; +}; + +} //end detail namespace + +/// +/// \brief Set intersection algorithm +/// +/// Finds the intersection of the sorted range [first1, last1) with the sorted +/// range [first2, last2) and stores it in range starting at result +/// \return Iterator pointing to end of intersection +/// +/// \param first1 Iterator pointing to start of first set +/// \param last1 Iterator pointing to end of first set +/// \param first2 Iterator pointing to start of second set +/// \param last2 Iterator pointing to end of second set +/// \param result Iterator pointing to start of range in which the intersection +/// will be stored +/// \param queue Queue on which to execute +/// +template +inline OutputIterator set_intersection(InputIterator1 first1, + InputIterator1 last1, + InputIterator2 first2, + InputIterator2 last2, + OutputIterator result, + command_queue &queue = system::default_queue()) +{ + typedef typename std::iterator_traits::value_type value_type; + + int tile_size = 1024; + + int count1 = detail::iterator_range_size(first1, last1); + int count2 = detail::iterator_range_size(first2, last2); + + vector tile_a((count1+count2+tile_size-1)/tile_size+1, queue.get_context()); + vector tile_b((count1+count2+tile_size-1)/tile_size+1, queue.get_context()); + + // Tile the sets + detail::balanced_path_kernel tiling_kernel; + tiling_kernel.tile_size = tile_size; + tiling_kernel.set_range(first1, last1, first2, last2, + tile_a.begin()+1, tile_b.begin()+1); + fill_n(tile_a.begin(), 1, 0, queue); + fill_n(tile_b.begin(), 1, 0, queue); + tiling_kernel.exec(queue); + + fill_n(tile_a.end()-1, 1, count1, queue); + fill_n(tile_b.end()-1, 1, count2, queue); + + vector temp_result(count1+count2, queue.get_context()); + vector counts((count1+count2+tile_size-1)/tile_size + 1, queue.get_context()); + fill_n(counts.end()-1, 1, 0, queue); + + // Find individual intersections + detail::serial_set_intersection_kernel intersection_kernel; + intersection_kernel.tile_size = tile_size; + intersection_kernel.set_range(first1, first2, tile_a.begin(), tile_a.end(), + tile_b.begin(), temp_result.begin(), counts.begin()); + + intersection_kernel.exec(queue); + + exclusive_scan(counts.begin(), counts.end(), counts.begin(), queue); + + // Compact the results + detail::compact_kernel compact_kernel; + compact_kernel.tile_size = tile_size; + compact_kernel.set_range(temp_result.begin(), counts.begin(), counts.end(), result); + + compact_kernel.exec(queue); + + return result + (counts.end() - 1).read(queue); +} + +} //end compute namespace +} //end boost namespace + +#endif // BOOST_COMPUTE_ALGORITHM_SET_INTERSECTION_HPP diff --git a/3party/boost/boost/compute/algorithm/set_symmetric_difference.hpp b/3party/boost/boost/compute/algorithm/set_symmetric_difference.hpp new file mode 100644 index 0000000000..6e60b38511 --- /dev/null +++ b/3party/boost/boost/compute/algorithm/set_symmetric_difference.hpp @@ -0,0 +1,194 @@ +//---------------------------------------------------------------------------// +// Copyright (c) 2014 Roshan +// +// 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 +// +// See http://boostorg.github.com/compute for more information. +//---------------------------------------------------------------------------// + +#ifndef BOOST_COMPUTE_ALGORITHM_SET_SYMMETRIC_DIFFERENCE_HPP +#define BOOST_COMPUTE_ALGORITHM_SET_SYMMETRIC_DIFFERENCE_HPP + +#include + +#include +#include +#include +#include +#include +#include +#include +#include + +namespace boost { +namespace compute { +namespace detail { + +/// +/// \brief Serial set symmetric difference kernel class +/// +/// Subclass of meta_kernel to perform serial set symmetric +/// difference after tiling +/// +class serial_set_symmetric_difference_kernel : meta_kernel +{ +public: + unsigned int tile_size; + + serial_set_symmetric_difference_kernel() : meta_kernel("set_symmetric_difference") + { + tile_size = 4; + } + + template + void set_range(InputIterator1 first1, + InputIterator2 first2, + InputIterator3 tile_first1, + InputIterator3 tile_last1, + InputIterator4 tile_first2, + OutputIterator1 result, + OutputIterator2 counts) + { + m_count = iterator_range_size(tile_first1, tile_last1) - 1; + + *this << + "uint i = get_global_id(0);\n" << + "uint start1 = " << tile_first1[expr("i")] << ";\n" << + "uint end1 = " << tile_first1[expr("i+1")] << ";\n" << + "uint start2 = " << tile_first2[expr("i")] << ";\n" << + "uint end2 = " << tile_first2[expr("i+1")] << ";\n" << + "uint index = i*" << tile_size << ";\n" << + "uint count = 0;\n" << + "while(start1("start1")] << " == " << + first2[expr("start2")] << ")\n" << + " {\n" << + " start1++; start2++;\n" << + " }\n" << + " else if(" << first1[expr("start1")] << " < " << + first2[expr("start2")] << ")\n" << + " {\n" << + result[expr("index")] << + " = " << first1[expr("start1")] << ";\n" << + " index++; count++;\n" << + " start1++;\n" << + " }\n" << + " else\n" << + " {\n" << + result[expr("index")] << + " = " << first2[expr("start2")] << ";\n" << + " index++; count++;\n" << + " start2++;\n" << + " }\n" << + "}\n" << + "while(start1("index")] << + " = " << first1[expr("start1")] << ";\n" << + " index++; count++;\n" << + " start1++;\n" << + "}\n" << + "while(start2("index")] << + " = " << first2[expr("start2")] << ";\n" << + " index++; count++;\n" << + " start2++;\n" << + "}\n" << + counts[expr("i")] << " = count;\n"; + } + + event exec(command_queue &queue) + { + if(m_count == 0) { + return event(); + } + + return exec_1d(queue, 0, m_count); + } + +private: + size_t m_count; +}; + +} //end detail namespace + +/// +/// \brief Set symmetric difference algorithm +/// +/// Finds the symmetric difference of the sorted range [first2, last2) from +/// the sorted range [first1, last1) and stores it in range starting at result +/// \return Iterator pointing to end of symmetric difference +/// +/// \param first1 Iterator pointing to start of first set +/// \param last1 Iterator pointing to end of first set +/// \param first2 Iterator pointing to start of second set +/// \param last2 Iterator pointing to end of second set +/// \param result Iterator pointing to start of range in which the symmetric +/// difference will be stored +/// \param queue Queue on which to execute +/// +template +inline OutputIterator set_symmetric_difference(InputIterator1 first1, + InputIterator1 last1, + InputIterator2 first2, + InputIterator2 last2, + OutputIterator result, + command_queue &queue = system::default_queue()) +{ + typedef typename std::iterator_traits::value_type value_type; + + int tile_size = 1024; + + int count1 = detail::iterator_range_size(first1, last1); + int count2 = detail::iterator_range_size(first2, last2); + + vector tile_a((count1+count2+tile_size-1)/tile_size+1, queue.get_context()); + vector tile_b((count1+count2+tile_size-1)/tile_size+1, queue.get_context()); + + // Tile the sets + detail::balanced_path_kernel tiling_kernel; + tiling_kernel.tile_size = tile_size; + tiling_kernel.set_range(first1, last1, first2, last2, + tile_a.begin()+1, tile_b.begin()+1); + fill_n(tile_a.begin(), 1, 0, queue); + fill_n(tile_b.begin(), 1, 0, queue); + tiling_kernel.exec(queue); + + fill_n(tile_a.end()-1, 1, count1, queue); + fill_n(tile_b.end()-1, 1, count2, queue); + + vector temp_result(count1+count2, queue.get_context()); + vector counts((count1+count2+tile_size-1)/tile_size + 1, queue.get_context()); + fill_n(counts.end()-1, 1, 0, queue); + + // Find individual symmetric differences + detail::serial_set_symmetric_difference_kernel symmetric_difference_kernel; + symmetric_difference_kernel.tile_size = tile_size; + symmetric_difference_kernel.set_range(first1, first2, tile_a.begin(), + tile_a.end(), tile_b.begin(), + temp_result.begin(), counts.begin()); + + symmetric_difference_kernel.exec(queue); + + exclusive_scan(counts.begin(), counts.end(), counts.begin(), queue); + + // Compact the results + detail::compact_kernel compact_kernel; + compact_kernel.tile_size = tile_size; + compact_kernel.set_range(temp_result.begin(), counts.begin(), counts.end(), result); + + compact_kernel.exec(queue); + + return result + (counts.end() - 1).read(queue); +} + +} //end compute namespace +} //end boost namespace + +#endif // BOOST_COMPUTE_ALGORITHM_SET_SYMMETRIC_DIFFERENCE_HPP diff --git a/3party/boost/boost/compute/algorithm/set_union.hpp b/3party/boost/boost/compute/algorithm/set_union.hpp new file mode 100644 index 0000000000..c61f7b29b3 --- /dev/null +++ b/3party/boost/boost/compute/algorithm/set_union.hpp @@ -0,0 +1,195 @@ +//---------------------------------------------------------------------------// +// Copyright (c) 2014 Roshan +// +// 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 +// +// See http://boostorg.github.com/compute for more information. +//---------------------------------------------------------------------------// + +#ifndef BOOST_COMPUTE_ALGORITHM_SET_UNION_HPP +#define BOOST_COMPUTE_ALGORITHM_SET_UNION_HPP + +#include + +#include +#include +#include +#include +#include +#include +#include +#include + +namespace boost { +namespace compute { +namespace detail { + +/// +/// \brief Serial set union kernel class +/// +/// Subclass of meta_kernel to perform serial set union after tiling +/// +class serial_set_union_kernel : meta_kernel +{ +public: + unsigned int tile_size; + + serial_set_union_kernel() : meta_kernel("set_union") + { + tile_size = 4; + } + + template + void set_range(InputIterator1 first1, + InputIterator2 first2, + InputIterator3 tile_first1, + InputIterator3 tile_last1, + InputIterator4 tile_first2, + OutputIterator1 result, + OutputIterator2 counts) + { + m_count = iterator_range_size(tile_first1, tile_last1) - 1; + + *this << + "uint i = get_global_id(0);\n" << + "uint start1 = " << tile_first1[expr("i")] << ";\n" << + "uint end1 = " << tile_first1[expr("i+1")] << ";\n" << + "uint start2 = " << tile_first2[expr("i")] << ";\n" << + "uint end2 = " << tile_first2[expr("i+1")] << ";\n" << + "uint index = i*" << tile_size << ";\n" << + "uint count = 0;\n" << + "while(start1("start1")] << " == " << + first2[expr("start2")] << ")\n" << + " {\n" << + result[expr("index")] << + " = " << first1[expr("start1")] << ";\n" << + " index++; count++;\n" << + " start1++; start2++;\n" << + " }\n" << + " else if(" << first1[expr("start1")] << " < " << + first2[expr("start2")] << ")\n" << + " {\n" << + result[expr("index")] << + " = " << first1[expr("start1")] << ";\n" << + " index++; count++;\n" << + " start1++;\n" << + " }\n" << + " else\n" << + " {\n" << + result[expr("index")] << + " = " << first2[expr("start2")] << ";\n" << + " index++; count++;\n" << + " start2++;\n" << + " }\n" << + "}\n" << + "while(start1("index")] << + " = " << first1[expr("start1")] << ";\n" << + " index++; count++;\n" << + " start1++;\n" << + "}\n" << + "while(start2("index")] << + " = " << first2[expr("start2")] << ";\n" << + " index++; count++;\n" << + " start2++;\n" << + "}\n" << + counts[expr("i")] << " = count;\n"; + } + + event exec(command_queue &queue) + { + if(m_count == 0) { + return event(); + } + + return exec_1d(queue, 0, m_count); + } + +private: + size_t m_count; +}; + +} //end detail namespace + +/// +/// \brief Set union algorithm +/// +/// Finds the union of the sorted range [first1, last1) with the sorted +/// range [first2, last2) and stores it in range starting at result +/// \return Iterator pointing to end of union +/// +/// \param first1 Iterator pointing to start of first set +/// \param last1 Iterator pointing to end of first set +/// \param first2 Iterator pointing to start of second set +/// \param last2 Iterator pointing to end of second set +/// \param result Iterator pointing to start of range in which the union +/// will be stored +/// \param queue Queue on which to execute +/// +template +inline OutputIterator set_union(InputIterator1 first1, + InputIterator1 last1, + InputIterator2 first2, + InputIterator2 last2, + OutputIterator result, + command_queue &queue = system::default_queue()) +{ + typedef typename std::iterator_traits::value_type value_type; + + int tile_size = 1024; + + int count1 = detail::iterator_range_size(first1, last1); + int count2 = detail::iterator_range_size(first2, last2); + + vector tile_a((count1+count2+tile_size-1)/tile_size+1, queue.get_context()); + vector tile_b((count1+count2+tile_size-1)/tile_size+1, queue.get_context()); + + // Tile the sets + detail::balanced_path_kernel tiling_kernel; + tiling_kernel.tile_size = tile_size; + tiling_kernel.set_range(first1, last1, first2, last2, + tile_a.begin()+1, tile_b.begin()+1); + fill_n(tile_a.begin(), 1, 0, queue); + fill_n(tile_b.begin(), 1, 0, queue); + tiling_kernel.exec(queue); + + fill_n(tile_a.end()-1, 1, count1, queue); + fill_n(tile_b.end()-1, 1, count2, queue); + + vector temp_result(count1+count2, queue.get_context()); + vector counts((count1+count2+tile_size-1)/tile_size + 1, queue.get_context()); + fill_n(counts.end()-1, 1, 0, queue); + + // Find individual unions + detail::serial_set_union_kernel union_kernel; + union_kernel.tile_size = tile_size; + union_kernel.set_range(first1, first2, tile_a.begin(), tile_a.end(), + tile_b.begin(), temp_result.begin(), counts.begin()); + + union_kernel.exec(queue); + + exclusive_scan(counts.begin(), counts.end(), counts.begin(), queue); + + // Compact the results + detail::compact_kernel compact_kernel; + compact_kernel.tile_size = tile_size; + compact_kernel.set_range(temp_result.begin(), counts.begin(), counts.end(), result); + + compact_kernel.exec(queue); + + return result + (counts.end() - 1).read(queue); +} + +} //end compute namespace +} //end boost namespace + +#endif // BOOST_COMPUTE_ALGORITHM_SET_UNION_HPP diff --git a/3party/boost/boost/compute/algorithm/sort.hpp b/3party/boost/boost/compute/algorithm/sort.hpp new file mode 100644 index 0000000000..7e0a583e3e --- /dev/null +++ b/3party/boost/boost/compute/algorithm/sort.hpp @@ -0,0 +1,205 @@ +//---------------------------------------------------------------------------// +// Copyright (c) 2013 Kyle Lutz +// +// 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 +// +// See http://boostorg.github.com/compute for more information. +//---------------------------------------------------------------------------// + +#ifndef BOOST_COMPUTE_ALGORITHM_SORT_HPP +#define BOOST_COMPUTE_ALGORITHM_SORT_HPP + +#include + +#include + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +namespace boost { +namespace compute { +namespace detail { + +template +inline void dispatch_gpu_sort(buffer_iterator first, + buffer_iterator last, + less, + command_queue &queue, + typename boost::enable_if_c< + is_radix_sortable::value + >::type* = 0) +{ + size_t count = detail::iterator_range_size(first, last); + + if(count < 2){ + // nothing to do + return; + } + else if(count <= 32){ + ::boost::compute::detail::serial_insertion_sort(first, last, queue); + } + else { + ::boost::compute::detail::radix_sort(first, last, queue); + } +} + +template +inline void dispatch_gpu_sort(buffer_iterator first, + buffer_iterator last, + greater compare, + command_queue &queue, + typename boost::enable_if_c< + is_radix_sortable::value + >::type* = 0) +{ + size_t count = detail::iterator_range_size(first, last); + + if(count < 2){ + // nothing to do + return; + } + else if(count <= 32){ + ::boost::compute::detail::serial_insertion_sort( + first, last, compare, queue + ); + } + else { + // radix sorts in descending order + ::boost::compute::detail::radix_sort(first, last, false, queue); + } +} + +template +inline void dispatch_gpu_sort(Iterator first, + Iterator last, + Compare compare, + command_queue &queue) +{ + size_t count = detail::iterator_range_size(first, last); + + if(count < 2){ + // nothing to do + return; + } + else if(count <= 32){ + ::boost::compute::detail::serial_insertion_sort( + first, last, compare, queue + ); + } + else { + ::boost::compute::detail::merge_sort_on_gpu( + first, last, compare, queue + ); + } +} + +// sort() for device iterators +template +inline void dispatch_sort(Iterator first, + Iterator last, + Compare compare, + command_queue &queue, + typename boost::enable_if< + is_device_iterator + >::type* = 0) +{ + if(queue.get_device().type() & device::gpu) { + dispatch_gpu_sort(first, last, compare, queue); + return; + } + ::boost::compute::detail::merge_sort_on_cpu(first, last, compare, queue); +} + +// sort() for host iterators +template +inline void dispatch_sort(Iterator first, + Iterator last, + Compare compare, + command_queue &queue, + typename boost::disable_if< + is_device_iterator + >::type* = 0) +{ + typedef typename std::iterator_traits::value_type T; + + size_t size = static_cast(std::distance(first, last)); + + // create mapped buffer + mapped_view view( + boost::addressof(*first), size, queue.get_context() + ); + + // sort mapped buffer + dispatch_sort(view.begin(), view.end(), compare, queue); + + // return results to host + view.map(queue); +} + +} // end detail namespace + +/// Sorts the values in the range [\p first, \p last) according to +/// \p compare. +/// +/// \param first first element in the range to sort +/// \param last last element in the range to sort +/// \param compare comparison function (by default \c less) +/// \param queue command queue to perform the operation +/// +/// For example, to sort a vector on the device: +/// \code +/// // create vector on the device with data +/// float data[] = { 2.f, 4.f, 1.f, 3.f }; +/// boost::compute::vector vec(data, data + 4, queue); +/// +/// // sort the vector on the device +/// boost::compute::sort(vec.begin(), vec.end(), queue); +/// \endcode +/// +/// The sort() algorithm can also be directly used with host iterators. This +/// example will automatically transfer the data to the device, sort it, and +/// then transfer the data back to the host: +/// \code +/// std::vector data = { 9, 3, 2, 5, 1, 4, 6, 7 }; +/// +/// boost::compute::sort(data.begin(), data.end(), queue); +/// \endcode +/// +/// \see is_sorted() +template +inline void sort(Iterator first, + Iterator last, + Compare compare, + command_queue &queue = system::default_queue()) +{ + ::boost::compute::detail::dispatch_sort(first, last, compare, queue); +} + +/// \overload +template +inline void sort(Iterator first, + Iterator last, + command_queue &queue = system::default_queue()) +{ + typedef typename std::iterator_traits::value_type value_type; + + ::boost::compute::sort( + first, last, ::boost::compute::less(), queue + ); +} + +} // end compute namespace +} // end boost namespace + +#endif // BOOST_COMPUTE_ALGORITHM_SORT_HPP diff --git a/3party/boost/boost/compute/algorithm/sort_by_key.hpp b/3party/boost/boost/compute/algorithm/sort_by_key.hpp new file mode 100644 index 0000000000..c39bcf9890 --- /dev/null +++ b/3party/boost/boost/compute/algorithm/sort_by_key.hpp @@ -0,0 +1,161 @@ +//---------------------------------------------------------------------------// +// Copyright (c) 2013 Kyle Lutz +// +// 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 +// +// See http://boostorg.github.com/compute for more information. +//---------------------------------------------------------------------------// + +#ifndef BOOST_COMPUTE_ALGORITHM_SORT_BY_KEY_HPP +#define BOOST_COMPUTE_ALGORITHM_SORT_BY_KEY_HPP + +#include + +#include + +#include +#include +#include +#include +#include +#include +#include +#include + +namespace boost { +namespace compute { + +namespace detail { + +template +inline void +dispatch_gpu_sort_by_key(KeyIterator keys_first, + KeyIterator keys_last, + ValueIterator values_first, + less::value_type> compare, + command_queue &queue, + typename boost::enable_if_c< + is_radix_sortable< + typename std::iterator_traits::value_type + >::value + >::type* = 0) +{ + size_t count = detail::iterator_range_size(keys_first, keys_last); + + if(count < 32){ + detail::serial_insertion_sort_by_key( + keys_first, keys_last, values_first, compare, queue + ); + } + else { + detail::radix_sort_by_key( + keys_first, keys_last, values_first, queue + ); + } +} + +template +inline void +dispatch_gpu_sort_by_key(KeyIterator keys_first, + KeyIterator keys_last, + ValueIterator values_first, + greater::value_type> compare, + command_queue &queue, + typename boost::enable_if_c< + is_radix_sortable< + typename std::iterator_traits::value_type + >::value + >::type* = 0) +{ + size_t count = detail::iterator_range_size(keys_first, keys_last); + + if(count < 32){ + detail::serial_insertion_sort_by_key( + keys_first, keys_last, values_first, compare, queue + ); + } + else { + // radix sorts in descending order + detail::radix_sort_by_key( + keys_first, keys_last, values_first, false, queue + ); + } +} + +template +inline void dispatch_gpu_sort_by_key(KeyIterator keys_first, + KeyIterator keys_last, + ValueIterator values_first, + Compare compare, + command_queue &queue) +{ + size_t count = detail::iterator_range_size(keys_first, keys_last); + + if(count < 32){ + detail::serial_insertion_sort_by_key( + keys_first, keys_last, values_first, compare, queue + ); + } else { + detail::merge_sort_by_key_on_gpu( + keys_first, keys_last, values_first, compare, queue + ); + } +} + +template +inline void dispatch_sort_by_key(KeyIterator keys_first, + KeyIterator keys_last, + ValueIterator values_first, + Compare compare, + command_queue &queue) +{ + if(queue.get_device().type() & device::gpu) { + dispatch_gpu_sort_by_key(keys_first, keys_last, values_first, compare, queue); + return; + } + ::boost::compute::detail::merge_sort_by_key_on_cpu( + keys_first, keys_last, values_first, compare, queue + ); +} + +} // end detail namespace + +/// Performs a key-value sort using the keys in the range [\p keys_first, +/// \p keys_last) on the values in the range [\p values_first, +/// \p values_first \c + (\p keys_last \c - \p keys_first)) using \p compare. +/// +/// If no compare function is specified, \c less is used. +/// +/// \see sort() +template +inline void sort_by_key(KeyIterator keys_first, + KeyIterator keys_last, + ValueIterator values_first, + Compare compare, + command_queue &queue = system::default_queue()) +{ + ::boost::compute::detail::dispatch_sort_by_key( + keys_first, keys_last, values_first, compare, queue + ); +} + +/// \overload +template +inline void sort_by_key(KeyIterator keys_first, + KeyIterator keys_last, + ValueIterator values_first, + command_queue &queue = system::default_queue()) +{ + typedef typename std::iterator_traits::value_type key_type; + + ::boost::compute::sort_by_key( + keys_first, keys_last, values_first, less(), queue + ); +} + +} // end compute namespace +} // end boost namespace + +#endif // BOOST_COMPUTE_ALGORITHM_SORT_BY_KEY_HPP diff --git a/3party/boost/boost/compute/algorithm/stable_partition.hpp b/3party/boost/boost/compute/algorithm/stable_partition.hpp new file mode 100644 index 0000000000..283b068283 --- /dev/null +++ b/3party/boost/boost/compute/algorithm/stable_partition.hpp @@ -0,0 +1,72 @@ +//---------------------------------------------------------------------------// +// Copyright (c) 2014 Roshan +// +// 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 +// +// See http://boostorg.github.com/compute for more information. +//---------------------------------------------------------------------------// + +#ifndef BOOST_COMPUTE_ALGORITHM_STABLE_PARTITION_HPP +#define BOOST_COMPUTE_ALGORITHM_STABLE_PARTITION_HPP + +#include +#include +#include +#include +#include +#include + +namespace boost { +namespace compute { + +/// +/// \brief Partitioning algorithm +/// +/// Partitions the elements in the range [\p first, \p last) according to +/// \p predicate. The order of the elements is preserved. +/// \return Iterator pointing to end of true values +/// +/// \param first Iterator pointing to start of range +/// \param last Iterator pointing to end of range +/// \param predicate Unary predicate to be applied on each element +/// \param queue Queue on which to execute +/// +/// \see is_partitioned() and partition() +/// +template +inline Iterator stable_partition(Iterator first, + Iterator last, + UnaryPredicate predicate, + command_queue &queue = system::default_queue()) +{ + typedef typename std::iterator_traits::value_type value_type; + + // make temporary copy of the input + ::boost::compute::vector tmp(first, last, queue); + + // copy true values + Iterator last_true = + ::boost::compute::copy_if(tmp.begin(), + tmp.end(), + first, + predicate, + queue); + + // copy false values + Iterator last_false = + ::boost::compute::copy_if(tmp.begin(), + tmp.end(), + last_true, + not1(predicate), + queue); + + // return iterator pointing to the last true value + return last_true; +} + +} // end compute namespace +} // end boost namespace + +#endif // BOOST_COMPUTE_ALGORITHM_STABLE_PARTITION_HPP diff --git a/3party/boost/boost/compute/algorithm/stable_sort.hpp b/3party/boost/boost/compute/algorithm/stable_sort.hpp new file mode 100644 index 0000000000..381fc81bc0 --- /dev/null +++ b/3party/boost/boost/compute/algorithm/stable_sort.hpp @@ -0,0 +1,107 @@ +//---------------------------------------------------------------------------// +// Copyright (c) 2013 Kyle Lutz +// +// 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 +// +// See http://boostorg.github.com/compute for more information. +//---------------------------------------------------------------------------// + +#ifndef BOOST_COMPUTE_ALGORITHM_STABLE_SORT_HPP +#define BOOST_COMPUTE_ALGORITHM_STABLE_SORT_HPP + +#include + +#include +#include +#include +#include +#include +#include +#include +#include +#include + +namespace boost { +namespace compute { +namespace detail { + +template +inline void dispatch_gpu_stable_sort(Iterator first, + Iterator last, + Compare compare, + command_queue &queue) +{ + size_t count = detail::iterator_range_size(first, last); + + if(count < 32){ + detail::serial_insertion_sort( + first, last, compare, queue + ); + } else { + detail::merge_sort_on_gpu( + first, last, compare, true /* stable */, queue + ); + } +} + +template +inline typename boost::enable_if_c::value>::type +dispatch_gpu_stable_sort(buffer_iterator first, + buffer_iterator last, + less, + command_queue &queue) +{ + ::boost::compute::detail::radix_sort(first, last, queue); +} + +template +inline typename boost::enable_if_c::value>::type +dispatch_gpu_stable_sort(buffer_iterator first, + buffer_iterator last, + greater, + command_queue &queue) +{ + // radix sorts in descending order + ::boost::compute::detail::radix_sort(first, last, false, queue); +} + +} // end detail namespace + +/// Sorts the values in the range [\p first, \p last) according to +/// \p compare. The relative order of identical values is preserved. +/// +/// \see sort(), is_sorted() +template +inline void stable_sort(Iterator first, + Iterator last, + Compare compare, + command_queue &queue = system::default_queue()) +{ + if(queue.get_device().type() & device::gpu) { + ::boost::compute::detail::dispatch_gpu_stable_sort( + first, last, compare, queue + ); + return; + } + ::boost::compute::detail::merge_sort_on_cpu(first, last, compare, queue); +} + +/// \overload +template +inline void stable_sort(Iterator first, + Iterator last, + command_queue &queue = system::default_queue()) +{ + typedef typename std::iterator_traits::value_type value_type; + + ::boost::compute::less less; + + ::boost::compute::stable_sort(first, last, less, queue); +} + +} // end compute namespace +} // end boost namespace + +#endif // BOOST_COMPUTE_ALGORITHM_STABLE_SORT_HPP diff --git a/3party/boost/boost/compute/algorithm/stable_sort_by_key.hpp b/3party/boost/boost/compute/algorithm/stable_sort_by_key.hpp new file mode 100644 index 0000000000..878f999f44 --- /dev/null +++ b/3party/boost/boost/compute/algorithm/stable_sort_by_key.hpp @@ -0,0 +1,159 @@ +//---------------------------------------------------------------------------// +// Copyright (c) 2016 Jakub Szuppe +// +// 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 +// +// See http://boostorg.github.com/compute for more information. +//---------------------------------------------------------------------------// + +#ifndef BOOST_COMPUTE_ALGORITHM_STABLE_SORT_BY_KEY_HPP +#define BOOST_COMPUTE_ALGORITHM_STABLE_SORT_BY_KEY_HPP + +#include + +#include +#include +#include +#include + +namespace boost { +namespace compute { + +namespace detail { + +template +inline void +dispatch_gpu_ssort_by_key(KeyIterator keys_first, + KeyIterator keys_last, + ValueIterator values_first, + less::value_type> compare, + command_queue &queue, + typename boost::enable_if_c< + is_radix_sortable< + typename std::iterator_traits::value_type + >::value + >::type* = 0) +{ + size_t count = detail::iterator_range_size(keys_first, keys_last); + + if(count < 32){ + detail::serial_insertion_sort_by_key( + keys_first, keys_last, values_first, compare, queue + ); + } + else { + detail::radix_sort_by_key( + keys_first, keys_last, values_first, queue + ); + } +} + +template +inline void +dispatch_gpu_ssort_by_key(KeyIterator keys_first, + KeyIterator keys_last, + ValueIterator values_first, + greater::value_type> compare, + command_queue &queue, + typename boost::enable_if_c< + is_radix_sortable< + typename std::iterator_traits::value_type + >::value + >::type* = 0) +{ + size_t count = detail::iterator_range_size(keys_first, keys_last); + + if(count < 32){ + detail::serial_insertion_sort_by_key( + keys_first, keys_last, values_first, compare, queue + ); + } + else { + // radix sorts in descending order + detail::radix_sort_by_key( + keys_first, keys_last, values_first, false, queue + ); + } +} + +template +inline void dispatch_gpu_ssort_by_key(KeyIterator keys_first, + KeyIterator keys_last, + ValueIterator values_first, + Compare compare, + command_queue &queue) +{ + size_t count = detail::iterator_range_size(keys_first, keys_last); + + if(count < 32){ + detail::serial_insertion_sort_by_key( + keys_first, keys_last, values_first, + compare, queue + ); + } else { + detail::merge_sort_by_key_on_gpu( + keys_first, keys_last, values_first, + compare, true /* stable */, queue + ); + } +} + +template +inline void dispatch_ssort_by_key(KeyIterator keys_first, + KeyIterator keys_last, + ValueIterator values_first, + Compare compare, + command_queue &queue) +{ + if(queue.get_device().type() & device::gpu) { + dispatch_gpu_ssort_by_key( + keys_first, keys_last, values_first, compare, queue + ); + return; + } + ::boost::compute::detail::merge_sort_by_key_on_cpu( + keys_first, keys_last, values_first, compare, queue + ); +} + +} // end detail namespace + +/// Performs a key-value stable sort using the keys in the range [\p keys_first, +/// \p keys_last) on the values in the range [\p values_first, +/// \p values_first \c + (\p keys_last \c - \p keys_first)) using \p compare. +/// +/// If no compare function is specified, \c less is used. +/// +/// \see sort() +template +inline void stable_sort_by_key(KeyIterator keys_first, + KeyIterator keys_last, + ValueIterator values_first, + Compare compare, + command_queue &queue = system::default_queue()) +{ + ::boost::compute::detail::dispatch_ssort_by_key( + keys_first, keys_last, values_first, compare, queue + ); +} + +/// \overload +template +inline void stable_sort_by_key(KeyIterator keys_first, + KeyIterator keys_last, + ValueIterator values_first, + command_queue &queue = system::default_queue()) +{ + typedef typename std::iterator_traits::value_type key_type; + + ::boost::compute::stable_sort_by_key( + keys_first, keys_last, values_first, less(), queue + ); +} + +} // end compute namespace +} // end boost namespace + +#endif // BOOST_COMPUTE_ALGORITHM_STABLE_SORT_BY_KEY_HPP diff --git a/3party/boost/boost/compute/algorithm/swap_ranges.hpp b/3party/boost/boost/compute/algorithm/swap_ranges.hpp new file mode 100644 index 0000000000..6ff3e14f6a --- /dev/null +++ b/3party/boost/boost/compute/algorithm/swap_ranges.hpp @@ -0,0 +1,44 @@ +//---------------------------------------------------------------------------// +// Copyright (c) 2013 Kyle Lutz +// +// 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 +// +// See http://boostorg.github.com/compute for more information. +//---------------------------------------------------------------------------// + +#ifndef BOOST_COMPUTE_ALGORITHM_SWAP_RANGES_HPP +#define BOOST_COMPUTE_ALGORITHM_SWAP_RANGES_HPP + +#include +#include +#include +#include + +namespace boost { +namespace compute { + +/// Swaps the elements in the range [\p first1, \p last1) with the +/// elements in the range beginning at \p first2. +template +inline Iterator2 swap_ranges(Iterator1 first1, + Iterator1 last1, + Iterator2 first2, + command_queue &queue = system::default_queue()) +{ + typedef typename std::iterator_traits::value_type value_type; + + Iterator2 last2 = first2 + std::distance(first1, last1); + + ::boost::compute::vector tmp(first1, last1, queue); + ::boost::compute::copy(first2, last2, first1, queue); + ::boost::compute::copy(tmp.begin(), tmp.end(), first2, queue); + + return last2; +} + +} // end compute namespace +} // end boost namespace + +#endif // BOOST_COMPUTE_ALGORITHM_SWAP_RANGES_HPP diff --git a/3party/boost/boost/compute/algorithm/transform.hpp b/3party/boost/boost/compute/algorithm/transform.hpp new file mode 100644 index 0000000000..68750a6523 --- /dev/null +++ b/3party/boost/boost/compute/algorithm/transform.hpp @@ -0,0 +1,76 @@ +//---------------------------------------------------------------------------// +// Copyright (c) 2013 Kyle Lutz +// +// 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 +// +// See http://boostorg.github.com/compute for more information. +//---------------------------------------------------------------------------// + +#ifndef BOOST_COMPUTE_ALGORITHM_TRANSFORM_HPP +#define BOOST_COMPUTE_ALGORITHM_TRANSFORM_HPP + +#include +#include +#include +#include +#include +#include + +namespace boost { +namespace compute { + +/// Transforms the elements in the range [\p first, \p last) using +/// operator \p op and stores the results in the range beginning at +/// \p result. +/// +/// For example, to calculate the absolute value for each element in a vector: +/// +/// \snippet test/test_transform.cpp transform_abs +/// +/// \see copy() +template +inline OutputIterator transform(InputIterator first, + InputIterator last, + OutputIterator result, + UnaryOperator op, + command_queue &queue = system::default_queue()) +{ + return copy( + ::boost::compute::make_transform_iterator(first, op), + ::boost::compute::make_transform_iterator(last, op), + result, + queue + ); +} + +/// \overload +template +inline OutputIterator transform(InputIterator1 first1, + InputIterator1 last1, + InputIterator2 first2, + OutputIterator result, + BinaryOperator op, + command_queue &queue = system::default_queue()) +{ + typedef typename std::iterator_traits::difference_type difference_type; + + difference_type n = std::distance(first1, last1); + + return transform( + make_zip_iterator(boost::make_tuple(first1, first2)), + make_zip_iterator(boost::make_tuple(last1, first2 + n)), + result, + detail::unpack(op), + queue + ); +} + +} // end compute namespace +} // end boost namespace + +#endif // BOOST_COMPUTE_ALGORITHM_TRANSFORM_HPP diff --git a/3party/boost/boost/compute/algorithm/transform_if.hpp b/3party/boost/boost/compute/algorithm/transform_if.hpp new file mode 100644 index 0000000000..0eb0fd434e --- /dev/null +++ b/3party/boost/boost/compute/algorithm/transform_if.hpp @@ -0,0 +1,117 @@ +//---------------------------------------------------------------------------// +// Copyright (c) 2013-2015 Kyle Lutz +// +// 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 +// +// See http://boostorg.github.com/compute for more information. +//---------------------------------------------------------------------------// + +#ifndef BOOST_COMPUTE_ALGORITHM_TRANSFORM_IF_HPP +#define BOOST_COMPUTE_ALGORITHM_TRANSFORM_IF_HPP + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +namespace boost { +namespace compute { +namespace detail { + +template +inline OutputIterator transform_if_impl(InputIterator first, + InputIterator last, + OutputIterator result, + UnaryFunction function, + Predicate predicate, + bool copyIndex, + command_queue &queue) +{ + typedef typename std::iterator_traits::difference_type difference_type; + + size_t count = detail::iterator_range_size(first, last); + if(count == 0){ + return result; + } + + const context &context = queue.get_context(); + + // storage for destination indices + ::boost::compute::vector indices(count, context); + + // write counts + ::boost::compute::detail::meta_kernel k1("transform_if_write_counts"); + k1 << indices.begin()[k1.get_global_id(0)] << " = " + << predicate(first[k1.get_global_id(0)]) << " ? 1 : 0;\n"; + k1.exec_1d(queue, 0, count); + + // count number of elements to be copied + size_t copied_element_count = + ::boost::compute::count(indices.begin(), indices.end(), 1, queue); + + // scan indices + ::boost::compute::exclusive_scan( + indices.begin(), indices.end(), indices.begin(), queue + ); + + // copy values + ::boost::compute::detail::meta_kernel k2("transform_if_do_copy"); + k2 << "if(" << predicate(first[k2.get_global_id(0)]) << ")" << + " " << result[indices.begin()[k2.get_global_id(0)]] << "="; + + if(copyIndex){ + k2 << k2.get_global_id(0) << ";\n"; + } + else { + k2 << function(first[k2.get_global_id(0)]) << ";\n"; + } + + k2.exec_1d(queue, 0, count); + + return result + static_cast(copied_element_count); +} + +template +inline discard_iterator transform_if_impl(InputIterator first, + InputIterator last, + discard_iterator result, + UnaryFunction function, + Predicate predicate, + bool copyIndex, + command_queue &queue) +{ + (void) function; + (void) copyIndex; + + return result + count_if(first, last, predicate, queue); +} + +} // end detail namespace + +/// Copies each element in the range [\p first, \p last) for which +/// \p predicate returns \c true to the range beginning at \p result. +template +inline OutputIterator transform_if(InputIterator first, + InputIterator last, + OutputIterator result, + UnaryFunction function, + Predicate predicate, + command_queue &queue = system::default_queue()) +{ + return detail::transform_if_impl( + first, last, result, function, predicate, false, queue + ); +} + +} // end compute namespace +} // end boost namespace + +#endif // BOOST_COMPUTE_ALGORITHM_TRANSFORM_IF_HPP diff --git a/3party/boost/boost/compute/algorithm/transform_reduce.hpp b/3party/boost/boost/compute/algorithm/transform_reduce.hpp new file mode 100644 index 0000000000..fbeee5a691 --- /dev/null +++ b/3party/boost/boost/compute/algorithm/transform_reduce.hpp @@ -0,0 +1,89 @@ +//---------------------------------------------------------------------------// +// Copyright (c) 2013 Kyle Lutz +// +// 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 +// +// See http://boostorg.github.com/compute for more information. +//---------------------------------------------------------------------------// + +#ifndef BOOST_COMPUTE_ALGORITHM_TRANSFORM_REDUCE_HPP +#define BOOST_COMPUTE_ALGORITHM_TRANSFORM_REDUCE_HPP + +#include +#include +#include +#include +#include +#include + +namespace boost { +namespace compute { + +/// Transforms each value in the range [\p first, \p last) with the unary +/// \p transform_function and then reduces each transformed value with +/// \p reduce_function. +/// +/// For example, to calculate the sum of the absolute values of a vector +/// of integers: +/// +/// \snippet test/test_transform_reduce.cpp sum_abs_int +/// +/// \see reduce(), inner_product() +template +inline void transform_reduce(InputIterator first, + InputIterator last, + OutputIterator result, + UnaryTransformFunction transform_function, + BinaryReduceFunction reduce_function, + command_queue &queue = system::default_queue()) +{ + ::boost::compute::reduce( + ::boost::compute::make_transform_iterator(first, transform_function), + ::boost::compute::make_transform_iterator(last, transform_function), + result, + reduce_function, + queue + ); +} + +/// \overload +template +inline void transform_reduce(InputIterator1 first1, + InputIterator1 last1, + InputIterator2 first2, + OutputIterator result, + BinaryTransformFunction transform_function, + BinaryReduceFunction reduce_function, + command_queue &queue = system::default_queue()) +{ + typedef typename std::iterator_traits::difference_type difference_type; + + difference_type n = std::distance(first1, last1); + + ::boost::compute::transform_reduce( + ::boost::compute::make_zip_iterator( + boost::make_tuple(first1, first2) + ), + ::boost::compute::make_zip_iterator( + boost::make_tuple(last1, first2 + n) + ), + result, + detail::unpack(transform_function), + reduce_function, + queue + ); +} + +} // end compute namespace +} // end boost namespace + +#endif // BOOST_COMPUTE_ALGORITHM_TRANSFORM_REDUCE_HPP diff --git a/3party/boost/boost/compute/algorithm/unique.hpp b/3party/boost/boost/compute/algorithm/unique.hpp new file mode 100644 index 0000000000..faa36bad9d --- /dev/null +++ b/3party/boost/boost/compute/algorithm/unique.hpp @@ -0,0 +1,66 @@ +//---------------------------------------------------------------------------// +// Copyright (c) 2014 Roshan +// +// 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 +// +// See http://boostorg.github.com/compute for more information. +//---------------------------------------------------------------------------// + +#ifndef BOOST_COMPUTE_ALGORITHM_UNIQUE_HPP +#define BOOST_COMPUTE_ALGORITHM_UNIQUE_HPP + +#include +#include +#include +#include +#include + +namespace boost { +namespace compute { + +/// Removes all consecutive duplicate elements (determined by \p op) from the +/// range [first, last). If \p op is not provided, the equality operator is +/// used. +/// +/// \param first first element in the input range +/// \param last last element in the input range +/// \param op binary operator used to check for uniqueness +/// \param queue command queue to perform the operation +/// +/// \return \c InputIterator to the new logical end of the range +/// +/// \see unique_copy() +template +inline InputIterator unique(InputIterator first, + InputIterator last, + BinaryPredicate op, + command_queue &queue = system::default_queue()) +{ + typedef typename std::iterator_traits::value_type value_type; + + vector temp(first, last, queue); + + return ::boost::compute::unique_copy( + temp.begin(), temp.end(), first, op, queue + ); +} + +/// \overload +template +inline InputIterator unique(InputIterator first, + InputIterator last, + command_queue &queue = system::default_queue()) +{ + typedef typename std::iterator_traits::value_type value_type; + + return ::boost::compute::unique( + first, last, ::boost::compute::equal_to(), queue + ); +} + +} // end compute namespace +} // end boost namespace + +#endif // BOOST_COMPUTE_ALGORITHM_UNIQUE_HPP diff --git a/3party/boost/boost/compute/algorithm/unique_copy.hpp b/3party/boost/boost/compute/algorithm/unique_copy.hpp new file mode 100644 index 0000000000..2ce60a9359 --- /dev/null +++ b/3party/boost/boost/compute/algorithm/unique_copy.hpp @@ -0,0 +1,164 @@ +//---------------------------------------------------------------------------// +// Copyright (c) 2014 Roshan +// +// 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 +// +// See http://boostorg.github.com/compute for more information. +//---------------------------------------------------------------------------// + +#ifndef BOOST_COMPUTE_ALGORITHM_UNIQUE_COPY_HPP +#define BOOST_COMPUTE_ALGORITHM_UNIQUE_COPY_HPP + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +namespace boost { +namespace compute { +namespace detail { + +template +inline OutputIterator serial_unique_copy(InputIterator first, + InputIterator last, + OutputIterator result, + BinaryPredicate op, + command_queue &queue) +{ + if(first == last){ + return result; + } + + typedef typename std::iterator_traits::value_type value_type; + + const context &context = queue.get_context(); + + size_t count = detail::iterator_range_size(first, last); + + detail::meta_kernel k("serial_unique_copy"); + + vector unique_count_vector(1, context); + + size_t size_arg = k.add_arg("size"); + size_t unique_count_arg = k.add_arg(memory_object::global_memory, "unique_count"); + + k << k.decl("index") << " = 0;\n" + << k.decl("current") << " = " << first[k.var("0")] << ";\n" + << result[k.var("0")] << " = current;\n" + << "for(uint i = 1; i < size; i++){\n" + << " " << k.decl("next") << " = " << first[k.var("i")] << ";\n" + << " if(!" << op(k.var("current"), k.var("next")) << "){\n" + << " " << result[k.var("++index")] << " = next;\n" + << " " << "current = next;\n" + << " }\n" + << "}\n" + << "*unique_count = index + 1;\n"; + + k.set_arg(size_arg, count); + k.set_arg(unique_count_arg, unique_count_vector.get_buffer()); + + k.exec_1d(queue, 0, 1, 1); + + uint_ unique_count; + copy_n(unique_count_vector.begin(), 1, &unique_count, queue); + + return result + unique_count; +} + +template +inline OutputIterator unique_copy(InputIterator first, + InputIterator last, + OutputIterator result, + BinaryPredicate op, + command_queue &queue) +{ + if(first == last){ + return result; + } + + const context &context = queue.get_context(); + size_t count = detail::iterator_range_size(first, last); + + // flags marking unique elements + vector flags(count, context); + + // find each unique element and mark it with a one + transform( + first, last - 1, first + 1, flags.begin() + 1, not2(op), queue + ); + + // first element is always unique + fill_n(flags.begin(), 1, 1, queue); + + // storage for desination indices + vector indices(count, context); + + // copy indices for each unique element + vector::iterator last_index = detail::copy_index_if( + flags.begin(), flags.end(), indices.begin(), lambda::_1 == 1, queue + ); + + // copy unique values from input to output using the computed indices + gather(indices.begin(), last_index, first, result, queue); + + // return an iterator to the end of the unique output range + return result + std::distance(indices.begin(), last_index); +} + +} // end detail namespace + +/// Makes a copy of the range [first, last) and removes all consecutive +/// duplicate elements (determined by \p op) from the copy. If \p op is not +/// provided, the equality operator is used. +/// +/// \param first first element in the input range +/// \param last last element in the input range +/// \param result first element in the result range +/// \param op binary operator used to check for uniqueness +/// \param queue command queue to perform the operation +/// +/// \return \c OutputIterator to the end of the result range +/// +/// \see unique() +template +inline OutputIterator unique_copy(InputIterator first, + InputIterator last, + OutputIterator result, + BinaryPredicate op, + command_queue &queue = system::default_queue()) +{ + size_t count = detail::iterator_range_size(first, last); + if(count < 32){ + return detail::serial_unique_copy(first, last, result, op, queue); + } + else { + return detail::unique_copy(first, last, result, op, queue); + } +} + +/// \overload +template +inline OutputIterator unique_copy(InputIterator first, + InputIterator last, + OutputIterator result, + command_queue &queue = system::default_queue()) +{ + typedef typename std::iterator_traits::value_type value_type; + + return ::boost::compute::unique_copy( + first, last, result, ::boost::compute::equal_to(), queue + ); +} + +} // end compute namespace +} // end boost namespace + +#endif // BOOST_COMPUTE_ALGORITHM_UNIQUE_COPY_HPP diff --git a/3party/boost/boost/compute/algorithm/upper_bound.hpp b/3party/boost/boost/compute/algorithm/upper_bound.hpp new file mode 100644 index 0000000000..a5a82d301c --- /dev/null +++ b/3party/boost/boost/compute/algorithm/upper_bound.hpp @@ -0,0 +1,43 @@ +//---------------------------------------------------------------------------// +// Copyright (c) 2013 Kyle Lutz +// +// 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 +// +// See http://boostorg.github.com/compute for more information. +//---------------------------------------------------------------------------// + +#ifndef BOOST_COMPUTE_ALGORITHM_UPPER_BOUND_HPP +#define BOOST_COMPUTE_ALGORITHM_UPPER_BOUND_HPP + +#include +#include +#include +#include + +namespace boost { +namespace compute { + +/// Returns an iterator pointing to the first element in the sorted +/// range [\p first, \p last) that is not less than or equal to +/// \p value. +template +inline InputIterator +upper_bound(InputIterator first, + InputIterator last, + const T &value, + command_queue &queue = system::default_queue()) +{ + using ::boost::compute::_1; + + InputIterator position = + detail::binary_find(first, last, _1 > value, queue); + + return position; +} + +} // end compute namespace +} // end boost namespace + +#endif // BOOST_COMPUTE_ALGORITHM_UPPER_BOUND_HPP diff --git a/3party/boost/boost/compute/allocator.hpp b/3party/boost/boost/compute/allocator.hpp new file mode 100644 index 0000000000..e3db491b42 --- /dev/null +++ b/3party/boost/boost/compute/allocator.hpp @@ -0,0 +1,21 @@ +//---------------------------------------------------------------------------// +// Copyright (c) 2013-2014 Kyle Lutz +// +// 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 +// +// See http://boostorg.github.com/compute for more information. +//---------------------------------------------------------------------------// + +#ifndef BOOST_COMPUTE_ALLOCATOR_HPP +#define BOOST_COMPUTE_ALLOCATOR_HPP + +/// \file +/// +/// Meta-header to include all Boost.Compute allocator headers. + +#include +#include + +#endif // BOOST_COMPUTE_ALLOCATOR_HPP diff --git a/3party/boost/boost/compute/allocator/buffer_allocator.hpp b/3party/boost/boost/compute/allocator/buffer_allocator.hpp new file mode 100644 index 0000000000..2139a97896 --- /dev/null +++ b/3party/boost/boost/compute/allocator/buffer_allocator.hpp @@ -0,0 +1,118 @@ +//---------------------------------------------------------------------------// +// Copyright (c) 2013-2014 Kyle Lutz +// +// 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 +// +// See http://boostorg.github.com/compute for more information. +//---------------------------------------------------------------------------// + +#ifndef BOOST_COMPUTE_ALLOCATOR_BUFFER_ALLOCATOR_HPP +#define BOOST_COMPUTE_ALLOCATOR_BUFFER_ALLOCATOR_HPP + +#include +#include +#include +#include + +namespace boost { +namespace compute { + +/// \class buffer_allocator +/// \brief The buffer_allocator class allocates memory with \ref buffer objects +/// +/// \see buffer +template +class buffer_allocator +{ +public: + typedef T value_type; + typedef detail::device_ptr pointer; + typedef const detail::device_ptr const_pointer; + typedef std::size_t size_type; + typedef std::ptrdiff_t difference_type; + + explicit buffer_allocator(const context &context) + : m_context(context), + m_mem_flags(buffer::read_write) + { + } + + buffer_allocator(const buffer_allocator &other) + : m_context(other.m_context), + m_mem_flags(other.m_mem_flags) + { + } + + buffer_allocator& operator=(const buffer_allocator &other) + { + if(this != &other){ + m_context = other.m_context; + m_mem_flags = other.m_mem_flags; + } + + return *this; + } + + #ifndef BOOST_COMPUTE_NO_RVALUE_REFERENCES + buffer_allocator(buffer_allocator&& other) BOOST_NOEXCEPT + : m_context(std::move(other.m_context)), + m_mem_flags(other.m_mem_flags) + { + } + + buffer_allocator& operator=(buffer_allocator&& other) BOOST_NOEXCEPT + { + m_context = std::move(other.m_context); + m_mem_flags = other.m_mem_flags; + + return *this; + } + #endif // BOOST_COMPUTE_NO_RVALUE_REFERENCES + + ~buffer_allocator() + { + } + + pointer allocate(size_type n) + { + buffer buf(m_context, n * sizeof(T), m_mem_flags); + clRetainMemObject(buf.get()); + return detail::device_ptr(buf); + } + + void deallocate(pointer p, size_type n) + { + BOOST_ASSERT(p.get_buffer().get_context() == m_context); + + (void) n; + + clReleaseMemObject(p.get_buffer().get()); + } + + size_type max_size() const + { + return m_context.get_device().max_memory_alloc_size() / sizeof(T); + } + + context get_context() const + { + return m_context; + } + +protected: + void set_mem_flags(cl_mem_flags flags) + { + m_mem_flags = flags; + } + +private: + context m_context; + cl_mem_flags m_mem_flags; +}; + +} // end compute namespace +} // end boost namespace + +#endif // BOOST_COMPUTE_ALLOCATOR_BUFFER_ALLOCATOR_HPP diff --git a/3party/boost/boost/compute/allocator/pinned_allocator.hpp b/3party/boost/boost/compute/allocator/pinned_allocator.hpp new file mode 100644 index 0000000000..9c85d93e79 --- /dev/null +++ b/3party/boost/boost/compute/allocator/pinned_allocator.hpp @@ -0,0 +1,53 @@ +//---------------------------------------------------------------------------// +// Copyright (c) 2013-2014 Kyle Lutz +// +// 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 +// +// See http://boostorg.github.com/compute for more information. +//---------------------------------------------------------------------------// + +#ifndef BOOST_COMPUTE_ALLOCATOR_PINNED_ALLOCATOR_HPP +#define BOOST_COMPUTE_ALLOCATOR_PINNED_ALLOCATOR_HPP + +#include + +namespace boost { +namespace compute { + +template +class pinned_allocator : public buffer_allocator +{ +public: + explicit pinned_allocator(const context &context) + : buffer_allocator(context) + { + buffer_allocator::set_mem_flags( + buffer::read_write | buffer::alloc_host_ptr + ); + } + + pinned_allocator(const pinned_allocator &other) + : buffer_allocator(other) + { + } + + pinned_allocator& operator=(const pinned_allocator &other) + { + if(this != &other){ + buffer_allocator::operator=(other); + } + + return *this; + } + + ~pinned_allocator() + { + } +}; + +} // end compute namespace +} // end boost namespace + +#endif // BOOST_COMPUTE_ALLOCATOR_PINNED_ALLOCATOR_HPP diff --git a/3party/boost/boost/compute/async.hpp b/3party/boost/boost/compute/async.hpp new file mode 100644 index 0000000000..415dedda7d --- /dev/null +++ b/3party/boost/boost/compute/async.hpp @@ -0,0 +1,21 @@ +//---------------------------------------------------------------------------// +// Copyright (c) 2013 Kyle Lutz +// +// 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 +// +// See http://boostorg.github.com/compute for more information. +//---------------------------------------------------------------------------// + +#ifndef BOOST_COMPUTE_ASYNC_HPP +#define BOOST_COMPUTE_ASYNC_HPP + +/// \file +/// +/// Meta-header to include all Boost.Compute async headers. + +#include +#include + +#endif // BOOST_COMPUTE_ASYNC_HPP diff --git a/3party/boost/boost/compute/async/future.hpp b/3party/boost/boost/compute/async/future.hpp new file mode 100644 index 0000000000..f7f7780deb --- /dev/null +++ b/3party/boost/boost/compute/async/future.hpp @@ -0,0 +1,166 @@ +//---------------------------------------------------------------------------// +// Copyright (c) 2013 Kyle Lutz +// +// 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 +// +// See http://boostorg.github.com/compute for more information. +//---------------------------------------------------------------------------// + +#ifndef BOOST_COMPUTE_ASYNC_FUTURE_HPP +#define BOOST_COMPUTE_ASYNC_FUTURE_HPP + +#include + +namespace boost { +namespace compute { + +/// \class future +/// \brief Holds the result of an asynchronous computation. +/// +/// \see event, wait_list +template +class future +{ +public: + future() + : m_event(0) + { + } + + future(const T &result, const event &event) + : m_result(result), + m_event(event) + { + } + + future(const future &other) + : m_result(other.m_result), + m_event(other.m_event) + { + } + + future& operator=(const future &other) + { + if(this != &other){ + m_result = other.m_result; + m_event = other.m_event; + } + + return *this; + } + + ~future() + { + } + + /// Returns the result of the computation. This will block until + /// the result is ready. + T get() + { + wait(); + + return m_result; + } + + /// Returns \c true if the future is valid. + bool valid() const + { + return m_event != 0; + } + + /// Blocks until the computation is complete. + void wait() const + { + m_event.wait(); + } + + /// Returns the underlying event object. + event get_event() const + { + return m_event; + } + +private: + T m_result; + event m_event; +}; + +/// \internal_ +template<> +class future +{ +public: + future() + : m_event(0) + { + } + + template + future(const future &other) + : m_event(other.get_event()) + { + } + + explicit future(const event &event) + : m_event(event) + { + } + + template + future &operator=(const future &other) + { + m_event = other.get_event(); + + return *this; + } + + future &operator=(const future &other) + { + if(this != &other){ + m_event = other.m_event; + } + + return *this; + } + + ~future() + { + } + + void get() + { + wait(); + } + + bool valid() const + { + return m_event != 0; + } + + void wait() const + { + m_event.wait(); + } + + event get_event() const + { + return m_event; + } + +private: + event m_event; +}; + +/// \internal_ +template +inline future make_future(const Result &result, const event &event) +{ + return future(result, event); +} + +} // end compute namespace +} // end boost namespace + +#endif // BOOST_COMPUTE_ASYNC_FUTURE_HPP diff --git a/3party/boost/boost/compute/async/wait.hpp b/3party/boost/boost/compute/async/wait.hpp new file mode 100644 index 0000000000..dacf0feb0c --- /dev/null +++ b/3party/boost/boost/compute/async/wait.hpp @@ -0,0 +1,56 @@ +//---------------------------------------------------------------------------// +// Copyright (c) 2013-2014 Kyle Lutz +// +// 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 +// +// See http://boostorg.github.com/compute for more information. +//---------------------------------------------------------------------------// + +#ifndef BOOST_COMPUTE_ASYNC_WAIT_HPP +#define BOOST_COMPUTE_ASYNC_WAIT_HPP + +#include +#include + +namespace boost { +namespace compute { +namespace detail { + +#ifndef BOOST_COMPUTE_NO_VARIADIC_TEMPLATES +template +inline void insert_events_variadic(wait_list &l, Event&& event) +{ + l.insert(std::forward(event)); +} + +template +inline void insert_events_variadic(wait_list &l, Event&& event, Rest&&... rest) +{ + l.insert(std::forward(event)); + + insert_events_variadic(l, std::forward(rest)...); +} +#endif // BOOST_COMPUTE_NO_VARIADIC_TEMPLATES + +} // end detail namespace + +#ifndef BOOST_COMPUTE_NO_VARIADIC_TEMPLATES +/// Blocks until all events have completed. Events can either be \ref event +/// objects or \ref future "future" objects. +/// +/// \see event, wait_list +template +inline void wait_for_all(Events&&... events) +{ + wait_list l; + detail::insert_events_variadic(l, std::forward(events)...); + l.wait(); +} +#endif // BOOST_COMPUTE_NO_VARIADIC_TEMPLATES + +} // end compute namespace +} // end boost namespace + +#endif // BOOST_COMPUTE_ASYNC_WAIT_HPP diff --git a/3party/boost/boost/compute/async/wait_guard.hpp b/3party/boost/boost/compute/async/wait_guard.hpp new file mode 100644 index 0000000000..46018fa35a --- /dev/null +++ b/3party/boost/boost/compute/async/wait_guard.hpp @@ -0,0 +1,63 @@ +//---------------------------------------------------------------------------// +// Copyright (c) 2013-2015 Kyle Lutz +// +// 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 +// +// See http://boostorg.github.com/compute for more information. +//---------------------------------------------------------------------------// + +#ifndef BOOST_COMPUTE_ASYNC_WAIT_GUARD_HPP +#define BOOST_COMPUTE_ASYNC_WAIT_GUARD_HPP + +#include + +namespace boost { +namespace compute { + +/// \class wait_guard +/// \brief A guard object for synchronizing an operation on the device +/// +/// The wait_guard class stores a waitable object representing an operation +/// on a compute device (e.g. \ref event, \ref future "future") and calls +/// its \c wait() method when the guard object goes out of scope. +/// +/// This is useful for ensuring that an OpenCL operation completes before +/// leaving the current scope and cleaning up any resources. +/// +/// For example: +/// \code +/// // enqueue a compute kernel for execution +/// event e = queue.enqueue_nd_range_kernel(...); +/// +/// // call e.wait() upon exiting the current scope +/// wait_guard guard(e); +/// \endcode +/// +/// \ref wait_list, wait_for_all() +template +class wait_guard : boost::noncopyable +{ +public: + /// Creates a new wait_guard object for \p waitable. + wait_guard(const Waitable &waitable) + : m_waitable(waitable) + { + } + + /// Destroys the wait_guard object. The default implementation will call + /// \c wait() on the stored waitable object. + ~wait_guard() + { + m_waitable.wait(); + } + +private: + Waitable m_waitable; +}; + +} // end compute namespace +} // end boost namespace + +#endif // BOOST_COMPUTE_ASYNC_WAIT_GUARD_HPP diff --git a/3party/boost/boost/compute/buffer.hpp b/3party/boost/boost/compute/buffer.hpp new file mode 100644 index 0000000000..b5a48806d5 --- /dev/null +++ b/3party/boost/boost/compute/buffer.hpp @@ -0,0 +1,227 @@ +//---------------------------------------------------------------------------// +// Copyright (c) 2013 Kyle Lutz +// +// 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 +// +// See http://boostorg.github.com/compute for more information. +//---------------------------------------------------------------------------// + +#ifndef BOOST_COMPUTE_BUFFER_HPP +#define BOOST_COMPUTE_BUFFER_HPP + +#include +#include +#include +#include +#include + +namespace boost { +namespace compute { + +// forward declarations +class command_queue; + +/// \class buffer +/// \brief A memory buffer on a compute device. +/// +/// The buffer class represents a memory buffer on a compute device. +/// +/// Buffers are allocated within a compute context. For example, to allocate +/// a memory buffer for 32 float's: +/// +/// \snippet test/test_buffer.cpp constructor +/// +/// Once created, data can be copied to and from the buffer using the +/// \c enqueue_*_buffer() methods in the command_queue class. For example, to +/// copy a set of \c int values from the host to the device: +/// \code +/// int data[] = { 1, 2, 3, 4 }; +/// +/// queue.enqueue_write_buffer(buf, 0, 4 * sizeof(int), data); +/// \endcode +/// +/// Also see the copy() algorithm for a higher-level interface to copying data +/// between the host and the device. For a higher-level, dynamically-resizable, +/// type-safe container for data on a compute device, use the vector class. +/// +/// Buffer objects have reference semantics. Creating a copy of a buffer +/// object simply creates another reference to the underlying OpenCL memory +/// object. To create an actual copy use the buffer::clone() method. +/// +/// \see context, command_queue +class buffer : public memory_object +{ +public: + /// Creates a null buffer object. + buffer() + : memory_object() + { + } + + /// Creates a buffer object for \p mem. If \p retain is \c true, the + /// reference count for \p mem will be incremented. + explicit buffer(cl_mem mem, bool retain = true) + : memory_object(mem, retain) + { + } + + /// Create a new memory buffer in of \p size with \p flags in + /// \p context. + /// + /// \see_opencl_ref{clCreateBuffer} + buffer(const context &context, + size_t size, + cl_mem_flags flags = read_write, + void *host_ptr = 0) + { + cl_int error = 0; + m_mem = clCreateBuffer(context, + flags, + (std::max)(size, size_t(1)), + host_ptr, + &error); + if(!m_mem){ + BOOST_THROW_EXCEPTION(opencl_error(error)); + } + } + + /// Creates a new buffer object as a copy of \p other. + buffer(const buffer &other) + : memory_object(other) + { + } + + /// Copies the buffer object from \p other to \c *this. + buffer& operator=(const buffer &other) + { + if(this != &other){ + memory_object::operator=(other); + } + + return *this; + } + + #ifndef BOOST_COMPUTE_NO_RVALUE_REFERENCES + /// Move-constructs a new buffer object from \p other. + buffer(buffer&& other) BOOST_NOEXCEPT + : memory_object(std::move(other)) + { + } + + /// Move-assigns the buffer from \p other to \c *this. + buffer& operator=(buffer&& other) BOOST_NOEXCEPT + { + memory_object::operator=(std::move(other)); + + return *this; + } + #endif // BOOST_COMPUTE_NO_RVALUE_REFERENCES + + /// Destroys the buffer object. + ~buffer() + { + } + + /// Returns the size of the buffer in bytes. + size_t size() const + { + return get_memory_size(); + } + + /// \internal_ + size_t max_size() const + { + return get_context().get_device().max_memory_alloc_size(); + } + + /// Returns information about the buffer. + /// + /// \see_opencl_ref{clGetMemObjectInfo} + template + T get_info(cl_mem_info info) const + { + return get_memory_info(info); + } + + /// \overload + template + typename detail::get_object_info_type::type + get_info() const; + + /// Creates a new buffer with a copy of the data in \c *this. Uses + /// \p queue to perform the copy. + buffer clone(command_queue &queue) const; + + #if defined(CL_VERSION_1_1) || defined(BOOST_COMPUTE_DOXYGEN_INVOKED) + /// Creates a new buffer out of this buffer. + /// The new buffer is a sub region of this buffer. + /// \p flags The mem_flags which should be used to create the new buffer + /// \p origin The start index in this buffer + /// \p size The size of the new sub buffer + /// + /// \see_opencl_ref{clCreateSubBuffer} + /// + /// \opencl_version_warning{1,1} + buffer create_subbuffer(cl_mem_flags flags, size_t origin, + size_t size) + { + BOOST_ASSERT(origin + size <= this->size()); + BOOST_ASSERT(origin % (get_context(). + get_device(). + get_info() / 8) == 0); + cl_int error = 0; + + cl_buffer_region region = { origin, size }; + + cl_mem mem = clCreateSubBuffer(m_mem, + flags, + CL_BUFFER_CREATE_TYPE_REGION, + ®ion, + &error); + + if(!mem){ + BOOST_THROW_EXCEPTION(opencl_error(error)); + } + + return buffer(mem, false); + } + #endif // CL_VERSION_1_1 +}; + +/// \internal_ define get_info() specializations for buffer +BOOST_COMPUTE_DETAIL_DEFINE_GET_INFO_SPECIALIZATIONS(buffer, + ((cl_mem_object_type, CL_MEM_TYPE)) + ((cl_mem_flags, CL_MEM_FLAGS)) + ((size_t, CL_MEM_SIZE)) + ((void *, CL_MEM_HOST_PTR)) + ((cl_uint, CL_MEM_MAP_COUNT)) + ((cl_uint, CL_MEM_REFERENCE_COUNT)) + ((cl_context, CL_MEM_CONTEXT)) +) + +#ifdef CL_VERSION_1_1 +BOOST_COMPUTE_DETAIL_DEFINE_GET_INFO_SPECIALIZATIONS(buffer, + ((cl_mem, CL_MEM_ASSOCIATED_MEMOBJECT)) + ((size_t, CL_MEM_OFFSET)) +) +#endif // CL_VERSION_1_1 + +namespace detail { + +// set_kernel_arg specialization for buffer +template<> +struct set_kernel_arg +{ + void operator()(kernel &kernel_, size_t index, const buffer &buffer_) + { + kernel_.set_arg(index, buffer_.get()); + } +}; + +} // end detail namespace +} // end compute namespace +} // end boost namespace + +#endif // BOOST_COMPUTE_BUFFER_HPP diff --git a/3party/boost/boost/compute/cl.hpp b/3party/boost/boost/compute/cl.hpp new file mode 100644 index 0000000000..c439d8dfdc --- /dev/null +++ b/3party/boost/boost/compute/cl.hpp @@ -0,0 +1,20 @@ +//---------------------------------------------------------------------------// +// Copyright (c) 2013 Kyle Lutz +// +// 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 +// +// See http://boostorg.github.com/compute for more information. +//---------------------------------------------------------------------------// + +#ifndef BOOST_COMPUTE_CL_HPP +#define BOOST_COMPUTE_CL_HPP + +#if defined(__APPLE__) +#include +#else +#include +#endif + +#endif // BOOST_COMPUTE_CL_HPP diff --git a/3party/boost/boost/compute/cl_ext.hpp b/3party/boost/boost/compute/cl_ext.hpp new file mode 100644 index 0000000000..0b21a12fd7 --- /dev/null +++ b/3party/boost/boost/compute/cl_ext.hpp @@ -0,0 +1,20 @@ +//---------------------------------------------------------------------------// +// Copyright (c) 2013 Kyle Lutz +// +// 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 +// +// See http://boostorg.github.com/compute for more information. +//---------------------------------------------------------------------------// + +#ifndef BOOST_COMPUTE_CL_EXT_HPP +#define BOOST_COMPUTE_CL_EXT_HPP + +#if defined(__APPLE__) +#include +#else +#include +#endif + +#endif // BOOST_COMPUTE_CL_EXT_HPP diff --git a/3party/boost/boost/compute/closure.hpp b/3party/boost/boost/compute/closure.hpp new file mode 100644 index 0000000000..6e3cbe702b --- /dev/null +++ b/3party/boost/boost/compute/closure.hpp @@ -0,0 +1,347 @@ +//---------------------------------------------------------------------------// +// Copyright (c) 2013-2014 Kyle Lutz +// +// 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 +// +// See http://boostorg.github.com/compute for more information. +//---------------------------------------------------------------------------// + +#ifndef BOOST_COMPUTE_CLOSURE_HPP +#define BOOST_COMPUTE_CLOSURE_HPP + +#include +#include + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +#include +#include +#include +#include + +namespace boost { +namespace compute { +namespace detail { + +template +class invoked_closure +{ +public: + typedef ResultType result_type; + + BOOST_STATIC_CONSTANT( + size_t, arity = boost::tuples::length::value + ); + + invoked_closure(const std::string &name, + const std::string &source, + const std::map &definitions, + const ArgTuple &args, + const CaptureTuple &capture) + : m_name(name), + m_source(source), + m_definitions(definitions), + m_args(args), + m_capture(capture) + { + } + + std::string name() const + { + return m_name; + } + + std::string source() const + { + return m_source; + } + + const std::map& definitions() const + { + return m_definitions; + } + + const ArgTuple& args() const + { + return m_args; + } + + const CaptureTuple& capture() const + { + return m_capture; + } + +private: + std::string m_name; + std::string m_source; + std::map m_definitions; + ArgTuple m_args; + CaptureTuple m_capture; +}; + +} // end detail namespace + +/// \internal_ +template +class closure +{ +public: + typedef typename + boost::function_traits::result_type result_type; + + BOOST_STATIC_CONSTANT( + size_t, arity = boost::function_traits::arity + ); + + closure(const std::string &name, + const CaptureTuple &capture, + const std::string &source) + : m_name(name), + m_source(source), + m_capture(capture) + { + } + + ~closure() + { + } + + std::string name() const + { + return m_name; + } + + /// \internal_ + std::string source() const + { + return m_source; + } + + /// \internal_ + void define(std::string name, std::string value = std::string()) + { + m_definitions[name] = value; + } + + /// \internal_ + detail::invoked_closure, CaptureTuple> + operator()() const + { + BOOST_STATIC_ASSERT_MSG( + arity == 0, + "Non-nullary closure function invoked with zero arguments" + ); + + return detail::invoked_closure, CaptureTuple>( + m_name, m_source, m_definitions, boost::make_tuple(), m_capture + ); + } + + /// \internal_ + template + detail::invoked_closure, CaptureTuple> + operator()(const Arg1 &arg1) const + { + BOOST_STATIC_ASSERT_MSG( + arity == 1, + "Non-unary closure function invoked with one argument" + ); + + return detail::invoked_closure, CaptureTuple>( + m_name, m_source, m_definitions, boost::make_tuple(arg1), m_capture + ); + } + + /// \internal_ + template + detail::invoked_closure, CaptureTuple> + operator()(const Arg1 &arg1, const Arg2 &arg2) const + { + BOOST_STATIC_ASSERT_MSG( + arity == 2, + "Non-binary closure function invoked with two arguments" + ); + + return detail::invoked_closure, CaptureTuple>( + m_name, m_source, m_definitions, boost::make_tuple(arg1, arg2), m_capture + ); + } + + /// \internal_ + template + detail::invoked_closure, CaptureTuple> + operator()(const Arg1 &arg1, const Arg2 &arg2, const Arg3 &arg3) const + { + BOOST_STATIC_ASSERT_MSG( + arity == 3, + "Non-ternary closure function invoked with three arguments" + ); + + return detail::invoked_closure, CaptureTuple>( + m_name, m_source, m_definitions, boost::make_tuple(arg1, arg2, arg3), m_capture + ); + } + +private: + std::string m_name; + std::string m_source; + std::map m_definitions; + CaptureTuple m_capture; +}; + +namespace detail { + +struct closure_signature_argument_inserter +{ + closure_signature_argument_inserter(std::stringstream &s_, + const char *capture_string, + size_t last) + : s(s_) + { + n = 0; + m_last = last; + + size_t capture_string_length = std::strlen(capture_string); + BOOST_ASSERT(capture_string[0] == '(' && + capture_string[capture_string_length-1] == ')'); + std::string capture_string_(capture_string + 1, capture_string_length - 2); + boost::split(m_capture_names, capture_string_ , boost::is_any_of(",")); + } + + template + void operator()(const T&) const + { + BOOST_ASSERT(n < m_capture_names.size()); + + // get captured variable name + std::string variable_name = m_capture_names[n]; + + // remove leading and trailing whitespace from variable name + boost::trim(variable_name); + + s << capture_traits::type_name() << " " << variable_name; + if(n+1 < m_last){ + s << ", "; + } + n++; + } + + mutable size_t n; + size_t m_last; + std::vector m_capture_names; + std::stringstream &s; +}; + +template +inline std::string +make_closure_declaration(const char *name, + const char *arguments, + const CaptureTuple &capture_tuple, + const char *capture_string) +{ + typedef typename + boost::function_traits::result_type result_type; + typedef typename + boost::function_types::parameter_types::type parameter_types; + typedef typename + mpl::size::type arity_type; + + std::stringstream s; + s << "inline " << type_name() << " " << name; + s << "("; + + // insert function arguments + signature_argument_inserter i(s, arguments, arity_type::value); + mpl::for_each< + typename mpl::transform + >::type>(i); + s << ", "; + + // insert capture arguments + closure_signature_argument_inserter j( + s, capture_string, boost::tuples::length::value + ); + fusion::for_each(capture_tuple, j); + + s << ")"; + return s.str(); +} + +// used by the BOOST_COMPUTE_CLOSURE() macro to create a closure +// function with the given signature, name, capture, and source. +template +inline closure +make_closure_impl(const char *name, + const char *arguments, + const CaptureTuple &capture, + const char *capture_string, + const std::string &source) +{ + std::stringstream s; + s << make_closure_declaration(name, arguments, capture, capture_string); + s << source; + + return closure(name, capture, s.str()); +} + +} // end detail namespace +} // end compute namespace +} // end boost namespace + +/// Creates a closure function object with \p name and \p source. +/// +/// \param return_type The return type for the function. +/// \param name The name of the function. +/// \param arguments A list of arguments for the function. +/// \param capture A list of variables to capture. +/// \param source The OpenCL C source code for the function. +/// +/// For example, to create a function which checks if a 2D point is +/// contained in a circle of a given radius: +/// \code +/// // radius variable declared in C++ +/// float radius = 1.5f; +/// +/// // create a closure function which returns true if the 2D point +/// // argument is contained within a circle of the given radius +/// BOOST_COMPUTE_CLOSURE(bool, is_in_circle, (const float2_ p), (radius), +/// { +/// return sqrt(p.x*p.x + p.y*p.y) < radius; +/// }); +/// +/// // vector of 2D points +/// boost::compute::vector points = ... +/// +/// // count number of points in the circle +/// size_t count = boost::compute::count_if( +/// points.begin(), points.end(), is_in_circle, queue +/// ); +/// \endcode +/// +/// \see BOOST_COMPUTE_FUNCTION() +#ifdef BOOST_COMPUTE_DOXYGEN_INVOKED +#define BOOST_COMPUTE_CLOSURE(return_type, name, arguments, capture, source) +#else +#define BOOST_COMPUTE_CLOSURE(return_type, name, arguments, capture, ...) \ + ::boost::compute::closure< \ + return_type arguments, BOOST_TYPEOF(boost::tie capture) \ + > name = \ + ::boost::compute::detail::make_closure_impl< \ + return_type arguments \ + >( \ + #name, #arguments, boost::tie capture, #capture, #__VA_ARGS__ \ + ) +#endif + +#endif // BOOST_COMPUTE_CLOSURE_HPP diff --git a/3party/boost/boost/compute/command_queue.hpp b/3party/boost/boost/compute/command_queue.hpp new file mode 100644 index 0000000000..2a1328a959 --- /dev/null +++ b/3party/boost/boost/compute/command_queue.hpp @@ -0,0 +1,1881 @@ +//---------------------------------------------------------------------------// +// Copyright (c) 2013 Kyle Lutz +// +// 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 +// +// See http://boostorg.github.com/compute for more information. +//---------------------------------------------------------------------------// + +#ifndef BOOST_COMPUTE_COMMAND_QUEUE_HPP +#define BOOST_COMPUTE_COMMAND_QUEUE_HPP + +#include +#include + +#include + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +namespace boost { +namespace compute { +namespace detail { + +inline void BOOST_COMPUTE_CL_CALLBACK +nullary_native_kernel_trampoline(void *user_func_ptr) +{ + void (*user_func)(); + std::memcpy(&user_func, user_func_ptr, sizeof(user_func)); + user_func(); +} + +} // end detail namespace + +/// \class command_queue +/// \brief A command queue. +/// +/// Command queues provide the interface for interacting with compute +/// devices. The command_queue class provides methods to copy data to +/// and from a compute device as well as execute compute kernels. +/// +/// Command queues are created for a compute device within a compute +/// context. +/// +/// For example, to create a context and command queue for the default device +/// on the system (this is the normal set up code used by almost all OpenCL +/// programs): +/// \code +/// #include +/// +/// // get the default compute device +/// boost::compute::device device = boost::compute::system::default_device(); +/// +/// // set up a compute context and command queue +/// boost::compute::context context(device); +/// boost::compute::command_queue queue(context, device); +/// \endcode +/// +/// The default command queue for the system can be obtained with the +/// system::default_queue() method. +/// +/// \see buffer, context, kernel +class command_queue +{ +public: + enum properties { + enable_profiling = CL_QUEUE_PROFILING_ENABLE, + enable_out_of_order_execution = CL_QUEUE_OUT_OF_ORDER_EXEC_MODE_ENABLE + }; + + enum map_flags { + map_read = CL_MAP_READ, + map_write = CL_MAP_WRITE + #ifdef CL_VERSION_1_2 + , + map_write_invalidate_region = CL_MAP_WRITE_INVALIDATE_REGION + #endif + }; + + /// Creates a null command queue. + command_queue() + : m_queue(0) + { + } + + explicit command_queue(cl_command_queue queue, bool retain = true) + : m_queue(queue) + { + if(m_queue && retain){ + clRetainCommandQueue(m_queue); + } + } + + /// Creates a command queue in \p context for \p device with + /// \p properties. + /// + /// \see_opencl_ref{clCreateCommandQueue} + command_queue(const context &context, + const device &device, + cl_command_queue_properties properties = 0) + { + BOOST_ASSERT(device.id() != 0); + + cl_int error = 0; + + #ifdef CL_VERSION_2_0 + if (device.check_version(2, 0)){ + std::vector queue_properties; + if(properties){ + queue_properties.push_back(CL_QUEUE_PROPERTIES); + queue_properties.push_back(cl_queue_properties(properties)); + queue_properties.push_back(cl_queue_properties(0)); + } + + const cl_queue_properties *queue_properties_ptr = + queue_properties.empty() ? 0 : &queue_properties[0]; + + m_queue = clCreateCommandQueueWithProperties( + context, device.id(), queue_properties_ptr, &error + ); + } else + #endif + { + // Suppress deprecated declarations warning + BOOST_COMPUTE_DISABLE_DEPRECATED_DECLARATIONS(); + m_queue = clCreateCommandQueue( + context, device.id(), properties, &error + ); + BOOST_COMPUTE_ENABLE_DEPRECATED_DECLARATIONS(); + } + + if(!m_queue){ + BOOST_THROW_EXCEPTION(opencl_error(error)); + } + } + + /// Creates a new command queue object as a copy of \p other. + command_queue(const command_queue &other) + : m_queue(other.m_queue) + { + if(m_queue){ + clRetainCommandQueue(m_queue); + } + } + + /// Copies the command queue object from \p other to \c *this. + command_queue& operator=(const command_queue &other) + { + if(this != &other){ + if(m_queue){ + clReleaseCommandQueue(m_queue); + } + + m_queue = other.m_queue; + + if(m_queue){ + clRetainCommandQueue(m_queue); + } + } + + return *this; + } + + #ifndef BOOST_COMPUTE_NO_RVALUE_REFERENCES + /// Move-constructs a new command queue object from \p other. + command_queue(command_queue&& other) BOOST_NOEXCEPT + : m_queue(other.m_queue) + { + other.m_queue = 0; + } + + /// Move-assigns the command queue from \p other to \c *this. + command_queue& operator=(command_queue&& other) BOOST_NOEXCEPT + { + if(m_queue){ + clReleaseCommandQueue(m_queue); + } + + m_queue = other.m_queue; + other.m_queue = 0; + + return *this; + } + #endif // BOOST_COMPUTE_NO_RVALUE_REFERENCES + + /// Destroys the command queue. + /// + /// \see_opencl_ref{clReleaseCommandQueue} + ~command_queue() + { + if(m_queue){ + BOOST_COMPUTE_ASSERT_CL_SUCCESS( + clReleaseCommandQueue(m_queue) + ); + } + } + + /// Returns the underlying OpenCL command queue. + cl_command_queue& get() const + { + return const_cast(m_queue); + } + + /// Returns the device that the command queue issues commands to. + device get_device() const + { + return device(get_info(CL_QUEUE_DEVICE)); + } + + /// Returns the context for the command queue. + context get_context() const + { + return context(get_info(CL_QUEUE_CONTEXT)); + } + + /// Returns information about the command queue. + /// + /// \see_opencl_ref{clGetCommandQueueInfo} + template + T get_info(cl_command_queue_info info) const + { + return detail::get_object_info(clGetCommandQueueInfo, m_queue, info); + } + + /// \overload + template + typename detail::get_object_info_type::type + get_info() const; + + /// Returns the properties for the command queue. + cl_command_queue_properties get_properties() const + { + return get_info(CL_QUEUE_PROPERTIES); + } + + /// Enqueues a command to read data from \p buffer to host memory. + /// + /// \see_opencl_ref{clEnqueueReadBuffer} + /// + /// \see copy() + event enqueue_read_buffer(const buffer &buffer, + size_t offset, + size_t size, + void *host_ptr, + const wait_list &events = wait_list()) + { + BOOST_ASSERT(m_queue != 0); + BOOST_ASSERT(size <= buffer.size()); + BOOST_ASSERT(buffer.get_context() == this->get_context()); + BOOST_ASSERT(host_ptr != 0); + + event event_; + + cl_int ret = clEnqueueReadBuffer( + m_queue, + buffer.get(), + CL_TRUE, + offset, + size, + host_ptr, + events.size(), + events.get_event_ptr(), + &event_.get() + ); + + if(ret != CL_SUCCESS){ + BOOST_THROW_EXCEPTION(opencl_error(ret)); + } + + return event_; + } + + /// Enqueues a command to read data from \p buffer to host memory. The + /// copy will be performed asynchronously. + /// + /// \see_opencl_ref{clEnqueueReadBuffer} + /// + /// \see copy_async() + event enqueue_read_buffer_async(const buffer &buffer, + size_t offset, + size_t size, + void *host_ptr, + const wait_list &events = wait_list()) + { + BOOST_ASSERT(m_queue != 0); + BOOST_ASSERT(size <= buffer.size()); + BOOST_ASSERT(buffer.get_context() == this->get_context()); + BOOST_ASSERT(host_ptr != 0); + + event event_; + + cl_int ret = clEnqueueReadBuffer( + m_queue, + buffer.get(), + CL_FALSE, + offset, + size, + host_ptr, + events.size(), + events.get_event_ptr(), + &event_.get() + ); + + if(ret != CL_SUCCESS){ + BOOST_THROW_EXCEPTION(opencl_error(ret)); + } + + return event_; + } + + #if defined(CL_VERSION_1_1) || defined(BOOST_COMPUTE_DOXYGEN_INVOKED) + /// Enqueues a command to read a rectangular region from \p buffer to + /// host memory. + /// + /// \see_opencl_ref{clEnqueueReadBufferRect} + /// + /// \opencl_version_warning{1,1} + event enqueue_read_buffer_rect(const buffer &buffer, + const size_t buffer_origin[3], + const size_t host_origin[3], + const size_t region[3], + size_t buffer_row_pitch, + size_t buffer_slice_pitch, + size_t host_row_pitch, + size_t host_slice_pitch, + void *host_ptr, + const wait_list &events = wait_list()) + { + BOOST_ASSERT(m_queue != 0); + BOOST_ASSERT(buffer.get_context() == this->get_context()); + BOOST_ASSERT(host_ptr != 0); + + event event_; + + cl_int ret = clEnqueueReadBufferRect( + m_queue, + buffer.get(), + CL_TRUE, + buffer_origin, + host_origin, + region, + buffer_row_pitch, + buffer_slice_pitch, + host_row_pitch, + host_slice_pitch, + host_ptr, + events.size(), + events.get_event_ptr(), + &event_.get() + ); + + if(ret != CL_SUCCESS){ + BOOST_THROW_EXCEPTION(opencl_error(ret)); + } + + return event_; + } + + /// Enqueues a command to read a rectangular region from \p buffer to + /// host memory. The copy will be performed asynchronously. + /// + /// \see_opencl_ref{clEnqueueReadBufferRect} + /// + /// \opencl_version_warning{1,1} + event enqueue_read_buffer_rect_async(const buffer &buffer, + const size_t buffer_origin[3], + const size_t host_origin[3], + const size_t region[3], + size_t buffer_row_pitch, + size_t buffer_slice_pitch, + size_t host_row_pitch, + size_t host_slice_pitch, + void *host_ptr, + const wait_list &events = wait_list()) + { + BOOST_ASSERT(m_queue != 0); + BOOST_ASSERT(buffer.get_context() == this->get_context()); + BOOST_ASSERT(host_ptr != 0); + + event event_; + + cl_int ret = clEnqueueReadBufferRect( + m_queue, + buffer.get(), + CL_FALSE, + buffer_origin, + host_origin, + region, + buffer_row_pitch, + buffer_slice_pitch, + host_row_pitch, + host_slice_pitch, + host_ptr, + events.size(), + events.get_event_ptr(), + &event_.get() + ); + + if(ret != CL_SUCCESS){ + BOOST_THROW_EXCEPTION(opencl_error(ret)); + } + + return event_; + } + #endif // CL_VERSION_1_1 + + /// Enqueues a command to write data from host memory to \p buffer. + /// + /// \see_opencl_ref{clEnqueueWriteBuffer} + /// + /// \see copy() + event enqueue_write_buffer(const buffer &buffer, + size_t offset, + size_t size, + const void *host_ptr, + const wait_list &events = wait_list()) + { + BOOST_ASSERT(m_queue != 0); + BOOST_ASSERT(size <= buffer.size()); + BOOST_ASSERT(buffer.get_context() == this->get_context()); + BOOST_ASSERT(host_ptr != 0); + + event event_; + + cl_int ret = clEnqueueWriteBuffer( + m_queue, + buffer.get(), + CL_TRUE, + offset, + size, + host_ptr, + events.size(), + events.get_event_ptr(), + &event_.get() + ); + + if(ret != CL_SUCCESS){ + BOOST_THROW_EXCEPTION(opencl_error(ret)); + } + + return event_; + } + + /// Enqueues a command to write data from host memory to \p buffer. + /// The copy is performed asynchronously. + /// + /// \see_opencl_ref{clEnqueueWriteBuffer} + /// + /// \see copy_async() + event enqueue_write_buffer_async(const buffer &buffer, + size_t offset, + size_t size, + const void *host_ptr, + const wait_list &events = wait_list()) + { + BOOST_ASSERT(m_queue != 0); + BOOST_ASSERT(size <= buffer.size()); + BOOST_ASSERT(buffer.get_context() == this->get_context()); + BOOST_ASSERT(host_ptr != 0); + + event event_; + + cl_int ret = clEnqueueWriteBuffer( + m_queue, + buffer.get(), + CL_FALSE, + offset, + size, + host_ptr, + events.size(), + events.get_event_ptr(), + &event_.get() + ); + + if(ret != CL_SUCCESS){ + BOOST_THROW_EXCEPTION(opencl_error(ret)); + } + + return event_; + } + + #if defined(CL_VERSION_1_1) || defined(BOOST_COMPUTE_DOXYGEN_INVOKED) + /// Enqueues a command to write a rectangular region from host memory + /// to \p buffer. + /// + /// \see_opencl_ref{clEnqueueWriteBufferRect} + /// + /// \opencl_version_warning{1,1} + event enqueue_write_buffer_rect(const buffer &buffer, + const size_t buffer_origin[3], + const size_t host_origin[3], + const size_t region[3], + size_t buffer_row_pitch, + size_t buffer_slice_pitch, + size_t host_row_pitch, + size_t host_slice_pitch, + void *host_ptr, + const wait_list &events = wait_list()) + { + BOOST_ASSERT(m_queue != 0); + BOOST_ASSERT(buffer.get_context() == this->get_context()); + BOOST_ASSERT(host_ptr != 0); + + event event_; + + cl_int ret = clEnqueueWriteBufferRect( + m_queue, + buffer.get(), + CL_TRUE, + buffer_origin, + host_origin, + region, + buffer_row_pitch, + buffer_slice_pitch, + host_row_pitch, + host_slice_pitch, + host_ptr, + events.size(), + events.get_event_ptr(), + &event_.get() + ); + + if(ret != CL_SUCCESS){ + BOOST_THROW_EXCEPTION(opencl_error(ret)); + } + + return event_; + } + + /// Enqueues a command to write a rectangular region from host memory + /// to \p buffer. The copy is performed asynchronously. + /// + /// \see_opencl_ref{clEnqueueWriteBufferRect} + /// + /// \opencl_version_warning{1,1} + event enqueue_write_buffer_rect_async(const buffer &buffer, + const size_t buffer_origin[3], + const size_t host_origin[3], + const size_t region[3], + size_t buffer_row_pitch, + size_t buffer_slice_pitch, + size_t host_row_pitch, + size_t host_slice_pitch, + void *host_ptr, + const wait_list &events = wait_list()) + { + BOOST_ASSERT(m_queue != 0); + BOOST_ASSERT(buffer.get_context() == this->get_context()); + BOOST_ASSERT(host_ptr != 0); + + event event_; + + cl_int ret = clEnqueueWriteBufferRect( + m_queue, + buffer.get(), + CL_FALSE, + buffer_origin, + host_origin, + region, + buffer_row_pitch, + buffer_slice_pitch, + host_row_pitch, + host_slice_pitch, + host_ptr, + events.size(), + events.get_event_ptr(), + &event_.get() + ); + + if(ret != CL_SUCCESS){ + BOOST_THROW_EXCEPTION(opencl_error(ret)); + } + + return event_; + } + #endif // CL_VERSION_1_1 + + /// Enqueues a command to copy data from \p src_buffer to + /// \p dst_buffer. + /// + /// \see_opencl_ref{clEnqueueCopyBuffer} + /// + /// \see copy() + event enqueue_copy_buffer(const buffer &src_buffer, + const buffer &dst_buffer, + size_t src_offset, + size_t dst_offset, + size_t size, + const wait_list &events = wait_list()) + { + BOOST_ASSERT(m_queue != 0); + BOOST_ASSERT(src_offset + size <= src_buffer.size()); + BOOST_ASSERT(dst_offset + size <= dst_buffer.size()); + BOOST_ASSERT(src_buffer.get_context() == this->get_context()); + BOOST_ASSERT(dst_buffer.get_context() == this->get_context()); + + event event_; + + cl_int ret = clEnqueueCopyBuffer( + m_queue, + src_buffer.get(), + dst_buffer.get(), + src_offset, + dst_offset, + size, + events.size(), + events.get_event_ptr(), + &event_.get() + ); + + if(ret != CL_SUCCESS){ + BOOST_THROW_EXCEPTION(opencl_error(ret)); + } + + return event_; + } + + #if defined(CL_VERSION_1_1) || defined(BOOST_COMPUTE_DOXYGEN_INVOKED) + /// Enqueues a command to copy a rectangular region from + /// \p src_buffer to \p dst_buffer. + /// + /// \see_opencl_ref{clEnqueueCopyBufferRect} + /// + /// \opencl_version_warning{1,1} + event enqueue_copy_buffer_rect(const buffer &src_buffer, + const buffer &dst_buffer, + const size_t src_origin[3], + const size_t dst_origin[3], + const size_t region[3], + size_t buffer_row_pitch, + size_t buffer_slice_pitch, + size_t host_row_pitch, + size_t host_slice_pitch, + const wait_list &events = wait_list()) + { + BOOST_ASSERT(m_queue != 0); + BOOST_ASSERT(src_buffer.get_context() == this->get_context()); + BOOST_ASSERT(dst_buffer.get_context() == this->get_context()); + + event event_; + + cl_int ret = clEnqueueCopyBufferRect( + m_queue, + src_buffer.get(), + dst_buffer.get(), + src_origin, + dst_origin, + region, + buffer_row_pitch, + buffer_slice_pitch, + host_row_pitch, + host_slice_pitch, + events.size(), + events.get_event_ptr(), + &event_.get() + ); + + if(ret != CL_SUCCESS){ + BOOST_THROW_EXCEPTION(opencl_error(ret)); + } + + return event_; + } + #endif // CL_VERSION_1_1 + + #if defined(CL_VERSION_1_2) || defined(BOOST_COMPUTE_DOXYGEN_INVOKED) + /// Enqueues a command to fill \p buffer with \p pattern. + /// + /// \see_opencl_ref{clEnqueueFillBuffer} + /// + /// \opencl_version_warning{1,2} + /// + /// \see fill() + event enqueue_fill_buffer(const buffer &buffer, + const void *pattern, + size_t pattern_size, + size_t offset, + size_t size, + const wait_list &events = wait_list()) + { + BOOST_ASSERT(m_queue != 0); + BOOST_ASSERT(offset + size <= buffer.size()); + BOOST_ASSERT(buffer.get_context() == this->get_context()); + + event event_; + + cl_int ret = clEnqueueFillBuffer( + m_queue, + buffer.get(), + pattern, + pattern_size, + offset, + size, + events.size(), + events.get_event_ptr(), + &event_.get() + ); + + if(ret != CL_SUCCESS){ + BOOST_THROW_EXCEPTION(opencl_error(ret)); + } + + return event_; + } + #endif // CL_VERSION_1_2 + + /// Enqueues a command to map \p buffer into the host address space. + /// Event associated with map operation is returned through + /// \p map_buffer_event parameter. + /// + /// \see_opencl_ref{clEnqueueMapBuffer} + void* enqueue_map_buffer(const buffer &buffer, + cl_map_flags flags, + size_t offset, + size_t size, + event &map_buffer_event, + const wait_list &events = wait_list()) + { + BOOST_ASSERT(m_queue != 0); + BOOST_ASSERT(offset + size <= buffer.size()); + BOOST_ASSERT(buffer.get_context() == this->get_context()); + + cl_int ret = 0; + void *pointer = clEnqueueMapBuffer( + m_queue, + buffer.get(), + CL_TRUE, + flags, + offset, + size, + events.size(), + events.get_event_ptr(), + &map_buffer_event.get(), + &ret + ); + + if(ret != CL_SUCCESS){ + BOOST_THROW_EXCEPTION(opencl_error(ret)); + } + + return pointer; + } + + /// \overload + void* enqueue_map_buffer(const buffer &buffer, + cl_map_flags flags, + size_t offset, + size_t size, + const wait_list &events = wait_list()) + { + event event_; + return enqueue_map_buffer(buffer, flags, offset, size, event_, events); + } + + /// Enqueues a command to map \p buffer into the host address space. + /// Map operation is performed asynchronously. The pointer to the mapped + /// region cannot be used until the map operation has completed. + /// + /// Event associated with map operation is returned through + /// \p map_buffer_event parameter. + /// + /// \see_opencl_ref{clEnqueueMapBuffer} + void* enqueue_map_buffer_async(const buffer &buffer, + cl_map_flags flags, + size_t offset, + size_t size, + event &map_buffer_event, + const wait_list &events = wait_list()) + { + BOOST_ASSERT(m_queue != 0); + BOOST_ASSERT(offset + size <= buffer.size()); + BOOST_ASSERT(buffer.get_context() == this->get_context()); + + cl_int ret = 0; + void *pointer = clEnqueueMapBuffer( + m_queue, + buffer.get(), + CL_FALSE, + flags, + offset, + size, + events.size(), + events.get_event_ptr(), + &map_buffer_event.get(), + &ret + ); + + if(ret != CL_SUCCESS){ + BOOST_THROW_EXCEPTION(opencl_error(ret)); + } + + return pointer; + } + + /// Enqueues a command to unmap \p buffer from the host memory space. + /// + /// \see_opencl_ref{clEnqueueUnmapMemObject} + event enqueue_unmap_buffer(const buffer &buffer, + void *mapped_ptr, + const wait_list &events = wait_list()) + { + BOOST_ASSERT(buffer.get_context() == this->get_context()); + + return enqueue_unmap_mem_object(buffer.get(), mapped_ptr, events); + } + + /// Enqueues a command to unmap \p mem from the host memory space. + /// + /// \see_opencl_ref{clEnqueueUnmapMemObject} + event enqueue_unmap_mem_object(cl_mem mem, + void *mapped_ptr, + const wait_list &events = wait_list()) + { + BOOST_ASSERT(m_queue != 0); + + event event_; + + cl_int ret = clEnqueueUnmapMemObject( + m_queue, + mem, + mapped_ptr, + events.size(), + events.get_event_ptr(), + &event_.get() + ); + + if(ret != CL_SUCCESS){ + BOOST_THROW_EXCEPTION(opencl_error(ret)); + } + + return event_; + } + + /// Enqueues a command to read data from \p image to host memory. + /// + /// \see_opencl_ref{clEnqueueReadImage} + event enqueue_read_image(const image_object& image, + const size_t *origin, + const size_t *region, + size_t row_pitch, + size_t slice_pitch, + void *host_ptr, + const wait_list &events = wait_list()) + { + BOOST_ASSERT(m_queue != 0); + + event event_; + + cl_int ret = clEnqueueReadImage( + m_queue, + image.get(), + CL_TRUE, + origin, + region, + row_pitch, + slice_pitch, + host_ptr, + events.size(), + events.get_event_ptr(), + &event_.get() + ); + + if(ret != CL_SUCCESS){ + BOOST_THROW_EXCEPTION(opencl_error(ret)); + } + + return event_; + } + + /// \overload + template + event enqueue_read_image(const image_object& image, + const extents origin, + const extents region, + void *host_ptr, + size_t row_pitch = 0, + size_t slice_pitch = 0, + const wait_list &events = wait_list()) + { + BOOST_ASSERT(image.get_context() == this->get_context()); + + size_t origin3[3] = { 0, 0, 0 }; + size_t region3[3] = { 1, 1, 1 }; + + std::copy(origin.data(), origin.data() + N, origin3); + std::copy(region.data(), region.data() + N, region3); + + return enqueue_read_image( + image, origin3, region3, row_pitch, slice_pitch, host_ptr, events + ); + } + + /// Enqueues a command to write data from host memory to \p image. + /// + /// \see_opencl_ref{clEnqueueWriteImage} + event enqueue_write_image(image_object& image, + const size_t *origin, + const size_t *region, + const void *host_ptr, + size_t input_row_pitch = 0, + size_t input_slice_pitch = 0, + const wait_list &events = wait_list()) + { + BOOST_ASSERT(m_queue != 0); + + event event_; + + cl_int ret = clEnqueueWriteImage( + m_queue, + image.get(), + CL_TRUE, + origin, + region, + input_row_pitch, + input_slice_pitch, + host_ptr, + events.size(), + events.get_event_ptr(), + &event_.get() + ); + + if(ret != CL_SUCCESS){ + BOOST_THROW_EXCEPTION(opencl_error(ret)); + } + + return event_; + } + + /// \overload + template + event enqueue_write_image(image_object& image, + const extents origin, + const extents region, + const void *host_ptr, + const size_t input_row_pitch = 0, + const size_t input_slice_pitch = 0, + const wait_list &events = wait_list()) + { + BOOST_ASSERT(image.get_context() == this->get_context()); + + size_t origin3[3] = { 0, 0, 0 }; + size_t region3[3] = { 1, 1, 1 }; + + std::copy(origin.data(), origin.data() + N, origin3); + std::copy(region.data(), region.data() + N, region3); + + return enqueue_write_image( + image, origin3, region3, host_ptr, input_row_pitch, input_slice_pitch, events + ); + } + + /// Enqueues a command to map \p image into the host address space. + /// + /// Event associated with map operation is returned through + /// \p map_image_event parameter. + /// + /// \see_opencl_ref{clEnqueueMapImage} + void* enqueue_map_image(const image_object &image, + cl_map_flags flags, + const size_t *origin, + const size_t *region, + size_t &output_row_pitch, + size_t &output_slice_pitch, + event &map_image_event, + const wait_list &events = wait_list()) + { + BOOST_ASSERT(m_queue != 0); + BOOST_ASSERT(image.get_context() == this->get_context()); + + cl_int ret = 0; + void *pointer = clEnqueueMapImage( + m_queue, + image.get(), + CL_TRUE, + flags, + origin, + region, + &output_row_pitch, + &output_slice_pitch, + events.size(), + events.get_event_ptr(), + &map_image_event.get(), + &ret + ); + + if(ret != CL_SUCCESS){ + BOOST_THROW_EXCEPTION(opencl_error(ret)); + } + + return pointer; + } + + /// \overload + void* enqueue_map_image(const image_object &image, + cl_map_flags flags, + const size_t *origin, + const size_t *region, + size_t &output_row_pitch, + size_t &output_slice_pitch, + const wait_list &events = wait_list()) + { + event event_; + return enqueue_map_image( + image, flags, origin, region, + output_row_pitch, output_slice_pitch, event_, events + ); + } + + /// \overload + template + void* enqueue_map_image(image_object& image, + cl_map_flags flags, + const extents origin, + const extents region, + size_t &output_row_pitch, + size_t &output_slice_pitch, + event &map_image_event, + const wait_list &events = wait_list()) + { + BOOST_ASSERT(image.get_context() == this->get_context()); + + size_t origin3[3] = { 0, 0, 0 }; + size_t region3[3] = { 1, 1, 1 }; + + std::copy(origin.data(), origin.data() + N, origin3); + std::copy(region.data(), region.data() + N, region3); + + return enqueue_map_image( + image, flags, origin3, region3, + output_row_pitch, output_slice_pitch, map_image_event, events + ); + } + + /// \overload + template + void* enqueue_map_image(image_object& image, + cl_map_flags flags, + const extents origin, + const extents region, + size_t &output_row_pitch, + size_t &output_slice_pitch, + const wait_list &events = wait_list()) + { + event event_; + return enqueue_map_image( + image, flags, origin, region, + output_row_pitch, output_slice_pitch, event_, events + ); + } + + /// Enqueues a command to map \p image into the host address space. + /// Map operation is performed asynchronously. The pointer to the mapped + /// region cannot be used until the map operation has completed. + /// + /// Event associated with map operation is returned through + /// \p map_image_event parameter. + /// + /// \see_opencl_ref{clEnqueueMapImage} + void* enqueue_map_image_async(const image_object &image, + cl_map_flags flags, + const size_t *origin, + const size_t *region, + size_t &output_row_pitch, + size_t &output_slice_pitch, + event &map_image_event, + const wait_list &events = wait_list()) + { + BOOST_ASSERT(m_queue != 0); + BOOST_ASSERT(image.get_context() == this->get_context()); + + cl_int ret = 0; + void *pointer = clEnqueueMapImage( + m_queue, + image.get(), + CL_FALSE, + flags, + origin, + region, + &output_row_pitch, + &output_slice_pitch, + events.size(), + events.get_event_ptr(), + &map_image_event.get(), + &ret + ); + + if(ret != CL_SUCCESS){ + BOOST_THROW_EXCEPTION(opencl_error(ret)); + } + + return pointer; + } + + /// \overload + template + void* enqueue_map_image_async(image_object& image, + cl_map_flags flags, + const extents origin, + const extents region, + size_t &output_row_pitch, + size_t &output_slice_pitch, + event &map_image_event, + const wait_list &events = wait_list()) + { + BOOST_ASSERT(image.get_context() == this->get_context()); + + size_t origin3[3] = { 0, 0, 0 }; + size_t region3[3] = { 1, 1, 1 }; + + std::copy(origin.data(), origin.data() + N, origin3); + std::copy(region.data(), region.data() + N, region3); + + return enqueue_map_image_async( + image, flags, origin3, region3, + output_row_pitch, output_slice_pitch, map_image_event, events + ); + } + + /// Enqueues a command to unmap \p image from the host memory space. + /// + /// \see_opencl_ref{clEnqueueUnmapMemObject} + event enqueue_unmap_image(const image_object &image, + void *mapped_ptr, + const wait_list &events = wait_list()) + { + BOOST_ASSERT(image.get_context() == this->get_context()); + + return enqueue_unmap_mem_object(image.get(), mapped_ptr, events); + } + + /// Enqueues a command to copy data from \p src_image to \p dst_image. + /// + /// \see_opencl_ref{clEnqueueCopyImage} + event enqueue_copy_image(const image_object& src_image, + image_object& dst_image, + const size_t *src_origin, + const size_t *dst_origin, + const size_t *region, + const wait_list &events = wait_list()) + { + BOOST_ASSERT(m_queue != 0); + + event event_; + + cl_int ret = clEnqueueCopyImage( + m_queue, + src_image.get(), + dst_image.get(), + src_origin, + dst_origin, + region, + events.size(), + events.get_event_ptr(), + &event_.get() + ); + + if(ret != CL_SUCCESS){ + BOOST_THROW_EXCEPTION(opencl_error(ret)); + } + + return event_; + } + + /// \overload + template + event enqueue_copy_image(const image_object& src_image, + image_object& dst_image, + const extents src_origin, + const extents dst_origin, + const extents region, + const wait_list &events = wait_list()) + { + BOOST_ASSERT(src_image.get_context() == this->get_context()); + BOOST_ASSERT(dst_image.get_context() == this->get_context()); + BOOST_ASSERT_MSG(src_image.format() == dst_image.format(), + "Source and destination image formats must match."); + + size_t src_origin3[3] = { 0, 0, 0 }; + size_t dst_origin3[3] = { 0, 0, 0 }; + size_t region3[3] = { 1, 1, 1 }; + + std::copy(src_origin.data(), src_origin.data() + N, src_origin3); + std::copy(dst_origin.data(), dst_origin.data() + N, dst_origin3); + std::copy(region.data(), region.data() + N, region3); + + return enqueue_copy_image( + src_image, dst_image, src_origin3, dst_origin3, region3, events + ); + } + + /// Enqueues a command to copy data from \p src_image to \p dst_buffer. + /// + /// \see_opencl_ref{clEnqueueCopyImageToBuffer} + event enqueue_copy_image_to_buffer(const image_object& src_image, + memory_object& dst_buffer, + const size_t *src_origin, + const size_t *region, + size_t dst_offset, + const wait_list &events = wait_list()) + { + BOOST_ASSERT(m_queue != 0); + + event event_; + + cl_int ret = clEnqueueCopyImageToBuffer( + m_queue, + src_image.get(), + dst_buffer.get(), + src_origin, + region, + dst_offset, + events.size(), + events.get_event_ptr(), + &event_.get() + ); + + if(ret != CL_SUCCESS){ + BOOST_THROW_EXCEPTION(opencl_error(ret)); + } + + return event_; + } + + /// Enqueues a command to copy data from \p src_buffer to \p dst_image. + /// + /// \see_opencl_ref{clEnqueueCopyBufferToImage} + event enqueue_copy_buffer_to_image(const memory_object& src_buffer, + image_object& dst_image, + size_t src_offset, + const size_t *dst_origin, + const size_t *region, + const wait_list &events = wait_list()) + { + BOOST_ASSERT(m_queue != 0); + + event event_; + + cl_int ret = clEnqueueCopyBufferToImage( + m_queue, + src_buffer.get(), + dst_image.get(), + src_offset, + dst_origin, + region, + events.size(), + events.get_event_ptr(), + &event_.get() + ); + + if(ret != CL_SUCCESS){ + BOOST_THROW_EXCEPTION(opencl_error(ret)); + } + + return event_; + } + + #if defined(CL_VERSION_1_2) || defined(BOOST_COMPUTE_DOXYGEN_INVOKED) + /// Enqueues a command to fill \p image with \p fill_color. + /// + /// \see_opencl_ref{clEnqueueFillImage} + /// + /// \opencl_version_warning{1,2} + event enqueue_fill_image(image_object& image, + const void *fill_color, + const size_t *origin, + const size_t *region, + const wait_list &events = wait_list()) + { + BOOST_ASSERT(m_queue != 0); + + event event_; + + cl_int ret = clEnqueueFillImage( + m_queue, + image.get(), + fill_color, + origin, + region, + events.size(), + events.get_event_ptr(), + &event_.get() + ); + + if(ret != CL_SUCCESS){ + BOOST_THROW_EXCEPTION(opencl_error(ret)); + } + + return event_; + } + + /// \overload + template + event enqueue_fill_image(image_object& image, + const void *fill_color, + const extents origin, + const extents region, + const wait_list &events = wait_list()) + { + BOOST_ASSERT(image.get_context() == this->get_context()); + + size_t origin3[3] = { 0, 0, 0 }; + size_t region3[3] = { 1, 1, 1 }; + + std::copy(origin.data(), origin.data() + N, origin3); + std::copy(region.data(), region.data() + N, region3); + + return enqueue_fill_image( + image, fill_color, origin3, region3, events + ); + } + + /// Enqueues a command to migrate \p mem_objects. + /// + /// \see_opencl_ref{clEnqueueMigrateMemObjects} + /// + /// \opencl_version_warning{1,2} + event enqueue_migrate_memory_objects(uint_ num_mem_objects, + const cl_mem *mem_objects, + cl_mem_migration_flags flags, + const wait_list &events = wait_list()) + { + BOOST_ASSERT(m_queue != 0); + + event event_; + + cl_int ret = clEnqueueMigrateMemObjects( + m_queue, + num_mem_objects, + mem_objects, + flags, + events.size(), + events.get_event_ptr(), + &event_.get() + ); + + if(ret != CL_SUCCESS){ + BOOST_THROW_EXCEPTION(opencl_error(ret)); + } + + return event_; + } + #endif // CL_VERSION_1_2 + + /// Enqueues a kernel for execution. + /// + /// \see_opencl_ref{clEnqueueNDRangeKernel} + event enqueue_nd_range_kernel(const kernel &kernel, + size_t work_dim, + const size_t *global_work_offset, + const size_t *global_work_size, + const size_t *local_work_size, + const wait_list &events = wait_list()) + { + BOOST_ASSERT(m_queue != 0); + BOOST_ASSERT(kernel.get_context() == this->get_context()); + + event event_; + + cl_int ret = clEnqueueNDRangeKernel( + m_queue, + kernel, + static_cast(work_dim), + global_work_offset, + global_work_size, + local_work_size, + events.size(), + events.get_event_ptr(), + &event_.get() + ); + + if(ret != CL_SUCCESS){ + BOOST_THROW_EXCEPTION(opencl_error(ret)); + } + + return event_; + } + + /// \overload + template + event enqueue_nd_range_kernel(const kernel &kernel, + const extents &global_work_offset, + const extents &global_work_size, + const extents &local_work_size, + const wait_list &events = wait_list()) + { + return enqueue_nd_range_kernel( + kernel, + N, + global_work_offset.data(), + global_work_size.data(), + local_work_size.data(), + events + ); + } + + /// Convenience method which calls enqueue_nd_range_kernel() with a + /// one-dimensional range. + event enqueue_1d_range_kernel(const kernel &kernel, + size_t global_work_offset, + size_t global_work_size, + size_t local_work_size, + const wait_list &events = wait_list()) + { + return enqueue_nd_range_kernel( + kernel, + 1, + &global_work_offset, + &global_work_size, + local_work_size ? &local_work_size : 0, + events + ); + } + + /// Enqueues a kernel to execute using a single work-item. + /// + /// \see_opencl_ref{clEnqueueTask} + event enqueue_task(const kernel &kernel, const wait_list &events = wait_list()) + { + BOOST_ASSERT(m_queue != 0); + BOOST_ASSERT(kernel.get_context() == this->get_context()); + + event event_; + + // clEnqueueTask() was deprecated in OpenCL 2.0. In that case we + // just forward to the equivalent clEnqueueNDRangeKernel() call. + #ifdef CL_VERSION_2_0 + size_t one = 1; + cl_int ret = clEnqueueNDRangeKernel( + m_queue, kernel, 1, 0, &one, &one, + events.size(), events.get_event_ptr(), &event_.get() + ); + #else + cl_int ret = clEnqueueTask( + m_queue, kernel, events.size(), events.get_event_ptr(), &event_.get() + ); + #endif + + if(ret != CL_SUCCESS){ + BOOST_THROW_EXCEPTION(opencl_error(ret)); + } + + return event_; + } + + /// Enqueues a function to execute on the host. + event enqueue_native_kernel(void (BOOST_COMPUTE_CL_CALLBACK *user_func)(void *), + void *args, + size_t cb_args, + uint_ num_mem_objects, + const cl_mem *mem_list, + const void **args_mem_loc, + const wait_list &events = wait_list()) + { + BOOST_ASSERT(m_queue != 0); + + event event_; + cl_int ret = clEnqueueNativeKernel( + m_queue, + user_func, + args, + cb_args, + num_mem_objects, + mem_list, + args_mem_loc, + events.size(), + events.get_event_ptr(), + &event_.get() + ); + if(ret != CL_SUCCESS){ + BOOST_THROW_EXCEPTION(opencl_error(ret)); + } + + return event_; + } + + /// Convenience overload for enqueue_native_kernel() which enqueues a + /// native kernel on the host with a nullary function. + event enqueue_native_kernel(void (BOOST_COMPUTE_CL_CALLBACK *user_func)(void), + const wait_list &events = wait_list()) + { + return enqueue_native_kernel( + detail::nullary_native_kernel_trampoline, + reinterpret_cast(&user_func), + sizeof(user_func), + 0, + 0, + 0, + events + ); + } + + /// Flushes the command queue. + /// + /// \see_opencl_ref{clFlush} + void flush() + { + BOOST_ASSERT(m_queue != 0); + + clFlush(m_queue); + } + + /// Blocks until all outstanding commands in the queue have finished. + /// + /// \see_opencl_ref{clFinish} + void finish() + { + BOOST_ASSERT(m_queue != 0); + + clFinish(m_queue); + } + + /// Enqueues a barrier in the queue. + void enqueue_barrier() + { + BOOST_ASSERT(m_queue != 0); + cl_int ret = CL_SUCCESS; + + #ifdef CL_VERSION_1_2 + if(get_device().check_version(1, 2)){ + ret = clEnqueueBarrierWithWaitList(m_queue, 0, 0, 0); + } else + #endif // CL_VERSION_1_2 + { + // Suppress deprecated declarations warning + BOOST_COMPUTE_DISABLE_DEPRECATED_DECLARATIONS(); + ret = clEnqueueBarrier(m_queue); + BOOST_COMPUTE_ENABLE_DEPRECATED_DECLARATIONS(); + } + + if(ret != CL_SUCCESS){ + BOOST_THROW_EXCEPTION(opencl_error(ret)); + } + } + + #if defined(CL_VERSION_1_2) || defined(BOOST_COMPUTE_DOXYGEN_INVOKED) + /// Enqueues a barrier in the queue after \p events. + /// + /// \opencl_version_warning{1,2} + event enqueue_barrier(const wait_list &events) + { + BOOST_ASSERT(m_queue != 0); + + event event_; + cl_int ret = CL_SUCCESS; + + ret = clEnqueueBarrierWithWaitList( + m_queue, events.size(), events.get_event_ptr(), &event_.get() + ); + + if(ret != CL_SUCCESS){ + BOOST_THROW_EXCEPTION(opencl_error(ret)); + } + + return event_; + } + #endif // CL_VERSION_1_2 + + /// Enqueues a marker in the queue and returns an event that can be + /// used to track its progress. + event enqueue_marker() + { + event event_; + cl_int ret = CL_SUCCESS; + + #ifdef CL_VERSION_1_2 + if(get_device().check_version(1, 2)){ + ret = clEnqueueMarkerWithWaitList(m_queue, 0, 0, &event_.get()); + } else + #endif + { + // Suppress deprecated declarations warning + BOOST_COMPUTE_DISABLE_DEPRECATED_DECLARATIONS(); + ret = clEnqueueMarker(m_queue, &event_.get()); + BOOST_COMPUTE_ENABLE_DEPRECATED_DECLARATIONS(); + } + + if(ret != CL_SUCCESS){ + BOOST_THROW_EXCEPTION(opencl_error(ret)); + } + + return event_; + } + + #if defined(CL_VERSION_1_2) || defined(BOOST_COMPUTE_DOXYGEN_INVOKED) + /// Enqueues a marker after \p events in the queue and returns an + /// event that can be used to track its progress. + /// + /// \opencl_version_warning{1,2} + event enqueue_marker(const wait_list &events) + { + event event_; + + cl_int ret = clEnqueueMarkerWithWaitList( + m_queue, events.size(), events.get_event_ptr(), &event_.get() + ); + + if(ret != CL_SUCCESS){ + BOOST_THROW_EXCEPTION(opencl_error(ret)); + } + + return event_; + } + #endif // CL_VERSION_1_2 + + #if defined(CL_VERSION_2_0) || defined(BOOST_COMPUTE_DOXYGEN_INVOKED) + /// Enqueues a command to copy \p size bytes of data from \p src_ptr to + /// \p dst_ptr. + /// + /// \opencl_version_warning{2,0} + /// + /// \see_opencl2_ref{clEnqueueSVMMemcpy} + event enqueue_svm_memcpy(void *dst_ptr, + const void *src_ptr, + size_t size, + const wait_list &events = wait_list()) + { + event event_; + + cl_int ret = clEnqueueSVMMemcpy( + m_queue, + CL_TRUE, + dst_ptr, + src_ptr, + size, + events.size(), + events.get_event_ptr(), + &event_.get() + ); + + if(ret != CL_SUCCESS){ + BOOST_THROW_EXCEPTION(opencl_error(ret)); + } + + return event_; + } + + /// Enqueues a command to copy \p size bytes of data from \p src_ptr to + /// \p dst_ptr. The operation is performed asynchronously. + /// + /// \opencl_version_warning{2,0} + /// + /// \see_opencl2_ref{clEnqueueSVMMemcpy} + event enqueue_svm_memcpy_async(void *dst_ptr, + const void *src_ptr, + size_t size, + const wait_list &events = wait_list()) + { + event event_; + + cl_int ret = clEnqueueSVMMemcpy( + m_queue, + CL_FALSE, + dst_ptr, + src_ptr, + size, + events.size(), + events.get_event_ptr(), + &event_.get() + ); + + if(ret != CL_SUCCESS){ + BOOST_THROW_EXCEPTION(opencl_error(ret)); + } + + return event_; + } + + /// Enqueues a command to fill \p size bytes of data at \p svm_ptr with + /// \p pattern. + /// + /// \opencl_version_warning{2,0} + /// + /// \see_opencl2_ref{clEnqueueSVMMemFill} + event enqueue_svm_fill(void *svm_ptr, + const void *pattern, + size_t pattern_size, + size_t size, + const wait_list &events = wait_list()) + + { + event event_; + + cl_int ret = clEnqueueSVMMemFill( + m_queue, + svm_ptr, + pattern, + pattern_size, + size, + events.size(), + events.get_event_ptr(), + &event_.get() + ); + + if(ret != CL_SUCCESS){ + BOOST_THROW_EXCEPTION(opencl_error(ret)); + } + + return event_; + } + + /// Enqueues a command to free \p svm_ptr. + /// + /// \opencl_version_warning{2,0} + /// + /// \see_opencl2_ref{clEnqueueSVMFree} + /// + /// \see svm_free() + event enqueue_svm_free(void *svm_ptr, + const wait_list &events = wait_list()) + { + event event_; + + cl_int ret = clEnqueueSVMFree( + m_queue, + 1, + &svm_ptr, + 0, + 0, + events.size(), + events.get_event_ptr(), + &event_.get() + ); + + if(ret != CL_SUCCESS){ + BOOST_THROW_EXCEPTION(opencl_error(ret)); + } + + return event_; + } + + /// Enqueues a command to map \p svm_ptr to the host memory space. + /// + /// \opencl_version_warning{2,0} + /// + /// \see_opencl2_ref{clEnqueueSVMMap} + event enqueue_svm_map(void *svm_ptr, + size_t size, + cl_map_flags flags, + const wait_list &events = wait_list()) + { + event event_; + + cl_int ret = clEnqueueSVMMap( + m_queue, + CL_TRUE, + flags, + svm_ptr, + size, + events.size(), + events.get_event_ptr(), + &event_.get() + ); + + if(ret != CL_SUCCESS){ + BOOST_THROW_EXCEPTION(opencl_error(ret)); + } + + return event_; + } + + /// Enqueues a command to unmap \p svm_ptr from the host memory space. + /// + /// \opencl_version_warning{2,0} + /// + /// \see_opencl2_ref{clEnqueueSVMUnmap} + event enqueue_svm_unmap(void *svm_ptr, + const wait_list &events = wait_list()) + { + event event_; + + cl_int ret = clEnqueueSVMUnmap( + m_queue, + svm_ptr, + events.size(), + events.get_event_ptr(), + &event_.get() + ); + + if(ret != CL_SUCCESS){ + BOOST_THROW_EXCEPTION(opencl_error(ret)); + } + + return event_; + } + #endif // CL_VERSION_2_0 + + /// Returns \c true if the command queue is the same at \p other. + bool operator==(const command_queue &other) const + { + return m_queue == other.m_queue; + } + + /// Returns \c true if the command queue is different from \p other. + bool operator!=(const command_queue &other) const + { + return m_queue != other.m_queue; + } + + /// \internal_ + operator cl_command_queue() const + { + return m_queue; + } + + /// \internal_ + bool check_device_version(int major, int minor) const + { + return get_device().check_version(major, minor); + } + +private: + cl_command_queue m_queue; +}; + +inline buffer buffer::clone(command_queue &queue) const +{ + buffer copy(get_context(), size(), get_memory_flags()); + queue.enqueue_copy_buffer(*this, copy, 0, 0, size()); + return copy; +} + +inline image1d image1d::clone(command_queue &queue) const +{ + image1d copy( + get_context(), width(), format(), get_memory_flags() + ); + + queue.enqueue_copy_image(*this, copy, origin(), copy.origin(), size()); + + return copy; +} + +inline image2d image2d::clone(command_queue &queue) const +{ + image2d copy( + get_context(), width(), height(), format(), get_memory_flags() + ); + + queue.enqueue_copy_image(*this, copy, origin(), copy.origin(), size()); + + return copy; +} + +inline image3d image3d::clone(command_queue &queue) const +{ + image3d copy( + get_context(), width(), height(), depth(), format(), get_memory_flags() + ); + + queue.enqueue_copy_image(*this, copy, origin(), copy.origin(), size()); + + return copy; +} + +/// \internal_ define get_info() specializations for command_queue +BOOST_COMPUTE_DETAIL_DEFINE_GET_INFO_SPECIALIZATIONS(command_queue, + ((cl_context, CL_QUEUE_CONTEXT)) + ((cl_device_id, CL_QUEUE_DEVICE)) + ((uint_, CL_QUEUE_REFERENCE_COUNT)) + ((cl_command_queue_properties, CL_QUEUE_PROPERTIES)) +) + +} // end compute namespace +} // end boost namespace + +#endif // BOOST_COMPUTE_COMMAND_QUEUE_HPP diff --git a/3party/boost/boost/compute/config.hpp b/3party/boost/boost/compute/config.hpp new file mode 100644 index 0000000000..e501ed28c9 --- /dev/null +++ b/3party/boost/boost/compute/config.hpp @@ -0,0 +1,66 @@ +//---------------------------------------------------------------------------// +// Copyright (c) 2013 Kyle Lutz +// +// 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 +// +// See http://boostorg.github.com/compute for more information. +//---------------------------------------------------------------------------// + +#ifndef BOOST_COMPUTE_CONFIG_HPP +#define BOOST_COMPUTE_CONFIG_HPP + +#include +#include +#include + +// check for minimum required boost version +#if BOOST_VERSION < 105400 +#error Boost.Compute requires Boost version 1.54 or later +#endif + +// the BOOST_COMPUTE_NO_VARIADIC_TEMPLATES macro is defined +// if the compiler does not *fully* support variadic templates +#if defined(BOOST_NO_CXX11_VARIADIC_TEMPLATES) || \ + (defined(__GNUC__) && !defined(__clang__) && \ + __GNUC__ == 4 && __GNUC_MINOR__ <= 6) + #define BOOST_COMPUTE_NO_VARIADIC_TEMPLATES +#endif // BOOST_NO_CXX11_VARIADIC_TEMPLATES + +// the BOOST_COMPUTE_NO_STD_TUPLE macro is defined if the +// compiler/stdlib does not support std::tuple +#if defined(BOOST_NO_CXX11_HDR_TUPLE) || \ + defined(BOOST_COMPUTE_NO_VARIADIC_TEMPLATES) + #define BOOST_COMPUTE_NO_STD_TUPLE +#endif // BOOST_NO_CXX11_HDR_TUPLE + +// defines BOOST_COMPUTE_CL_CALLBACK to the value of CL_CALLBACK +// if it is defined (it was added in OpenCL 1.1). this is used to +// annotate certain callback functions registered with OpenCL +#ifdef CL_CALLBACK +# define BOOST_COMPUTE_CL_CALLBACK CL_CALLBACK +#else +# define BOOST_COMPUTE_CL_CALLBACK +#endif + +// Maximum number of iterators acceptable for make_zip_iterator +#ifndef BOOST_COMPUTE_MAX_ARITY + // should be no more than max boost::tuple size (10 by default) +# define BOOST_COMPUTE_MAX_ARITY 10 +#endif + +#if !defined(BOOST_COMPUTE_DOXYGEN_INVOKED) && \ + defined(BOOST_NO_CXX11_RVALUE_REFERENCES) +# define BOOST_COMPUTE_NO_RVALUE_REFERENCES +#endif // BOOST_NO_CXX11_RVALUE_REFERENCES + +#if defined(BOOST_NO_CXX11_HDR_INITIALIZER_LIST) +# define BOOST_COMPUTE_NO_HDR_INITIALIZER_LIST +#endif // BOOST_NO_CXX11_HDR_INITIALIZER_LIST + +#if defined(BOOST_NO_CXX11_HDR_CHRONO) +# define BOOST_COMPUTE_NO_HDR_CHRONO +#endif // BOOST_NO_CXX11_HDR_CHRONO + +#endif // BOOST_COMPUTE_CONFIG_HPP diff --git a/3party/boost/boost/compute/container.hpp b/3party/boost/boost/compute/container.hpp new file mode 100644 index 0000000000..fc14f5fde2 --- /dev/null +++ b/3party/boost/boost/compute/container.hpp @@ -0,0 +1,27 @@ +//---------------------------------------------------------------------------// +// Copyright (c) 2013 Kyle Lutz +// +// 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 +// +// See http://boostorg.github.com/compute for more information. +//---------------------------------------------------------------------------// + +#ifndef BOOST_COMPUTE_CONTAINER_HPP +#define BOOST_COMPUTE_CONTAINER_HPP + +/// \file +/// +/// Meta-header to include all Boost.Compute container headers. + +#include +#include +#include +#include +#include +#include +#include +#include + +#endif // BOOST_COMPUTE_CONTAINER_HPP diff --git a/3party/boost/boost/compute/container/array.hpp b/3party/boost/boost/compute/container/array.hpp new file mode 100644 index 0000000000..2b504be4a8 --- /dev/null +++ b/3party/boost/boost/compute/container/array.hpp @@ -0,0 +1,317 @@ +//---------------------------------------------------------------------------// +// Copyright (c) 2013 Kyle Lutz +// +// 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 +// +// See http://boostorg.github.com/compute for more information. +//---------------------------------------------------------------------------// + +#ifndef BOOST_COMPUTE_CONTAINER_ARRAY_HPP +#define BOOST_COMPUTE_CONTAINER_ARRAY_HPP + +#include +#include +#include + +#include +#include + +#include +#include +#include +#include +#include +#include +#include + +namespace boost { +namespace compute { + +/// \class array +/// \brief A fixed-size container. +/// +/// The array container is very similar to the \ref vector container except +/// its size is fixed at compile-time rather than being dynamically resizable +/// at run-time. +/// +/// For example, to create a fixed-size array with eight values on the device: +/// \code +/// boost::compute::array values(context); +/// \endcode +/// +/// The Boost.Compute \c array class provides a STL-like API and is modeled +/// after the \c std::array class from the C++ standard library. +/// +/// \see \ref vector "vector" +template +class array +{ +public: + typedef T value_type; + typedef std::size_t size_type; + typedef ptrdiff_t difference_type; + typedef detail::buffer_value reference; + typedef const detail::buffer_value const_reference; + typedef T* pointer; + typedef const T* const_pointer; + typedef buffer_iterator iterator; + typedef buffer_iterator const_iterator; + typedef std::reverse_iterator reverse_iterator; + typedef std::reverse_iterator const_reverse_iterator; + + enum { + static_size = N + }; + + explicit array(const context &context = system::default_context()) + : m_buffer(context, sizeof(T) * N) + { + } + + array(const array &other) + : m_buffer(other.m_buffer.get_context(), sizeof(T) * N) + { + command_queue queue = default_queue(); + boost::compute::copy(other.begin(), other.end(), begin(), queue); + queue.finish(); + } + + array(const boost::array &array, + const context &context = system::default_context()) + : m_buffer(context, sizeof(T) * N) + { + command_queue queue = default_queue(); + boost::compute::copy(array.begin(), array.end(), begin(), queue); + queue.finish(); + } + + array(const array &other, + const command_queue &queue) + : m_buffer(other.m_buffer.get_context(), sizeof(T) * N) + { + boost::compute::copy(other.begin(), other.end(), begin(), queue); + } + + array& operator=(const array &other) + { + if(this != &other){ + command_queue queue = default_queue(); + boost::compute::copy(other.begin(), other.end(), begin(), queue); + queue.finish(); + } + + return *this; + } + + array& operator=(const boost::array &array) + { + command_queue queue = default_queue(); + boost::compute::copy(array.begin(), array.end(), begin(), queue); + queue.finish(); + + return *this; + } + + ~array() + { + } + + iterator begin() + { + return buffer_iterator(m_buffer, 0); + } + + const_iterator begin() const + { + return buffer_iterator(m_buffer, 0); + } + + const_iterator cbegin() const + { + return begin(); + } + + iterator end() + { + return buffer_iterator(m_buffer, N); + } + + const_iterator end() const + { + return buffer_iterator(m_buffer, N); + } + + const_iterator cend() const + { + return end(); + } + + reverse_iterator rbegin() + { + return reverse_iterator(end() - 1); + } + + const_reverse_iterator rbegin() const + { + return reverse_iterator(end() - 1); + } + + const_reverse_iterator crbegin() const + { + return rbegin(); + } + + reverse_iterator rend() + { + return reverse_iterator(begin() - 1); + } + + const_reverse_iterator rend() const + { + return reverse_iterator(begin() - 1); + } + + const_reverse_iterator crend() const + { + return rend(); + } + + size_type size() const + { + return N; + } + + bool empty() const + { + return N == 0; + } + + size_type max_size() const + { + return N; + } + + reference operator[](size_type index) + { + return *(begin() + static_cast(index)); + } + + const_reference operator[](size_type index) const + { + return *(begin() + static_cast(index)); + } + + reference at(size_type index) + { + if(index >= N){ + BOOST_THROW_EXCEPTION(std::out_of_range("index out of range")); + } + + return operator[](index); + } + + const_reference at(size_type index) const + { + if(index >= N){ + BOOST_THROW_EXCEPTION(std::out_of_range("index out of range")); + } + + return operator[](index); + } + + reference front() + { + return *begin(); + } + + const_reference front() const + { + return *begin(); + } + + reference back() + { + return *(end() - static_cast(1)); + } + + const_reference back() const + { + return *(end() - static_cast(1)); + } + + void fill(const value_type &value, const command_queue &queue) + { + ::boost::compute::fill(begin(), end(), value, queue); + } + + void swap(array &other, const command_queue &queue) + { + ::boost::compute::swap_ranges(begin(), end(), other.begin(), queue); + } + + void fill(const value_type &value) + { + command_queue queue = default_queue(); + ::boost::compute::fill(begin(), end(), value, queue); + queue.finish(); + } + + void swap(array &other) + { + command_queue queue = default_queue(); + ::boost::compute::swap_ranges(begin(), end(), other.begin(), queue); + queue.finish(); + } + + const buffer& get_buffer() const + { + return m_buffer; + } + +private: + buffer m_buffer; + + command_queue default_queue() const + { + const context &context = m_buffer.get_context(); + command_queue queue(context, context.get_device()); + return queue; + } +}; + +namespace detail { + +// set_kernel_arg specialization for array +template +struct set_kernel_arg > +{ + void operator()(kernel &kernel_, size_t index, const array &array) + { + kernel_.set_arg(index, array.get_buffer()); + } +}; + +// for capturing array with BOOST_COMPUTE_CLOSURE() +template +struct capture_traits > +{ + static std::string type_name() + { + return std::string("__global ") + ::boost::compute::type_name() + "*"; + } +}; + +// meta_kernel streaming operator for array +template +meta_kernel& operator<<(meta_kernel &k, const array &array) +{ + return k << k.get_buffer_identifier(array.get_buffer()); +} + +} // end detail namespace +} // end compute namespace +} // end boost namespace + +#endif // BOOST_COMPUTE_CONTAINER_ARRAY_HPP diff --git a/3party/boost/boost/compute/container/basic_string.hpp b/3party/boost/boost/compute/container/basic_string.hpp new file mode 100644 index 0000000000..c5a2c46aa5 --- /dev/null +++ b/3party/boost/boost/compute/container/basic_string.hpp @@ -0,0 +1,331 @@ +//---------------------------------------------------------------------------// +// Copyright (c) 2013 Kyle Lutz +// +// 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 +// +// See http://boostorg.github.com/compute for more information. +//---------------------------------------------------------------------------// + +#ifndef BOOST_COMPUTE_CONTAINER_BASIC_STRING_HPP +#define BOOST_COMPUTE_CONTAINER_BASIC_STRING_HPP + +#include +#include + +#include +#include +#include +#include +#include +#include +#include + +namespace boost { +namespace compute { + +/// \class basic_string +/// \brief A template for a dynamically-sized character sequence. +/// +/// The \c basic_string class provides a generic template for a dynamically- +/// sized character sequence. This is most commonly used through the \c string +/// typedef (for \c basic_string). +/// +/// For example, to create a string on the device with its contents copied +/// from a C-string on the host: +/// \code +/// boost::compute::string str("hello, world!"); +/// \endcode +/// +/// \see \ref vector "vector" +template > +class basic_string +{ +public: + typedef Traits traits_type; + typedef typename Traits::char_type value_type; + typedef size_t size_type; + static const size_type npos = size_type(-1); + typedef typename ::boost::compute::vector::reference reference; + typedef typename ::boost::compute::vector::const_reference const_reference; + typedef typename ::boost::compute::vector::iterator iterator; + typedef typename ::boost::compute::vector::const_iterator const_iterator; + typedef typename ::boost::compute::vector::reverse_iterator reverse_iterator; + typedef typename ::boost::compute::vector::const_reverse_iterator const_reverse_iterator; + + basic_string() + { + } + + basic_string(size_type count, CharT ch) + : m_data(count) + { + std::fill(m_data.begin(), m_data.end(), ch); + } + + basic_string(const basic_string &other, + size_type pos, + size_type count = npos) + : m_data(other.begin() + pos, + other.begin() + (std::min)(other.size(), count)) + { + } + + basic_string(const char *s, size_type count) + : m_data(s, s + count) + { + } + + basic_string(const char *s) + : m_data(s, s + std::strlen(s)) + { + } + + template + basic_string(InputIterator first, InputIterator last) + : m_data(first, last) + { + } + + basic_string(const basic_string &other) + : m_data(other.m_data) + { + } + + basic_string& operator=(const basic_string &other) + { + if(this != &other){ + m_data = other.m_data; + } + + return *this; + } + + ~basic_string() + { + } + + reference at(size_type pos) + { + return m_data.at(pos); + } + + const_reference at(size_type pos) const + { + return m_data.at(pos); + } + + reference operator[](size_type pos) + { + return m_data[pos]; + } + + const_reference operator[](size_type pos) const + { + return m_data[pos]; + } + + reference front() + { + return m_data.front(); + } + + const_reference front() const + { + return m_data.front(); + } + + reference back() + { + return m_data.back(); + } + + const_reference back() const + { + return m_data.back(); + } + + iterator begin() + { + return m_data.begin(); + } + + const_iterator begin() const + { + return m_data.begin(); + } + + const_iterator cbegin() const + { + return m_data.cbegin(); + } + + iterator end() + { + return m_data.end(); + } + + const_iterator end() const + { + return m_data.end(); + } + + const_iterator cend() const + { + return m_data.cend(); + } + + reverse_iterator rbegin() + { + return m_data.rbegin(); + } + + const_reverse_iterator rbegin() const + { + return m_data.rbegin(); + } + + const_reverse_iterator crbegin() const + { + return m_data.crbegin(); + } + + reverse_iterator rend() + { + return m_data.rend(); + } + + const_reverse_iterator rend() const + { + return m_data.rend(); + } + + const_reverse_iterator crend() const + { + return m_data.crend(); + } + + bool empty() const + { + return m_data.empty(); + } + + size_type size() const + { + return m_data.size(); + } + + size_type length() const + { + return m_data.size(); + } + + size_type max_size() const + { + return m_data.max_size(); + } + + void reserve(size_type size) + { + m_data.reserve(size); + } + + size_type capacity() const + { + return m_data.capacity(); + } + + void shrink_to_fit() + { + m_data.shrink_to_fit(); + } + + void clear() + { + m_data.clear(); + } + + void swap(basic_string &other) + { + if(this != &other) + { + ::boost::compute::vector temp_data(other.m_data); + other.m_data = m_data; + m_data = temp_data; + } + } + + basic_string substr(size_type pos = 0, + size_type count = npos) const + { + return basic_string(*this, pos, count); + } + + /// Finds the first character \p ch + size_type find(CharT ch, size_type pos = 0) const + { + const_iterator iter = ::boost::compute::find(begin() + pos, end(), ch); + if(iter == end()){ + return npos; + } + else { + return static_cast(std::distance(begin(), iter)); + } + } + + /// Finds the first substring equal to \p str + size_type find(basic_string& str, size_type pos = 0) const + { + const_iterator iter = ::boost::compute::search(begin() + pos, end(), + str.begin(), str.end()); + if(iter == end()){ + return npos; + } + else { + return static_cast(std::distance(begin(), iter)); + } + } + + /// Finds the first substring equal to the character string + /// pointed to by \p s. + /// The length of the string is determined by the first null character. + /// + /// For example, the following code + /// \snippet test/test_string.cpp string_find + /// + /// will return 5 as position. + size_type find(const char* s, size_type pos = 0) const + { + basic_string str(s); + const_iterator iter = ::boost::compute::search(begin() + pos, end(), + str.begin(), str.end()); + if(iter == end()){ + return npos; + } + else { + return static_cast(std::distance(begin(), iter)); + } + } + +private: + ::boost::compute::vector m_data; +}; + +template +std::ostream& +operator<<(std::ostream& stream, + boost::compute::basic_stringconst& outStr) +{ + command_queue queue = ::boost::compute::system::default_queue(); + boost::compute::copy(outStr.begin(), + outStr.end(), + std::ostream_iterator(stream), + queue); + return stream; +} + +} // end compute namespace +} // end boost namespace + +#endif // BOOST_COMPUTE_CONTAINER_BASIC_STRING_HPP diff --git a/3party/boost/boost/compute/container/detail/scalar.hpp b/3party/boost/boost/compute/container/detail/scalar.hpp new file mode 100644 index 0000000000..7ecd86e540 --- /dev/null +++ b/3party/boost/boost/compute/container/detail/scalar.hpp @@ -0,0 +1,61 @@ +//---------------------------------------------------------------------------// +// Copyright (c) 2013 Kyle Lutz +// +// 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 +// +// See http://boostorg.github.com/compute for more information. +//---------------------------------------------------------------------------// + +#ifndef BOOST_COMPUTE_CONTAINER_DETAIL_SCALAR_HPP +#define BOOST_COMPUTE_CONTAINER_DETAIL_SCALAR_HPP + +#include +#include + +namespace boost { +namespace compute { +namespace detail { + +// scalar provides a trivial "container" that stores a +// single value in a memory buffer on a compute device +template +class scalar +{ +public: + typedef T value_type; + + scalar(const context &context) + : m_buffer(context, sizeof(T)) + { + } + + ~scalar() + { + } + + T read(command_queue &queue) const + { + return read_single_value(m_buffer, 0, queue); + } + + void write(const T &value, command_queue &queue) + { + write_single_value(value, m_buffer, 0, queue); + } + + const buffer& get_buffer() const + { + return m_buffer; + } + +private: + buffer m_buffer; +}; + +} // end detail namespace +} // end compute namespace +} // end boost namespace + +#endif // BOOST_COMPUTE_CONTAINER_DETAIL_SCALAR_HPP diff --git a/3party/boost/boost/compute/container/dynamic_bitset.hpp b/3party/boost/boost/compute/container/dynamic_bitset.hpp new file mode 100644 index 0000000000..7f41901d64 --- /dev/null +++ b/3party/boost/boost/compute/container/dynamic_bitset.hpp @@ -0,0 +1,237 @@ +//---------------------------------------------------------------------------// +// Copyright (c) 2013-2014 Kyle Lutz +// +// 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 +// +// See http://boostorg.github.com/compute for more information. +//---------------------------------------------------------------------------// + +#ifndef BOOST_COMPUTE_CONTAINER_DYNAMIC_BITSET_HPP +#define BOOST_COMPUTE_CONTAINER_DYNAMIC_BITSET_HPP + +#include +#include +#include +#include +#include +#include +#include + +namespace boost { +namespace compute { + +/// \class dynamic_bitset +/// \brief The dynamic_bitset class contains a resizable bit array. +/// +/// For example, to create a dynamic-bitset with space for 1000 bits on the +/// device: +/// \code +/// boost::compute::dynamic_bitset<> bits(1000, queue); +/// \endcode +/// +/// The Boost.Compute \c dynamic_bitset class provides a STL-like API and is +/// modeled after the \c boost::dynamic_bitset class from Boost. +/// +/// \see \ref vector "vector" +template > +class dynamic_bitset +{ +public: + typedef Block block_type; + typedef Alloc allocator_type; + typedef vector container_type; + typedef typename container_type::size_type size_type; + + BOOST_STATIC_CONSTANT(size_type, bits_per_block = sizeof(block_type) * CHAR_BIT); + BOOST_STATIC_CONSTANT(size_type, npos = static_cast(-1)); + + /// Creates a new dynamic bitset with storage for \p size bits. Initializes + /// all bits to zero. + dynamic_bitset(size_type size, command_queue &queue) + : m_bits(size / sizeof(block_type), queue.get_context()), + m_size(size) + { + // initialize all bits to zero + reset(queue); + } + + /// Creates a new dynamic bitset as a copy of \p other. + dynamic_bitset(const dynamic_bitset &other) + : m_bits(other.m_bits), + m_size(other.m_size) + { + } + + /// Copies the data from \p other to \c *this. + dynamic_bitset& operator=(const dynamic_bitset &other) + { + if(this != &other){ + m_bits = other.m_bits; + m_size = other.m_size; + } + + return *this; + } + + /// Destroys the dynamic bitset. + ~dynamic_bitset() + { + } + + /// Returns the size of the dynamic bitset. + size_type size() const + { + return m_size; + } + + /// Returns the number of blocks to store the bits in the dynamic bitset. + size_type num_blocks() const + { + return m_bits.size(); + } + + /// Returns the maximum possible size for the dynamic bitset. + size_type max_size() const + { + return m_bits.max_size() * bits_per_block; + } + + /// Returns \c true if the dynamic bitset is empty (i.e. \c size() == \c 0). + bool empty() const + { + return size() == 0; + } + + /// Returns the number of set bits (i.e. '1') in the bitset. + size_type count(command_queue &queue) const + { + ulong_ count = 0; + transform_reduce( + m_bits.begin(), + m_bits.end(), + &count, + popcount(), + plus(), + queue + ); + return static_cast(count); + } + + /// Resizes the bitset to contain \p num_bits. If the new size is greater + /// than the current size the new bits are set to zero. + void resize(size_type num_bits, command_queue &queue) + { + // resize bits + const size_type current_block_count = m_bits.size(); + m_bits.resize(num_bits * bits_per_block, queue); + + // fill new block with zeros (if new blocks were added) + const size_type new_block_count = m_bits.size(); + if(new_block_count > current_block_count){ + fill_n( + m_bits.begin() + current_block_count, + new_block_count - current_block_count, + block_type(0), + queue + ); + } + + // store new size + m_size = num_bits; + } + + /// Sets the bit at position \p n to \c true. + void set(size_type n, command_queue &queue) + { + set(n, true, queue); + } + + /// Sets the bit at position \p n to \p value. + void set(size_type n, bool value, command_queue &queue) + { + const size_type bit = n % bits_per_block; + const size_type block = n / bits_per_block; + + // load current block + block_type block_value; + copy_n(m_bits.begin() + block, 1, &block_value, queue); + + // update block value + if(value){ + block_value |= (size_type(1) << bit); + } + else { + block_value &= ~(size_type(1) << bit); + } + + // store new block + copy_n(&block_value, 1, m_bits.begin() + block, queue); + } + + /// Returns \c true if the bit at position \p n is set (i.e. '1'). + bool test(size_type n, command_queue &queue) + { + const size_type bit = n % (sizeof(block_type) * CHAR_BIT); + const size_type block = n / (sizeof(block_type) * CHAR_BIT); + + block_type block_value; + copy_n(m_bits.begin() + block, 1, &block_value, queue); + + return block_value & (size_type(1) << bit); + } + + /// Flips the value of the bit at position \p n. + void flip(size_type n, command_queue &queue) + { + set(n, !test(n, queue), queue); + } + + /// Returns \c true if any bit in the bitset is set (i.e. '1'). + bool any(command_queue &queue) const + { + return any_of( + m_bits.begin(), m_bits.end(), lambda::_1 != block_type(0), queue + ); + } + + /// Returns \c true if all of the bits in the bitset are set to zero. + bool none(command_queue &queue) const + { + return !any(queue); + } + + /// Sets all of the bits in the bitset to zero. + void reset(command_queue &queue) + { + fill(m_bits.begin(), m_bits.end(), block_type(0), queue); + } + + /// Sets the bit at position \p n to zero. + void reset(size_type n, command_queue &queue) + { + set(n, false, queue); + } + + /// Empties the bitset (e.g. \c resize(0)). + void clear() + { + m_bits.clear(); + } + + /// Returns the allocator used to allocate storage for the bitset. + allocator_type get_allocator() const + { + return m_bits.get_allocator(); + } + +private: + container_type m_bits; + size_type m_size; +}; + +} // end compute namespace +} // end boost namespace + +#endif // BOOST_COMPUTE_CONTAINER_DYNAMIC_BITSET_HPP diff --git a/3party/boost/boost/compute/container/flat_map.hpp b/3party/boost/boost/compute/container/flat_map.hpp new file mode 100644 index 0000000000..684c4da122 --- /dev/null +++ b/3party/boost/boost/compute/container/flat_map.hpp @@ -0,0 +1,406 @@ +//---------------------------------------------------------------------------// +// Copyright (c) 2013 Kyle Lutz +// +// 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 +// +// See http://boostorg.github.com/compute for more information. +//---------------------------------------------------------------------------// + +#ifndef BOOST_COMPUTE_CONTAINER_FLAT_MAP_HPP +#define BOOST_COMPUTE_CONTAINER_FLAT_MAP_HPP + +#include +#include +#include + +#include +#include + +#include +#include +#include +#include +#include +#include +#include +#include +#include + +namespace boost { +namespace compute { + +template +class flat_map +{ +public: + typedef Key key_type; + typedef T mapped_type; + typedef typename ::boost::compute::vector > vector_type; + typedef typename vector_type::value_type value_type; + typedef typename vector_type::size_type size_type; + typedef typename vector_type::difference_type difference_type; + typedef typename vector_type::reference reference; + typedef typename vector_type::const_reference const_reference; + typedef typename vector_type::pointer pointer; + typedef typename vector_type::const_pointer const_pointer; + typedef typename vector_type::iterator iterator; + typedef typename vector_type::const_iterator const_iterator; + typedef typename vector_type::reverse_iterator reverse_iterator; + typedef typename vector_type::const_reverse_iterator const_reverse_iterator; + + explicit flat_map(const context &context = system::default_context()) + : m_vector(context) + { + } + + flat_map(const flat_map &other) + : m_vector(other.m_vector) + { + } + + flat_map& operator=(const flat_map &other) + { + if(this != &other){ + m_vector = other.m_vector; + } + + return *this; + } + + ~flat_map() + { + } + + iterator begin() + { + return m_vector.begin(); + } + + const_iterator begin() const + { + return m_vector.begin(); + } + + const_iterator cbegin() const + { + return m_vector.cbegin(); + } + + iterator end() + { + return m_vector.end(); + } + + const_iterator end() const + { + return m_vector.end(); + } + + const_iterator cend() const + { + return m_vector.cend(); + } + + reverse_iterator rbegin() + { + return m_vector.rbegin(); + } + + const_reverse_iterator rbegin() const + { + return m_vector.rbegin(); + } + + const_reverse_iterator crbegin() const + { + return m_vector.crbegin(); + } + + reverse_iterator rend() + { + return m_vector.rend(); + } + + const_reverse_iterator rend() const + { + return m_vector.rend(); + } + + const_reverse_iterator crend() const + { + return m_vector.crend(); + } + + size_type size() const + { + return m_vector.size(); + } + + size_type max_size() const + { + return m_vector.max_size(); + } + + bool empty() const + { + return m_vector.empty(); + } + + size_type capacity() const + { + return m_vector.capacity(); + } + + void reserve(size_type size, command_queue &queue) + { + m_vector.reserve(size, queue); + } + + void reserve(size_type size) + { + command_queue queue = m_vector.default_queue(); + reserve(size, queue); + queue.finish(); + } + + void shrink_to_fit() + { + m_vector.shrink_to_fit(); + } + + void clear() + { + m_vector.clear(); + } + + std::pair + insert(const value_type &value, command_queue &queue) + { + iterator location = upper_bound(value.first, queue); + + if(location != begin()){ + value_type current_value; + ::boost::compute::copy_n(location - 1, 1, ¤t_value, queue); + if(value.first == current_value.first){ + return std::make_pair(location - 1, false); + } + } + + m_vector.insert(location, value); + return std::make_pair(location, true); + } + + std::pair insert(const value_type &value) + { + command_queue queue = m_vector.default_queue(); + std::pair result = insert(value, queue); + queue.finish(); + return result; + } + + iterator erase(const const_iterator &position, command_queue &queue) + { + return erase(position, position + 1, queue); + } + + iterator erase(const const_iterator &position) + { + command_queue queue = m_vector.default_queue(); + iterator iter = erase(position, queue); + queue.finish(); + return iter; + } + + iterator erase(const const_iterator &first, + const const_iterator &last, + command_queue &queue) + { + return m_vector.erase(first, last, queue); + } + + iterator erase(const const_iterator &first, const const_iterator &last) + { + command_queue queue = m_vector.default_queue(); + iterator iter = erase(first, last, queue); + queue.finish(); + return iter; + } + + size_type erase(const key_type &value, command_queue &queue) + { + iterator position = find(value, queue); + + if(position == end()){ + return 0; + } + else { + erase(position, queue); + return 1; + } + } + + iterator find(const key_type &value, command_queue &queue) + { + ::boost::compute::get<0> get_key; + + return ::boost::compute::find( + ::boost::compute::make_transform_iterator(begin(), get_key), + ::boost::compute::make_transform_iterator(end(), get_key), + value, + queue + ).base(); + } + + iterator find(const key_type &value) + { + command_queue queue = m_vector.default_queue(); + iterator iter = find(value, queue); + queue.finish(); + return iter; + } + + const_iterator find(const key_type &value, command_queue &queue) const + { + ::boost::compute::get<0> get_key; + + return ::boost::compute::find( + ::boost::compute::make_transform_iterator(begin(), get_key), + ::boost::compute::make_transform_iterator(end(), get_key), + value, + queue + ).base(); + } + + const_iterator find(const key_type &value) const + { + command_queue queue = m_vector.default_queue(); + const_iterator iter = find(value, queue); + queue.finish(); + return iter; + } + + size_type count(const key_type &value, command_queue &queue) const + { + return find(value, queue) != end() ? 1 : 0; + } + + size_type count(const key_type &value) const + { + command_queue queue = m_vector.default_queue(); + size_type result = count(value, queue); + queue.finish(); + return result; + } + + iterator lower_bound(const key_type &value, command_queue &queue) + { + ::boost::compute::get<0> get_key; + + return ::boost::compute::lower_bound( + ::boost::compute::make_transform_iterator(begin(), get_key), + ::boost::compute::make_transform_iterator(end(), get_key), + value, + queue + ).base(); + } + + iterator lower_bound(const key_type &value) + { + command_queue queue = m_vector.default_queue(); + iterator iter = lower_bound(value, queue); + queue.finish(); + return iter; + } + + const_iterator lower_bound(const key_type &value, command_queue &queue) const + { + ::boost::compute::get<0> get_key; + + return ::boost::compute::lower_bound( + ::boost::compute::make_transform_iterator(begin(), get_key), + ::boost::compute::make_transform_iterator(end(), get_key), + value, + queue + ).base(); + } + + const_iterator lower_bound(const key_type &value) const + { + command_queue queue = m_vector.default_queue(); + const_iterator iter = lower_bound(value, queue); + queue.finish(); + return iter; + } + + iterator upper_bound(const key_type &value, command_queue &queue) + { + ::boost::compute::get<0> get_key; + + return ::boost::compute::upper_bound( + ::boost::compute::make_transform_iterator(begin(), get_key), + ::boost::compute::make_transform_iterator(end(), get_key), + value, + queue + ).base(); + } + + iterator upper_bound(const key_type &value) + { + command_queue queue = m_vector.default_queue(); + iterator iter = upper_bound(value, queue); + queue.finish(); + return iter; + } + + const_iterator upper_bound(const key_type &value, command_queue &queue) const + { + ::boost::compute::get<0> get_key; + + return ::boost::compute::upper_bound( + ::boost::compute::make_transform_iterator(begin(), get_key), + ::boost::compute::make_transform_iterator(end(), get_key), + value, + queue + ).base(); + } + + const_iterator upper_bound(const key_type &value) const + { + command_queue queue = m_vector.default_queue(); + const_iterator iter = upper_bound(value, queue); + queue.finish(); + return iter; + } + + const mapped_type at(const key_type &key) const + { + const_iterator iter = find(key); + if(iter == end()){ + BOOST_THROW_EXCEPTION(std::out_of_range("key not found")); + } + + return value_type(*iter).second; + } + + detail::buffer_value operator[](const key_type &key) + { + iterator iter = find(key); + if(iter == end()){ + iter = insert(std::make_pair(key, mapped_type())).first; + } + + size_t index = iter.get_index() * sizeof(value_type) + sizeof(key_type); + + return detail::buffer_value(m_vector.get_buffer(), index); + } + +private: + ::boost::compute::vector > m_vector; +}; + +} // end compute namespace +} // end boost namespace + +#endif // BOOST_COMPUTE_CONTAINER_FLAT_MAP_HPP diff --git a/3party/boost/boost/compute/container/flat_set.hpp b/3party/boost/boost/compute/container/flat_set.hpp new file mode 100644 index 0000000000..8826f78846 --- /dev/null +++ b/3party/boost/boost/compute/container/flat_set.hpp @@ -0,0 +1,339 @@ +//---------------------------------------------------------------------------// +// Copyright (c) 2013 Kyle Lutz +// +// 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 +// +// See http://boostorg.github.com/compute for more information. +//---------------------------------------------------------------------------// + +#ifndef BOOST_COMPUTE_CONTAINER_FLAT_SET_HPP +#define BOOST_COMPUTE_CONTAINER_FLAT_SET_HPP + +#include +#include + +#include +#include +#include +#include + +namespace boost { +namespace compute { + +template +class flat_set +{ +public: + typedef T key_type; + typedef typename vector::value_type value_type; + typedef typename vector::size_type size_type; + typedef typename vector::difference_type difference_type; + typedef typename vector::reference reference; + typedef typename vector::const_reference const_reference; + typedef typename vector::pointer pointer; + typedef typename vector::const_pointer const_pointer; + typedef typename vector::iterator iterator; + typedef typename vector::const_iterator const_iterator; + typedef typename vector::reverse_iterator reverse_iterator; + typedef typename vector::const_reverse_iterator const_reverse_iterator; + + explicit flat_set(const context &context = system::default_context()) + : m_vector(context) + { + } + + flat_set(const flat_set &other) + : m_vector(other.m_vector) + { + } + + flat_set& operator=(const flat_set &other) + { + if(this != &other){ + m_vector = other.m_vector; + } + + return *this; + } + + ~flat_set() + { + } + + iterator begin() + { + return m_vector.begin(); + } + + const_iterator begin() const + { + return m_vector.begin(); + } + + const_iterator cbegin() const + { + return m_vector.cbegin(); + } + + iterator end() + { + return m_vector.end(); + } + + const_iterator end() const + { + return m_vector.end(); + } + + const_iterator cend() const + { + return m_vector.cend(); + } + + reverse_iterator rbegin() + { + return m_vector.rbegin(); + } + + const_reverse_iterator rbegin() const + { + return m_vector.rbegin(); + } + + const_reverse_iterator crbegin() const + { + return m_vector.crbegin(); + } + + reverse_iterator rend() + { + return m_vector.rend(); + } + + const_reverse_iterator rend() const + { + return m_vector.rend(); + } + + const_reverse_iterator crend() const + { + return m_vector.crend(); + } + + size_type size() const + { + return m_vector.size(); + } + + size_type max_size() const + { + return m_vector.max_size(); + } + + bool empty() const + { + return m_vector.empty(); + } + + size_type capacity() const + { + return m_vector.capacity(); + } + + void reserve(size_type size, command_queue &queue) + { + m_vector.reserve(size, queue); + } + + void reserve(size_type size) + { + command_queue queue = m_vector.default_queue(); + reserve(size, queue); + queue.finish(); + } + + void shrink_to_fit() + { + m_vector.shrink_to_fit(); + } + + void clear() + { + m_vector.clear(); + } + + std::pair + insert(const value_type &value, command_queue &queue) + { + iterator location = upper_bound(value, queue); + + if(location != begin()){ + value_type current_value; + ::boost::compute::copy_n(location - 1, 1, ¤t_value, queue); + if(value == current_value){ + return std::make_pair(location - 1, false); + } + } + + m_vector.insert(location, value, queue); + return std::make_pair(location, true); + } + + std::pair insert(const value_type &value) + { + command_queue queue = m_vector.default_queue(); + std::pair result = insert(value, queue); + queue.finish(); + return result; + } + + iterator erase(const const_iterator &position, command_queue &queue) + { + return erase(position, position + 1, queue); + } + + iterator erase(const const_iterator &position) + { + command_queue queue = m_vector.default_queue(); + iterator iter = erase(position, queue); + queue.finish(); + return iter; + } + + iterator erase(const const_iterator &first, + const const_iterator &last, + command_queue &queue) + { + return m_vector.erase(first, last, queue); + } + + iterator erase(const const_iterator &first, const const_iterator &last) + { + command_queue queue = m_vector.default_queue(); + iterator iter = erase(first, last, queue); + queue.finish(); + return iter; + } + + size_type erase(const key_type &value, command_queue &queue) + { + iterator position = find(value, queue); + + if(position == end()){ + return 0; + } + else { + erase(position, queue); + return 1; + } + } + + size_type erase(const key_type &value) + { + command_queue queue = m_vector.default_queue(); + size_type result = erase(value, queue); + queue.finish(); + return result; + } + + iterator find(const key_type &value, command_queue &queue) + { + return ::boost::compute::find(begin(), end(), value, queue); + } + + iterator find(const key_type &value) + { + command_queue queue = m_vector.default_queue(); + iterator iter = find(value, queue); + queue.finish(); + return iter; + } + + const_iterator find(const key_type &value, command_queue &queue) const + { + return ::boost::compute::find(begin(), end(), value, queue); + } + + const_iterator find(const key_type &value) const + { + command_queue queue = m_vector.default_queue(); + const_iterator iter = find(value, queue); + queue.finish(); + return iter; + } + + size_type count(const key_type &value, command_queue &queue) const + { + return find(value, queue) != end() ? 1 : 0; + } + + size_type count(const key_type &value) const + { + command_queue queue = m_vector.default_queue(); + size_type result = count(value, queue); + queue.finish(); + return result; + } + + iterator lower_bound(const key_type &value, command_queue &queue) + { + return ::boost::compute::lower_bound(begin(), end(), value, queue); + } + + iterator lower_bound(const key_type &value) + { + command_queue queue = m_vector.default_queue(); + iterator iter = lower_bound(value, queue); + queue.finish(); + return iter; + } + + const_iterator lower_bound(const key_type &value, command_queue &queue) const + { + return ::boost::compute::lower_bound(begin(), end(), value, queue); + } + + const_iterator lower_bound(const key_type &value) const + { + command_queue queue = m_vector.default_queue(); + const_iterator iter = lower_bound(value, queue); + queue.finish(); + return iter; + } + + iterator upper_bound(const key_type &value, command_queue &queue) + { + return ::boost::compute::upper_bound(begin(), end(), value, queue); + } + + iterator upper_bound(const key_type &value) + { + command_queue queue = m_vector.default_queue(); + iterator iter = upper_bound(value, queue); + queue.finish(); + return iter; + } + + const_iterator upper_bound(const key_type &value, command_queue &queue) const + { + return ::boost::compute::upper_bound(begin(), end(), value, queue); + } + + const_iterator upper_bound(const key_type &value) const + { + command_queue queue = m_vector.default_queue(); + const_iterator iter = upper_bound(value, queue); + queue.finish(); + return iter; + } + +private: + vector m_vector; +}; + +} // end compute namespace +} // end boost namespace + +#endif // BOOST_COMPUTE_CONTAINER_FLAT_SET_HPP diff --git a/3party/boost/boost/compute/container/mapped_view.hpp b/3party/boost/boost/compute/container/mapped_view.hpp new file mode 100644 index 0000000000..59b1e4e0a4 --- /dev/null +++ b/3party/boost/boost/compute/container/mapped_view.hpp @@ -0,0 +1,250 @@ +//---------------------------------------------------------------------------// +// Copyright (c) 2013-2014 Kyle Lutz +// +// 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 +// +// See http://boostorg.github.com/compute for more information. +//---------------------------------------------------------------------------// + +#ifndef BOOST_COMPUTE_CONTAINER_MAPPED_VIEW_HPP +#define BOOST_COMPUTE_CONTAINER_MAPPED_VIEW_HPP + +#include +#include + +#include +#include + +#include +#include +#include +#include +#include + +namespace boost { +namespace compute { + +/// \class mapped_view +/// \brief A mapped view of host memory. +/// +/// The mapped_view class simplifies mapping host-memory to a compute +/// device. This allows for host-allocated memory to be used with the +/// Boost.Compute algorithms. +/// +/// The following example shows how to map a simple C-array containing +/// data on the host to the device and run the reduce() algorithm to +/// calculate the sum: +/// +/// \snippet test/test_mapped_view.cpp reduce +/// +/// \see buffer +template +class mapped_view +{ +public: + typedef T value_type; + typedef size_t size_type; + typedef ptrdiff_t difference_type; + typedef buffer_iterator iterator; + typedef buffer_iterator const_iterator; + + /// Creates a null mapped_view object. + mapped_view() + { + m_mapped_ptr = 0; + } + + /// Creates a mapped_view for \p host_ptr with \p n elements. After + /// constructing a mapped_view the data is available for use by a + /// compute device. Use the \p unmap() method to make the updated data + /// available to the host. + mapped_view(T *host_ptr, + size_type n, + const context &context = system::default_context()) + : m_buffer(_make_mapped_buffer(host_ptr, n, context)) + { + m_mapped_ptr = 0; + } + + /// Creates a read-only mapped_view for \p host_ptr with \p n elements. + /// After constructing a mapped_view the data is available for use by a + /// compute device. Use the \p unmap() method to make the updated data + /// available to the host. + mapped_view(const T *host_ptr, + size_type n, + const context &context = system::default_context()) + : m_buffer(_make_mapped_buffer(host_ptr, n, context)) + { + m_mapped_ptr = 0; + } + + /// Creates a copy of \p other. + mapped_view(const mapped_view &other) + : m_buffer(other.m_buffer) + { + m_mapped_ptr = 0; + } + + /// Copies the mapped buffer from \p other. + mapped_view& operator=(const mapped_view &other) + { + if(this != &other){ + m_buffer = other.m_buffer; + m_mapped_ptr = 0; + } + + return *this; + } + + /// Destroys the mapped_view object. + ~mapped_view() + { + } + + /// Returns an iterator to the first element in the mapped_view. + iterator begin() + { + return ::boost::compute::make_buffer_iterator(m_buffer, 0); + } + + /// Returns a const_iterator to the first element in the mapped_view. + const_iterator begin() const + { + return ::boost::compute::make_buffer_iterator(m_buffer, 0); + } + + /// Returns a const_iterator to the first element in the mapped_view. + const_iterator cbegin() const + { + return begin(); + } + + /// Returns an iterator to one past the last element in the mapped_view. + iterator end() + { + return ::boost::compute::make_buffer_iterator(m_buffer, size()); + } + + /// Returns a const_iterator to one past the last element in the mapped_view. + const_iterator end() const + { + return ::boost::compute::make_buffer_iterator(m_buffer, size()); + } + + /// Returns a const_iterator to one past the last element in the mapped_view. + const_iterator cend() const + { + return end(); + } + + /// Returns the number of elements in the mapped_view. + size_type size() const + { + return m_buffer.size() / sizeof(T); + } + + /// Returns the host data pointer. + T* get_host_ptr() + { + return static_cast(m_buffer.get_info(CL_MEM_HOST_PTR)); + } + + /// Returns the host data pointer. + const T* get_host_ptr() const + { + return static_cast(m_buffer.get_info(CL_MEM_HOST_PTR)); + } + + /// Resizes the mapped_view to \p size elements. + void resize(size_type size) + { + T *old_ptr = get_host_ptr(); + + m_buffer = _make_mapped_buffer(old_ptr, size, m_buffer.get_context()); + } + + /// Returns \c true if the mapped_view is empty. + bool empty() const + { + return size() == 0; + } + + /// Returns the mapped buffer. + const buffer& get_buffer() const + { + return m_buffer; + } + + /// Maps the buffer into the host address space. + /// + /// \see_opencl_ref{clEnqueueMapBuffer} + void map(cl_map_flags flags, command_queue &queue) + { + BOOST_ASSERT(m_mapped_ptr == 0); + + m_mapped_ptr = queue.enqueue_map_buffer( + m_buffer, flags, 0, m_buffer.size() + ); + } + + /// Maps the buffer into the host address space for reading and writing. + /// + /// Equivalent to: + /// \code + /// map(CL_MAP_READ | CL_MAP_WRITE, queue); + /// \endcode + void map(command_queue &queue) + { + map(CL_MAP_READ | CL_MAP_WRITE, queue); + } + + /// Unmaps the buffer from the host address space. + /// + /// \see_opencl_ref{clEnqueueUnmapMemObject} + void unmap(command_queue &queue) + { + BOOST_ASSERT(m_mapped_ptr != 0); + + queue.enqueue_unmap_buffer(m_buffer, m_mapped_ptr); + + m_mapped_ptr = 0; + } + +private: + /// \internal_ + static buffer _make_mapped_buffer(T *host_ptr, + size_t n, + const context &context) + { + return buffer( + context, + n * sizeof(T), + buffer::read_write | buffer::use_host_ptr, + host_ptr + ); + } + + /// \internal_ + static buffer _make_mapped_buffer(const T *host_ptr, + size_t n, + const context &context) + { + return buffer( + context, + n * sizeof(T), + buffer::read_only | buffer::use_host_ptr, + const_cast(static_cast(host_ptr)) + ); + } + +private: + buffer m_buffer; + void *m_mapped_ptr; +}; + +} // end compute namespace +} // end boost namespace + +#endif // BOOST_COMPUTE_CONTAINER_MAPPED_VIEW_HPP diff --git a/3party/boost/boost/compute/container/stack.hpp b/3party/boost/boost/compute/container/stack.hpp new file mode 100644 index 0000000000..dc86df459a --- /dev/null +++ b/3party/boost/boost/compute/container/stack.hpp @@ -0,0 +1,81 @@ +//---------------------------------------------------------------------------// +// Copyright (c) 2013 Kyle Lutz +// +// 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 +// +// See http://boostorg.github.com/compute for more information. +//---------------------------------------------------------------------------// + +#ifndef BOOST_COMPUTE_CONTAINER_STACK_HPP +#define BOOST_COMPUTE_CONTAINER_STACK_HPP + +#include + +namespace boost { +namespace compute { + +template +class stack +{ +public: + typedef vector container_type; + typedef typename container_type::size_type size_type; + typedef typename container_type::value_type value_type; + + stack() + { + } + + stack(const stack &other) + : m_vector(other.m_vector) + { + } + + stack& operator=(const stack &other) + { + if(this != &other){ + m_vector = other.m_vector; + } + + return *this; + } + + ~stack() + { + } + + bool empty() const + { + return m_vector.empty(); + } + + size_type size() const + { + return m_vector.size(); + } + + value_type top() const + { + return m_vector.back(); + } + + void push(const T &value) + { + m_vector.push_back(value); + } + + void pop() + { + m_vector.pop_back(); + } + +private: + container_type m_vector; +}; + +} // end compute namespace +} // end boost namespace + +#endif // BOOST_COMPUTE_CONTAINER_STACK_HPP diff --git a/3party/boost/boost/compute/container/string.hpp b/3party/boost/boost/compute/container/string.hpp new file mode 100644 index 0000000000..a721ab5746 --- /dev/null +++ b/3party/boost/boost/compute/container/string.hpp @@ -0,0 +1,25 @@ +//---------------------------------------------------------------------------// +// Copyright (c) 2013 Kyle Lutz +// +// 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 +// +// See http://boostorg.github.com/compute for more information. +//---------------------------------------------------------------------------// + +#ifndef BOOST_COMPUTE_CONTAINER_STRING_HPP +#define BOOST_COMPUTE_CONTAINER_STRING_HPP + +#include +#include + +namespace boost { +namespace compute { + +typedef basic_string string; + +} // end compute namespace +} // end boost namespace + +#endif // BOOST_COMPUTE_CONTAINER_STRING_HPP diff --git a/3party/boost/boost/compute/container/valarray.hpp b/3party/boost/boost/compute/container/valarray.hpp new file mode 100644 index 0000000000..8ac8e01753 --- /dev/null +++ b/3party/boost/boost/compute/container/valarray.hpp @@ -0,0 +1,499 @@ +//---------------------------------------------------------------------------// +// Copyright (c) 2013 Kyle Lutz +// +// 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 +// +// See http://boostorg.github.com/compute for more information. +//---------------------------------------------------------------------------// + +#ifndef BOOST_COMPUTE_CONTAINER_VALARRAY_HPP +#define BOOST_COMPUTE_CONTAINER_VALARRAY_HPP + +#include +#include + +#include +#include + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +namespace boost { +namespace compute { + +template +class valarray +{ +public: + explicit valarray(const context &context = system::default_context()) + : m_buffer(context, 0) + { + } + + explicit valarray(size_t size, + const context &context = system::default_context()) + : m_buffer(context, size * sizeof(T)) + { + } + + valarray(const T &value, + size_t size, + const context &context = system::default_context()) + : m_buffer(context, size * sizeof(T)) + { + fill(begin(), end(), value); + } + + valarray(const T *values, + size_t size, + const context &context = system::default_context()) + : m_buffer(context, size * sizeof(T)) + { + copy(values, values + size, begin()); + } + + valarray(const valarray &other) + : m_buffer(other.m_buffer.get_context(), other.size() * sizeof(T)) + { + } + + valarray(const std::valarray &valarray, + const context &context = system::default_context()) + : m_buffer(context, valarray.size() * sizeof(T)) + { + copy(&valarray[0], &valarray[valarray.size()], begin()); + } + + valarray& operator=(const valarray &other) + { + if(this != &other){ + // change to other's OpenCL context + m_buffer = buffer(other.m_buffer.get_context(), other.size() * sizeof(T)); + copy(other.begin(), other.end(), begin()); + } + + return *this; + } + + valarray& operator=(const std::valarray &valarray) + { + m_buffer = buffer(m_buffer.get_context(), valarray.size() * sizeof(T)); + copy(&valarray[0], &valarray[valarray.size()], begin()); + + return *this; + } + + valarray& operator*=(const T&); + + valarray& operator/=(const T&); + + valarray& operator%=(const T& val); + + valarray operator+() const + { + // This operator can be used with any type. + valarray result(size()); + copy(begin(), end(), result.begin()); + return result; + } + + valarray operator-() const + { + BOOST_STATIC_ASSERT_MSG( + is_fundamental::value, + "This operator can be used with all OpenCL built-in scalar" + " and vector types" + ); + valarray result(size()); + BOOST_COMPUTE_FUNCTION(T, unary_minus, (T x), + { + return -x; + }); + transform(begin(), end(), result.begin(), unary_minus); + return result; + } + + valarray operator~() const + { + BOOST_STATIC_ASSERT_MSG( + is_fundamental::value && + !is_floating_point::type>::value, + "This operator can be used with all OpenCL built-in scalar" + " and vector types except the built-in scalar and vector float types" + ); + valarray result(size()); + BOOST_COMPUTE_FUNCTION(T, bitwise_not, (T x), + { + return ~x; + }); + transform(begin(), end(), result.begin(), bitwise_not); + return result; + } + + /// In OpenCL there cannot be memory buffer with bool type, for + /// this reason return type is valarray instead of valarray. + /// 1 means true, 0 means false. + valarray operator!() const + { + BOOST_STATIC_ASSERT_MSG( + is_fundamental::value, + "This operator can be used with all OpenCL built-in scalar" + " and vector types" + ); + valarray result(size()); + BOOST_COMPUTE_FUNCTION(char, logical_not, (T x), + { + return !x; + }); + transform(begin(), end(), &result[0], logical_not); + return result; + } + + valarray& operator+=(const T&); + + valarray& operator-=(const T&); + + valarray& operator^=(const T&); + + valarray& operator&=(const T&); + + valarray& operator|=(const T&); + + valarray& operator<<=(const T&); + + valarray& operator>>=(const T&); + + valarray& operator*=(const valarray&); + + valarray& operator/=(const valarray&); + + valarray& operator%=(const valarray&); + + valarray& operator+=(const valarray&); + + valarray& operator-=(const valarray&); + + valarray& operator^=(const valarray&); + + valarray& operator&=(const valarray&); + + valarray& operator|=(const valarray&); + + valarray& operator<<=(const valarray&); + + valarray& operator>>=(const valarray&); + + ~valarray() + { + + } + + size_t size() const + { + return m_buffer.size() / sizeof(T); + } + + void resize(size_t size, T value = T()) + { + m_buffer = buffer(m_buffer.get_context(), size * sizeof(T)); + fill(begin(), end(), value); + } + + detail::buffer_value operator[](size_t index) + { + return *(begin() + static_cast(index)); + } + + const detail::buffer_value operator[](size_t index) const + { + return *(begin() + static_cast(index)); + } + + T (min)() const + { + return *(boost::compute::min_element(begin(), end())); + } + + T (max)() const + { + return *(boost::compute::max_element(begin(), end())); + } + + T sum() const + { + return boost::compute::accumulate(begin(), end(), T(0)); + } + + template + valarray apply(UnaryFunction function) const + { + valarray result(size()); + transform(begin(), end(), result.begin(), function); + return result; + } + + const buffer& get_buffer() const + { + return m_buffer; + } + + +private: + buffer_iterator begin() const + { + return buffer_iterator(m_buffer, 0); + } + + buffer_iterator end() const + { + return buffer_iterator(m_buffer, size()); + } + +private: + buffer m_buffer; +}; + +/// \internal_ +#define BOOST_COMPUTE_DEFINE_VALARRAY_COMPOUND_ASSIGNMENT(op, op_name, assert) \ + template \ + inline valarray& \ + valarray::operator op##=(const T& val) \ + { \ + assert \ + transform(begin(), end(), begin(), \ + ::boost::compute::bind(op_name(), placeholders::_1, val)); \ + return *this; \ + } \ + \ + template \ + inline valarray& \ + valarray::operator op##=(const valarray &rhs) \ + { \ + assert \ + transform(begin(), end(), rhs.begin(), begin(), op_name()); \ + return *this; \ + } + +/// \internal_ +#define BOOST_COMPUTE_DEFINE_VALARRAY_COMPOUND_ASSIGNMENT_ANY(op, op_name) \ + BOOST_COMPUTE_DEFINE_VALARRAY_COMPOUND_ASSIGNMENT(op, op_name, \ + BOOST_STATIC_ASSERT_MSG( \ + is_fundamental::value, \ + "This operator can be used with all OpenCL built-in scalar" \ + " and vector types" \ + ); \ + ) + +/// \internal_ +/// For some operators class T can't be floating point type. +/// See OpenCL specification, operators chapter. +#define BOOST_COMPUTE_DEFINE_VALARRAY_COMPOUND_ASSIGNMENT_NO_FP(op, op_name) \ + BOOST_COMPUTE_DEFINE_VALARRAY_COMPOUND_ASSIGNMENT(op, op_name, \ + BOOST_STATIC_ASSERT_MSG( \ + is_fundamental::value && \ + !is_floating_point::type>::value, \ + "This operator can be used with all OpenCL built-in scalar" \ + " and vector types except the built-in scalar and vector float types" \ + ); \ + ) + +// defining operators +BOOST_COMPUTE_DEFINE_VALARRAY_COMPOUND_ASSIGNMENT_ANY(+, plus) +BOOST_COMPUTE_DEFINE_VALARRAY_COMPOUND_ASSIGNMENT_ANY(-, minus) +BOOST_COMPUTE_DEFINE_VALARRAY_COMPOUND_ASSIGNMENT_ANY(*, multiplies) +BOOST_COMPUTE_DEFINE_VALARRAY_COMPOUND_ASSIGNMENT_ANY(/, divides) +BOOST_COMPUTE_DEFINE_VALARRAY_COMPOUND_ASSIGNMENT_NO_FP(^, bit_xor) +BOOST_COMPUTE_DEFINE_VALARRAY_COMPOUND_ASSIGNMENT_NO_FP(&, bit_and) +BOOST_COMPUTE_DEFINE_VALARRAY_COMPOUND_ASSIGNMENT_NO_FP(|, bit_or) +BOOST_COMPUTE_DEFINE_VALARRAY_COMPOUND_ASSIGNMENT_NO_FP(<<, shift_left) +BOOST_COMPUTE_DEFINE_VALARRAY_COMPOUND_ASSIGNMENT_NO_FP(>>, shift_right) + +// The remainder (%) operates on +// integer scalar and integer vector data types only. +// See OpenCL specification. +BOOST_COMPUTE_DEFINE_VALARRAY_COMPOUND_ASSIGNMENT(%, modulus, + BOOST_STATIC_ASSERT_MSG( + is_integral::type>::value, + "This operator can be used only with OpenCL built-in integer types" + ); +) + +#undef BOOST_COMPUTE_DEFINE_VALARRAY_COMPOUND_ASSIGNMENT_ANY +#undef BOOST_COMPUTE_DEFINE_VALARRAY_COMPOUND_ASSIGNMENT_NO_FP + +#undef BOOST_COMPUTE_DEFINE_VALARRAY_COMPOUND_ASSIGNMENT + +/// \internal_ +/// Macro for defining binary operators for valarray +#define BOOST_COMPUTE_DEFINE_VALARRAY_BINARY_OPERATOR(op, op_name, assert) \ + template \ + valarray operator op (const valarray& lhs, const valarray& rhs) \ + { \ + assert \ + valarray result(lhs.size()); \ + transform(buffer_iterator(lhs.get_buffer(), 0), \ + buffer_iterator(lhs.get_buffer(), lhs.size()), \ + buffer_iterator(rhs.get_buffer(), 0), \ + buffer_iterator(result.get_buffer(), 0), \ + op_name()); \ + return result; \ + } \ + \ + template \ + valarray operator op (const T& val, const valarray& rhs) \ + { \ + assert \ + valarray result(rhs.size()); \ + transform(buffer_iterator(rhs.get_buffer(), 0), \ + buffer_iterator(rhs.get_buffer(), rhs.size()), \ + buffer_iterator(result.get_buffer(), 0), \ + ::boost::compute::bind(op_name(), val, placeholders::_1)); \ + return result; \ + } \ + \ + template \ + valarray operator op (const valarray& lhs, const T& val) \ + { \ + assert \ + valarray result(lhs.size()); \ + transform(buffer_iterator(lhs.get_buffer(), 0), \ + buffer_iterator(lhs.get_buffer(), lhs.size()), \ + buffer_iterator(result.get_buffer(), 0), \ + ::boost::compute::bind(op_name(), placeholders::_1, val)); \ + return result; \ + } + +/// \internal_ +#define BOOST_COMPUTE_DEFINE_VALARRAY_BINARY_OPERATOR_ANY(op, op_name) \ + BOOST_COMPUTE_DEFINE_VALARRAY_BINARY_OPERATOR(op, op_name, \ + BOOST_STATIC_ASSERT_MSG( \ + is_fundamental::value, \ + "This operator can be used with all OpenCL built-in scalar" \ + " and vector types" \ + ); \ + ) + +/// \internal_ +/// For some operators class T can't be floating point type. +/// See OpenCL specification, operators chapter. +#define BOOST_COMPUTE_DEFINE_VALARRAY_BINARY_OPERATOR_NO_FP(op, op_name) \ + BOOST_COMPUTE_DEFINE_VALARRAY_BINARY_OPERATOR(op, op_name, \ + BOOST_STATIC_ASSERT_MSG( \ + is_fundamental::value && \ + !is_floating_point::type>::value, \ + "This operator can be used with all OpenCL built-in scalar" \ + " and vector types except the built-in scalar and vector float types" \ + ); \ + ) + +// defining binary operators for valarray +BOOST_COMPUTE_DEFINE_VALARRAY_BINARY_OPERATOR_ANY(+, plus) +BOOST_COMPUTE_DEFINE_VALARRAY_BINARY_OPERATOR_ANY(-, minus) +BOOST_COMPUTE_DEFINE_VALARRAY_BINARY_OPERATOR_ANY(*, multiplies) +BOOST_COMPUTE_DEFINE_VALARRAY_BINARY_OPERATOR_ANY(/, divides) +BOOST_COMPUTE_DEFINE_VALARRAY_BINARY_OPERATOR_NO_FP(^, bit_xor) +BOOST_COMPUTE_DEFINE_VALARRAY_BINARY_OPERATOR_NO_FP(&, bit_and) +BOOST_COMPUTE_DEFINE_VALARRAY_BINARY_OPERATOR_NO_FP(|, bit_or) +BOOST_COMPUTE_DEFINE_VALARRAY_BINARY_OPERATOR_NO_FP(<<, shift_left) +BOOST_COMPUTE_DEFINE_VALARRAY_BINARY_OPERATOR_NO_FP(>>, shift_right) + +#undef BOOST_COMPUTE_DEFINE_VALARRAY_BINARY_OPERATOR_ANY +#undef BOOST_COMPUTE_DEFINE_VALARRAY_BINARY_OPERATOR_NO_FP + +#undef BOOST_COMPUTE_DEFINE_VALARRAY_BINARY_OPERATOR + +/// \internal_ +/// Macro for defining valarray comparison operators. +/// For return type valarray is used instead of valarray because +/// in OpenCL there cannot be memory buffer with bool type. +/// +/// Note it's also used for defining binary logical operators (==, &&) +#define BOOST_COMPUTE_DEFINE_VALARRAY_COMPARISON_OPERATOR(op, op_name) \ + template \ + valarray operator op (const valarray& lhs, const valarray& rhs) \ + { \ + BOOST_STATIC_ASSERT_MSG( \ + is_fundamental::value, \ + "This operator can be used with all OpenCL built-in scalar" \ + " and vector types" \ + ); \ + valarray result(lhs.size()); \ + transform(buffer_iterator(lhs.get_buffer(), 0), \ + buffer_iterator(lhs.get_buffer(), lhs.size()), \ + buffer_iterator(rhs.get_buffer(), 0), \ + buffer_iterator(result.get_buffer(), 0), \ + op_name()); \ + return result; \ + } \ + \ + template \ + valarray operator op (const T& val, const valarray& rhs) \ + { \ + BOOST_STATIC_ASSERT_MSG( \ + is_fundamental::value, \ + "This operator can be used with all OpenCL built-in scalar" \ + " and vector types" \ + ); \ + valarray result(rhs.size()); \ + transform(buffer_iterator(rhs.get_buffer(), 0), \ + buffer_iterator(rhs.get_buffer(), rhs.size()), \ + buffer_iterator(result.get_buffer(), 0), \ + ::boost::compute::bind(op_name(), val, placeholders::_1)); \ + return result; \ + } \ + \ + template \ + valarray operator op (const valarray& lhs, const T& val) \ + { \ + BOOST_STATIC_ASSERT_MSG( \ + is_fundamental::value, \ + "This operator can be used with all OpenCL built-in scalar" \ + " and vector types" \ + ); \ + valarray result(lhs.size()); \ + transform(buffer_iterator(lhs.get_buffer(), 0), \ + buffer_iterator(lhs.get_buffer(), lhs.size()), \ + buffer_iterator(result.get_buffer(), 0), \ + ::boost::compute::bind(op_name(), placeholders::_1, val)); \ + return result; \ + } + +BOOST_COMPUTE_DEFINE_VALARRAY_COMPARISON_OPERATOR(==, equal_to) +BOOST_COMPUTE_DEFINE_VALARRAY_COMPARISON_OPERATOR(!=, not_equal_to) +BOOST_COMPUTE_DEFINE_VALARRAY_COMPARISON_OPERATOR(>, greater) +BOOST_COMPUTE_DEFINE_VALARRAY_COMPARISON_OPERATOR(<, less) +BOOST_COMPUTE_DEFINE_VALARRAY_COMPARISON_OPERATOR(>=, greater_equal) +BOOST_COMPUTE_DEFINE_VALARRAY_COMPARISON_OPERATOR(<=, less_equal) + +/// \internal_ +/// Macro for defining binary logical operators for valarray. +/// +/// For return type valarray is used instead of valarray because +/// in OpenCL there cannot be memory buffer with bool type. +/// 1 means true, 0 means false. +#define BOOST_COMPUTE_DEFINE_VALARRAY_LOGICAL_OPERATOR(op, op_name) \ + BOOST_COMPUTE_DEFINE_VALARRAY_COMPARISON_OPERATOR(op, op_name) + +BOOST_COMPUTE_DEFINE_VALARRAY_LOGICAL_OPERATOR(&&, logical_and) +BOOST_COMPUTE_DEFINE_VALARRAY_LOGICAL_OPERATOR(||, logical_or) + +#undef BOOST_COMPUTE_DEFINE_VALARRAY_LOGICAL_OPERATOR + +#undef BOOST_COMPUTE_DEFINE_VALARRAY_COMPARISON_OPERATOR + +} // end compute namespace +} // end boost namespace + +#endif // BOOST_COMPUTE_CONTAINER_VALARRAY_HPP diff --git a/3party/boost/boost/compute/container/vector.hpp b/3party/boost/boost/compute/container/vector.hpp new file mode 100644 index 0000000000..aa0eb98ce9 --- /dev/null +++ b/3party/boost/boost/compute/container/vector.hpp @@ -0,0 +1,779 @@ +//---------------------------------------------------------------------------// +// Copyright (c) 2013 Kyle Lutz +// +// 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 +// +// See http://boostorg.github.com/compute for more information. +//---------------------------------------------------------------------------// + +#ifndef BOOST_COMPUTE_CONTAINER_VECTOR_HPP +#define BOOST_COMPUTE_CONTAINER_VECTOR_HPP + +#include +#include +#include +#include + +#include + +#include + +#ifndef BOOST_COMPUTE_NO_HDR_INITIALIZER_LIST +#include +#endif + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +namespace boost { +namespace compute { + +/// \class vector +/// \brief A resizable array of values. +/// +/// The vector class stores a dynamic array of values. Internally, the data +/// is stored in an OpenCL buffer object. +/// +/// The vector class is the prefered container for storing and accessing data +/// on a compute device. In most cases it should be used instead of directly +/// dealing with buffer objects. If the undelying buffer is needed, it can be +/// accessed with the get_buffer() method. +/// +/// The internal storage is allocated in a specific OpenCL context which is +/// passed as an argument to the constructor when the vector is created. +/// +/// For example, to create a vector on the device containing space for ten +/// \c int values: +/// \code +/// boost::compute::vector vec(10, context); +/// \endcode +/// +/// Allocation and data transfer can also be performed in a single step: +/// \code +/// // values on the host +/// int data[] = { 1, 2, 3, 4 }; +/// +/// // create a vector of size four and copy the values from data +/// boost::compute::vector vec(data, data + 4, queue); +/// \endcode +/// +/// The Boost.Compute \c vector class provides a STL-like API and is modeled +/// after the \c std::vector class from the C++ standard library. It can be +/// used with any of the STL-like algorithms provided by Boost.Compute +/// including \c copy(), \c transform(), and \c sort() (among many others). +/// +/// For example: +/// \code +/// // a vector on a compute device +/// boost::compute::vector vec = ... +/// +/// // copy data to the vector from a host std:vector +/// boost::compute::copy(host_vec.begin(), host_vec.end(), vec.begin(), queue); +/// +/// // copy data from the vector to a host std::vector +/// boost::compute::copy(vec.begin(), vec.end(), host_vec.begin(), queue); +/// +/// // sort the values in the vector +/// boost::compute::sort(vec.begin(), vec.end(), queue); +/// +/// // calculate the sum of the values in the vector (also see reduce()) +/// float sum = boost::compute::accumulate(vec.begin(), vec.end(), 0, queue); +/// +/// // reverse the values in the vector +/// boost::compute::reverse(vec.begin(), vec.end(), queue); +/// +/// // fill the vector with ones +/// boost::compute::fill(vec.begin(), vec.end(), 1, queue); +/// \endcode +/// +/// \see \ref array "array", buffer +template > +class vector +{ +public: + typedef T value_type; + typedef Alloc allocator_type; + typedef typename allocator_type::size_type size_type; + typedef typename allocator_type::difference_type difference_type; + typedef detail::buffer_value reference; + typedef const detail::buffer_value const_reference; + typedef typename allocator_type::pointer pointer; + typedef typename allocator_type::const_pointer const_pointer; + typedef buffer_iterator iterator; + typedef buffer_iterator const_iterator; + typedef std::reverse_iterator reverse_iterator; + typedef std::reverse_iterator const_reverse_iterator; + + /// Creates an empty vector in \p context. + explicit vector(const context &context = system::default_context()) + : m_size(0), + m_allocator(context) + { + m_data = m_allocator.allocate(_minimum_capacity()); + } + + /// Creates a vector with space for \p count elements in \p context. + /// + /// Note that unlike \c std::vector's constructor, this will not initialize + /// the values in the container. Either call the vector constructor which + /// takes a value to initialize with or use the fill() algorithm to set + /// the initial values. + /// + /// For example: + /// \code + /// // create a vector on the device with space for ten ints + /// boost::compute::vector vec(10, context); + /// \endcode + explicit vector(size_type count, + const context &context = system::default_context()) + : m_size(count), + m_allocator(context) + { + m_data = m_allocator.allocate((std::max)(count, _minimum_capacity())); + } + + /// Creates a vector with space for \p count elements and sets each equal + /// to \p value. + /// + /// For example: + /// \code + /// // creates a vector with four values set to nine (e.g. [9, 9, 9, 9]). + /// boost::compute::vector vec(4, 9, queue); + /// \endcode + vector(size_type count, + const T &value, + command_queue &queue = system::default_queue()) + : m_size(count), + m_allocator(queue.get_context()) + { + m_data = m_allocator.allocate((std::max)(count, _minimum_capacity())); + + ::boost::compute::fill_n(begin(), count, value, queue); + } + + /// Creates a vector with space for the values in the range [\p first, + /// \p last) and copies them into the vector with \p queue. + /// + /// For example: + /// \code + /// // values on the host + /// int data[] = { 1, 2, 3, 4 }; + /// + /// // create a vector of size four and copy the values from data + /// boost::compute::vector vec(data, data + 4, queue); + /// \endcode + template + vector(InputIterator first, + InputIterator last, + command_queue &queue = system::default_queue()) + : m_size(detail::iterator_range_size(first, last)), + m_allocator(queue.get_context()) + { + m_data = m_allocator.allocate((std::max)(m_size, _minimum_capacity())); + + ::boost::compute::copy(first, last, begin(), queue); + } + + /// Creates a new vector and copies the values from \p other. + vector(const vector &other, + command_queue &queue = system::default_queue()) + : m_size(other.m_size), + m_allocator(other.m_allocator) + { + m_data = m_allocator.allocate((std::max)(m_size, _minimum_capacity())); + + if(!other.empty()){ + if(other.get_buffer().get_context() != queue.get_context()){ + command_queue other_queue = other.default_queue(); + ::boost::compute::copy(other.begin(), other.end(), begin(), other_queue); + other_queue.finish(); + } + else { + ::boost::compute::copy(other.begin(), other.end(), begin(), queue); + queue.finish(); + } + } + } + + /// Creates a new vector and copies the values from \p other. + template + vector(const vector &other, + command_queue &queue = system::default_queue()) + : m_size(other.size()), + m_allocator(queue.get_context()) + { + m_data = m_allocator.allocate((std::max)(m_size, _minimum_capacity())); + + if(!other.empty()){ + ::boost::compute::copy(other.begin(), other.end(), begin(), queue); + queue.finish(); + } + } + + /// Creates a new vector and copies the values from \p vector. + template + vector(const std::vector &vector, + command_queue &queue = system::default_queue()) + : m_size(vector.size()), + m_allocator(queue.get_context()) + { + m_data = m_allocator.allocate((std::max)(m_size, _minimum_capacity())); + + ::boost::compute::copy(vector.begin(), vector.end(), begin(), queue); + } + + #ifndef BOOST_COMPUTE_NO_HDR_INITIALIZER_LIST + vector(std::initializer_list list, + command_queue &queue = system::default_queue()) + : m_size(list.size()), + m_allocator(queue.get_context()) + { + m_data = m_allocator.allocate((std::max)(m_size, _minimum_capacity())); + + ::boost::compute::copy(list.begin(), list.end(), begin(), queue); + } + #endif // BOOST_COMPUTE_NO_HDR_INITIALIZER_LIST + + vector& operator=(const vector &other) + { + if(this != &other){ + command_queue queue = default_queue(); + resize(other.size(), queue); + ::boost::compute::copy(other.begin(), other.end(), begin(), queue); + queue.finish(); + } + + return *this; + } + + template + vector& operator=(const vector &other) + { + command_queue queue = default_queue(); + resize(other.size(), queue); + ::boost::compute::copy(other.begin(), other.end(), begin(), queue); + queue.finish(); + + return *this; + } + + template + vector& operator=(const std::vector &vector) + { + command_queue queue = default_queue(); + resize(vector.size(), queue); + ::boost::compute::copy(vector.begin(), vector.end(), begin(), queue); + queue.finish(); + return *this; + } + + #ifndef BOOST_COMPUTE_NO_RVALUE_REFERENCES + /// Move-constructs a new vector from \p other. + vector(vector&& other) + : m_data(std::move(other.m_data)), + m_size(other.m_size), + m_allocator(std::move(other.m_allocator)) + { + other.m_size = 0; + } + + /// Move-assigns the data from \p other to \c *this. + vector& operator=(vector&& other) + { + if(m_size){ + m_allocator.deallocate(m_data, m_size); + } + + m_data = std::move(other.m_data); + m_size = other.m_size; + m_allocator = std::move(other.m_allocator); + + other.m_size = 0; + + return *this; + } + #endif // BOOST_COMPUTE_NO_RVALUE_REFERENCES + + /// Destroys the vector object. + ~vector() + { + if(m_size){ + m_allocator.deallocate(m_data, m_size); + } + } + + iterator begin() + { + return ::boost::compute::make_buffer_iterator(m_data.get_buffer(), 0); + } + + const_iterator begin() const + { + return ::boost::compute::make_buffer_iterator(m_data.get_buffer(), 0); + } + + const_iterator cbegin() const + { + return begin(); + } + + iterator end() + { + return ::boost::compute::make_buffer_iterator(m_data.get_buffer(), m_size); + } + + const_iterator end() const + { + return ::boost::compute::make_buffer_iterator(m_data.get_buffer(), m_size); + } + + const_iterator cend() const + { + return end(); + } + + reverse_iterator rbegin() + { + return reverse_iterator(end() - 1); + } + + const_reverse_iterator rbegin() const + { + return reverse_iterator(end() - 1); + } + + const_reverse_iterator crbegin() const + { + return rbegin(); + } + + reverse_iterator rend() + { + return reverse_iterator(begin() - 1); + } + + const_reverse_iterator rend() const + { + return reverse_iterator(begin() - 1); + } + + const_reverse_iterator crend() const + { + return rend(); + } + + /// Returns the number of elements in the vector. + size_type size() const + { + return m_size; + } + + size_type max_size() const + { + return m_allocator.max_size(); + } + + /// Resizes the vector to \p size. + void resize(size_type size, command_queue &queue) + { + if(size <= capacity()){ + m_size = size; + } + else { + // allocate new buffer + pointer new_data = + m_allocator.allocate( + static_cast( + static_cast(size) * _growth_factor() + ) + ); + + // copy old values to the new buffer + ::boost::compute::copy(m_data, m_data + m_size, new_data, queue); + + // free old memory + m_allocator.deallocate(m_data, m_size); + + // set new data and size + m_data = new_data; + m_size = size; + } + } + + /// \overload + void resize(size_type size) + { + command_queue queue = default_queue(); + resize(size, queue); + queue.finish(); + } + + /// Returns \c true if the vector is empty. + bool empty() const + { + return m_size == 0; + } + + /// Returns the capacity of the vector. + size_type capacity() const + { + return m_data.get_buffer().size() / sizeof(T); + } + + void reserve(size_type size, command_queue &queue) + { + (void) size; + (void) queue; + } + + void reserve(size_type size) + { + command_queue queue = default_queue(); + reserve(size, queue); + queue.finish(); + } + + void shrink_to_fit(command_queue &queue) + { + (void) queue; + } + + void shrink_to_fit() + { + command_queue queue = default_queue(); + shrink_to_fit(queue); + queue.finish(); + } + + reference operator[](size_type index) + { + return *(begin() + static_cast(index)); + } + + const_reference operator[](size_type index) const + { + return *(begin() + static_cast(index)); + } + + reference at(size_type index) + { + if(index >= size()){ + BOOST_THROW_EXCEPTION(std::out_of_range("index out of range")); + } + + return operator[](index); + } + + const_reference at(size_type index) const + { + if(index >= size()){ + BOOST_THROW_EXCEPTION(std::out_of_range("index out of range")); + } + + return operator[](index); + } + + reference front() + { + return *begin(); + } + + const_reference front() const + { + return *begin(); + } + + reference back() + { + return *(end() - static_cast(1)); + } + + const_reference back() const + { + return *(end() - static_cast(1)); + } + + template + void assign(InputIterator first, + InputIterator last, + command_queue &queue) + { + // resize vector for new contents + resize(detail::iterator_range_size(first, last), queue); + + // copy values into the vector + ::boost::compute::copy(first, last, begin(), queue); + } + + template + void assign(InputIterator first, InputIterator last) + { + command_queue queue = default_queue(); + assign(first, last, queue); + queue.finish(); + } + + void assign(size_type n, const T &value, command_queue &queue) + { + // resize vector for new contents + resize(n, queue); + + // fill vector with value + ::boost::compute::fill_n(begin(), n, value, queue); + } + + void assign(size_type n, const T &value) + { + command_queue queue = default_queue(); + assign(n, value, queue); + queue.finish(); + } + + /// Inserts \p value at the end of the vector (resizing if neccessary). + /// + /// Note that calling \c push_back() to insert data values one at a time + /// is inefficient as there is a non-trivial overhead in performing a data + /// transfer to the device. It is usually better to store a set of values + /// on the host (for example, in a \c std::vector) and then transfer them + /// in bulk using the \c insert() method or the copy() algorithm. + void push_back(const T &value, command_queue &queue) + { + insert(end(), value, queue); + } + + /// \overload + void push_back(const T &value) + { + command_queue queue = default_queue(); + push_back(value, queue); + queue.finish(); + } + + void pop_back(command_queue &queue) + { + resize(size() - 1, queue); + } + + void pop_back() + { + command_queue queue = default_queue(); + pop_back(queue); + queue.finish(); + } + + iterator insert(iterator position, const T &value, command_queue &queue) + { + if(position == end()){ + resize(m_size + 1, queue); + position = begin() + position.get_index(); + ::boost::compute::copy_n(&value, 1, position, queue); + } + else { + ::boost::compute::vector tmp(position, end(), queue); + resize(m_size + 1, queue); + position = begin() + position.get_index(); + ::boost::compute::copy_n(&value, 1, position, queue); + ::boost::compute::copy(tmp.begin(), tmp.end(), position + 1, queue); + } + + return position + 1; + } + + iterator insert(iterator position, const T &value) + { + command_queue queue = default_queue(); + iterator iter = insert(position, value, queue); + queue.finish(); + return iter; + } + + void insert(iterator position, + size_type count, + const T &value, + command_queue &queue) + { + ::boost::compute::vector tmp(position, end(), queue); + resize(size() + count, queue); + + position = begin() + position.get_index(); + + ::boost::compute::fill_n(position, count, value, queue); + ::boost::compute::copy( + tmp.begin(), + tmp.end(), + position + static_cast(count), + queue + ); + } + + void insert(iterator position, size_type count, const T &value) + { + command_queue queue = default_queue(); + insert(position, count, value, queue); + queue.finish(); + } + + /// Inserts the values in the range [\p first, \p last) into the vector at + /// \p position using \p queue. + template + void insert(iterator position, + InputIterator first, + InputIterator last, + command_queue &queue) + { + ::boost::compute::vector tmp(position, end(), queue); + + size_type count = detail::iterator_range_size(first, last); + resize(size() + count, queue); + + position = begin() + position.get_index(); + + ::boost::compute::copy(first, last, position, queue); + ::boost::compute::copy( + tmp.begin(), + tmp.end(), + position + static_cast(count), + queue + ); + } + + /// \overload + template + void insert(iterator position, InputIterator first, InputIterator last) + { + command_queue queue = default_queue(); + insert(position, first, last, queue); + queue.finish(); + } + + iterator erase(iterator position, command_queue &queue) + { + return erase(position, position + 1, queue); + } + + iterator erase(iterator position) + { + command_queue queue = default_queue(); + iterator iter = erase(position, queue); + queue.finish(); + return iter; + } + + iterator erase(iterator first, iterator last, command_queue &queue) + { + if(last != end()){ + ::boost::compute::vector tmp(last, end(), queue); + ::boost::compute::copy(tmp.begin(), tmp.end(), first, queue); + } + + difference_type count = std::distance(first, last); + resize(size() - static_cast(count), queue); + + return begin() + first.get_index() + count; + } + + iterator erase(iterator first, iterator last) + { + command_queue queue = default_queue(); + iterator iter = erase(first, last, queue); + queue.finish(); + return iter; + } + + /// Swaps the contents of \c *this with \p other. + void swap(vector &other) + { + std::swap(m_data, other.m_data); + std::swap(m_size, other.m_size); + std::swap(m_allocator, other.m_allocator); + } + + /// Removes all elements from the vector. + void clear() + { + m_size = 0; + } + + allocator_type get_allocator() const + { + return m_allocator; + } + + /// Returns the underlying buffer. + const buffer& get_buffer() const + { + return m_data.get_buffer(); + } + + /// \internal_ + /// + /// Returns a command queue usable to issue commands for the vector's + /// memory buffer. This is used when a member function is called without + /// specifying an existing command queue to use. + command_queue default_queue() const + { + const context &context = m_allocator.get_context(); + command_queue queue(context, context.get_device()); + return queue; + } + +private: + /// \internal_ + BOOST_CONSTEXPR size_type _minimum_capacity() const { return 4; } + + /// \internal_ + BOOST_CONSTEXPR float _growth_factor() const { return 1.5; } + +private: + pointer m_data; + size_type m_size; + allocator_type m_allocator; +}; + +namespace detail { + +// set_kernel_arg specialization for vector +template +struct set_kernel_arg > +{ + void operator()(kernel &kernel_, size_t index, const vector &vector) + { + kernel_.set_arg(index, vector.get_buffer()); + } +}; + +// for capturing vector with BOOST_COMPUTE_CLOSURE() +template +struct capture_traits > +{ + static std::string type_name() + { + return std::string("__global ") + ::boost::compute::type_name() + "*"; + } +}; + +// meta_kernel streaming operator for vector +template +meta_kernel& operator<<(meta_kernel &k, const vector &vector) +{ + return k << k.get_buffer_identifier(vector.get_buffer()); +} + +} // end detail namespace +} // end compute namespace +} // end boost namespace + +#endif // BOOST_COMPUTE_CONTAINER_VECTOR_HPP diff --git a/3party/boost/boost/compute/context.hpp b/3party/boost/boost/compute/context.hpp new file mode 100644 index 0000000000..61e84e9767 --- /dev/null +++ b/3party/boost/boost/compute/context.hpp @@ -0,0 +1,245 @@ +//---------------------------------------------------------------------------// +// Copyright (c) 2013 Kyle Lutz +// +// 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 +// +// See http://boostorg.github.com/compute for more information. +//---------------------------------------------------------------------------// + +#ifndef BOOST_COMPUTE_CONTEXT_HPP +#define BOOST_COMPUTE_CONTEXT_HPP + +#include + +#include + +#include +#include +#include +#include + +namespace boost { +namespace compute { + +/// \class context +/// \brief A compute context. +/// +/// The context class represents a compute context. +/// +/// A context object manages a set of OpenCL resources including memory +/// buffers and program objects. Before allocating memory on the device or +/// executing kernels you must set up a context object. +/// +/// To create a context for the default device on the system: +/// \code +/// // get the default compute device +/// boost::compute::device gpu = boost::compute::system::default_device(); +/// +/// // create a context for the device +/// boost::compute::context context(gpu); +/// \endcode +/// +/// Once a context is created, memory can be allocated using the buffer class +/// and kernels can be executed using the command_queue class. +/// +/// \see device, command_queue +class context +{ +public: + /// Create a null context object. + context() + : m_context(0) + { + } + + /// Creates a new context for \p device with \p properties. + /// + /// \see_opencl_ref{clCreateContext} + explicit context(const device &device, + const cl_context_properties *properties = 0) + { + BOOST_ASSERT(device.id() != 0); + + cl_device_id device_id = device.id(); + + cl_int error = 0; + m_context = clCreateContext(properties, 1, &device_id, 0, 0, &error); + + if(!m_context){ + BOOST_THROW_EXCEPTION(opencl_error(error)); + } + } + + /// Creates a new context for \p devices with \p properties. + /// + /// \see_opencl_ref{clCreateContext} + explicit context(const std::vector &devices, + const cl_context_properties *properties = 0) + { + BOOST_ASSERT(!devices.empty()); + + cl_int error = 0; + + m_context = clCreateContext( + properties, + static_cast(devices.size()), + reinterpret_cast(&devices[0]), + 0, + 0, + &error + ); + + if(!m_context){ + BOOST_THROW_EXCEPTION(opencl_error(error)); + } + } + + /// Creates a new context object for \p context. If \p retain is + /// \c true, the reference count for \p context will be incremented. + explicit context(cl_context context, bool retain = true) + : m_context(context) + { + if(m_context && retain){ + clRetainContext(m_context); + } + } + + /// Creates a new context object as a copy of \p other. + context(const context &other) + : m_context(other.m_context) + { + if(m_context){ + clRetainContext(m_context); + } + } + + /// Copies the context object from \p other to \c *this. + context& operator=(const context &other) + { + if(this != &other){ + if(m_context){ + clReleaseContext(m_context); + } + + m_context = other.m_context; + + if(m_context){ + clRetainContext(m_context); + } + } + + return *this; + } + + #ifndef BOOST_COMPUTE_NO_RVALUE_REFERENCES + /// Move-constructs a new context object from \p other. + context(context&& other) BOOST_NOEXCEPT + : m_context(other.m_context) + { + other.m_context = 0; + } + + /// Move-assigns the context from \p other to \c *this. + context& operator=(context&& other) BOOST_NOEXCEPT + { + if(m_context){ + clReleaseContext(m_context); + } + + m_context = other.m_context; + other.m_context = 0; + + return *this; + } + #endif // BOOST_COMPUTE_NO_RVALUE_REFERENCES + + /// Destroys the context object. + ~context() + { + if(m_context){ + BOOST_COMPUTE_ASSERT_CL_SUCCESS( + clReleaseContext(m_context) + ); + } + } + + /// Returns the underlying OpenCL context. + cl_context& get() const + { + return const_cast(m_context); + } + + /// Returns the device for the context. If the context contains multiple + /// devices, the first is returned. + device get_device() const + { + std::vector devices = get_devices(); + + if(devices.empty()) { + return device(); + } + + return devices.front(); + } + + /// Returns a vector of devices for the context. + std::vector get_devices() const + { + return get_info >(CL_CONTEXT_DEVICES); + } + + /// Returns information about the context. + /// + /// \see_opencl_ref{clGetContextInfo} + template + T get_info(cl_context_info info) const + { + return detail::get_object_info(clGetContextInfo, m_context, info); + } + + /// \overload + template + typename detail::get_object_info_type::type + get_info() const; + + /// Returns \c true if the context is the same as \p other. + bool operator==(const context &other) const + { + return m_context == other.m_context; + } + + /// Returns \c true if the context is different from \p other. + bool operator!=(const context &other) const + { + return m_context != other.m_context; + } + + /// \internal_ + operator cl_context() const + { + return m_context; + } + +private: + cl_context m_context; +}; + +/// \internal_ define get_info() specializations for context +BOOST_COMPUTE_DETAIL_DEFINE_GET_INFO_SPECIALIZATIONS(context, + ((cl_uint, CL_CONTEXT_REFERENCE_COUNT)) + ((std::vector, CL_CONTEXT_DEVICES)) + ((std::vector, CL_CONTEXT_PROPERTIES)) +) + +#ifdef CL_VERSION_1_1 +BOOST_COMPUTE_DETAIL_DEFINE_GET_INFO_SPECIALIZATIONS(context, + ((cl_uint, CL_CONTEXT_NUM_DEVICES)) +) +#endif // CL_VERSION_1_1 + +} // end compute namespace +} // end boost namespace + +#endif // BOOST_COMPUTE_CONTEXT_HPP diff --git a/3party/boost/boost/compute/core.hpp b/3party/boost/boost/compute/core.hpp new file mode 100644 index 0000000000..a8e2eb92a6 --- /dev/null +++ b/3party/boost/boost/compute/core.hpp @@ -0,0 +1,32 @@ +//---------------------------------------------------------------------------// +// Copyright (c) 2013-2014 Kyle Lutz +// +// 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 +// +// See http://boostorg.github.com/compute for more information. +//---------------------------------------------------------------------------// + +#ifndef BOOST_COMPUTE_CORE_HPP +#define BOOST_COMPUTE_CORE_HPP + +/// \file +/// +/// Meta-header to include all Boost.Compute core headers. + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +#endif // BOOST_COMPUTE_CORE_HPP diff --git a/3party/boost/boost/compute/detail/assert_cl_success.hpp b/3party/boost/boost/compute/detail/assert_cl_success.hpp new file mode 100644 index 0000000000..78acaf6caf --- /dev/null +++ b/3party/boost/boost/compute/detail/assert_cl_success.hpp @@ -0,0 +1,24 @@ +//---------------------------------------------------------------------------// +// Copyright (c) 2013 Kyle Lutz +// +// 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 +// +// See http://boostorg.github.com/compute for more information. +//---------------------------------------------------------------------------// + +#ifndef BOOST_COMPUTE_DETAIL_ASSERT_CL_SUCCESS_HPP +#define BOOST_COMPUTE_DETAIL_ASSERT_CL_SUCCESS_HPP + +#include + +#if defined(BOOST_DISABLE_ASSERTS) || defined(NDEBUG) +#define BOOST_COMPUTE_ASSERT_CL_SUCCESS(function) \ + function +#else +#define BOOST_COMPUTE_ASSERT_CL_SUCCESS(function) \ + BOOST_ASSERT(function == CL_SUCCESS) +#endif + +#endif // BOOST_COMPUTE_DETAIL_ASSERT_CL_SUCCESS_HPP diff --git a/3party/boost/boost/compute/detail/buffer_value.hpp b/3party/boost/boost/compute/detail/buffer_value.hpp new file mode 100644 index 0000000000..6a4e78fc19 --- /dev/null +++ b/3party/boost/boost/compute/detail/buffer_value.hpp @@ -0,0 +1,178 @@ +//---------------------------------------------------------------------------// +// Copyright (c) 2013 Kyle Lutz +// +// 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 +// +// See http://boostorg.github.com/compute for more information. +//---------------------------------------------------------------------------// + +#ifndef BOOST_COMPUTE_DETAIL_BUFFER_VALUE_HPP +#define BOOST_COMPUTE_DETAIL_BUFFER_VALUE_HPP + +#include +#include +#include +#include + +namespace boost { +namespace compute { +namespace detail { + +template +class buffer_value +{ +public: + typedef T value_type; + + buffer_value() + { + } + + buffer_value(const value_type &value) + : m_value(value) + { + } + + // creates a reference for the value in buffer at index (in bytes). + buffer_value(const buffer &buffer, size_t index) + : m_buffer(buffer.get(), false), + m_index(index) + { + } + + buffer_value(const buffer_value &other) + : m_buffer(other.m_buffer.get(), false), + m_index(other.m_index) + { + } + + ~buffer_value() + { + // set buffer to null so that its reference count will + // not be decremented when its destructor is called + m_buffer.get() = 0; + } + + operator value_type() const + { + if(m_buffer.get()){ + const context &context = m_buffer.get_context(); + const device &device = context.get_device(); + command_queue queue(context, device); + + return detail::read_single_value(m_buffer, m_index / sizeof(T), queue); + } + else { + return m_value; + } + } + + buffer_value operator-() const + { + return -T(*this); + } + + bool operator<(const T &value) const + { + return T(*this) < value; + } + + bool operator>(const T &value) const + { + return T(*this) > value; + } + + bool operator<=(const T &value) const + { + return T(*this) <= value; + } + + bool operator>=(const T &value) const + { + return T(*this) <= value; + } + + bool operator==(const T &value) const + { + return T(*this) == value; + } + + bool operator==(const buffer_value &other) const + { + if(m_buffer.get() != other.m_buffer.get()){ + return false; + } + + if(m_buffer.get()){ + return m_index == other.m_index; + } + else { + return m_value == other.m_value; + } + } + + bool operator!=(const T &value) const + { + return T(*this) != value; + } + + buffer_value& operator=(const T &value) + { + if(m_buffer.get()){ + const context &context = m_buffer.get_context(); + command_queue queue(context, context.get_device()); + + detail::write_single_value(value, m_buffer, m_index / sizeof(T), queue); + + return *this; + } + else { + m_value = value; + return *this; + } + } + + buffer_value& operator=(const buffer_value &value) + { + return operator=(T(value)); + } + + detail::device_ptr operator&() const + { + return detail::device_ptr(m_buffer, m_index); + } + + buffer_value& operator++() + { + if(m_buffer.get()){ + T value = T(*this); + value++; + *this = value; + } + else { + m_value++; + } + + return *this; + } + + buffer_value operator++(int) + { + buffer_value result(*this); + ++(*this); + return result; + } + +private: + const buffer m_buffer; + size_t m_index; + value_type m_value; +}; + +} // end detail namespace +} // end compute namespace +} // end boost namespace + +#endif // BOOST_COMPUTE_DETAIL_BUFFER_VALUE_HPP diff --git a/3party/boost/boost/compute/detail/device_ptr.hpp b/3party/boost/boost/compute/detail/device_ptr.hpp new file mode 100644 index 0000000000..29ecd13631 --- /dev/null +++ b/3party/boost/boost/compute/detail/device_ptr.hpp @@ -0,0 +1,215 @@ +//---------------------------------------------------------------------------// +// Copyright (c) 2013 Kyle Lutz +// +// 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 +// +// See http://boostorg.github.com/compute for more information. +//---------------------------------------------------------------------------// + +#ifndef BOOST_COMPUTE_DEVICE_PTR_HPP +#define BOOST_COMPUTE_DEVICE_PTR_HPP + +#include +#include + +#include +#include +#include +#include +#include + +namespace boost { +namespace compute { +namespace detail { + +template +struct device_ptr_index_expr +{ + typedef T result_type; + + device_ptr_index_expr(const buffer &buffer, + uint_ index, + const IndexExpr &expr) + : m_buffer(buffer), + m_index(index), + m_expr(expr) + { + } + + operator T() const + { + BOOST_STATIC_ASSERT_MSG(boost::is_integral::value, + "Index expression must be integral"); + + BOOST_ASSERT(m_buffer.get()); + + const context &context = m_buffer.get_context(); + const device &device = context.get_device(); + command_queue queue(context, device); + + return detail::read_single_value(m_buffer, m_expr, queue); + } + + const buffer &m_buffer; + uint_ m_index; + IndexExpr m_expr; +}; + +template +class device_ptr +{ +public: + typedef T value_type; + typedef std::size_t size_type; + typedef std::ptrdiff_t difference_type; + typedef std::random_access_iterator_tag iterator_category; + typedef T* pointer; + typedef T& reference; + + device_ptr() + : m_index(0) + { + } + + device_ptr(const buffer &buffer, size_t index = 0) + : m_buffer(buffer.get(), false), + m_index(index) + { + } + + device_ptr(const device_ptr &other) + : m_buffer(other.m_buffer.get(), false), + m_index(other.m_index) + { + } + + device_ptr& operator=(const device_ptr &other) + { + if(this != &other){ + m_buffer.get() = other.m_buffer.get(); + m_index = other.m_index; + } + + return *this; + } + + #ifndef BOOST_COMPUTE_NO_RVALUE_REFERENCES + device_ptr(device_ptr&& other) BOOST_NOEXCEPT + : m_buffer(other.m_buffer.get(), false), + m_index(other.m_index) + { + other.m_buffer.get() = 0; + } + + device_ptr& operator=(device_ptr&& other) BOOST_NOEXCEPT + { + m_buffer.get() = other.m_buffer.get(); + m_index = other.m_index; + + other.m_buffer.get() = 0; + + return *this; + } + #endif // BOOST_COMPUTE_NO_RVALUE_REFERENCES + + ~device_ptr() + { + // set buffer to null so that its reference count will + // not be decremented when its destructor is called + m_buffer.get() = 0; + } + + size_type get_index() const + { + return m_index; + } + + const buffer& get_buffer() const + { + return m_buffer; + } + + template + device_ptr cast() const + { + return device_ptr(m_buffer, m_index); + } + + device_ptr operator+(difference_type n) const + { + return device_ptr(m_buffer, m_index + n); + } + + device_ptr operator+(const device_ptr &other) const + { + return device_ptr(m_buffer, m_index + other.m_index); + } + + device_ptr& operator+=(difference_type n) + { + m_index += static_cast(n); + return *this; + } + + difference_type operator-(const device_ptr &other) const + { + return static_cast(m_index - other.m_index); + } + + device_ptr& operator-=(difference_type n) + { + m_index -= n; + return *this; + } + + bool operator==(const device_ptr &other) const + { + return m_buffer.get() == other.m_buffer.get() && + m_index == other.m_index; + } + + bool operator!=(const device_ptr &other) const + { + return !(*this == other); + } + + template + detail::device_ptr_index_expr + operator[](const Expr &expr) const + { + BOOST_ASSERT(m_buffer.get()); + + return detail::device_ptr_index_expr(m_buffer, + uint_(m_index), + expr); + } + +private: + const buffer m_buffer; + size_t m_index; +}; + +// is_buffer_iterator specialization for device_ptr +template +struct is_buffer_iterator< + Iterator, + typename boost::enable_if< + boost::is_same< + device_ptr, + typename boost::remove_const::type + > + >::type +> : public boost::true_type {}; + +} // end detail namespace + +// is_device_iterator specialization for device_ptr +template +struct is_device_iterator > : boost::true_type {}; + +} // end compute namespace +} // end boost namespace + +#endif // BOOST_COMPUTE_DEVICE_PTR_HPP diff --git a/3party/boost/boost/compute/detail/diagnostic.hpp b/3party/boost/boost/compute/detail/diagnostic.hpp new file mode 100644 index 0000000000..76a69f6570 --- /dev/null +++ b/3party/boost/boost/compute/detail/diagnostic.hpp @@ -0,0 +1,112 @@ +//---------------------------------------------------------------------------// +// Copyright (c) 2016 Jakub Szuppe +// +// 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 +// +// See http://boostorg.github.com/compute for more information. +//---------------------------------------------------------------------------// + +#ifndef BOOST_COMPUTE_DETAIL_DIAGNOSTIC_HPP +#define BOOST_COMPUTE_DETAIL_DIAGNOSTIC_HPP + +// Macros for suppressing warnings for GCC version 4.6 or later. Usage: +// +// BOOST_COMPUTE_BOOST_COMPUTE_GCC_DIAG_OFF(sign-compare); +// if(a < b){ +// BOOST_COMPUTE_BOOST_COMPUTE_GCC_DIAG_ON(sign-compare); +// +// Source: https://svn.boost.org/trac/boost/wiki/Guidelines/WarningsGuidelines +#if ((__GNUC__ * 100) + __GNUC_MINOR__) >= 402 +#define BOOST_COMPUTE_GCC_DIAG_STR(s) #s +#define BOOST_COMPUTE_GCC_DIAG_JOINSTR(x,y) BOOST_COMPUTE_GCC_DIAG_STR(x ## y) +# define BOOST_COMPUTE_GCC_DIAG_DO_PRAGMA(x) _Pragma (#x) +# define BOOST_COMPUTE_GCC_DIAG_PRAGMA(x) BOOST_COMPUTE_GCC_DIAG_DO_PRAGMA(GCC diagnostic x) +# if ((__GNUC__ * 100) + __GNUC_MINOR__) >= 406 +# define BOOST_COMPUTE_GCC_DIAG_OFF(x) BOOST_COMPUTE_GCC_DIAG_PRAGMA(push) \ + BOOST_COMPUTE_GCC_DIAG_PRAGMA(ignored BOOST_COMPUTE_GCC_DIAG_JOINSTR(-W,x)) +# define BOOST_COMPUTE_GCC_DIAG_ON(x) BOOST_COMPUTE_GCC_DIAG_PRAGMA(pop) +# else +# define BOOST_COMPUTE_GCC_DIAG_OFF(x) \ + BOOST_COMPUTE_GCC_DIAG_PRAGMA(ignored BOOST_COMPUTE_GCC_DIAG_JOINSTR(-W,x)) +# define BOOST_COMPUTE_GCC_DIAG_ON(x) \ + BOOST_COMPUTE_GCC_DIAG_PRAGMA(warning BOOST_COMPUTE_GCC_DIAG_JOINSTR(-W,x)) +# endif +#else // Ensure these macros do nothing for other compilers. +# define BOOST_COMPUTE_GCC_DIAG_OFF(x) +# define BOOST_COMPUTE_GCC_DIAG_ON(x) +#endif + +// Macros for suppressing warnings for Clang. +// +// BOOST_COMPUTE_BOOST_COMPUTE_CLANG_DIAG_OFF(sign-compare); +// if(a < b){ +// BOOST_COMPUTE_BOOST_COMPUTE_CLANG_DIAG_ON(sign-compare); +// +// Source: https://svn.boost.org/trac/boost/wiki/Guidelines/WarningsGuidelines +#ifdef __clang__ +# define BOOST_COMPUTE_CLANG_DIAG_STR(s) # s +// stringize s to "no-sign-compare" +# define BOOST_COMPUTE_CLANG_DIAG_JOINSTR(x,y) BOOST_COMPUTE_CLANG_DIAG_STR(x ## y) +// join -W with no-unused-variable to "-Wno-sign-compare" +# define BOOST_COMPUTE_CLANG_DIAG_DO_PRAGMA(x) _Pragma (#x) +// _Pragma is unary operator #pragma ("") +# define BOOST_COMPUTE_CLANG_DIAG_PRAGMA(x) \ + BOOST_COMPUTE_CLANG_DIAG_DO_PRAGMA(clang diagnostic x) +# define BOOST_COMPUTE_CLANG_DIAG_OFF(x) BOOST_COMPUTE_CLANG_DIAG_PRAGMA(push) \ + BOOST_COMPUTE_CLANG_DIAG_PRAGMA(ignored BOOST_COMPUTE_CLANG_DIAG_JOINSTR(-W,x)) +// For example: #pragma clang diagnostic ignored "-Wno-sign-compare" +# define BOOST_COMPUTE_CLANG_DIAG_ON(x) BOOST_COMPUTE_CLANG_DIAG_PRAGMA(pop) +// For example: #pragma clang diagnostic warning "-Wno-sign-compare" +#else // Ensure these macros do nothing for other compilers. +# define BOOST_COMPUTE_CLANG_DIAG_OFF(x) +# define BOOST_COMPUTE_CLANG_DIAG_ON(x) +# define BOOST_COMPUTE_CLANG_DIAG_PRAGMA(x) +#endif + +// Macros for suppressing warnings for MSVC. Usage: +// +// BOOST_COMPUTE_BOOST_COMPUTE_MSVC_DIAG_OFF(4018); //sign-compare +// if(a < b){ +// BOOST_COMPUTE_BOOST_COMPUTE_MSVC_DIAG_ON(4018); +// +#if defined(_MSC_VER) +# define BOOST_COMPUTE_MSVC_DIAG_DO_PRAGMA(x) __pragma(x) +# define BOOST_COMPUTE_MSVC_DIAG_PRAGMA(x) \ + BOOST_COMPUTE_MSVC_DIAG_DO_PRAGMA(warning(x)) +# define BOOST_COMPUTE_MSVC_DIAG_OFF(x) BOOST_COMPUTE_MSVC_DIAG_PRAGMA(push) \ + BOOST_COMPUTE_MSVC_DIAG_PRAGMA(disable: x) +# define BOOST_COMPUTE_MSVC_DIAG_ON(x) BOOST_COMPUTE_MSVC_DIAG_PRAGMA(pop) +#else // Ensure these macros do nothing for other compilers. +# define BOOST_COMPUTE_MSVC_DIAG_OFF(x) +# define BOOST_COMPUTE_MSVC_DIAG_ON(x) +#endif + +// Macros for suppressing warnings for GCC, Clang and MSVC. Usage: +// +// BOOST_COMPUTE_DIAG_OFF(sign-compare, sign-compare, 4018); +// if(a < b){ +// BOOST_COMPUTE_DIAG_ON(sign-compare, sign-compare, 4018); +// +#if defined(_MSC_VER) // MSVC +# define BOOST_COMPUTE_DIAG_OFF(gcc, clang, msvc) BOOST_COMPUTE_MSVC_DIAG_OFF(msvc) +# define BOOST_COMPUTE_DIAG_ON(gcc, clang, msvc) BOOST_COMPUTE_MSVC_DIAG_ON(msvc) +#elif defined(__clang__) // Clang +# define BOOST_COMPUTE_DIAG_OFF(gcc, clang, msvc) BOOST_COMPUTE_CLANG_DIAG_OFF(clang) +# define BOOST_COMPUTE_DIAG_ON(gcc, clang, msvc) BOOST_COMPUTE_CLANG_DIAG_ON(clang) +#elif defined(__GNUC__) // GCC/G++ +# define BOOST_COMPUTE_DIAG_OFF(gcc, clang, msvc) BOOST_COMPUTE_GCC_DIAG_OFF(gcc) +# define BOOST_COMPUTE_DIAG_ON(gcc, clang, msvc) BOOST_COMPUTE_GCC_DIAG_ON(gcc) +#else // Ensure these macros do nothing for other compilers. +# define BOOST_COMPUTE_DIAG_OFF(gcc, clang, msvc) +# define BOOST_COMPUTE_DIAG_ON(gcc, clang, msvc) +#endif + +#define BOOST_COMPUTE_DISABLE_DEPRECATED_DECLARATIONS() \ + BOOST_COMPUTE_DIAG_OFF(deprecated-declarations, deprecated-declarations, 4996) +#define BOOST_COMPUTE_ENABLE_DEPRECATED_DECLARATIONS() \ + BOOST_COMPUTE_DIAG_ON(deprecated-declarations, deprecated-declarations, 4996); + + +#endif /* BOOST_COMPUTE_DETAIL_DIAGNOSTIC_HPP */ diff --git a/3party/boost/boost/compute/detail/duration.hpp b/3party/boost/boost/compute/detail/duration.hpp new file mode 100644 index 0000000000..601f12d291 --- /dev/null +++ b/3party/boost/boost/compute/detail/duration.hpp @@ -0,0 +1,50 @@ +//---------------------------------------------------------------------------// +// Copyright (c) 2013-2014 Kyle Lutz +// +// 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 +// +// See http://boostorg.github.com/compute for more information. +//---------------------------------------------------------------------------// + +#ifndef BOOST_COMPUTE_DETAIL_DURATION_HPP +#define BOOST_COMPUTE_DETAIL_DURATION_HPP + +#include + +#ifndef BOOST_COMPUTE_NO_HDR_CHRONO +#include +#endif + +#include + +namespace boost { +namespace compute { +namespace detail { + +#ifndef BOOST_COMPUTE_NO_HDR_CHRONO +template +inline std::chrono::duration +make_duration_from_nanoseconds(std::chrono::duration, size_t nanoseconds) +{ + return std::chrono::duration_cast >( + std::chrono::nanoseconds(nanoseconds) + ); +} +#endif // BOOST_COMPUTE_NO_HDR_CHRONO + +template +inline boost::chrono::duration +make_duration_from_nanoseconds(boost::chrono::duration, size_t nanoseconds) +{ + return boost::chrono::duration_cast >( + boost::chrono::nanoseconds(nanoseconds) + ); +} + +} // end detail namespace +} // end compute namespace +} // end boost namespace + +#endif // BOOST_COMPUTE_DETAIL_DURATION_HPP diff --git a/3party/boost/boost/compute/detail/get_object_info.hpp b/3party/boost/boost/compute/detail/get_object_info.hpp new file mode 100644 index 0000000000..cdc20cbc13 --- /dev/null +++ b/3party/boost/boost/compute/detail/get_object_info.hpp @@ -0,0 +1,216 @@ +//---------------------------------------------------------------------------// +// Copyright (c) 2013-2014 Kyle Lutz +// +// 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 +// +// See http://boostorg.github.com/compute for more information. +//---------------------------------------------------------------------------// + +#ifndef BOOST_COMPUTE_DETAIL_GET_OBJECT_INFO_HPP +#define BOOST_COMPUTE_DETAIL_GET_OBJECT_INFO_HPP + +#include +#include + +#include +#include + +#include + +#include +#include + +namespace boost { +namespace compute { +namespace detail { + +template +struct bound_info_function +{ + bound_info_function(Function function, Object object, AuxInfo aux_info) + : m_function(function), + m_object(object), + m_aux_info(aux_info) + { + } + + template + cl_int operator()(Info info, size_t size, void *value, size_t *size_ret) const + { + return m_function(m_object, m_aux_info, info, size, value, size_ret); + } + + Function m_function; + Object m_object; + AuxInfo m_aux_info; +}; + +template +struct bound_info_function +{ + bound_info_function(Function function, Object object) + : m_function(function), + m_object(object) + { + } + + template + cl_int operator()(Info info, size_t size, void *value, size_t *size_ret) const + { + return m_function(m_object, info, size, value, size_ret); + } + + Function m_function; + Object m_object; +}; + +template +inline bound_info_function +bind_info_function(Function f, Object o) +{ + return bound_info_function(f, o); +} + +template +inline bound_info_function +bind_info_function(Function f, Object o, AuxInfo j) +{ + return bound_info_function(f, o, j); +} + +// default implementation +template +struct get_object_info_impl +{ + template + T operator()(Function function, Info info) const + { + T value; + + cl_int ret = function(info, sizeof(T), &value, 0); + if(ret != CL_SUCCESS){ + BOOST_THROW_EXCEPTION(opencl_error(ret)); + } + + return value; + } +}; + +// specialization for bool +template<> +struct get_object_info_impl +{ + template + bool operator()(Function function, Info info) const + { + cl_bool value; + + cl_int ret = function(info, sizeof(cl_bool), &value, 0); + if(ret != CL_SUCCESS){ + BOOST_THROW_EXCEPTION(opencl_error(ret)); + } + + return value == CL_TRUE; + } +}; + +// specialization for std::string +template<> +struct get_object_info_impl +{ + template + std::string operator()(Function function, Info info) const + { + size_t size = 0; + + cl_int ret = function(info, 0, 0, &size); + if(ret != CL_SUCCESS){ + BOOST_THROW_EXCEPTION(opencl_error(ret)); + } + + if(size == 0){ + return std::string(); + } + + std::string value(size - 1, 0); + + ret = function(info, size, &value[0], 0); + if(ret != CL_SUCCESS){ + BOOST_THROW_EXCEPTION(opencl_error(ret)); + } + + return value; + } +}; + +// specialization for std::vector +template +struct get_object_info_impl > +{ + template + std::vector operator()(Function function, Info info) const + { + size_t size = 0; + + cl_int ret = function(info, 0, 0, &size); + if(ret != CL_SUCCESS){ + BOOST_THROW_EXCEPTION(opencl_error(ret)); + } + + std::vector vector(size / sizeof(T)); + ret = function(info, size, &vector[0], 0); + if(ret != CL_SUCCESS){ + BOOST_THROW_EXCEPTION(opencl_error(ret)); + } + + return vector; + } +}; + +// returns the value (of type T) from the given clGet*Info() function call. +template +inline T get_object_info(Function f, Object o, Info i) +{ + return get_object_info_impl()(bind_info_function(f, o), i); +} + +template +inline T get_object_info(Function f, Object o, Info i, AuxInfo j) +{ + return get_object_info_impl()(bind_info_function(f, o, j), i); +} + +// returns the value type for the clGet*Info() call on Object with Enum. +template +struct get_object_info_type; + +// defines the object::get_info() specialization +#define BOOST_COMPUTE_DETAIL_DEFINE_GET_INFO_SPECIALIZATION(object_type, result_type, value) \ + namespace detail { \ + template<> struct get_object_info_type { typedef result_type type; }; \ + } \ + template<> inline result_type object_type::get_info() const \ + { \ + return get_info(value); \ + } + +// used by BOOST_COMPUTE_DETAIL_DEFINE_GET_INFO_SPECIALIZATIONS() +#define BOOST_COMPUTE_DETAIL_DEFINE_GET_INFO_IMPL(r, data, elem) \ + BOOST_COMPUTE_DETAIL_DEFINE_GET_INFO_SPECIALIZATION( \ + data, BOOST_PP_TUPLE_ELEM(2, 0, elem), BOOST_PP_TUPLE_ELEM(2, 1, elem) \ + ) + +// defines the object::get_info() specialization for each +// (result_type, value) tuple in seq for object_type. +#define BOOST_COMPUTE_DETAIL_DEFINE_GET_INFO_SPECIALIZATIONS(object_type, seq) \ + BOOST_PP_SEQ_FOR_EACH( \ + BOOST_COMPUTE_DETAIL_DEFINE_GET_INFO_IMPL, object_type, seq \ + ) + +} // end detail namespace +} // end compute namespace +} // end boost namespace + +#endif // BOOST_COMPUTE_DETAIL_GET_OBJECT_INFO_HPP diff --git a/3party/boost/boost/compute/detail/getenv.hpp b/3party/boost/boost/compute/detail/getenv.hpp new file mode 100644 index 0000000000..ceb3605d5a --- /dev/null +++ b/3party/boost/boost/compute/detail/getenv.hpp @@ -0,0 +1,36 @@ +//---------------------------------------------------------------------------// +// Copyright (c) 2013-2014 Kyle Lutz +// +// 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 +// +// See http://boostorg.github.com/compute for more information. +//---------------------------------------------------------------------------// + +#ifndef BOOST_COMPUTE_DETAIL_GETENV_HPP +#define BOOST_COMPUTE_DETAIL_GETENV_HPP + +#include + +namespace boost { +namespace compute { +namespace detail { + +inline const char* getenv(const char *env_var) +{ +#ifdef _MSC_VER +# pragma warning(push) +# pragma warning(disable: 4996) +#endif + return std::getenv(env_var); +#ifdef _MSC_VER +# pragma warning(pop) +#endif +} + +} // end detail namespace +} // end compute namespace +} // end boost namespace + +#endif // BOOST_COMPUTE_DETAIL_GETENV_HPP diff --git a/3party/boost/boost/compute/detail/global_static.hpp b/3party/boost/boost/compute/detail/global_static.hpp new file mode 100644 index 0000000000..d8014e4252 --- /dev/null +++ b/3party/boost/boost/compute/detail/global_static.hpp @@ -0,0 +1,37 @@ +//---------------------------------------------------------------------------// +// Copyright (c) 2013-2014 Kyle Lutz +// +// 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 +// +// See http://boostorg.github.com/compute for more information. +//---------------------------------------------------------------------------// + +#ifndef BOOST_COMPUTE_DETAIL_GLOBAL_STATIC_HPP +#define BOOST_COMPUTE_DETAIL_GLOBAL_STATIC_HPP + +#include + +#ifdef BOOST_COMPUTE_THREAD_SAFE +# ifdef BOOST_COMPUTE_HAVE_THREAD_LOCAL + // use c++11 thread local storage +# define BOOST_COMPUTE_DETAIL_GLOBAL_STATIC(type, name, ctor) \ + thread_local type name ctor; +# else + // use thread_specific_ptr from boost.thread +# include +# define BOOST_COMPUTE_DETAIL_GLOBAL_STATIC(type, name, ctor) \ + static ::boost::thread_specific_ptr< type > BOOST_PP_CAT(name, _tls_ptr_); \ + if(!BOOST_PP_CAT(name, _tls_ptr_).get()){ \ + BOOST_PP_CAT(name, _tls_ptr_).reset(new type ctor); \ + } \ + static type &name = *BOOST_PP_CAT(name, _tls_ptr_); +# endif +#else + // no thread-safety, just use static +# define BOOST_COMPUTE_DETAIL_GLOBAL_STATIC(type, name, ctor) \ + static type name ctor; +#endif + +#endif // BOOST_COMPUTE_DETAIL_GLOBAL_STATIC_HPP diff --git a/3party/boost/boost/compute/detail/is_buffer_iterator.hpp b/3party/boost/boost/compute/detail/is_buffer_iterator.hpp new file mode 100644 index 0000000000..c0caa050d6 --- /dev/null +++ b/3party/boost/boost/compute/detail/is_buffer_iterator.hpp @@ -0,0 +1,30 @@ +//---------------------------------------------------------------------------// +// Copyright (c) 2013 Kyle Lutz +// +// 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 +// +// See http://boostorg.github.com/compute for more information. +//---------------------------------------------------------------------------// + +#ifndef BOOST_COMPUTE_DETAIL_IS_BUFFER_ITERATOR_HPP +#define BOOST_COMPUTE_DETAIL_IS_BUFFER_ITERATOR_HPP + +#include +#include +#include + +namespace boost { +namespace compute { +namespace detail { + +// default = false +template +struct is_buffer_iterator : public boost::false_type {}; + +} // end detail namespace +} // end compute namespace +} // end boost namespace + +#endif // BOOST_COMPUTE_DETAIL_IS_BUFFER_ITERATOR_HPP diff --git a/3party/boost/boost/compute/detail/is_contiguous_iterator.hpp b/3party/boost/boost/compute/detail/is_contiguous_iterator.hpp new file mode 100644 index 0000000000..d0889b2f9e --- /dev/null +++ b/3party/boost/boost/compute/detail/is_contiguous_iterator.hpp @@ -0,0 +1,118 @@ +//---------------------------------------------------------------------------// +// Copyright (c) 2013 Kyle Lutz +// +// 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 +// +// See http://boostorg.github.com/compute for more information. +//---------------------------------------------------------------------------// + +#ifndef BOOST_COMPUTE_DETAIL_IS_CONTIGUOUS_ITERATOR_HPP +#define BOOST_COMPUTE_DETAIL_IS_CONTIGUOUS_ITERATOR_HPP + +#include +#include + +#include +#include +#include + +namespace boost { +namespace compute { +namespace detail { + +// default = false +template +struct _is_contiguous_iterator : public boost::false_type {}; + +// std::vector::iterator = true +template +struct _is_contiguous_iterator< + Iterator, + typename boost::enable_if< + typename boost::is_same< + Iterator, + typename std::vector::iterator + >::type + >::type +> : public boost::true_type {}; + +// std::vector::const_iterator = true +template +struct _is_contiguous_iterator< + Iterator, + typename boost::enable_if< + typename boost::is_same< + Iterator, + typename std::vector::const_iterator + >::type + >::type +> : public boost::true_type {}; + +// std::valarray::iterator = true +template +struct _is_contiguous_iterator< + Iterator, + typename boost::enable_if< + typename boost::is_same< + Iterator, + typename std::valarray::iterator + >::type + >::type +> : public boost::true_type {}; + +// std::valarray::const_iterator = true +template +struct _is_contiguous_iterator< + Iterator, + typename boost::enable_if< + typename boost::is_same< + Iterator, + typename std::valarray::const_iterator + >::type + >::type +> : public boost::true_type {}; + +// T* = true +template +struct _is_contiguous_iterator< + Iterator, + typename boost::enable_if< + boost::is_pointer + >::type +> : public boost::true_type {}; + +// the is_contiguous_iterator meta-function returns true if Iterator points +// to a range of contiguous values. examples of contiguous iterators are +// std::vector<>::iterator and float*. examples of non-contiguous iterators +// are std::set<>::iterator and std::insert_iterator<>. +// +// the implementation consists of two phases. the first checks that value_type +// for the iterator is not void. this must be done as for many containers void +// is not a valid value_type (ex. std::vector::iterator is not valid). +// after ensuring a non-void value_type, the _is_contiguous_iterator function +// is invoked. it has specializations retuning true for all (known) contiguous +// iterators types and a default value of false. +template +struct is_contiguous_iterator : + public _is_contiguous_iterator< + typename boost::remove_cv::type + > {}; + +// value_type of void = false +template +struct is_contiguous_iterator< + Iterator, + typename boost::enable_if< + typename boost::is_void< + typename Iterator::value_type + >::type + >::type +> : public boost::false_type {}; + +} // end detail namespace +} // end compute namespace +} // end boost namespace + +#endif // BOOST_COMPUTE_DETAIL_IS_CONTIGUOUS_ITERATOR_HPP diff --git a/3party/boost/boost/compute/detail/iterator_plus_distance.hpp b/3party/boost/boost/compute/detail/iterator_plus_distance.hpp new file mode 100644 index 0000000000..26e95f16c0 --- /dev/null +++ b/3party/boost/boost/compute/detail/iterator_plus_distance.hpp @@ -0,0 +1,53 @@ +//---------------------------------------------------------------------------// +// Copyright (c) 2013 Kyle Lutz +// +// 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 +// +// See http://boostorg.github.com/compute for more information. +//---------------------------------------------------------------------------// + +#ifndef BOOST_COMPUTE_DETAIL_ITERATOR_PLUS_DISTANCE_HPP +#define BOOST_COMPUTE_DETAIL_ITERATOR_PLUS_DISTANCE_HPP + +#include + +namespace boost { +namespace compute { +namespace detail { + +template +inline Iterator iterator_plus_distance(Iterator i, Distance n, Tag) +{ + while(n--){ i++; } + + return i; +} + +template +inline Iterator iterator_plus_distance(Iterator i, + Distance n, + std::random_access_iterator_tag) +{ + typedef typename + std::iterator_traits::difference_type difference_type; + + return i + static_cast(n); +} + +// similar to std::advance() except returns the advanced iterator and +// also works with iterators that don't define difference_type +template +inline Iterator iterator_plus_distance(Iterator i, Distance n) +{ + typedef typename std::iterator_traits::iterator_category tag; + + return iterator_plus_distance(i, n, tag()); +} + +} // end detail namespace +} // end compute namespace +} // end boost namespace + +#endif // BOOST_COMPUTE_DETAIL_ITERATOR_PLUS_DISTANCE_HPP diff --git a/3party/boost/boost/compute/detail/iterator_range_size.hpp b/3party/boost/boost/compute/detail/iterator_range_size.hpp new file mode 100644 index 0000000000..67a675f833 --- /dev/null +++ b/3party/boost/boost/compute/detail/iterator_range_size.hpp @@ -0,0 +1,44 @@ +//---------------------------------------------------------------------------// +// Copyright (c) 2013 Kyle Lutz +// +// 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 +// +// See http://boostorg.github.com/compute for more information. +//---------------------------------------------------------------------------// + +#ifndef BOOST_COMPUTE_DETAIL_ITERATOR_RANGE_SIZE_H +#define BOOST_COMPUTE_DETAIL_ITERATOR_RANGE_SIZE_H + +#include +#include +#include + +namespace boost { +namespace compute { +namespace detail { + +// This is a convenience function which returns the size of a range +// bounded by two iterators. This function has two differences from +// the std::distance() function: 1) the return type (size_t) is +// unsigned, and 2) the return value is always positive. +template +inline size_t iterator_range_size(Iterator first, Iterator last) +{ + typedef typename + std::iterator_traits::difference_type + difference_type; + + difference_type difference = std::distance(first, last); + + return static_cast( + (std::max)(difference, static_cast(0)) + ); +} + +} // end detail namespace +} // end compute namespace +} // end boost namespace + +#endif // BOOST_COMPUTE_DETAIL_ITERATOR_RANGE_SIZE_H diff --git a/3party/boost/boost/compute/detail/iterator_traits.hpp b/3party/boost/boost/compute/detail/iterator_traits.hpp new file mode 100644 index 0000000000..45f0f683e6 --- /dev/null +++ b/3party/boost/boost/compute/detail/iterator_traits.hpp @@ -0,0 +1,35 @@ +//---------------------------------------------------------------------------// +// Copyright (c) 2013 Kyle Lutz +// +// 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 +// +// See http://boostorg.github.com/compute for more information. +//---------------------------------------------------------------------------// + +#ifndef BOOST_COMPUTE_DETAIL_ITERATOR_TRAITS_HPP +#define BOOST_COMPUTE_DETAIL_ITERATOR_TRAITS_HPP + +#include + +#include +#include + +namespace boost { +namespace compute { +namespace detail { + +template +struct iterator_traits : public std::iterator_traits +{ + static const bool is_contiguous = is_contiguous_iterator::value; + static const bool is_on_device = is_device_iterator::value; + static const bool is_on_host = !is_on_device; +}; + +} // end detail namespace +} // end compute namespace +} // end boost namespace + +#endif // BOOST_COMPUTE_ITERATOR_TRAITS_HPP diff --git a/3party/boost/boost/compute/detail/literal.hpp b/3party/boost/boost/compute/detail/literal.hpp new file mode 100644 index 0000000000..874830ee49 --- /dev/null +++ b/3party/boost/boost/compute/detail/literal.hpp @@ -0,0 +1,53 @@ +//---------------------------------------------------------------------------// +// Copyright (c) 2013-2014 Kyle Lutz +// +// 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 +// +// See http://boostorg.github.com/compute for more information. +//---------------------------------------------------------------------------// + +#ifndef BOOST_COMPUTE_DETAIL_LITERAL_HPP +#define BOOST_COMPUTE_DETAIL_LITERAL_HPP + +#include +#include +#include + +#include + +#include + +namespace boost { +namespace compute { +namespace detail { + +template +std::string make_literal(T x) +{ + std::stringstream s; + s << std::setprecision( +#ifndef BOOST_NO_CXX11_NUMERIC_LIMITS + std::numeric_limits::max_digits10 +#else + // We don't have max_digits10, so add 3 other digits (this is what is required for + // float, and is one more than required for double). + 3 + std::numeric_limits::digits10 +#endif + ) + << std::scientific + << x; + + if(boost::is_same::value || boost::is_same::value){ + s << "f"; + } + + return s.str(); +} + +} // end detail namespace +} // end compute namespace +} // end boost namespace + +#endif // BOOST_COMPUTE_DETAIL_LITERAL_HPP diff --git a/3party/boost/boost/compute/detail/lru_cache.hpp b/3party/boost/boost/compute/detail/lru_cache.hpp new file mode 100644 index 0000000000..fe1a56f74b --- /dev/null +++ b/3party/boost/boost/compute/detail/lru_cache.hpp @@ -0,0 +1,139 @@ +//---------------------------------------------------------------------------// +// Copyright (c) 2013 Kyle Lutz +// +// 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 +// +// See http://boostorg.github.com/compute for more information. +//---------------------------------------------------------------------------// + +#ifndef BOOST_COMPUTE_DETAIL_LRU_CACHE_HPP +#define BOOST_COMPUTE_DETAIL_LRU_CACHE_HPP + +#include +#include +#include + +#include + +namespace boost { +namespace compute { +namespace detail { + +// a cache which evicts the least recently used item when it is full +template +class lru_cache +{ +public: + typedef Key key_type; + typedef Value value_type; + typedef std::list list_type; + typedef std::map< + key_type, + std::pair + > map_type; + + lru_cache(size_t capacity) + : m_capacity(capacity) + { + } + + ~lru_cache() + { + } + + size_t size() const + { + return m_map.size(); + } + + size_t capacity() const + { + return m_capacity; + } + + bool empty() const + { + return m_map.empty(); + } + + bool contains(const key_type &key) + { + return m_map.find(key) != m_map.end(); + } + + void insert(const key_type &key, const value_type &value) + { + typename map_type::iterator i = m_map.find(key); + if(i == m_map.end()){ + // insert item into the cache, but first check if it is full + if(size() >= m_capacity){ + // cache is full, evict the least recently used item + evict(); + } + + // insert the new item + m_list.push_front(key); + m_map[key] = std::make_pair(value, m_list.begin()); + } + } + + boost::optional get(const key_type &key) + { + // lookup value in the cache + typename map_type::iterator i = m_map.find(key); + if(i == m_map.end()){ + // value not in cache + return boost::none; + } + + // return the value, but first update its place in the most + // recently used list + typename list_type::iterator j = i->second.second; + if(j != m_list.begin()){ + // move item to the front of the most recently used list + m_list.erase(j); + m_list.push_front(key); + + // update iterator in map + j = m_list.begin(); + const value_type &value = i->second.first; + m_map[key] = std::make_pair(value, j); + + // return the value + return value; + } + else { + // the item is already at the front of the most recently + // used list so just return it + return i->second.first; + } + } + + void clear() + { + m_map.clear(); + m_list.clear(); + } + +private: + void evict() + { + // evict item from the end of most recently used list + typename list_type::iterator i = --m_list.end(); + m_map.erase(*i); + m_list.erase(i); + } + +private: + map_type m_map; + list_type m_list; + size_t m_capacity; +}; + +} // end detail namespace +} // end compute namespace +} // end boost namespace + +#endif // BOOST_COMPUTE_DETAIL_LRU_CACHE_HPP diff --git a/3party/boost/boost/compute/detail/meta_kernel.hpp b/3party/boost/boost/compute/detail/meta_kernel.hpp new file mode 100644 index 0000000000..5e6d6e0337 --- /dev/null +++ b/3party/boost/boost/compute/detail/meta_kernel.hpp @@ -0,0 +1,1141 @@ +//---------------------------------------------------------------------------// +// Copyright (c) 2013 Kyle Lutz +// +// 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 +// +// See http://boostorg.github.com/compute for more information. +//---------------------------------------------------------------------------// + +#ifndef BOOST_COMPUTE_DETAIL_META_KERNEL_HPP +#define BOOST_COMPUTE_DETAIL_META_KERNEL_HPP + +#include +#include +#include +#include +#include +#include + +#include +#include +#include +#include +#include +#include + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +namespace boost { +namespace compute { +namespace detail { + +template +class meta_kernel_variable +{ +public: + typedef T result_type; + + meta_kernel_variable(const std::string &name) + : m_name(name) + { + } + + meta_kernel_variable(const meta_kernel_variable &other) + : m_name(other.m_name) + { + } + + meta_kernel_variable& operator=(const meta_kernel_variable &other) + { + if(this != &other){ + m_name = other.m_name; + } + + return *this; + } + + ~meta_kernel_variable() + { + } + + std::string name() const + { + return m_name; + } + +private: + std::string m_name; +}; + +template +class meta_kernel_literal +{ +public: + typedef T result_type; + + meta_kernel_literal(const T &value) + : m_value(value) + { + } + + meta_kernel_literal(const meta_kernel_literal &other) + : m_value(other.m_value) + { + } + + meta_kernel_literal& operator=(const meta_kernel_literal &other) + { + if(this != &other){ + m_value = other.m_value; + } + + return *this; + } + + ~meta_kernel_literal() + { + } + + const T& value() const + { + return m_value; + } + +private: + T m_value; +}; + +struct meta_kernel_stored_arg +{ + meta_kernel_stored_arg() + : m_size(0), + m_value(0) + { + } + + meta_kernel_stored_arg(const meta_kernel_stored_arg &other) + : m_size(0), + m_value(0) + { + set_value(other.m_size, other.m_value); + } + + meta_kernel_stored_arg& operator=(const meta_kernel_stored_arg &other) + { + if(this != &other){ + set_value(other.m_size, other.m_value); + } + + return *this; + } + + template + meta_kernel_stored_arg(const T &value) + : m_size(0), + m_value(0) + { + set_value(value); + } + + ~meta_kernel_stored_arg() + { + if(m_value){ + std::free(m_value); + } + } + + void set_value(size_t size, const void *value) + { + if(m_value){ + std::free(m_value); + } + + m_size = size; + + if(value){ + m_value = std::malloc(size); + std::memcpy(m_value, value, size); + } + else { + m_value = 0; + } + } + + template + void set_value(const T &value) + { + set_value(sizeof(T), boost::addressof(value)); + } + + size_t m_size; + void *m_value; +}; + +struct meta_kernel_buffer_info +{ + meta_kernel_buffer_info(const buffer &buffer, + const std::string &id, + memory_object::address_space addr_space, + size_t i) + : m_mem(buffer.get()), + identifier(id), + address_space(addr_space), + index(i) + { + } + + cl_mem m_mem; + std::string identifier; + memory_object::address_space address_space; + size_t index; +}; + +struct meta_kernel_svm_info +{ + template + meta_kernel_svm_info(const svm_ptr ptr, + const std::string &id, + memory_object::address_space addr_space, + size_t i) + : ptr(ptr.get()), + identifier(id), + address_space(addr_space), + index(i) + { + + } + + void* ptr; + std::string identifier; + memory_object::address_space address_space; + size_t index; +}; + + +class meta_kernel; + +template +struct inject_type_impl +{ + void operator()(meta_kernel &) + { + // default implementation does nothing + } +}; + +#define BOOST_COMPUTE_META_KERNEL_DECLARE_SCALAR_TYPE_STREAM_OPERATOR(type) \ + meta_kernel& operator<<(const type &x) \ + { \ + m_source << x; \ + return *this; \ + } + +#define BOOST_COMPUTE_META_KERNEL_DECLARE_VECTOR_TYPE_STREAM_OPERATOR(type) \ + meta_kernel& operator<<(const type &x) \ + { \ + m_source << "(" << type_name() << ")"; \ + m_source << "("; \ + for(size_t i = 0; i < vector_size::value; i++){ \ + *this << lit(x[i]); \ + \ + if(i != vector_size::value - 1){ \ + m_source << ","; \ + } \ + } \ + m_source << ")"; \ + return *this; \ + } + +#define BOOST_COMPUTE_META_KERNEL_DECLARE_TYPE_STREAM_OPERATORS(type) \ + BOOST_COMPUTE_META_KERNEL_DECLARE_SCALAR_TYPE_STREAM_OPERATOR(BOOST_PP_CAT(type, _)) \ + BOOST_COMPUTE_META_KERNEL_DECLARE_VECTOR_TYPE_STREAM_OPERATOR(BOOST_PP_CAT(BOOST_PP_CAT(type, 2), _)) \ + BOOST_COMPUTE_META_KERNEL_DECLARE_VECTOR_TYPE_STREAM_OPERATOR(BOOST_PP_CAT(BOOST_PP_CAT(type, 4), _)) \ + BOOST_COMPUTE_META_KERNEL_DECLARE_VECTOR_TYPE_STREAM_OPERATOR(BOOST_PP_CAT(BOOST_PP_CAT(type, 8), _)) \ + BOOST_COMPUTE_META_KERNEL_DECLARE_VECTOR_TYPE_STREAM_OPERATOR(BOOST_PP_CAT(BOOST_PP_CAT(type, 16), _)) + +class meta_kernel +{ +public: + template + class argument + { + public: + argument(const std::string &name, size_t index) + : m_name(name), + m_index(index) + { + } + + const std::string &name() const + { + return m_name; + } + + size_t index() const + { + return m_index; + } + + private: + std::string m_name; + size_t m_index; + }; + + explicit meta_kernel(const std::string &name) + : m_name(name) + { + } + + meta_kernel(const meta_kernel &other) + { + m_source.str(other.m_source.str()); + m_options = other.m_options; + } + + meta_kernel& operator=(const meta_kernel &other) + { + if(this != &other){ + m_source.str(other.m_source.str()); + m_options = other.m_options; + } + + return *this; + } + + ~meta_kernel() + { + } + + std::string name() const + { + return m_name; + } + + std::string source() const + { + std::stringstream stream; + + // add pragmas + if(!m_pragmas.empty()){ + stream << m_pragmas << "\n"; + } + + // add macros + stream << "#define boost_pair_type(t1, t2) _pair_ ## t1 ## _ ## t2 ## _t\n"; + stream << "#define boost_pair_get(x, n) (n == 0 ? x.first ## x.second)\n"; + stream << "#define boost_make_pair(t1, x, t2, y) (boost_pair_type(t1, t2)) { x, y }\n"; + stream << "#define boost_tuple_get(x, n) (x.v ## n)\n"; + + // add type declaration source + stream << m_type_declaration_source.str() << "\n"; + + // add external function source + stream << m_external_function_source.str() << "\n"; + + // add kernel source + stream << "__kernel void " << m_name + << "(" << boost::join(m_args, ", ") << ")\n" + << "{\n" << m_source.str() << "\n}\n"; + + return stream.str(); + } + + kernel compile(const context &context, const std::string &options = std::string()) + { + // generate the program source + std::string source = this->source(); + + // generate cache key + std::string cache_key = "__boost_meta_kernel_" + + static_cast(detail::sha1(source)); + + // load program cache + boost::shared_ptr cache = + program_cache::get_global_cache(context); + + std::string compile_options = m_options + options; + + // load (or build) program from cache + ::boost::compute::program program = + cache->get_or_build(cache_key, compile_options, source, context); + + // create kernel + ::boost::compute::kernel kernel = program.create_kernel(name()); + + // bind stored args + for(size_t i = 0; i < m_stored_args.size(); i++){ + const detail::meta_kernel_stored_arg &arg = m_stored_args[i]; + + if(arg.m_size != 0){ + kernel.set_arg(i, arg.m_size, arg.m_value); + } + } + + // bind buffer args + for(size_t i = 0; i < m_stored_buffers.size(); i++){ + const detail::meta_kernel_buffer_info &bi = m_stored_buffers[i]; + + kernel.set_arg(bi.index, bi.m_mem); + } + + // bind svm args + for(size_t i = 0; i < m_stored_svm_ptrs.size(); i++){ + const detail::meta_kernel_svm_info &spi = m_stored_svm_ptrs[i]; + + kernel.set_arg_svm_ptr(spi.index, spi.ptr); + } + + return kernel; + } + + template + size_t add_arg(const std::string &name) + { + std::stringstream stream; + stream << type() << " " << name; + + // add argument to list + m_args.push_back(stream.str()); + + // return index + return m_args.size() - 1; + } + + template + size_t add_arg(memory_object::address_space address_space, + const std::string &name) + { + return add_arg_with_qualifiers(address_space_prefix(address_space), name); + } + + template + void set_arg(size_t index, const T &value) + { + if(index >= m_stored_args.size()){ + m_stored_args.resize(index + 1); + } + + m_stored_args[index] = detail::meta_kernel_stored_arg(value); + } + + void set_arg(size_t index, const memory_object &mem) + { + set_arg(index, mem.get()); + } + + void set_arg(size_t index, const image_sampler &sampler) + { + set_arg(index, cl_sampler(sampler)); + } + + template + size_t add_set_arg(const std::string &name, const T &value) + { + size_t index = add_arg(name); + set_arg(index, value); + return index; + } + + void add_extension_pragma(const std::string &extension, + const std::string &value = "enable") + { + m_pragmas += "#pragma OPENCL EXTENSION " + extension + " : " + value + "\n"; + } + + void add_extension_pragma(const std::string &extension, + const std::string &value) const + { + return const_cast(this)->add_extension_pragma(extension, value); + } + + template + std::string type() const + { + std::stringstream stream; + + // const qualifier + if(boost::is_const::value){ + stream << "const "; + } + + // volatile qualifier + if(boost::is_volatile::value){ + stream << "volatile "; + } + + // type + typedef + typename boost::remove_cv< + typename boost::remove_pointer::type + >::type Type; + stream << type_name(); + + // pointer + if(boost::is_pointer::value){ + stream << "*"; + } + + // inject type pragmas and/or definitions + inject_type(); + + return stream.str(); + } + + template + std::string decl(const std::string &name) const + { + return type() + " " + name; + } + + template + std::string decl(const std::string &name, const Expr &init) const + { + meta_kernel tmp((std::string())); + tmp << tmp.decl(name) << " = " << init; + return tmp.m_source.str(); + } + + template + detail::meta_kernel_variable var(const std::string &name) const + { + type(); + + return make_var(name); + } + + template + detail::meta_kernel_literal lit(const T &value) const + { + type(); + + return detail::meta_kernel_literal(value); + } + + template + detail::meta_kernel_variable expr(const std::string &expr) const + { + type(); + + return detail::meta_kernel_variable(expr); + } + + // define stream operators for scalar and vector types + BOOST_COMPUTE_META_KERNEL_DECLARE_TYPE_STREAM_OPERATORS(char) + BOOST_COMPUTE_META_KERNEL_DECLARE_TYPE_STREAM_OPERATORS(uchar) + BOOST_COMPUTE_META_KERNEL_DECLARE_TYPE_STREAM_OPERATORS(short) + BOOST_COMPUTE_META_KERNEL_DECLARE_TYPE_STREAM_OPERATORS(ushort) + BOOST_COMPUTE_META_KERNEL_DECLARE_TYPE_STREAM_OPERATORS(int) + BOOST_COMPUTE_META_KERNEL_DECLARE_TYPE_STREAM_OPERATORS(uint) + BOOST_COMPUTE_META_KERNEL_DECLARE_TYPE_STREAM_OPERATORS(long) + BOOST_COMPUTE_META_KERNEL_DECLARE_TYPE_STREAM_OPERATORS(ulong) + BOOST_COMPUTE_META_KERNEL_DECLARE_TYPE_STREAM_OPERATORS(double) + + // define stream operators for float scalar and vector types + meta_kernel& operator<<(const float &x) + { + m_source << std::showpoint << x << 'f'; + return *this; + } + + BOOST_COMPUTE_META_KERNEL_DECLARE_VECTOR_TYPE_STREAM_OPERATOR(float2_) + BOOST_COMPUTE_META_KERNEL_DECLARE_VECTOR_TYPE_STREAM_OPERATOR(float4_) + BOOST_COMPUTE_META_KERNEL_DECLARE_VECTOR_TYPE_STREAM_OPERATOR(float8_) + BOOST_COMPUTE_META_KERNEL_DECLARE_VECTOR_TYPE_STREAM_OPERATOR(float16_) + + // define stream operators for variable types + template + meta_kernel& operator<<(const meta_kernel_variable &variable) + { + return *this << variable.name(); + } + + // define stream operators for literal types + template + meta_kernel& operator<<(const meta_kernel_literal &literal) + { + return *this << literal.value(); + } + + meta_kernel& operator<<(const meta_kernel_literal &literal) + { + return *this << (literal.value() ? "true" : "false"); + } + + meta_kernel& operator<<(const meta_kernel_literal &literal) + { + const char c = literal.value(); + + switch(c){ + // control characters + case '\0': + return *this << "'\\0'"; + case '\a': + return *this << "'\\a'"; + case '\b': + return *this << "'\\b'"; + case '\t': + return *this << "'\\t'"; + case '\n': + return *this << "'\\n'"; + case '\v': + return *this << "'\\v'"; + case '\f': + return *this << "'\\f'"; + case '\r': + return *this << "'\\r'"; + + // characters which need escaping + case '\"': + case '\'': + case '\?': + case '\\': + return *this << "'\\" << c << "'"; + + // all other characters + default: + return *this << "'" << c << "'"; + } + } + + meta_kernel& operator<<(const meta_kernel_literal &literal) + { + return *this << lit(literal.value()); + } + + meta_kernel& operator<<(const meta_kernel_literal &literal) + { + return *this << uint_(literal.value()); + } + + // define stream operators for strings + meta_kernel& operator<<(char ch) + { + m_source << ch; + return *this; + } + + meta_kernel& operator<<(const char *string) + { + m_source << string; + return *this; + } + + meta_kernel& operator<<(const std::string &string) + { + m_source << string; + return *this; + } + + template + static detail::meta_kernel_variable make_var(const std::string &name) + { + return detail::meta_kernel_variable(name); + } + + template + static detail::meta_kernel_literal make_lit(const T &value) + { + return detail::meta_kernel_literal(value); + } + + template + static detail::meta_kernel_variable make_expr(const std::string &expr) + { + return detail::meta_kernel_variable(expr); + } + + event exec(command_queue &queue) + { + return exec_1d(queue, 0, 1); + } + + event exec_1d(command_queue &queue, + size_t global_work_offset, + size_t global_work_size) + { + const context &context = queue.get_context(); + + ::boost::compute::kernel kernel = compile(context); + + return queue.enqueue_1d_range_kernel( + kernel, + global_work_offset, + global_work_size, + 0 + ); + } + + event exec_1d(command_queue &queue, + size_t global_work_offset, + size_t global_work_size, + size_t local_work_size) + { + const context &context = queue.get_context(); + + ::boost::compute::kernel kernel = compile(context); + + return queue.enqueue_1d_range_kernel( + kernel, + global_work_offset, + global_work_size, + local_work_size + ); + } + + template + std::string get_buffer_identifier(const buffer &buffer, + const memory_object::address_space address_space = + memory_object::global_memory) + { + // check if we've already seen buffer + for(size_t i = 0; i < m_stored_buffers.size(); i++){ + const detail::meta_kernel_buffer_info &bi = m_stored_buffers[i]; + + if(bi.m_mem == buffer.get() && + bi.address_space == address_space){ + return bi.identifier; + } + } + + // create a new binding + std::string identifier = + "_buf" + lexical_cast(m_stored_buffers.size()); + size_t index = add_arg(address_space, identifier); + + // store new buffer info + m_stored_buffers.push_back( + detail::meta_kernel_buffer_info(buffer, identifier, address_space, index)); + + return identifier; + } + + template + std::string get_svm_identifier(const svm_ptr &svm_ptr, + const memory_object::address_space address_space = + memory_object::global_memory) + { + BOOST_ASSERT( + (address_space == memory_object::global_memory) + || (address_space == memory_object::constant_memory) + ); + + // check if we've already seen this pointer + for(size_t i = 0; i < m_stored_svm_ptrs.size(); i++){ + const detail::meta_kernel_svm_info &spi = m_stored_svm_ptrs[i]; + + if(spi.ptr == svm_ptr.get() && + spi.address_space == address_space){ + return spi.identifier; + } + } + + // create a new binding + std::string identifier = + "_svm_ptr" + lexical_cast(m_stored_svm_ptrs.size()); + size_t index = add_arg(address_space, identifier); + + if(m_stored_svm_ptrs.empty()) { + m_options += std::string(" -cl-std=CL2.0"); + } + + // store new svm pointer info + m_stored_svm_ptrs.push_back( + detail::meta_kernel_svm_info( + svm_ptr, identifier, address_space, index + ) + ); + + return identifier; + } + + std::string get_image_identifier(const char *qualifiers, const image2d &image) + { + size_t index = add_arg_with_qualifiers(qualifiers, "image"); + + set_arg(index, image); + + return "image"; + } + + std::string get_sampler_identifier(bool normalized_coords, + cl_addressing_mode addressing_mode, + cl_filter_mode filter_mode) + { + (void) normalized_coords; + (void) addressing_mode; + (void) filter_mode; + + m_pragmas += "const sampler_t sampler = CLK_NORMALIZED_COORDS_FALSE |\n" + " CLK_ADDRESS_NONE |\n" + " CLK_FILTER_NEAREST;\n"; + + return "sampler"; + } + + template + static std::string expr_to_string(const Expr &expr) + { + meta_kernel tmp((std::string())); + tmp << expr; + return tmp.m_source.str(); + } + + template + detail::invoked_function > if_(Predicate pred) const + { + return detail::invoked_function >( + "if", std::string(), boost::make_tuple(pred) + ); + } + + template + detail::invoked_function > else_if_(Predicate pred) const + { + return detail::invoked_function >( + "else if", std::string(), boost::make_tuple(pred) + ); + } + + detail::meta_kernel_variable get_global_id(size_t dim) const + { + return expr("get_global_id(" + lexical_cast(dim) + ")"); + } + + void add_function(const std::string &name, const std::string &source) + { + if(m_external_function_names.count(name)){ + return; + } + + m_external_function_names.insert(name); + m_external_function_source << source << "\n"; + } + + void add_function(const std::string &name, + const std::string &source, + const std::map &definitions) + { + typedef std::map::const_iterator iter; + + std::stringstream s; + + // add #define's + for(iter i = definitions.begin(); i != definitions.end(); i++){ + s << "#define " << i->first; + if(!i->second.empty()){ + s << " " << i->second; + } + s << "\n"; + } + + s << source << "\n"; + + // add #undef's + for(iter i = definitions.begin(); i != definitions.end(); i++){ + s << "#undef " << i->first << "\n"; + } + + add_function(name, s.str()); + } + + template + void add_type_declaration(const std::string &declaration) + { + const char *name = type_name(); + + // check if the type has already been declared + std::string source = m_type_declaration_source.str(); + if(source.find(name) != std::string::npos){ + return; + } + + m_type_declaration_source << declaration; + } + + template + void inject_type() const + { + inject_type_impl()(const_cast(*this)); + } + + // the insert_function_call() method inserts a call to a function with + // the given name tuple of argument values. + template + void insert_function_call(const std::string &name, const ArgTuple &args) + { + *this << name << '('; + insert_function_call_args(args); + *this << ')'; + } + + // the insert_function_call_args() method takes a tuple of argument values + // and inserts them into the source string with a comma in-between each. + // this is useful for creating function calls given a tuple of values. + void insert_function_call_args(const boost::tuple<>&) + { + } + + #define BOOST_COMPUTE_META_KERNEL_INSERT_FUNCTION_ARG_TYPE(z, n, unused) \ + inject_type(); + + #define BOOST_COMPUTE_META_KERNEL_STREAM_FUNCTION_ARG(z, n, unused) \ + << boost::get(args) << ", " + + #define BOOST_COMPUTE_META_KERNEL_INSERT_FUNCTION_ARGS(z, n, unused) \ + template \ + void insert_function_call_args( \ + const boost::tuple &args \ + ) \ + { \ + BOOST_PP_REPEAT_FROM_TO( \ + 0, n, BOOST_COMPUTE_META_KERNEL_INSERT_FUNCTION_ARG_TYPE, ~ \ + ) \ + *this \ + BOOST_PP_REPEAT_FROM_TO( \ + 1, n, BOOST_COMPUTE_META_KERNEL_STREAM_FUNCTION_ARG, ~ \ + ) \ + << boost::get(args); \ + } + + BOOST_PP_REPEAT_FROM_TO( + 1, BOOST_COMPUTE_MAX_ARITY, BOOST_COMPUTE_META_KERNEL_INSERT_FUNCTION_ARGS, ~ + ) + + #undef BOOST_COMPUTE_META_KERNEL_INSERT_FUNCTION_ARG_TYPE + #undef BOOST_COMPUTE_META_KERNEL_STREAM_FUNCTION_ARG + #undef BOOST_COMPUTE_META_KERNEL_INSERT_FUNCTION_ARGS + + static const char* address_space_prefix(const memory_object::address_space value) + { + switch(value){ + case memory_object::global_memory: return "__global"; + case memory_object::local_memory: return "__local"; + case memory_object::private_memory: return "__private"; + case memory_object::constant_memory: return "__constant"; + }; + + return 0; // unreachable + } + +private: + template + size_t add_arg_with_qualifiers(const char *qualifiers, const std::string &name) + { + size_t index = add_arg(name); + + // update argument type declaration with qualifiers + std::stringstream s; + s << qualifiers << " " << m_args[index]; + m_args[index] = s.str(); + + return index; + } + +private: + std::string m_name; + std::stringstream m_source; + std::stringstream m_external_function_source; + std::stringstream m_type_declaration_source; + std::set m_external_function_names; + std::vector m_args; + std::string m_pragmas; + std::string m_options; + std::vector m_stored_args; + std::vector m_stored_buffers; + std::vector m_stored_svm_ptrs; +}; + +template +inline meta_kernel& +operator<<(meta_kernel &kernel, const invoked_function &expr) +{ + if(!expr.source().empty()){ + kernel.add_function(expr.name(), expr.source(), expr.definitions()); + } + + kernel.insert_function_call(expr.name(), expr.args()); + + return kernel; +} + +template +inline meta_kernel& +operator<<(meta_kernel &kernel, + const invoked_closure &expr) +{ + if(!expr.source().empty()){ + kernel.add_function(expr.name(), expr.source(), expr.definitions()); + } + + kernel << expr.name() << '('; + kernel.insert_function_call_args(expr.args()); + kernel << ", "; + kernel.insert_function_call_args(expr.capture()); + kernel << ')'; + + return kernel; +} + +template +inline meta_kernel& operator<<(meta_kernel &kernel, + const invoked_binary_operator &expr) +{ + return kernel << "((" << expr.arg1() << ")" + << expr.op() + << "(" << expr.arg2() << "))"; +} + +template +inline meta_kernel& operator<<(meta_kernel &kernel, + const detail::device_ptr_index_expr &expr) +{ + if(expr.m_index == 0){ + return kernel << + kernel.get_buffer_identifier(expr.m_buffer) << + '[' << expr.m_expr << ']'; + } + else { + return kernel << + kernel.get_buffer_identifier(expr.m_buffer) << + '[' << expr.m_index << "+(" << expr.m_expr << ")]"; + } +} + +template +inline meta_kernel& operator<<(meta_kernel &kernel, + const detail::device_ptr_index_expr, IndexExpr> &expr) +{ + typedef std::pair T; + + if(expr.m_index == 0){ + return kernel << + kernel.get_buffer_identifier(expr.m_buffer) << + '[' << expr.m_expr << ']'; + } + else { + return kernel << + kernel.get_buffer_identifier(expr.m_buffer) << + '[' << expr.m_index << "+(" << expr.m_expr << ")]"; + } +} + +// SVM requires OpenCL 2.0 +#if defined(CL_VERSION_2_0) || defined(BOOST_COMPUTE_DOXYGEN_INVOKED) +template +inline meta_kernel& operator<<(meta_kernel &kernel, + const svm_ptr_index_expr &expr) +{ + return kernel << + kernel.get_svm_identifier(expr.m_svm_ptr) << + '[' << expr.m_expr << ']'; +} +#endif + +template +inline meta_kernel& operator<<(meta_kernel &kernel, + const invoked_unary_negate_function &expr) +{ + return kernel << "!(" << expr.pred()(expr.expr()) << ')'; +} + +template +inline meta_kernel& operator<<(meta_kernel &kernel, + const invoked_binary_negate_function &expr) +{ + return kernel << "!(" << expr.pred()(expr.expr1(), expr.expr2()) << ')'; +} + +// get() for vector types +template +inline meta_kernel& operator<<(meta_kernel &kernel, + const invoked_get &expr) +{ + BOOST_STATIC_ASSERT(N < 16); + + if(N < 10){ + return kernel << expr.m_arg << ".s" << uint_(N); + } + else if(N < 16){ +#ifdef _MSC_VER +# pragma warning(push) +# pragma warning(disable: 4307) +#endif + return kernel << expr.m_arg << ".s" << char('a' + (N - 10)); +#ifdef _MSC_VER +# pragma warning(pop) +#endif + } + + return kernel; +} + +template +inline meta_kernel& operator<<(meta_kernel &kernel, + const invoked_field &expr) +{ + return kernel << expr.m_arg << "." << expr.m_field; +} + +template +inline meta_kernel& operator<<(meta_kernel &k, + const invoked_as &expr) +{ + return k << "as_" << type_name() << "(" << expr.m_arg << ")"; +} + +template +inline meta_kernel& operator<<(meta_kernel &k, + const invoked_convert &expr) +{ + return k << "convert_" << type_name() << "(" << expr.m_arg << ")"; +} + +template +inline meta_kernel& operator<<(meta_kernel &k, + const invoked_identity &expr) +{ + return k << expr.m_arg; +} + +template<> +struct inject_type_impl +{ + void operator()(meta_kernel &kernel) + { + kernel.add_extension_pragma("cl_khr_fp64", "enable"); + } +}; + +template +struct inject_type_impl > +{ + void operator()(meta_kernel &kernel) + { + kernel.inject_type(); + } +}; + +} // end detail namespace +} // end compute namespace +} // end boost namespace + +#endif // BOOST_COMPUTE_DETAIL_META_KERNEL_HPP diff --git a/3party/boost/boost/compute/detail/mpl_vector_to_tuple.hpp b/3party/boost/boost/compute/detail/mpl_vector_to_tuple.hpp new file mode 100644 index 0000000000..292a6e36e1 --- /dev/null +++ b/3party/boost/boost/compute/detail/mpl_vector_to_tuple.hpp @@ -0,0 +1,65 @@ +//---------------------------------------------------------------------------// +// Copyright (c) 2013 Kyle Lutz +// +// 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 +// +// See http://boostorg.github.com/compute for more information. +//---------------------------------------------------------------------------// + +#ifndef BOOST_COMPUTE_DETAIL_MPL_VECTOR_TO_TUPLE_HPP +#define BOOST_COMPUTE_DETAIL_MPL_VECTOR_TO_TUPLE_HPP + +#include +#include +#include +#include +#include +#include + +#include + +namespace boost { +namespace compute { +namespace detail { + +namespace mpl = boost::mpl; + +template +struct mpl_vector_to_tuple_impl; + +#define BOOST_COMPUTE_PRINT_ELEM(z, n, unused) \ + typename mpl::at_c::type + +#define BOOST_COMPUTE_VEC2TUP(z, n, unused) \ +template \ +struct mpl_vector_to_tuple_impl \ +{ \ + typedef typename \ + boost::tuple< \ + BOOST_PP_ENUM(n, BOOST_COMPUTE_PRINT_ELEM, ~) \ + > type; \ +}; + +BOOST_PP_REPEAT_FROM_TO(1, BOOST_COMPUTE_MAX_ARITY, BOOST_COMPUTE_VEC2TUP, ~) + +#undef BOOST_COMPUTE_VEC2TUP +#undef BOOST_COMPUTE_PRINT_ELEM + +// meta-function which converts a mpl::vector to a boost::tuple +template +struct mpl_vector_to_tuple +{ + typedef typename + mpl_vector_to_tuple_impl< + Vector, + mpl::size::value + >::type type; +}; + +} // end detail namespace +} // end compute namespace +} // end boost namespace + +#endif // BOOST_COMPUTE_DETAIL_MPL_VECTOR_TO_TUPLE_HPP diff --git a/3party/boost/boost/compute/detail/nvidia_compute_capability.hpp b/3party/boost/boost/compute/detail/nvidia_compute_capability.hpp new file mode 100644 index 0000000000..3f859562bd --- /dev/null +++ b/3party/boost/boost/compute/detail/nvidia_compute_capability.hpp @@ -0,0 +1,60 @@ +//---------------------------------------------------------------------------// +// Copyright (c) 2013-2014 Kyle Lutz +// +// 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 +// +// See http://boostorg.github.com/compute for more information. +//---------------------------------------------------------------------------// + +#ifndef BOOST_COMPUTE_DETAIL_NVIDIA_COMPUTE_CAPABILITY_HPP +#define BOOST_COMPUTE_DETAIL_NVIDIA_COMPUTE_CAPABILITY_HPP + +#include + +#ifdef BOOST_COMPUTE_HAVE_HDR_CL_EXT + #include +#endif + +namespace boost { +namespace compute { +namespace detail { + +#ifdef CL_DEVICE_COMPUTE_CAPABILITY_MAJOR_NV + #define BOOST_COMPUTE_CL_DEVICE_COMPUTE_CAPABILITY_MAJOR_NV CL_DEVICE_COMPUTE_CAPABILITY_MAJOR_NV +#else + #define BOOST_COMPUTE_CL_DEVICE_COMPUTE_CAPABILITY_MAJOR_NV 0x4000 +#endif + +#ifdef CL_DEVICE_COMPUTE_CAPABILITY_MINOR_NV + #define BOOST_COMPUTE_CL_DEVICE_COMPUTE_CAPABILITY_MINOR_NV CL_DEVICE_COMPUTE_CAPABILITY_MINOR_NV +#else + #define BOOST_COMPUTE_CL_DEVICE_COMPUTE_CAPABILITY_MINOR_NV 0x4001 +#endif + +inline void get_nvidia_compute_capability(const device &device, int &major, int &minor) +{ + if(!device.supports_extension("cl_nv_device_attribute_query")){ + major = minor = 0; + return; + } + + major = device.get_info(BOOST_COMPUTE_CL_DEVICE_COMPUTE_CAPABILITY_MAJOR_NV); + minor = device.get_info(BOOST_COMPUTE_CL_DEVICE_COMPUTE_CAPABILITY_MINOR_NV); +} + +inline bool check_nvidia_compute_capability(const device &device, int major, int minor) +{ + int actual_major, actual_minor; + get_nvidia_compute_capability(device, actual_major, actual_minor); + + return actual_major > major || + (actual_major == major && actual_minor >= minor); +} + +} // end detail namespace +} // end compute namespace +} // end boost namespace + +#endif // BOOST_COMPUTE_DETAIL_NVIDIA_COMPUTE_CAPABILITY_HPP diff --git a/3party/boost/boost/compute/detail/parameter_cache.hpp b/3party/boost/boost/compute/detail/parameter_cache.hpp new file mode 100644 index 0000000000..0a16cd9b0e --- /dev/null +++ b/3party/boost/boost/compute/detail/parameter_cache.hpp @@ -0,0 +1,215 @@ +//---------------------------------------------------------------------------// +// Copyright (c) 2013-2015 Kyle Lutz +// +// 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 +// +// See http://boostorg.github.com/compute for more information. +//---------------------------------------------------------------------------// + +#ifndef BOOST_COMPUTE_DETAIL_PARAMETER_CACHE_HPP +#define BOOST_COMPUTE_DETAIL_PARAMETER_CACHE_HPP + +#include +#include + +#include +#include +#include + +#include +#include +#include +#include + +#ifdef BOOST_COMPUTE_USE_OFFLINE_CACHE +#include +#include +#include +#include +#endif // BOOST_COMPUTE_USE_OFFLINE_CACHE + +namespace boost { +namespace compute { +namespace detail { + +class parameter_cache : boost::noncopyable +{ +public: + parameter_cache(const device &device) + : m_dirty(false), + m_device_name(device.name()) + { + #ifdef BOOST_COMPUTE_USE_OFFLINE_CACHE + // get offline cache file name (e.g. /home/user/.boost_compute/tune/device.json) + m_file_name = make_file_name(); + + // load parameters from offline cache file (if it exists) + if(boost::filesystem::exists(m_file_name)){ + read_from_disk(); + } + #endif // BOOST_COMPUTE_USE_OFFLINE_CACHE + } + + ~parameter_cache() + { + #ifdef BOOST_COMPUTE_USE_OFFLINE_CACHE + write_to_disk(); + #endif // BOOST_COMPUTE_USE_OFFLINE_CACHE + } + + void set(const std::string &object, const std::string ¶meter, uint_ value) + { + m_cache[std::make_pair(object, parameter)] = value; + + // set the dirty flag to true. this will cause the updated parameters + // to be stored to disk. + m_dirty = true; + } + + uint_ get(const std::string &object, const std::string ¶meter, uint_ default_value) + { + std::map, uint_>::iterator + iter = m_cache.find(std::make_pair(object, parameter)); + if(iter != m_cache.end()){ + return iter->second; + } + else { + return default_value; + } + } + + static boost::shared_ptr get_global_cache(const device &device) + { + // device name -> parameter cache + typedef std::map > cache_map; + + BOOST_COMPUTE_DETAIL_GLOBAL_STATIC(cache_map, caches, ((std::less()))); + + cache_map::iterator iter = caches.find(device.name()); + if(iter == caches.end()){ + boost::shared_ptr cache = + boost::make_shared(device); + + caches.insert(iter, std::make_pair(device.name(), cache)); + + return cache; + } + else { + return iter->second; + } + } + +private: +#ifdef BOOST_COMPUTE_USE_OFFLINE_CACHE + // returns a string containing a cannoical device name + static std::string cannonical_device_name(std::string name) + { + boost::algorithm::trim(name); + std::replace(name.begin(), name.end(), ' ', '_'); + std::replace(name.begin(), name.end(), '(', '_'); + std::replace(name.begin(), name.end(), ')', '_'); + return name; + } + + // returns the boost.compute version string + static std::string version_string() + { + char buf[32]; + std::snprintf(buf, sizeof(buf), "%d.%d.%d", BOOST_COMPUTE_VERSION_MAJOR, + BOOST_COMPUTE_VERSION_MINOR, + BOOST_COMPUTE_VERSION_PATCH); + return buf; + } + + // returns the file path for the cached parameters + std::string make_file_name() const + { + return detail::parameter_cache_path(true) + cannonical_device_name(m_device_name) + ".json"; + } + + // store current parameters to disk + void write_to_disk() + { + BOOST_ASSERT(!m_file_name.empty()); + + if(m_dirty){ + // save current parameters to disk + boost::property_tree::ptree pt; + pt.put("header.device", m_device_name); + pt.put("header.version", version_string()); + typedef std::map, uint_> map_type; + for(map_type::const_iterator iter = m_cache.begin(); iter != m_cache.end(); ++iter){ + const std::pair &key = iter->first; + pt.add(key.first + "." + key.second, iter->second); + } + write_json(m_file_name, pt); + + m_dirty = false; + } + } + + // load stored parameters from disk + void read_from_disk() + { + BOOST_ASSERT(!m_file_name.empty()); + + m_cache.clear(); + + boost::property_tree::ptree pt; + try { + read_json(m_file_name, pt); + } + catch(boost::property_tree::json_parser::json_parser_error&){ + // no saved cache file, ignore + return; + } + + std::string stored_device; + try { + stored_device = pt.get("header.device"); + } + catch(boost::property_tree::ptree_bad_path&){ + return; + } + + std::string stored_version; + try { + stored_version = pt.get("header.version"); + } + catch(boost::property_tree::ptree_bad_path&){ + return; + } + + if(stored_device == m_device_name && stored_version == version_string()){ + typedef boost::property_tree::ptree::const_iterator pt_iter; + for(pt_iter iter = pt.begin(); iter != pt.end(); ++iter){ + if(iter->first == "header"){ + // skip header + continue; + } + + boost::property_tree::ptree child_pt = pt.get_child(iter->first); + for(pt_iter child_iter = child_pt.begin(); child_iter != child_pt.end(); ++child_iter){ + set(iter->first, child_iter->first, boost::lexical_cast(child_iter->second.data())); + } + } + } + + m_dirty = false; + } +#endif // BOOST_COMPUTE_USE_OFFLINE_CACHE + +private: + bool m_dirty; + std::string m_device_name; + std::string m_file_name; + std::map, uint_> m_cache; +}; + +} // end detail namespace +} // end compute namespace +} // end boost namespace + +#endif // BOOST_COMPUTE_DETAIL_PARAMETER_CACHE_HPP diff --git a/3party/boost/boost/compute/detail/path.hpp b/3party/boost/boost/compute/detail/path.hpp new file mode 100644 index 0000000000..ec8760eaf9 --- /dev/null +++ b/3party/boost/boost/compute/detail/path.hpp @@ -0,0 +1,73 @@ +//---------------------------------------------------------------------------// +// Copyright (c) 2013-2014 Kyle Lutz +// +// 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 +// +// See http://boostorg.github.com/compute for more information. +//---------------------------------------------------------------------------// + +#ifndef BOOST_COMPUTE_DETAIL_PATH_HPP +#define BOOST_COMPUTE_DETAIL_PATH_HPP + +#include +#include +#include + +namespace boost { +namespace compute { +namespace detail { + +// Path delimiter symbol for the current OS. +static const std::string& path_delim() +{ + static const std::string delim = + boost::filesystem::path("/").make_preferred().string(); + return delim; +} + +// Path to appdata folder. +inline const std::string& appdata_path() +{ + #ifdef WIN32 + static const std::string appdata = detail::getenv("APPDATA") + + path_delim() + "boost_compute"; + #else + static const std::string appdata = detail::getenv("HOME") + + path_delim() + ".boost_compute"; + #endif + return appdata; +} + +// Path to cached binaries. +inline std::string program_binary_path(const std::string &hash, bool create = false) +{ + std::string dir = detail::appdata_path() + path_delim() + + hash.substr(0, 2) + path_delim() + + hash.substr(2); + + if(create && !boost::filesystem::exists(dir)){ + boost::filesystem::create_directories(dir); + } + + return dir + path_delim(); +} + +// Path to parameter caches. +inline std::string parameter_cache_path(bool create = false) +{ + const static std::string dir = appdata_path() + path_delim() + "tune"; + + if(create && !boost::filesystem::exists(dir)){ + boost::filesystem::create_directories(dir); + } + + return dir + path_delim(); +} + +} // end detail namespace +} // end compute namespace +} // end boost namespace + +#endif // BOOST_COMPUTE_DETAIL_PATH_HPP diff --git a/3party/boost/boost/compute/detail/print_range.hpp b/3party/boost/boost/compute/detail/print_range.hpp new file mode 100644 index 0000000000..bfe02f6828 --- /dev/null +++ b/3party/boost/boost/compute/detail/print_range.hpp @@ -0,0 +1,82 @@ +//---------------------------------------------------------------------------// +// Copyright (c) 2013 Kyle Lutz +// +// 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 +// +// See http://boostorg.github.com/compute for more information. +//---------------------------------------------------------------------------// + +#ifndef BOOST_COMPUTE_DETAIL_PRINT_RANGE_HPP +#define BOOST_COMPUTE_DETAIL_PRINT_RANGE_HPP + +#include +#include +#include + +#include +#include +#include +#include + +namespace boost { +namespace compute { +namespace detail { + +template +inline void print_range(InputIterator first, + InputIterator last, + command_queue &queue, + typename boost::enable_if< + is_buffer_iterator + >::type* = 0) +{ + typedef typename + std::iterator_traits::value_type + value_type; + + const size_t size = iterator_range_size(first, last); + + // copy values to temporary vector on the host + std::vector tmp(size); + ::boost::compute::copy(first, last, tmp.begin(), queue); + + // print values + std::cout << "[ "; + for(size_t i = 0; i < size; i++){ + std::cout << tmp[i]; + if(i != size - 1){ + std::cout << ", "; + } + } + std::cout << " ]" << std::endl; +} + +template +inline void print_range(InputIterator first, + InputIterator last, + command_queue &queue, + typename boost::enable_if_c< + !is_buffer_iterator::value + >::type* = 0) +{ + typedef typename + std::iterator_traits::value_type + value_type; + + const context &context = queue.get_context(); + const size_t size = iterator_range_size(first, last); + + // copy values to temporary vector on the device + ::boost::compute::vector tmp(size, context); + ::boost::compute::copy(first, last, tmp.begin(), queue); + + print_range(tmp.begin(), tmp.end(), queue); +} + +} // end detail namespace +} // end compute namespace +} // end boost namespace + +#endif // BOOST_COMPUTE_DETAIL_PRINT_RANGE_HPP diff --git a/3party/boost/boost/compute/detail/read_write_single_value.hpp b/3party/boost/boost/compute/detail/read_write_single_value.hpp new file mode 100644 index 0000000000..fde40d946c --- /dev/null +++ b/3party/boost/boost/compute/detail/read_write_single_value.hpp @@ -0,0 +1,77 @@ +//---------------------------------------------------------------------------// +// Copyright (c) 2013 Kyle Lutz +// +// 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 +// +// See http://boostorg.github.com/compute for more information. +//---------------------------------------------------------------------------// + +#ifndef BOOST_COMPUTE_DETAIL_READ_WRITE_SINGLE_VALUE_HPP +#define BOOST_COMPUTE_DETAIL_READ_WRITE_SINGLE_VALUE_HPP + +#include + +#include +#include +#include + +namespace boost { +namespace compute { +namespace detail { + +// reads and returns a single value at index in the buffer +template +inline T read_single_value(const buffer &buffer, + size_t index, + command_queue &queue) +{ + BOOST_ASSERT(index < buffer.size() / sizeof(T)); + BOOST_ASSERT(buffer.get_context() == queue.get_context()); + + T value; + queue.enqueue_read_buffer(buffer, + sizeof(T) * index, + sizeof(T), + &value); + return value; +} + +// reads and returns a the first value in the buffer +template +inline T read_single_value(const buffer &buffer, command_queue &queue) +{ + return read_single_value(buffer, 0, queue); +} + +// writes a single value at index to the buffer +template +inline void write_single_value(const T &value, + const buffer &buffer, + size_t index, + command_queue &queue) +{ + BOOST_ASSERT(index < buffer.size() / sizeof(T)); + BOOST_ASSERT(buffer.get_context() == queue.get_context()); + + queue.enqueue_write_buffer(buffer, + index * sizeof(T), + sizeof(T), + &value); +} + +// writes value to the first location in buffer +template +inline void write_single_value(const T &value, + const buffer &buffer, + command_queue &queue) +{ + write_single_value(value, buffer, 0, queue); +} + +} // end detail namespace +} // end compute namespace +} // end boost namespace + +#endif // BOOST_COMPUTE_DETAIL_READ_WRITE_SINGLE_VALUE_HPP diff --git a/3party/boost/boost/compute/detail/sha1.hpp b/3party/boost/boost/compute/detail/sha1.hpp new file mode 100644 index 0000000000..5685fa4407 --- /dev/null +++ b/3party/boost/boost/compute/detail/sha1.hpp @@ -0,0 +1,53 @@ +//---------------------------------------------------------------------------// +// Copyright (c) 2013-2014 Kyle Lutz +// +// 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 +// +// See http://boostorg.github.com/compute for more information. +//---------------------------------------------------------------------------// + +#ifndef BOOST_COMPUTE_DETAIL_SHA1_HPP +#define BOOST_COMPUTE_DETAIL_SHA1_HPP + +#include +#include +#include + +namespace boost { +namespace compute { +namespace detail { + +// Accumulates SHA1 hash of the passed strings. +class sha1 { + public: + sha1(const std::string &s = "") { + if (!s.empty()) this->process(s); + } + + sha1& process(const std::string &s) { + h.process_bytes(s.c_str(), s.size()); + return *this; + } + + operator std::string() { + unsigned int digest[5]; + h.get_digest(digest); + + std::ostringstream buf; + for(int i = 0; i < 5; ++i) + buf << std::hex << std::setfill('0') << std::setw(8) << digest[i]; + + return buf.str(); + } + private: + boost::uuids::detail::sha1 h; +}; + +} // end detail namespace +} // end compute namespace +} // end boost namespace + + +#endif // BOOST_COMPUTE_DETAIL_SHA1_HPP diff --git a/3party/boost/boost/compute/detail/variadic_macros.hpp b/3party/boost/boost/compute/detail/variadic_macros.hpp new file mode 100644 index 0000000000..60f44bd1a8 --- /dev/null +++ b/3party/boost/boost/compute/detail/variadic_macros.hpp @@ -0,0 +1,35 @@ +//---------------------------------------------------------------------------// +// Copyright (c) 2013-2014 Kyle Lutz +// +// 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 +// +// See http://boostorg.github.com/compute for more information. +//---------------------------------------------------------------------------// + +#ifndef BOOST_COMPUTE_DETAIL_VARIDAIC_MACROS_HPP +#define BOOST_COMPUTE_DETAIL_VARIDAIC_MACROS_HPP + +#include +#include +#include + +#if BOOST_PP_VARIADICS == 1 +# include +#endif + +#ifdef BOOST_PP_VARIADIC_SIZE +# define BOOST_COMPUTE_PP_VARIADIC_SIZE BOOST_PP_VARIADIC_SIZE +#else +# define BOOST_COMPUTE_PP_VARIADIC_SIZE(...) BOOST_COMPUTE_PP_VARIADIC_SIZE_I(__VA_ARGS__, 64, 63, 62, 61, 60, 59, 58, 57, 56, 55, 54, 53, 52, 51, 50, 49, 48, 47, 46, 45, 44, 43, 42, 41, 40, 39, 38, 37, 36, 35, 34, 33, 32, 31, 30, 29, 28, 27, 26, 25, 24, 23, 22, 21, 20, 19, 18, 17, 16, 15, 14, 13, 12, 11, 10, 9, 8, 7, 6, 5, 4, 3, 2, 1,) +# define BOOST_COMPUTE_PP_VARIADIC_SIZE_I(e0, e1, e2, e3, e4, e5, e6, e7, e8, e9, e10, e11, e12, e13, e14, e15, e16, e17, e18, e19, e20, e21, e22, e23, e24, e25, e26, e27, e28, e29, e30, e31, e32, e33, e34, e35, e36, e37, e38, e39, e40, e41, e42, e43, e44, e45, e46, e47, e48, e49, e50, e51, e52, e53, e54, e55, e56, e57, e58, e59, e60, e61, e62, e63, size, ...) size +#endif + +#define BOOST_COMPUTE_PP_TUPLE_SIZE(tuple) \ + BOOST_COMPUTE_PP_VARIADIC_SIZE tuple + +#define BOOST_COMPUTE_PP_TUPLE_TO_SEQ(tuple) \ + BOOST_PP_TUPLE_TO_SEQ(BOOST_COMPUTE_PP_TUPLE_SIZE(tuple), tuple) + +#endif // BOOST_COMPUTE_DETAIL_VARIDAIC_MACROS_HPP diff --git a/3party/boost/boost/compute/detail/vendor.hpp b/3party/boost/boost/compute/detail/vendor.hpp new file mode 100644 index 0000000000..e2359cb466 --- /dev/null +++ b/3party/boost/boost/compute/detail/vendor.hpp @@ -0,0 +1,50 @@ +//---------------------------------------------------------------------------// +// Copyright (c) 2013-2014 Kyle Lutz +// +// 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 +// +// See http://boostorg.github.com/compute for more information. +//---------------------------------------------------------------------------// + +#ifndef BOOST_COMPUTE_DETAIL_VENDOR_HPP +#define BOOST_COMPUTE_DETAIL_VENDOR_HPP + +#include +#include + +namespace boost { +namespace compute { +namespace detail { + +// returns true if the device is an nvidia gpu +inline bool is_nvidia_device(const device &device) +{ + std::string nvidia("NVIDIA"); + return device.vendor().compare(0, nvidia.size(), nvidia) == 0; +} + +// returns true if the device is an amd cpu or gpu +inline bool is_amd_device(const device &device) +{ + return device.platform().vendor() == "Advanced Micro Devices, Inc."; +} + +// returns true if the platform is Apple OpenCL platform +inline bool is_apple_platform(const platform &platform) +{ + return platform.name() == "Apple"; +} + +// returns true if the device is from Apple OpenCL Platform +inline bool is_apple_platform_device(const device &device) +{ + return is_apple_platform(device.platform()); +} + +} // end detail namespace +} // end compute namespace +} // end boost namespace + +#endif // BOOST_COMPUTE_DETAIL_VENDOR_HPP diff --git a/3party/boost/boost/compute/detail/work_size.hpp b/3party/boost/boost/compute/detail/work_size.hpp new file mode 100644 index 0000000000..552d797b8b --- /dev/null +++ b/3party/boost/boost/compute/detail/work_size.hpp @@ -0,0 +1,37 @@ +//---------------------------------------------------------------------------// +// Copyright (c) 2013-2014 Kyle Lutz +// +// 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 +// +// See http://boostorg.github.com/compute for more information. +//---------------------------------------------------------------------------// + +#ifndef BOOST_COMPUTE_DETAIL_WORK_SIZE_HPP +#define BOOST_COMPUTE_DETAIL_WORK_SIZE_HPP + +#include + +namespace boost { +namespace compute { +namespace detail { + +// Given a total number of values (count), a number of values to +// process per thread (vtp), and a number of threads to execute per +// block (tpb), this function returns the global work size to be +// passed to clEnqueueNDRangeKernel() for a 1D algorithm. +inline size_t calculate_work_size(size_t count, size_t vpt, size_t tpb) +{ + size_t work_size = static_cast(std::ceil(float(count) / vpt)); + if(work_size % tpb != 0){ + work_size += tpb - work_size % tpb; + } + return work_size; +} + +} // end detail namespace +} // end compute namespace +} // end boost namespace + +#endif // BOOST_COMPUTE_DETAIL_WORK_SIZE_HPP diff --git a/3party/boost/boost/compute/device.hpp b/3party/boost/boost/compute/device.hpp new file mode 100644 index 0000000000..5cf2e8c931 --- /dev/null +++ b/3party/boost/boost/compute/device.hpp @@ -0,0 +1,584 @@ +//---------------------------------------------------------------------------// +// Copyright (c) 2013 Kyle Lutz +// +// 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 +// +// See http://boostorg.github.com/compute for more information. +//---------------------------------------------------------------------------// + +#ifndef BOOST_COMPUTE_DEVICE_HPP +#define BOOST_COMPUTE_DEVICE_HPP + +#include +#include +#include + +#include +#include + +#include +#include +#include +#include +#include + +namespace boost { +namespace compute { + +class platform; + +/// \class device +/// \brief A compute device. +/// +/// Typical compute devices include GPUs and multi-core CPUs. A list +/// of all compute devices available on a platform can be obtained +/// via the platform::devices() method. +/// +/// The default compute device for the system can be obtained with +/// the system::default_device() method. For example: +/// +/// \snippet test/test_device.cpp default_gpu +/// +/// \see platform, context, command_queue +class device +{ +public: + enum type { + cpu = CL_DEVICE_TYPE_CPU, + gpu = CL_DEVICE_TYPE_GPU, + accelerator = CL_DEVICE_TYPE_ACCELERATOR + }; + + /// Creates a null device object. + device() + : m_id(0) + { + } + + /// Creates a new device object for \p id. If \p retain is \c true, + /// the reference count for the device will be incremented. + explicit device(cl_device_id id, bool retain = true) + : m_id(id) + { + #ifdef CL_VERSION_1_2 + if(m_id && retain && is_subdevice()){ + clRetainDevice(m_id); + } + #else + (void) retain; + #endif + } + + /// Creates a new device object as a copy of \p other. + device(const device &other) + : m_id(other.m_id) + { + #ifdef CL_VERSION_1_2 + if(m_id && is_subdevice()){ + clRetainDevice(m_id); + } + #endif + } + + /// Copies the device from \p other to \c *this. + device& operator=(const device &other) + { + if(this != &other){ + #ifdef CL_VERSION_1_2 + if(m_id && is_subdevice()){ + clReleaseDevice(m_id); + } + #endif + + m_id = other.m_id; + + #ifdef CL_VERSION_1_2 + if(m_id && is_subdevice()){ + clRetainDevice(m_id); + } + #endif + } + + return *this; + } + + #ifndef BOOST_COMPUTE_NO_RVALUE_REFERENCES + /// Move-constructs a new device object from \p other. + device(device&& other) BOOST_NOEXCEPT + : m_id(other.m_id) + { + other.m_id = 0; + } + + /// Move-assigns the device from \p other to \c *this. + device& operator=(device&& other) BOOST_NOEXCEPT + { + #ifdef CL_VERSION_1_2 + if(m_id && is_subdevice()){ + clReleaseDevice(m_id); + } + #endif + + m_id = other.m_id; + other.m_id = 0; + + return *this; + } + #endif // BOOST_COMPUTE_NO_RVALUE_REFERENCES + + /// Destroys the device object. + ~device() + { + #ifdef CL_VERSION_1_2 + if(m_id && is_subdevice()){ + BOOST_COMPUTE_ASSERT_CL_SUCCESS( + clReleaseDevice(m_id) + ); + } + #endif + } + + /// Returns the ID of the device. + cl_device_id id() const + { + return m_id; + } + + /// Returns a reference to the underlying OpenCL device id. + cl_device_id& get() const + { + return const_cast(m_id); + } + + /// Returns the type of the device. + cl_device_type type() const + { + return get_info(CL_DEVICE_TYPE); + } + + #ifdef BOOST_COMPUTE_DOXYGEN_INVOKED + /// Returns the platform for the device. + platform platform() const; + #else + boost::compute::platform platform() const; + #endif + + /// Returns the name of the device. + std::string name() const + { + return get_info(CL_DEVICE_NAME); + } + + /// Returns the name of the vendor for the device. + std::string vendor() const + { + return get_info(CL_DEVICE_VENDOR); + } + + /// Returns the device profile string. + std::string profile() const + { + return get_info(CL_DEVICE_PROFILE); + } + + /// Returns the device version string. + std::string version() const + { + return get_info(CL_DEVICE_VERSION); + } + + /// Returns the driver version string. + std::string driver_version() const + { + return get_info(CL_DRIVER_VERSION); + } + + /// Returns a list of extensions supported by the device. + std::vector extensions() const + { + std::string extensions_string = + get_info(CL_DEVICE_EXTENSIONS); + std::vector extensions_vector; + boost::split(extensions_vector, + extensions_string, + boost::is_any_of("\t "), + boost::token_compress_on); + return extensions_vector; + } + + /// Returns \c true if the device supports the extension with + /// \p name. + bool supports_extension(const std::string &name) const + { + const std::vector extensions = this->extensions(); + + return std::find( + extensions.begin(), extensions.end(), name) != extensions.end(); + } + + /// Returns the number of address bits. + uint_ address_bits() const + { + return get_info(CL_DEVICE_ADDRESS_BITS); + } + + /// Returns the global memory size in bytes. + ulong_ global_memory_size() const + { + return get_info(CL_DEVICE_GLOBAL_MEM_SIZE); + } + + /// Returns the local memory size in bytes. + ulong_ local_memory_size() const + { + return get_info(CL_DEVICE_LOCAL_MEM_SIZE); + } + + /// Returns the clock frequency for the device's compute units. + uint_ clock_frequency() const + { + return get_info(CL_DEVICE_MAX_CLOCK_FREQUENCY); + } + + /// Returns the number of compute units in the device. + uint_ compute_units() const + { + return get_info(CL_DEVICE_MAX_COMPUTE_UNITS); + } + + /// \internal_ + ulong_ max_memory_alloc_size() const + { + return get_info(CL_DEVICE_MAX_MEM_ALLOC_SIZE); + } + + /// \internal_ + size_t max_work_group_size() const + { + return get_info(CL_DEVICE_MAX_WORK_GROUP_SIZE); + } + + /// \internal_ + uint_ max_work_item_dimensions() const + { + return get_info(CL_DEVICE_MAX_WORK_ITEM_DIMENSIONS); + } + + /// Returns the preferred vector width for type \c T. + template + uint_ preferred_vector_width() const + { + return 0; + } + + /// Returns the profiling timer resolution in nanoseconds. + size_t profiling_timer_resolution() const + { + return get_info(CL_DEVICE_PROFILING_TIMER_RESOLUTION); + } + + /// Returns \c true if the device is a sub-device. + bool is_subdevice() const + { + #if defined(CL_VERSION_1_2) + try { + return get_info(CL_DEVICE_PARENT_DEVICE) != 0; + } + catch(opencl_error&){ + // the get_info() call above will throw if the device's opencl version + // is less than 1.2 (in which case it can't be a sub-device). + return false; + } + #else + return false; + #endif + } + + /// Returns information about the device. + /// + /// For example, to get the number of compute units: + /// \code + /// device.get_info(CL_DEVICE_MAX_COMPUTE_UNITS); + /// \endcode + /// + /// Alternatively, the template-specialized version can be used which + /// automatically determines the result type: + /// \code + /// device.get_info(); + /// \endcode + /// + /// \see_opencl_ref{clGetDeviceInfo} + template + T get_info(cl_device_info info) const + { + return detail::get_object_info(clGetDeviceInfo, m_id, info); + } + + /// \overload + template + typename detail::get_object_info_type::type + get_info() const; + + #if defined(CL_VERSION_1_2) || defined(BOOST_COMPUTE_DOXYGEN_INVOKED) + /// Partitions the device into multiple sub-devices according to + /// \p properties. + /// + /// \opencl_version_warning{1,2} + std::vector + partition(const cl_device_partition_property *properties) const + { + // get sub-device count + uint_ count = 0; + int_ ret = clCreateSubDevices(m_id, properties, 0, 0, &count); + if(ret != CL_SUCCESS){ + BOOST_THROW_EXCEPTION(opencl_error(ret)); + } + + // get sub-device ids + std::vector ids(count); + ret = clCreateSubDevices(m_id, properties, count, &ids[0], 0); + if(ret != CL_SUCCESS){ + BOOST_THROW_EXCEPTION(opencl_error(ret)); + } + + // convert ids to device objects + std::vector devices(count); + for(size_t i = 0; i < count; i++){ + devices[i] = device(ids[i], false); + } + + return devices; + } + + /// \opencl_version_warning{1,2} + std::vector partition_equally(size_t count) const + { + cl_device_partition_property properties[] = { + CL_DEVICE_PARTITION_EQUALLY, + static_cast(count), + 0 + }; + + return partition(properties); + } + + /// \opencl_version_warning{1,2} + std::vector + partition_by_counts(const std::vector &counts) const + { + std::vector properties; + + properties.push_back(CL_DEVICE_PARTITION_BY_COUNTS); + for(size_t i = 0; i < counts.size(); i++){ + properties.push_back( + static_cast(counts[i])); + } + properties.push_back(CL_DEVICE_PARTITION_BY_COUNTS_LIST_END); + properties.push_back(0); + + return partition(&properties[0]); + } + + /// \opencl_version_warning{1,2} + std::vector + partition_by_affinity_domain(cl_device_affinity_domain domain) const + { + cl_device_partition_property properties[] = { + CL_DEVICE_PARTITION_BY_AFFINITY_DOMAIN, + static_cast(domain), + 0 + }; + + return partition(properties); + } + #endif // CL_VERSION_1_2 + + /// Returns \c true if the device is the same at \p other. + bool operator==(const device &other) const + { + return m_id == other.m_id; + } + + /// Returns \c true if the device is different from \p other. + bool operator!=(const device &other) const + { + return m_id != other.m_id; + } + + /// \internal_ + bool check_version(int major, int minor) const + { + std::stringstream stream; + stream << version(); + + int actual_major, actual_minor; + stream.ignore(7); // 'OpenCL ' + stream >> actual_major; + stream.ignore(1); // '.' + stream >> actual_minor; + + return actual_major > major || + (actual_major == major && actual_minor >= minor); + } + +private: + cl_device_id m_id; +}; + +/// \internal_ +template<> +inline uint_ device::preferred_vector_width() const +{ + return get_info(CL_DEVICE_PREFERRED_VECTOR_WIDTH_SHORT); +} + +/// \internal_ +template<> +inline uint_ device::preferred_vector_width() const +{ + return get_info(CL_DEVICE_PREFERRED_VECTOR_WIDTH_INT); +} + +/// \internal_ +template<> +inline uint_ device::preferred_vector_width() const +{ + return get_info(CL_DEVICE_PREFERRED_VECTOR_WIDTH_LONG); +} + +/// \internal_ +template<> +inline uint_ device::preferred_vector_width() const +{ + return get_info(CL_DEVICE_PREFERRED_VECTOR_WIDTH_FLOAT); +} + +/// \internal_ +template<> +inline uint_ device::preferred_vector_width() const +{ + return get_info(CL_DEVICE_PREFERRED_VECTOR_WIDTH_DOUBLE); +} + +/// \internal_ define get_info() specializations for device +BOOST_COMPUTE_DETAIL_DEFINE_GET_INFO_SPECIALIZATIONS(device, + ((cl_uint, CL_DEVICE_ADDRESS_BITS)) + ((bool, CL_DEVICE_AVAILABLE)) + ((bool, CL_DEVICE_COMPILER_AVAILABLE)) + ((bool, CL_DEVICE_ENDIAN_LITTLE)) + ((bool, CL_DEVICE_ERROR_CORRECTION_SUPPORT)) + ((cl_device_exec_capabilities, CL_DEVICE_EXECUTION_CAPABILITIES)) + ((std::string, CL_DEVICE_EXTENSIONS)) + ((cl_ulong, CL_DEVICE_GLOBAL_MEM_CACHE_SIZE)) + ((cl_device_mem_cache_type, CL_DEVICE_GLOBAL_MEM_CACHE_TYPE)) + ((cl_ulong, CL_DEVICE_GLOBAL_MEM_CACHELINE_SIZE)) + ((cl_ulong, CL_DEVICE_GLOBAL_MEM_SIZE)) + ((bool, CL_DEVICE_IMAGE_SUPPORT)) + ((size_t, CL_DEVICE_IMAGE2D_MAX_HEIGHT)) + ((size_t, CL_DEVICE_IMAGE2D_MAX_WIDTH)) + ((size_t, CL_DEVICE_IMAGE3D_MAX_DEPTH)) + ((size_t, CL_DEVICE_IMAGE3D_MAX_HEIGHT)) + ((size_t, CL_DEVICE_IMAGE3D_MAX_WIDTH)) + ((cl_ulong, CL_DEVICE_LOCAL_MEM_SIZE)) + ((cl_device_local_mem_type, CL_DEVICE_LOCAL_MEM_TYPE)) + ((cl_uint, CL_DEVICE_MAX_CLOCK_FREQUENCY)) + ((cl_uint, CL_DEVICE_MAX_COMPUTE_UNITS)) + ((cl_uint, CL_DEVICE_MAX_CONSTANT_ARGS)) + ((cl_ulong, CL_DEVICE_MAX_CONSTANT_BUFFER_SIZE)) + ((cl_ulong, CL_DEVICE_MAX_MEM_ALLOC_SIZE)) + ((size_t, CL_DEVICE_MAX_PARAMETER_SIZE)) + ((cl_uint, CL_DEVICE_MAX_READ_IMAGE_ARGS)) + ((cl_uint, CL_DEVICE_MAX_SAMPLERS)) + ((size_t, CL_DEVICE_MAX_WORK_GROUP_SIZE)) + ((cl_uint, CL_DEVICE_MAX_WORK_ITEM_DIMENSIONS)) + ((std::vector, CL_DEVICE_MAX_WORK_ITEM_SIZES)) + ((cl_uint, CL_DEVICE_MAX_WRITE_IMAGE_ARGS)) + ((cl_uint, CL_DEVICE_MEM_BASE_ADDR_ALIGN)) + ((cl_uint, CL_DEVICE_MIN_DATA_TYPE_ALIGN_SIZE)) + ((std::string, CL_DEVICE_NAME)) + ((cl_platform_id, CL_DEVICE_PLATFORM)) + ((cl_uint, CL_DEVICE_PREFERRED_VECTOR_WIDTH_CHAR)) + ((cl_uint, CL_DEVICE_PREFERRED_VECTOR_WIDTH_SHORT)) + ((cl_uint, CL_DEVICE_PREFERRED_VECTOR_WIDTH_INT)) + ((cl_uint, CL_DEVICE_PREFERRED_VECTOR_WIDTH_LONG)) + ((cl_uint, CL_DEVICE_PREFERRED_VECTOR_WIDTH_FLOAT)) + ((cl_uint, CL_DEVICE_PREFERRED_VECTOR_WIDTH_DOUBLE)) + ((std::string, CL_DEVICE_PROFILE)) + ((size_t, CL_DEVICE_PROFILING_TIMER_RESOLUTION)) + ((cl_command_queue_properties, CL_DEVICE_QUEUE_PROPERTIES)) + ((cl_device_fp_config, CL_DEVICE_SINGLE_FP_CONFIG)) + ((cl_device_type, CL_DEVICE_TYPE)) + ((std::string, CL_DEVICE_VENDOR)) + ((cl_uint, CL_DEVICE_VENDOR_ID)) + ((std::string, CL_DEVICE_VERSION)) + ((std::string, CL_DRIVER_VERSION)) +) + +#ifdef CL_DEVICE_DOUBLE_FP_CONFIG +BOOST_COMPUTE_DETAIL_DEFINE_GET_INFO_SPECIALIZATIONS(device, + ((cl_device_fp_config, CL_DEVICE_DOUBLE_FP_CONFIG)) +) +#endif + +#ifdef CL_DEVICE_HALF_FP_CONFIG +BOOST_COMPUTE_DETAIL_DEFINE_GET_INFO_SPECIALIZATIONS(device, + ((cl_device_fp_config, CL_DEVICE_HALF_FP_CONFIG)) +) +#endif + +#ifdef CL_VERSION_1_1 +BOOST_COMPUTE_DETAIL_DEFINE_GET_INFO_SPECIALIZATIONS(device, + ((bool, CL_DEVICE_HOST_UNIFIED_MEMORY)) + ((cl_uint, CL_DEVICE_NATIVE_VECTOR_WIDTH_CHAR)) + ((cl_uint, CL_DEVICE_NATIVE_VECTOR_WIDTH_SHORT)) + ((cl_uint, CL_DEVICE_NATIVE_VECTOR_WIDTH_INT)) + ((cl_uint, CL_DEVICE_NATIVE_VECTOR_WIDTH_LONG)) + ((cl_uint, CL_DEVICE_NATIVE_VECTOR_WIDTH_FLOAT)) + ((cl_uint, CL_DEVICE_NATIVE_VECTOR_WIDTH_DOUBLE)) + ((std::string, CL_DEVICE_OPENCL_C_VERSION)) +) +#endif // CL_VERSION_1_1 + +#ifdef CL_VERSION_1_2 +BOOST_COMPUTE_DETAIL_DEFINE_GET_INFO_SPECIALIZATIONS(device, + ((std::string, CL_DEVICE_BUILT_IN_KERNELS)) + ((bool, CL_DEVICE_LINKER_AVAILABLE)) + ((cl_device_id, CL_DEVICE_PARENT_DEVICE)) + ((cl_uint, CL_DEVICE_PARTITION_MAX_SUB_DEVICES)) + ((cl_device_partition_property, CL_DEVICE_PARTITION_PROPERTIES)) + ((cl_device_affinity_domain, CL_DEVICE_PARTITION_AFFINITY_DOMAIN)) + ((cl_device_partition_property, CL_DEVICE_PARTITION_TYPE)) + ((size_t, CL_DEVICE_PRINTF_BUFFER_SIZE)) + ((bool, CL_DEVICE_PREFERRED_INTEROP_USER_SYNC)) + ((cl_uint, CL_DEVICE_REFERENCE_COUNT)) +) +#endif // CL_VERSION_1_2 + +#ifdef CL_VERSION_2_0 +BOOST_COMPUTE_DETAIL_DEFINE_GET_INFO_SPECIALIZATIONS(device, + ((size_t, CL_DEVICE_GLOBAL_VARIABLE_PREFERRED_TOTAL_SIZE)) + ((size_t, CL_DEVICE_MAX_GLOBAL_VARIABLE_SIZE)) + ((cl_uint, CL_DEVICE_MAX_ON_DEVICE_EVENTS)) + ((cl_uint, CL_DEVICE_MAX_ON_DEVICE_QUEUES)) + ((cl_uint, CL_DEVICE_MAX_PIPE_ARGS)) + ((cl_uint, CL_DEVICE_MAX_READ_WRITE_IMAGE_ARGS)) + ((cl_uint, CL_DEVICE_PIPE_MAX_ACTIVE_RESERVATIONS)) + ((cl_uint, CL_DEVICE_PIPE_MAX_PACKET_SIZE)) + ((cl_uint, CL_DEVICE_PREFERRED_GLOBAL_ATOMIC_ALIGNMENT)) + ((cl_uint, CL_DEVICE_PREFERRED_LOCAL_ATOMIC_ALIGNMENT)) + ((cl_uint, CL_DEVICE_PREFERRED_PLATFORM_ATOMIC_ALIGNMENT)) + ((cl_uint, CL_DEVICE_QUEUE_ON_DEVICE_MAX_SIZE)) + ((cl_uint, CL_DEVICE_QUEUE_ON_DEVICE_PREFERRED_SIZE)) + ((cl_command_queue_properties, CL_DEVICE_QUEUE_ON_DEVICE_PROPERTIES)) + ((cl_device_svm_capabilities, CL_DEVICE_SVM_CAPABILITIES)) + ((cl_uint, CL_DEVICE_IMAGE_BASE_ADDRESS_ALIGNMENT)) + ((cl_uint, CL_DEVICE_IMAGE_PITCH_ALIGNMENT)) +) +#endif // CL_VERSION_2_0 + +} // end compute namespace +} // end boost namespace + +#endif // BOOST_COMPUTE_DEVICE_HPP diff --git a/3party/boost/boost/compute/event.hpp b/3party/boost/boost/compute/event.hpp new file mode 100644 index 0000000000..2f53d87650 --- /dev/null +++ b/3party/boost/boost/compute/event.hpp @@ -0,0 +1,338 @@ +//---------------------------------------------------------------------------// +// Copyright (c) 2013 Kyle Lutz +// +// 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 +// +// See http://boostorg.github.com/compute for more information. +//---------------------------------------------------------------------------// + +#ifndef BOOST_COMPUTE_EVENT_HPP +#define BOOST_COMPUTE_EVENT_HPP + +#include + +#include +#include +#include +#include +#include +#include + +namespace boost { +namespace compute { + +/// \class event +/// \brief An event corresponding to an operation on a compute device +/// +/// Event objects are used to track operations running on the device (such as +/// kernel executions and memory transfers). Event objects are returned by the +/// various \c enqueue_* methods of the command_queue class. +/// +/// Events can be used to synchronize operations between the host and the +/// device. The \c wait() method will block execution on the host until the +/// operation corresponding to the event on the device has completed. The +/// status of the operation can also be polled with the \c status() method. +/// +/// Event objects can also be used for performance profiling. In order to use +/// events for profiling, the command queue must be constructed with the +/// \c CL_QUEUE_PROFILING_ENABLE flag. Then the \c duration() method can be +/// used to retrieve the total duration of the operation on the device: +/// \code +/// std::cout << "time = " << e.duration().count() << "ms\n"; +/// \endcode +/// +/// \see \ref future "future", wait_list +class event +{ +public: + /// \internal_ + enum execution_status { + complete = CL_COMPLETE, + running = CL_RUNNING, + submitted = CL_SUBMITTED, + queued = CL_QUEUED + }; + + /// \internal_ + enum command_type { + ndrange_kernel = CL_COMMAND_NDRANGE_KERNEL, + task = CL_COMMAND_TASK, + native_kernel = CL_COMMAND_NATIVE_KERNEL, + read_buffer = CL_COMMAND_READ_BUFFER, + write_buffer = CL_COMMAND_WRITE_BUFFER, + copy_buffer = CL_COMMAND_COPY_BUFFER, + read_image = CL_COMMAND_READ_IMAGE, + write_image = CL_COMMAND_WRITE_IMAGE, + copy_image = CL_COMMAND_COPY_IMAGE, + copy_image_to_buffer = CL_COMMAND_COPY_IMAGE_TO_BUFFER, + copy_buffer_to_image = CL_COMMAND_COPY_BUFFER_TO_IMAGE, + map_buffer = CL_COMMAND_MAP_BUFFER, + map_image = CL_COMMAND_MAP_IMAGE, + unmap_mem_object = CL_COMMAND_UNMAP_MEM_OBJECT, + marker = CL_COMMAND_MARKER, + aquire_gl_objects = CL_COMMAND_ACQUIRE_GL_OBJECTS, + release_gl_object = CL_COMMAND_RELEASE_GL_OBJECTS + #if defined(CL_VERSION_1_1) + , + read_buffer_rect = CL_COMMAND_READ_BUFFER_RECT, + write_buffer_rect = CL_COMMAND_WRITE_BUFFER_RECT, + copy_buffer_rect = CL_COMMAND_COPY_BUFFER_RECT + #endif + }; + + /// \internal_ + enum profiling_info { + profiling_command_queued = CL_PROFILING_COMMAND_QUEUED, + profiling_command_submit = CL_PROFILING_COMMAND_SUBMIT, + profiling_command_start = CL_PROFILING_COMMAND_START, + profiling_command_end = CL_PROFILING_COMMAND_END + }; + + /// Creates a null event object. + event() + : m_event(0) + { + } + + explicit event(cl_event event, bool retain = true) + : m_event(event) + { + if(m_event && retain){ + clRetainEvent(event); + } + } + + /// Makes a new event as a copy of \p other. + event(const event &other) + : m_event(other.m_event) + { + if(m_event){ + clRetainEvent(m_event); + } + } + + /// Copies the event object from \p other to \c *this. + event& operator=(const event &other) + { + if(this != &other){ + if(m_event){ + clReleaseEvent(m_event); + } + + m_event = other.m_event; + + if(m_event){ + clRetainEvent(m_event); + } + } + + return *this; + } + + #ifndef BOOST_COMPUTE_NO_RVALUE_REFERENCES + /// Move-constructs a new event object from \p other. + event(event&& other) BOOST_NOEXCEPT + : m_event(other.m_event) + { + other.m_event = 0; + } + + /// Move-assigns the event from \p other to \c *this. + event& operator=(event&& other) BOOST_NOEXCEPT + { + if(m_event){ + clReleaseEvent(m_event); + } + + m_event = other.m_event; + other.m_event = 0; + + return *this; + } + #endif // BOOST_COMPUTE_NO_RVALUE_REFERENCES + + /// Destroys the event object. + ~event() + { + if(m_event){ + BOOST_COMPUTE_ASSERT_CL_SUCCESS( + clReleaseEvent(m_event) + ); + } + } + + /// Returns a reference to the underlying OpenCL event object. + cl_event& get() const + { + return const_cast(m_event); + } + + /// Returns the status of the event. + cl_int status() const + { + return get_info(CL_EVENT_COMMAND_EXECUTION_STATUS); + } + + /// Returns the command type for the event. + cl_command_type get_command_type() const + { + return get_info(CL_EVENT_COMMAND_TYPE); + } + + /// Returns information about the event. + /// + /// \see_opencl_ref{clGetEventInfo} + template + T get_info(cl_event_info info) const + { + return detail::get_object_info(clGetEventInfo, m_event, info); + } + + /// \overload + template + typename detail::get_object_info_type::type + get_info() const; + + /// Returns profiling information for the event. + /// + /// \see event::duration() + /// + /// \see_opencl_ref{clGetEventProfilingInfo} + template + T get_profiling_info(cl_profiling_info info) const + { + return detail::get_object_info(clGetEventProfilingInfo, + m_event, + info); + } + + /// Blocks until the actions corresponding to the event have + /// completed. + void wait() const + { + cl_int ret = clWaitForEvents(1, &m_event); + if(ret != CL_SUCCESS){ + BOOST_THROW_EXCEPTION(opencl_error(ret)); + } + } + + #if defined(CL_VERSION_1_1) || defined(BOOST_COMPUTE_DOXYGEN_INVOKED) + /// Registers a function to be called when the event status changes to + /// \p status (by default CL_COMPLETE). The callback is passed the OpenCL + /// event object, the event status, and a pointer to arbitrary user data. + /// + /// \see_opencl_ref{clSetEventCallback} + /// + /// \opencl_version_warning{1,1} + void set_callback(void (BOOST_COMPUTE_CL_CALLBACK *callback)( + cl_event event, cl_int status, void *user_data + ), + cl_int status = CL_COMPLETE, + void *user_data = 0) + { + cl_int ret = clSetEventCallback(m_event, status, callback, user_data); + if(ret != CL_SUCCESS){ + BOOST_THROW_EXCEPTION(opencl_error(ret)); + } + } + + /// Registers a generic function to be called when the event status + /// changes to \p status (by default \c CL_COMPLETE). + /// + /// The function specified by \p callback must be invokable with zero + /// arguments (e.g. \c callback()). + /// + /// \opencl_version_warning{1,1} + template + void set_callback(Function callback, cl_int status = CL_COMPLETE) + { + set_callback( + event_callback_invoker, + status, + new boost::function(callback) + ); + } + #endif // CL_VERSION_1_1 + + /// Returns the total duration of the event from \p start to \p end. + /// + /// For example, to print the number of milliseconds the event took to + /// execute: + /// \code + /// std::cout << event.duration().count() << " ms" << std::endl; + /// \endcode + /// + /// \see event::get_profiling_info() + template + Duration duration(cl_profiling_info start = CL_PROFILING_COMMAND_START, + cl_profiling_info end = CL_PROFILING_COMMAND_END) const + { + const ulong_ nanoseconds = + get_profiling_info(end) - get_profiling_info(start); + + return detail::make_duration_from_nanoseconds(Duration(), nanoseconds); + } + + /// Returns \c true if the event is the same as \p other. + bool operator==(const event &other) const + { + return m_event == other.m_event; + } + + /// Returns \c true if the event is different from \p other. + bool operator!=(const event &other) const + { + return m_event != other.m_event; + } + + /// \internal_ + operator cl_event() const + { + return m_event; + } + + /// \internal_ (deprecated) + cl_int get_status() const + { + return status(); + } + +private: + #ifdef CL_VERSION_1_1 + /// \internal_ + static void BOOST_COMPUTE_CL_CALLBACK + event_callback_invoker(cl_event, cl_int, void *user_data) + { + boost::function *callback = + static_cast *>(user_data); + + (*callback)(); + + delete callback; + } + #endif // CL_VERSION_1_1 + +protected: + cl_event m_event; +}; + +/// \internal_ define get_info() specializations for event +BOOST_COMPUTE_DETAIL_DEFINE_GET_INFO_SPECIALIZATIONS(event, + ((cl_command_queue, CL_EVENT_COMMAND_QUEUE)) + ((cl_command_type, CL_EVENT_COMMAND_TYPE)) + ((cl_int, CL_EVENT_COMMAND_EXECUTION_STATUS)) + ((cl_uint, CL_EVENT_REFERENCE_COUNT)) +) + +#ifdef CL_VERSION_1_1 +BOOST_COMPUTE_DETAIL_DEFINE_GET_INFO_SPECIALIZATIONS(event, + ((cl_context, CL_EVENT_CONTEXT)) +) +#endif + +} // end compute namespace +} // end boost namespace + +#endif // BOOST_COMPUTE_EVENT_HPP diff --git a/3party/boost/boost/compute/exception.hpp b/3party/boost/boost/compute/exception.hpp new file mode 100644 index 0000000000..10a271de03 --- /dev/null +++ b/3party/boost/boost/compute/exception.hpp @@ -0,0 +1,23 @@ +//---------------------------------------------------------------------------// +// Copyright (c) 2013 Kyle Lutz +// +// 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 +// +// See http://boostorg.github.com/compute for more information. +//---------------------------------------------------------------------------// + +#ifndef BOOST_COMPUTE_EXCEPTION_HPP +#define BOOST_COMPUTE_EXCEPTION_HPP + +/// \file +/// +/// Meta-header to include all Boost.Compute exception headers. + +#include +#include +#include +#include + +#endif // BOOST_COMPUTE_EXCEPTION_HPP diff --git a/3party/boost/boost/compute/exception/context_error.hpp b/3party/boost/boost/compute/exception/context_error.hpp new file mode 100644 index 0000000000..ec8dc7c30f --- /dev/null +++ b/3party/boost/boost/compute/exception/context_error.hpp @@ -0,0 +1,88 @@ +//---------------------------------------------------------------------------// +// Copyright (c) 2013 Kyle Lutz +// +// 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 +// +// See http://boostorg.github.com/compute for more information. +//---------------------------------------------------------------------------// + +#ifndef BOOST_COMPUTE_EXCEPTION_CONTEXT_ERROR_HPP +#define BOOST_COMPUTE_EXCEPTION_CONTEXT_ERROR_HPP + +#include + +namespace boost { +namespace compute { + +class context; + +/// \class context_error +/// \brief A run-time OpenCL context error. +/// +/// The context_error exception is thrown when the OpenCL context encounters +/// an error condition. Boost.Compute is notified of these error conditions by +/// registering an error handler when creating context objects (via the +/// \c pfn_notify argument to the \c clCreateContext() function). +/// +/// This exception is different than the opencl_error exception which is thrown +/// as a result of error caused when calling a single OpenCL API function. +/// +/// \see opencl_error +class context_error : public std::exception +{ +public: + /// Creates a new context error exception object. + context_error(const context *context, + const char *errinfo, + const void *private_info, + size_t private_info_size) throw() + : m_context(context), + m_errinfo(errinfo), + m_private_info(private_info), + m_private_info_size(private_info_size) + { + } + + /// Destroys the context error object. + ~context_error() throw() + { + } + + /// Returns a string with a description of the error. + const char* what() const throw() + { + return m_errinfo; + } + + /// Returns a pointer to the context object which generated the error + /// notification. + const context* get_context_ptr() const throw() + { + return m_context; + } + + /// Returns a pointer to the private info memory block. + const void* get_private_info_ptr() const throw() + { + return m_private_info; + } + + /// Returns the size of the private info memory block. + size_t get_private_info_size() const throw() + { + return m_private_info_size; + } + +private: + const context *m_context; + const char *m_errinfo; + const void *m_private_info; + size_t m_private_info_size; +}; + +} // end compute namespace +} // end boost namespace + +#endif // BOOST_COMPUTE_EXCEPTION_CONTEXT_ERROR_HPP diff --git a/3party/boost/boost/compute/exception/no_device_found.hpp b/3party/boost/boost/compute/exception/no_device_found.hpp new file mode 100644 index 0000000000..fb73942e0c --- /dev/null +++ b/3party/boost/boost/compute/exception/no_device_found.hpp @@ -0,0 +1,48 @@ +//---------------------------------------------------------------------------// +// Copyright (c) 2013-2015 Kyle Lutz +// +// 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 +// +// See http://boostorg.github.com/compute for more information. +//---------------------------------------------------------------------------// + +#ifndef BOOST_COMPUTE_EXCEPTION_NO_DEVICE_FOUND_HPP +#define BOOST_COMPUTE_EXCEPTION_NO_DEVICE_FOUND_HPP + +#include + +namespace boost { +namespace compute { + +/// \class no_device_found +/// \brief Exception thrown when no OpenCL device is found +/// +/// This exception is thrown when no valid OpenCL device can be found. +/// +/// \see opencl_error +class no_device_found : public std::exception +{ +public: + /// Creates a new no_device_found exception object. + no_device_found() throw() + { + } + + /// Destroys the no_device_found exception object. + ~no_device_found() throw() + { + } + + /// Returns a string containing a human-readable error message. + const char* what() const throw() + { + return "No OpenCL device found"; + } +}; + +} // end compute namespace +} // end boost namespace + +#endif // BOOST_COMPUTE_EXCEPTION_NO_DEVICE_FOUND_HPP diff --git a/3party/boost/boost/compute/exception/opencl_error.hpp b/3party/boost/boost/compute/exception/opencl_error.hpp new file mode 100644 index 0000000000..29a3a9d258 --- /dev/null +++ b/3party/boost/boost/compute/exception/opencl_error.hpp @@ -0,0 +1,158 @@ +//---------------------------------------------------------------------------// +// Copyright (c) 2013 Kyle Lutz +// +// 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 +// +// See http://boostorg.github.com/compute for more information. +//---------------------------------------------------------------------------// + +#ifndef BOOST_COMPUTE_EXCEPTION_OPENCL_ERROR_HPP +#define BOOST_COMPUTE_EXCEPTION_OPENCL_ERROR_HPP + +#include +#include +#include + +#include + +namespace boost { +namespace compute { + +/// \class opencl_error +/// \brief A run-time OpenCL error. +/// +/// The opencl_error class represents an error returned from an OpenCL +/// function. +/// +/// \see context_error +class opencl_error : public std::exception +{ +public: + /// Creates a new opencl_error exception object for \p error. + explicit opencl_error(cl_int error) throw() + : m_error(error), + m_error_string(to_string(error)) + { + } + + /// Destroys the opencl_error object. + ~opencl_error() throw() + { + } + + /// Returns the numeric error code. + cl_int error_code() const throw() + { + return m_error; + } + + /// Returns a string description of the error. + std::string error_string() const throw() + { + return m_error_string; + } + + /// Returns a C-string description of the error. + const char* what() const throw() + { + return m_error_string.c_str(); + } + + /// Static function which converts the numeric OpenCL error code \p error + /// to a human-readable string. + /// + /// For example: + /// \code + /// std::cout << opencl_error::to_string(CL_INVALID_KERNEL_ARGS) << std::endl; + /// \endcode + /// + /// Will print "Invalid Kernel Arguments". + /// + /// If the error code is unknown (e.g. not a valid OpenCL error), a string + /// containing "Unknown OpenCL Error" along with the error number will be + /// returned. + static std::string to_string(cl_int error) + { + switch(error){ + case CL_SUCCESS: return "Success"; + case CL_DEVICE_NOT_FOUND: return "Device Not Found"; + case CL_DEVICE_NOT_AVAILABLE: return "Device Not Available"; + case CL_COMPILER_NOT_AVAILABLE: return "Compiler Not Available"; + case CL_MEM_OBJECT_ALLOCATION_FAILURE: return "Memory Object Allocation Failure"; + case CL_OUT_OF_RESOURCES: return "Out of Resources"; + case CL_OUT_OF_HOST_MEMORY: return "Out of Host Memory"; + case CL_PROFILING_INFO_NOT_AVAILABLE: return "Profiling Information Not Available"; + case CL_MEM_COPY_OVERLAP: return "Memory Copy Overlap"; + case CL_IMAGE_FORMAT_MISMATCH: return "Image Format Mismatch"; + case CL_IMAGE_FORMAT_NOT_SUPPORTED: return "Image Format Not Supported"; + case CL_BUILD_PROGRAM_FAILURE: return "Build Program Failure"; + case CL_MAP_FAILURE: return "Map Failure"; + case CL_INVALID_VALUE: return "Invalid Value"; + case CL_INVALID_DEVICE_TYPE: return "Invalid Device Type"; + case CL_INVALID_PLATFORM: return "Invalid Platform"; + case CL_INVALID_DEVICE: return "Invalid Device"; + case CL_INVALID_CONTEXT: return "Invalid Context"; + case CL_INVALID_QUEUE_PROPERTIES: return "Invalid Queue Properties"; + case CL_INVALID_COMMAND_QUEUE: return "Invalid Command Queue"; + case CL_INVALID_HOST_PTR: return "Invalid Host Pointer"; + case CL_INVALID_MEM_OBJECT: return "Invalid Memory Object"; + case CL_INVALID_IMAGE_FORMAT_DESCRIPTOR: return "Invalid Image Format Descriptor"; + case CL_INVALID_IMAGE_SIZE: return "Invalid Image Size"; + case CL_INVALID_SAMPLER: return "Invalid Sampler"; + case CL_INVALID_BINARY: return "Invalid Binary"; + case CL_INVALID_BUILD_OPTIONS: return "Invalid Build Options"; + case CL_INVALID_PROGRAM: return "Invalid Program"; + case CL_INVALID_PROGRAM_EXECUTABLE: return "Invalid Program Executable"; + case CL_INVALID_KERNEL_NAME: return "Invalid Kernel Name"; + case CL_INVALID_KERNEL_DEFINITION: return "Invalid Kernel Definition"; + case CL_INVALID_KERNEL: return "Invalid Kernel"; + case CL_INVALID_ARG_INDEX: return "Invalid Argument Index"; + case CL_INVALID_ARG_VALUE: return "Invalid Argument Value"; + case CL_INVALID_ARG_SIZE: return "Invalid Argument Size"; + case CL_INVALID_KERNEL_ARGS: return "Invalid Kernel Arguments"; + case CL_INVALID_WORK_DIMENSION: return "Invalid Work Dimension"; + case CL_INVALID_WORK_GROUP_SIZE: return "Invalid Work Group Size"; + case CL_INVALID_WORK_ITEM_SIZE: return "Invalid Work Item Size"; + case CL_INVALID_GLOBAL_OFFSET: return "Invalid Global Offset"; + case CL_INVALID_EVENT_WAIT_LIST: return "Invalid Event Wait List"; + case CL_INVALID_EVENT: return "Invalid Event"; + case CL_INVALID_OPERATION: return "Invalid Operation"; + case CL_INVALID_GL_OBJECT: return "Invalid GL Object"; + case CL_INVALID_BUFFER_SIZE: return "Invalid Buffer Size"; + case CL_INVALID_MIP_LEVEL: return "Invalid MIP Level"; + case CL_INVALID_GLOBAL_WORK_SIZE: return "Invalid Global Work Size"; + #ifdef CL_VERSION_1_2 + case CL_COMPILE_PROGRAM_FAILURE: return "Compile Program Failure"; + case CL_LINKER_NOT_AVAILABLE: return "Linker Not Available"; + case CL_LINK_PROGRAM_FAILURE: return "Link Program Failure"; + case CL_DEVICE_PARTITION_FAILED: return "Device Partition Failed"; + case CL_KERNEL_ARG_INFO_NOT_AVAILABLE: return "Kernel Argument Info Not Available"; + case CL_INVALID_PROPERTY: return "Invalid Property"; + case CL_INVALID_IMAGE_DESCRIPTOR: return "Invalid Image Descriptor"; + case CL_INVALID_COMPILER_OPTIONS: return "Invalid Compiler Options"; + case CL_INVALID_LINKER_OPTIONS: return "Invalid Linker Options"; + case CL_INVALID_DEVICE_PARTITION_COUNT: return "Invalid Device Partition Count"; + #endif // CL_VERSION_1_2 + #ifdef CL_VERSION_2_0 + case CL_INVALID_PIPE_SIZE: return "Invalid Pipe Size"; + case CL_INVALID_DEVICE_QUEUE: return "Invalid Device Queue"; + #endif + default: { + std::stringstream s; + s << "Unknown OpenCL Error (" << error << ")"; + return s.str(); + } + } + } + +private: + cl_int m_error; + std::string m_error_string; +}; + +} // end compute namespace +} // end boost namespace + +#endif // BOOST_COMPUTE_EXCEPTION_OPENCL_ERROR_HPP diff --git a/3party/boost/boost/compute/exception/unsupported_extension_error.hpp b/3party/boost/boost/compute/exception/unsupported_extension_error.hpp new file mode 100644 index 0000000000..c6f4de6c33 --- /dev/null +++ b/3party/boost/boost/compute/exception/unsupported_extension_error.hpp @@ -0,0 +1,71 @@ +//---------------------------------------------------------------------------// +// Copyright (c) 2013-2014 Kyle Lutz +// +// 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 +// +// See http://boostorg.github.com/compute for more information. +//---------------------------------------------------------------------------// + +#ifndef BOOST_COMPUTE_EXCEPTION_UNSUPPORTED_EXTENSION_ERROR_HPP +#define BOOST_COMPUTE_EXCEPTION_UNSUPPORTED_EXTENSION_ERROR_HPP + +#include +#include +#include + +namespace boost { +namespace compute { + +/// \class unsupported_extension_error +/// \brief Exception thrown when attempting to use an unsupported +/// OpenCL extension. +/// +/// This exception is thrown when the user attempts to use an OpenCL +/// extension which is not supported on the platform and/or device. +/// +/// An example of this is attempting to use CL-GL sharing on a non-GPU +/// device. +/// +/// \see opencl_error +class unsupported_extension_error : public std::exception +{ +public: + /// Creates a new unsupported extension error exception object indicating + /// that \p extension is not supported by the OpenCL platform or device. + explicit unsupported_extension_error(const char *extension) throw() + : m_extension(extension) + { + std::stringstream msg; + msg << "OpenCL extension " << extension << " not supported"; + m_error_string = msg.str(); + } + + /// Destroys the unsupported extension error object. + ~unsupported_extension_error() throw() + { + } + + /// Returns the name of the unsupported extension. + std::string extension_name() const throw() + { + return m_extension; + } + + /// Returns a string containing a human-readable error message containing + /// the name of the unsupported exception. + const char* what() const throw() + { + return m_error_string.c_str(); + } + +private: + std::string m_extension; + std::string m_error_string; +}; + +} // end compute namespace +} // end boost namespace + +#endif // BOOST_COMPUTE_EXCEPTION_UNSUPPORTED_EXTENSION_ERROR_HPP diff --git a/3party/boost/boost/compute/experimental/clamp_range.hpp b/3party/boost/boost/compute/experimental/clamp_range.hpp new file mode 100644 index 0000000000..0c2260498f --- /dev/null +++ b/3party/boost/boost/compute/experimental/clamp_range.hpp @@ -0,0 +1,49 @@ +//---------------------------------------------------------------------------// +// Copyright (c) 2013 Kyle Lutz +// +// 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 +// +// See http://boostorg.github.com/compute for more information. +//---------------------------------------------------------------------------// + +#ifndef BOOST_COMPUTE_EXPERIMENTAL_CLAMP_RANGE_HPP +#define BOOST_COMPUTE_EXPERIMENTAL_CLAMP_RANGE_HPP + +#include + +#include +#include + +namespace boost { +namespace compute { +namespace experimental { + +template +inline OutputIterator +clamp_range(InputIterator first, + InputIterator last, + OutputIterator result, + typename std::iterator_traits::value_type lo, + typename std::iterator_traits::value_type hi, + command_queue &queue) +{ + using ::boost::compute::lambda::_1; + using ::boost::compute::lambda::_2; + using ::boost::compute::lambda::clamp; + + return ::boost::compute::transform( + first, + last, + result, + clamp(_1, lo, hi), + queue + ); +} + +} // end experimental namespace +} // end compute namespace +} // end boost namespace + +#endif // BOOST_COMPUTE_EXPERIMENTAL_CLAMP_RANGE_HPP diff --git a/3party/boost/boost/compute/experimental/malloc.hpp b/3party/boost/boost/compute/experimental/malloc.hpp new file mode 100644 index 0000000000..ad96888743 --- /dev/null +++ b/3party/boost/boost/compute/experimental/malloc.hpp @@ -0,0 +1,51 @@ +//---------------------------------------------------------------------------// +// Copyright (c) 2013 Kyle Lutz +// +// 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 +// +// See http://boostorg.github.com/compute for more information. +//---------------------------------------------------------------------------// + +#ifndef BOOST_COMPUTE_EXPERIMENTAL_MALLOC_HPP +#define BOOST_COMPUTE_EXPERIMENTAL_MALLOC_HPP + +#include +#include +#include +#include + +namespace boost { +namespace compute { +namespace experimental { + +// bring device_ptr into the experimental namespace +using detail::device_ptr; + +template +inline device_ptr +malloc(std::size_t size, const context &context = system::default_context()) +{ + buffer buf(context, size * sizeof(T)); + clRetainMemObject(buf.get()); + return device_ptr(buf); +} + +inline device_ptr +malloc(std::size_t size, const context &context = system::default_context()) +{ + return malloc(size, context); +} + +template +inline void free(device_ptr &ptr) +{ + clReleaseMemObject(ptr.get_buffer().get()); +} + +} // end experimental namespace +} // end compute namespace +} // end boost namespace + +#endif // BOOST_COMPUTE_EXPERIMENTAL_MALLOC_HPP diff --git a/3party/boost/boost/compute/experimental/sort_by_transform.hpp b/3party/boost/boost/compute/experimental/sort_by_transform.hpp new file mode 100644 index 0000000000..3d84ba9810 --- /dev/null +++ b/3party/boost/boost/compute/experimental/sort_by_transform.hpp @@ -0,0 +1,66 @@ +//---------------------------------------------------------------------------// +// Copyright (c) 2013 Kyle Lutz +// +// 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 +// +// See http://boostorg.github.com/compute for more information. +//---------------------------------------------------------------------------// + +#ifndef BOOST_COMPUTE_EXPERIMENTAL_SORT_BY_TRANSFORM_HPP +#define BOOST_COMPUTE_EXPERIMENTAL_SORT_BY_TRANSFORM_HPP + +#include + +#include +#include +#include +#include +#include + +namespace boost { +namespace compute { +namespace experimental { + +template +inline void sort_by_transform(Iterator first, + Iterator last, + Transform transform, + Compare compare, + command_queue &queue = system::default_queue()) +{ + typedef typename std::iterator_traits::value_type value_type; + typedef typename boost::compute::result_of::type key_type; + + size_t n = detail::iterator_range_size(first, last); + if(n < 2){ + return; + } + + const context &context = queue.get_context(); + + ::boost::compute::vector keys(n, context); + + ::boost::compute::transform( + first, + last, + keys.begin(), + transform, + queue + ); + + ::boost::compute::sort_by_key( + keys.begin(), + keys.end(), + first, + compare, + queue + ); +} + +} // end experimental namespace +} // end compute namespace +} // end boost namespace + +#endif // BOOST_COMPUTE_EXPERIMENTAL_SORT_BY_TRANSFORM_HPP diff --git a/3party/boost/boost/compute/experimental/tabulate.hpp b/3party/boost/boost/compute/experimental/tabulate.hpp new file mode 100644 index 0000000000..4f607e7961 --- /dev/null +++ b/3party/boost/boost/compute/experimental/tabulate.hpp @@ -0,0 +1,44 @@ +//---------------------------------------------------------------------------// +// Copyright (c) 2013 Kyle Lutz +// +// 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 +// +// See http://boostorg.github.com/compute for more information. +//---------------------------------------------------------------------------// + +#ifndef BOOST_COMPUTE_EXPERIMENTAL_TABULATE_HPP +#define BOOST_COMPUTE_EXPERIMENTAL_TABULATE_HPP + +#include + +#include +#include + +namespace boost { +namespace compute { +namespace experimental { + +template +inline void tabulate(Iterator first, + Iterator last, + UnaryFunction function, + command_queue &queue) +{ + size_t n = detail::iterator_range_size(first, last); + + ::boost::compute::transform( + ::boost::compute::make_counting_iterator(0), + ::boost::compute::make_counting_iterator(n), + first, + function, + queue + ); +} + +} // end experimental namespace +} // end compute namespace +} // end boost namespace + +#endif // BOOST_COMPUTE_EXPERIMENTAL_TABULATE_HPP diff --git a/3party/boost/boost/compute/function.hpp b/3party/boost/boost/compute/function.hpp new file mode 100644 index 0000000000..b0b893e948 --- /dev/null +++ b/3party/boost/boost/compute/function.hpp @@ -0,0 +1,454 @@ +//---------------------------------------------------------------------------// +// Copyright (c) 2013 Kyle Lutz +// +// 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 +// +// See http://boostorg.github.com/compute for more information. +//---------------------------------------------------------------------------// + +#ifndef BOOST_COMPUTE_FUNCTION_HPP +#define BOOST_COMPUTE_FUNCTION_HPP + +#include +#include +#include +#include + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +#include +#include +#include + +namespace boost { +namespace compute { +namespace detail { + +template +class invoked_function +{ +public: + typedef ResultType result_type; + + BOOST_STATIC_CONSTANT( + size_t, arity = boost::tuples::length::value + ); + + invoked_function(const std::string &name, + const std::string &source) + : m_name(name), + m_source(source) + { + } + + invoked_function(const std::string &name, + const std::string &source, + const std::map &definitions) + : m_name(name), + m_source(source), + m_definitions(definitions) + { + } + + invoked_function(const std::string &name, + const std::string &source, + const ArgTuple &args) + : m_name(name), + m_source(source), + m_args(args) + { + } + + invoked_function(const std::string &name, + const std::string &source, + const std::map &definitions, + const ArgTuple &args) + : m_name(name), + m_source(source), + m_definitions(definitions), + m_args(args) + { + } + + std::string name() const + { + return m_name; + } + + std::string source() const + { + return m_source; + } + + const std::map& definitions() const + { + return m_definitions; + } + + const ArgTuple& args() const + { + return m_args; + } + +private: + std::string m_name; + std::string m_source; + std::map m_definitions; + ArgTuple m_args; +}; + +} // end detail namespace + +/// \class function +/// \brief A function object. +template +class function +{ +public: + /// \internal_ + typedef typename + boost::function_traits::result_type result_type; + + /// \internal_ + BOOST_STATIC_CONSTANT( + size_t, arity = boost::function_traits::arity + ); + + /// \internal_ + typedef Signature signature; + + /// Creates a new function object with \p name. + function(const std::string &name) + : m_name(name) + { + } + + /// Destroys the function object. + ~function() + { + } + + /// \internal_ + std::string name() const + { + return m_name; + } + + /// \internal_ + void set_source(const std::string &source) + { + m_source = source; + } + + /// \internal_ + std::string source() const + { + return m_source; + } + + /// \internal_ + void define(std::string name, std::string value = std::string()) + { + m_definitions[name] = value; + } + + /// \internal_ + detail::invoked_function > + operator()() const + { + BOOST_STATIC_ASSERT_MSG( + arity == 0, + "Non-nullary function invoked with zero arguments" + ); + + return detail::invoked_function >( + m_name, m_source, m_definitions + ); + } + + /// \internal_ + template + detail::invoked_function > + operator()(const Arg1 &arg1) const + { + BOOST_STATIC_ASSERT_MSG( + arity == 1, + "Non-unary function invoked one argument" + ); + + return detail::invoked_function >( + m_name, m_source, m_definitions, boost::make_tuple(arg1) + ); + } + + /// \internal_ + template + detail::invoked_function > + operator()(const Arg1 &arg1, const Arg2 &arg2) const + { + BOOST_STATIC_ASSERT_MSG( + arity == 2, + "Non-binary function invoked with two arguments" + ); + + return detail::invoked_function >( + m_name, m_source, m_definitions, boost::make_tuple(arg1, arg2) + ); + } + + /// \internal_ + template + detail::invoked_function > + operator()(const Arg1 &arg1, const Arg2 &arg2, const Arg3 &arg3) const + { + BOOST_STATIC_ASSERT_MSG( + arity == 3, + "Non-ternary function invoked with three arguments" + ); + + return detail::invoked_function >( + m_name, m_source, m_definitions, boost::make_tuple(arg1, arg2, arg3) + ); + } + +private: + std::string m_name; + std::string m_source; + std::map m_definitions; +}; + +/// Creates a function object given its \p name and \p source. +/// +/// \param name The function name. +/// \param source The function source code. +/// +/// \see BOOST_COMPUTE_FUNCTION() +template +inline function +make_function_from_source(const std::string &name, const std::string &source) +{ + function f(name); + f.set_source(source); + return f; +} + +namespace detail { + +// given a string containing the arguments declaration for a function +// like: "(int a, const float b)", returns a vector containing the name +// of each argument (e.g. ["a", "b"]). +inline std::vector parse_argument_names(const char *arguments) +{ + BOOST_ASSERT_MSG( + arguments[0] == '(' && arguments[std::strlen(arguments)-1] == ')', + "Arguments should start and end with parentheses" + ); + + std::vector args; + + size_t last_space = 0; + size_t skip_comma = 0; + for(size_t i = 1; i < std::strlen(arguments) - 2; i++){ + const char c = arguments[i]; + + if(c == ' '){ + last_space = i; + } + else if(c == ',' && !skip_comma){ + std::string name( + arguments + last_space + 1, i - last_space - 1 + ); + args.push_back(name); + } + else if(c == '<'){ + skip_comma++; + } + else if(c == '>'){ + skip_comma--; + } + } + + std::string last_argument( + arguments + last_space + 1, std::strlen(arguments) - last_space - 2 + ); + args.push_back(last_argument); + + return args; +} + +struct signature_argument_inserter +{ + signature_argument_inserter(std::stringstream &s_, const char *arguments, size_t last) + : s(s_) + { + n = 0; + m_last = last; + + m_argument_names = parse_argument_names(arguments); + + BOOST_ASSERT_MSG( + m_argument_names.size() == last, + "Wrong number of arguments" + ); + } + + template + void operator()(const T*) + { + s << type_name() << " " << m_argument_names[n]; + if(n+1 < m_last){ + s << ", "; + } + n++; + } + + size_t n; + size_t m_last; + std::stringstream &s; + std::vector m_argument_names; +}; + +template +inline std::string make_function_declaration(const char *name, const char *arguments) +{ + typedef typename + boost::function_traits::result_type result_type; + typedef typename + boost::function_types::parameter_types::type parameter_types; + typedef typename + mpl::size::type arity_type; + + std::stringstream s; + s << "inline " << type_name() << " " << name; + s << "("; + + if(arity_type::value > 0){ + signature_argument_inserter i(s, arguments, arity_type::value); + mpl::for_each< + typename mpl::transform + >::type>(i); + } + + s << ")"; + return s.str(); +} + +struct argument_list_inserter +{ + argument_list_inserter(std::stringstream &s_, const char first, size_t last) + : s(s_) + { + n = 0; + m_last = last; + m_name = first; + } + + template + void operator()(const T*) + { + s << type_name() << " " << m_name++; + if(n+1 < m_last){ + s << ", "; + } + n++; + } + + size_t n; + size_t m_last; + char m_name; + std::stringstream &s; +}; + +template +inline std::string generate_argument_list(const char first = 'a') +{ + typedef typename + boost::function_types::parameter_types::type parameter_types; + typedef typename + mpl::size::type arity_type; + + std::stringstream s; + s << '('; + + if(arity_type::value > 0){ + argument_list_inserter i(s, first, arity_type::value); + mpl::for_each< + typename mpl::transform + >::type>(i); + } + + s << ')'; + return s.str(); +} + +// used by the BOOST_COMPUTE_FUNCTION() macro to create a function +// with the given signature, name, arguments, and source. +template +inline function +make_function_impl(const char *name, const char *arguments, const char *source) +{ + std::stringstream s; + s << make_function_declaration(name, arguments); + s << source; + + return make_function_from_source(name, s.str()); +} + +} // end detail namespace +} // end compute namespace +} // end boost namespace + +/// Creates a function object with \p name and \p source. +/// +/// \param return_type The return type for the function. +/// \param name The name of the function. +/// \param arguments A list of arguments for the function. +/// \param source The OpenCL C source code for the function. +/// +/// The function declaration and signature are automatically created using +/// the \p return_type, \p name, and \p arguments macro parameters. +/// +/// The source code for the function is interpreted as OpenCL C99 source code +/// which is stringified and passed to the OpenCL compiler when the function +/// is invoked. +/// +/// For example, to create a function which squares a number: +/// \code +/// BOOST_COMPUTE_FUNCTION(float, square, (float x), +/// { +/// return x * x; +/// }); +/// \endcode +/// +/// And to create a function which sums two numbers: +/// \code +/// BOOST_COMPUTE_FUNCTION(int, sum_two, (int x, int y), +/// { +/// return x + y; +/// }); +/// \endcode +/// +/// \see BOOST_COMPUTE_CLOSURE() +#ifdef BOOST_COMPUTE_DOXYGEN_INVOKED +#define BOOST_COMPUTE_FUNCTION(return_type, name, arguments, source) +#else +#define BOOST_COMPUTE_FUNCTION(return_type, name, arguments, ...) \ + ::boost::compute::function name = \ + ::boost::compute::detail::make_function_impl( \ + #name, #arguments, #__VA_ARGS__ \ + ) +#endif + +#endif // BOOST_COMPUTE_FUNCTION_HPP diff --git a/3party/boost/boost/compute/functional.hpp b/3party/boost/boost/compute/functional.hpp new file mode 100644 index 0000000000..d2065216f4 --- /dev/null +++ b/3party/boost/boost/compute/functional.hpp @@ -0,0 +1,34 @@ +//---------------------------------------------------------------------------// +// Copyright (c) 2013 Kyle Lutz +// +// 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 +// +// See http://boostorg.github.com/compute for more information. +//---------------------------------------------------------------------------// + +#ifndef BOOST_COMPUTE_FUNCTIONAL_HPP +#define BOOST_COMPUTE_FUNCTIONAL_HPP + +/// \file +/// +/// Meta-header to include all Boost.Compute functional headers. + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +#endif // BOOST_COMPUTE_FUNCTIONAL_HPP diff --git a/3party/boost/boost/compute/functional/as.hpp b/3party/boost/boost/compute/functional/as.hpp new file mode 100644 index 0000000000..584bd0f38a --- /dev/null +++ b/3party/boost/boost/compute/functional/as.hpp @@ -0,0 +1,51 @@ +//---------------------------------------------------------------------------// +// Copyright (c) 2013 Kyle Lutz +// +// 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 +// +// See http://boostorg.github.com/compute for more information. +//---------------------------------------------------------------------------// + +#ifndef BOOST_COMPUTE_FUNCTIONAL_AS_HPP +#define BOOST_COMPUTE_FUNCTIONAL_AS_HPP + +namespace boost { +namespace compute { +namespace detail { + +template +struct invoked_as +{ + invoked_as(const Arg &arg) + : m_arg(arg) + { + } + + Arg m_arg; +}; + +} // end detail namespace + +/// The \ref as function converts its argument to type \c T (similar to +/// reinterpret_cast). +/// +/// \see \ref convert "convert" +template +struct as +{ + typedef T result_type; + + /// \internal_ + template + detail::invoked_as operator()(const Arg &arg) const + { + return detail::invoked_as(arg); + } +}; + +} // end compute namespace +} // end boost namespace + +#endif // BOOST_COMPUTE_FUNCTIONAL_AS_HPP diff --git a/3party/boost/boost/compute/functional/atomic.hpp b/3party/boost/boost/compute/functional/atomic.hpp new file mode 100644 index 0000000000..2701561bc3 --- /dev/null +++ b/3party/boost/boost/compute/functional/atomic.hpp @@ -0,0 +1,141 @@ +//---------------------------------------------------------------------------// +// Copyright (c) 2013 Kyle Lutz +// +// 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 +// +// See http://boostorg.github.com/compute for more information. +//---------------------------------------------------------------------------// + +#ifndef BOOST_COMPUTE_FUNCTIONAL_ATOMIC_HPP +#define BOOST_COMPUTE_FUNCTIONAL_ATOMIC_HPP + +#include +#include + +#ifndef BOOST_COMPUTE_DOXYGEN_INVOKED +#ifdef CL_VERSION_1_1 + #define BOOST_COMPUTE_DETAIL_ATOMIC_PREFIX "atomic_" +#else + #define BOOST_COMPUTE_DETAIL_ATOMIC_PREFIX "atom_" +#endif +#endif // BOOST_COMPUTE_DOXYGEN_INVOKED + +namespace boost { +namespace compute { + +template +class atomic_add : public function +{ +public: + atomic_add() + : function(BOOST_COMPUTE_DETAIL_ATOMIC_PREFIX "add") + { + } +}; + +template +class atomic_sub : public function +{ +public: + atomic_sub() + : function(BOOST_COMPUTE_DETAIL_ATOMIC_PREFIX "sub") + { + } +}; + +template +class atomic_xchg : public function +{ +public: + atomic_xchg() + : function(BOOST_COMPUTE_DETAIL_ATOMIC_PREFIX "xchg") + { + } +}; + +template +class atomic_inc : public function +{ +public: + atomic_inc() + : function(BOOST_COMPUTE_DETAIL_ATOMIC_PREFIX "inc") + { + } +}; + +template +class atomic_dec : public function +{ +public: + atomic_dec() + : function(BOOST_COMPUTE_DETAIL_ATOMIC_PREFIX "dec") + { + } +}; + +template +class atomic_cmpxchg : public function +{ +public: + atomic_cmpxchg() + : function(BOOST_COMPUTE_DETAIL_ATOMIC_PREFIX "cmpxchg") + { + } +}; + +template +class atomic_max : public function +{ +public: + atomic_max() + : function(BOOST_COMPUTE_DETAIL_ATOMIC_PREFIX "max") + { + } +}; + +template +class atomic_min : public function +{ +public: + atomic_min() + : function(BOOST_COMPUTE_DETAIL_ATOMIC_PREFIX "min") + { + } +}; + +template +class atomic_and : public function +{ +public: + atomic_and() + : function(BOOST_COMPUTE_DETAIL_ATOMIC_PREFIX "and") + { + } +}; + +template +class atomic_or : public function +{ +public: + atomic_or() + : function(BOOST_COMPUTE_DETAIL_ATOMIC_PREFIX "or") + { + } +}; + +template +class atomic_xor : public function +{ +public: + atomic_xor() + : function(BOOST_COMPUTE_DETAIL_ATOMIC_PREFIX "xor") + { + } +}; + +} // end compute namespace +} // end boost namespace + +#endif // BOOST_COMPUTE_FUNCTIONAL_ATOMIC_HPP diff --git a/3party/boost/boost/compute/functional/bind.hpp b/3party/boost/boost/compute/functional/bind.hpp new file mode 100644 index 0000000000..0c5929f3b9 --- /dev/null +++ b/3party/boost/boost/compute/functional/bind.hpp @@ -0,0 +1,261 @@ +//---------------------------------------------------------------------------// +// Copyright (c) 2013-2014 Kyle Lutz +// +// 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 +// +// See http://boostorg.github.com/compute for more information. +//---------------------------------------------------------------------------// + +#ifndef BOOST_COMPUTE_FUNCTIONAL_BIND_HPP +#define BOOST_COMPUTE_FUNCTIONAL_BIND_HPP + +#include +#include +#include + +#include +#include + +namespace boost { +namespace compute { +namespace placeholders { + +/// \internal_ +template +struct placeholder : boost::integral_constant +{ + placeholder() { } +}; + +placeholder<0> const _1; +placeholder<1> const _2; + +} // end placeholders namespace + +/// Meta-function returning \c true if \c T is a placeholder type. +template +struct is_placeholder : boost::false_type +{ +}; + +/// \internal_ +template +struct is_placeholder > : boost::true_type +{ +}; + +namespace detail { + +template +struct invoked_bound_function +{ + invoked_bound_function(Function f, BoundArgs bound_args, Args args) + : m_function(f), + m_bound_args(bound_args), + m_args(args) + { + } + + // meta-function returning true if the N'th argument is a placeholder + template + struct is_placeholder_arg + { + typedef typename boost::tuples::element::type nth_bound_arg; + + typedef typename is_placeholder::type type; + static const bool value = is_placeholder::value; + }; + + template + struct get_arg_type + { + typedef Arg type; + }; + + template + struct get_arg_type > + { + typedef typename boost::tuples::element::type type; + }; + + // meta-function returning the type of the N'th argument when invoked + template + struct get_nth_arg_type + { + typedef typename boost::tuples::element::type nth_bound_arg; + + typedef typename get_arg_type::type type; + }; + + template + typename get_nth_arg_type::type get_nth_arg( + typename boost::enable_if_c::value>::type* = 0 + ) const + { + typedef typename boost::tuples::element::type nth_bound_arg; + + return boost::get(m_args); + } + + template + typename get_nth_arg_type::type get_nth_arg( + typename boost::disable_if_c::value>::type* = 0 + ) const + { + return boost::get(m_bound_args); + } + + Function m_function; + BoundArgs m_bound_args; + Args m_args; +}; + +template +inline meta_kernel& apply_invoked_bound_function( + meta_kernel &k, + const invoked_bound_function &expr, + typename boost::enable_if_c< + boost::tuples::length::value == 1 + >::type* = 0 +) +{ + return k << expr.m_function(expr.template get_nth_arg<0>()); +} + +template +inline meta_kernel& apply_invoked_bound_function( + meta_kernel &k, + const invoked_bound_function &expr, + typename boost::enable_if_c< + boost::tuples::length::value == 2 + >::type* = 0 +) +{ + return k << expr.m_function(expr.template get_nth_arg<0>(), + expr.template get_nth_arg<1>()); +} + +template +inline meta_kernel& apply_invoked_bound_function( + meta_kernel &k, + const invoked_bound_function &expr, + typename boost::enable_if_c< + boost::tuples::length::value == 3 + >::type* = 0 +) +{ + return k << expr.m_function(expr.template get_nth_arg<0>(), + expr.template get_nth_arg<1>(), + expr.template get_nth_arg<2>()); +} + +template +inline meta_kernel& operator<<( + meta_kernel &k, + const invoked_bound_function &expr +) +{ + return apply_invoked_bound_function(k, expr); +} + +template +struct bound_function +{ + typedef int result_type; + + bound_function(Function f, BoundArgs args) + : m_function(f), + m_args(args) + { + } + + template + detail::invoked_bound_function< + Function, + BoundArgs, + boost::tuple + > + operator()(const Arg1 &arg1) const + { + return detail::invoked_bound_function< + Function, + BoundArgs, + boost::tuple + >(m_function, m_args, boost::make_tuple(arg1)); + } + + template + detail::invoked_bound_function< + Function, + BoundArgs, + boost::tuple + > + operator()(const Arg1 &arg1, const Arg2 &arg2) const + { + return detail::invoked_bound_function< + Function, + BoundArgs, + boost::tuple + >(m_function, m_args, boost::make_tuple(arg1, arg2)); + } + + Function m_function; + BoundArgs m_args; +}; + +} // end detail namespace + +#if !defined(BOOST_COMPUTE_NO_VARIADIC_TEMPLATES) || defined(BOOST_COMPUTE_DOXYGEN_INVOKED) +/// Returns a function wrapper which invokes \p f with \p args when called. +/// +/// For example, to generate a unary function object which returns \c true +/// when its argument is less than \c 7: +/// \code +/// using boost::compute::less; +/// using boost::compute::placeholders::_1; +/// +/// auto less_than_seven = boost::compute::bind(less(), _1, 7); +/// \endcode +template +inline detail::bound_function > +bind(F f, Args... args) +{ + typedef typename boost::tuple ArgsTuple; + + return detail::bound_function(f, boost::make_tuple(args...)); +} +#else +template +inline detail::bound_function > +bind(F f, A1 a1) +{ + typedef typename boost::tuple Args; + + return detail::bound_function(f, boost::make_tuple(a1)); +} + +template +inline detail::bound_function > +bind(F f, A1 a1, A2 a2) +{ + typedef typename boost::tuple Args; + + return detail::bound_function(f, boost::make_tuple(a1, a2)); +} + +template +inline detail::bound_function > +bind(F f, A1 a1, A2 a2, A3 a3) +{ + typedef typename boost::tuple Args; + + return detail::bound_function(f, boost::make_tuple(a1, a2, a3)); +} +#endif // BOOST_COMPUTE_NO_VARIADIC_TEMPLATES + +} // end compute namespace +} // end boost namespace + +#endif // BOOST_COMPUTE_FUNCTIONAL_BIND_HPP diff --git a/3party/boost/boost/compute/functional/common.hpp b/3party/boost/boost/compute/functional/common.hpp new file mode 100644 index 0000000000..9ad8b43502 --- /dev/null +++ b/3party/boost/boost/compute/functional/common.hpp @@ -0,0 +1,29 @@ +//---------------------------------------------------------------------------// +// Copyright (c) 2013 Kyle Lutz +// +// 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 +// +// See http://boostorg.github.com/compute for more information. +//---------------------------------------------------------------------------// + +#ifndef BOOST_COMPUTE_FUNCTIONAL_COMMON_HPP +#define BOOST_COMPUTE_FUNCTIONAL_COMMON_HPP + +#include + +namespace boost { +namespace compute { + +BOOST_COMPUTE_DECLARE_BUILTIN_FUNCTION(clamp, T (T, T, T), class T) +BOOST_COMPUTE_DECLARE_BUILTIN_FUNCTION(degrees, T (T), class T) +BOOST_COMPUTE_DECLARE_BUILTIN_FUNCTION(radians, T (T), class T) +BOOST_COMPUTE_DECLARE_BUILTIN_FUNCTION(sign, T (T), class T) +BOOST_COMPUTE_DECLARE_BUILTIN_FUNCTION(smoothstep, T (T, T, T), class T) +BOOST_COMPUTE_DECLARE_BUILTIN_FUNCTION(step, T (T, T), class T) + +} // end compute namespace +} // end boost namespace + +#endif // BOOST_COMPUTE_FUNCTIONAL_COMMON_HPP diff --git a/3party/boost/boost/compute/functional/convert.hpp b/3party/boost/boost/compute/functional/convert.hpp new file mode 100644 index 0000000000..f182e8ec72 --- /dev/null +++ b/3party/boost/boost/compute/functional/convert.hpp @@ -0,0 +1,51 @@ +//---------------------------------------------------------------------------// +// Copyright (c) 2013 Kyle Lutz +// +// 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 +// +// See http://boostorg.github.com/compute for more information. +//---------------------------------------------------------------------------// + +#ifndef BOOST_COMPUTE_FUNCTIONAL_CONVERT_HPP +#define BOOST_COMPUTE_FUNCTIONAL_CONVERT_HPP + +namespace boost { +namespace compute { +namespace detail { + +template +struct invoked_convert +{ + invoked_convert(const Arg &arg) + : m_arg(arg) + { + } + + Arg m_arg; +}; + +} // end detail namespace + +/// The \ref convert function converts its argument to type \c T (similar to +/// static_cast). +/// +/// \see \ref as "as" +template +struct convert +{ + typedef T result_type; + + /// \internal_ + template + detail::invoked_convert operator()(const Arg &arg) const + { + return detail::invoked_convert(arg); + } +}; + +} // end compute namespace +} // end boost namespace + +#endif // BOOST_COMPUTE_FUNCTIONAL_CONVERT_HPP diff --git a/3party/boost/boost/compute/functional/detail/macros.hpp b/3party/boost/boost/compute/functional/detail/macros.hpp new file mode 100644 index 0000000000..71ae3722e5 --- /dev/null +++ b/3party/boost/boost/compute/functional/detail/macros.hpp @@ -0,0 +1,35 @@ +//---------------------------------------------------------------------------// +// Copyright (c) 2013 Kyle Lutz +// +// 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 +// +// See http://boostorg.github.com/compute for more information. +//---------------------------------------------------------------------------// + +#ifndef BOOST_COMPUTE_FUNCTIONAL_MACROS_HPP +#define BOOST_COMPUTE_FUNCTIONAL_MACROS_HPP + +#include +#include + +#include + +#define BOOST_COMPUTE_DECLARE_BUILTIN_FUNCTION(name, signature, template_args) \ + template \ + class name : public function \ + { \ + public: \ + (name)() : function(BOOST_PP_STRINGIZE(name)) { } \ + }; + +#define BOOST_COMPUTE_DECLARE_BUILTIN_FUNCTION_UNDERSCORE(name, signature, template_args) \ + template \ + class BOOST_PP_CAT(name, _) : public function \ + { \ + public: \ + BOOST_PP_CAT(name, _)() : function(BOOST_PP_STRINGIZE(name)) { } \ + }; + +#endif // BOOST_COMPUTE_FUNCTIONAL_MACROS_HPP diff --git a/3party/boost/boost/compute/functional/detail/nvidia_ballot.hpp b/3party/boost/boost/compute/functional/detail/nvidia_ballot.hpp new file mode 100644 index 0000000000..cf66828f1c --- /dev/null +++ b/3party/boost/boost/compute/functional/detail/nvidia_ballot.hpp @@ -0,0 +1,48 @@ +//---------------------------------------------------------------------------// +// Copyright (c) 2013 Kyle Lutz +// +// 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 +// +// See http://boostorg.github.com/compute for more information. +//---------------------------------------------------------------------------// + +#ifndef BOOST_COMPUTE_FUNCTIONAL_DETAIL_NVIDIA_BALLOT_HPP +#define BOOST_COMPUTE_FUNCTIONAL_DETAIL_NVIDIA_BALLOT_HPP + +#include +#include + +namespace boost { +namespace compute { +namespace detail { + +template +class nvidia_ballot : public function +{ +public: + nvidia_ballot() + : function("nvidia_ballot") + { + this->set_source( + "inline uint nvidia_ballot(const uint x)\n" + "{\n" + " uint result;\n" + " asm volatile(\n" + " \"setp.ne.u32 %%p1, %1, 0;\"\n" + " \"vote.ballot.b32 %0, %%p1;\"\n" + " : \"=r\"(result)\n" + " : \"r\"(x)\n" + " );\n" + " return result;\n" + "}\n" + ); + } +}; + +} // end detail namespace +} // end compute namespace +} // end boost namespace + +#endif // BOOST_COMPUTE_FUNCTIONAL_DETAIL_NVIDIA_BALLOT_HPP diff --git a/3party/boost/boost/compute/functional/detail/nvidia_popcount.hpp b/3party/boost/boost/compute/functional/detail/nvidia_popcount.hpp new file mode 100644 index 0000000000..b042ea4ba9 --- /dev/null +++ b/3party/boost/boost/compute/functional/detail/nvidia_popcount.hpp @@ -0,0 +1,42 @@ +//---------------------------------------------------------------------------// +// Copyright (c) 2013 Kyle Lutz +// +// 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 +// +// See http://boostorg.github.com/compute for more information. +//---------------------------------------------------------------------------// + +#ifndef BOOST_COMPUTE_FUNCTIONAL_DETAIL_NVIDIA_POPCOUNT_HPP +#define BOOST_COMPUTE_FUNCTIONAL_DETAIL_NVIDIA_POPCOUNT_HPP + +#include + +namespace boost { +namespace compute { +namespace detail { + +template +class nvidia_popcount : public function +{ +public: + nvidia_popcount() + : function("nvidia_popcount") + { + this->set_source( + "inline uint nvidia_popcount(const uint x)\n" + "{\n" + " uint count;\n" + " asm(\"popc.b32 %0, %1;\" : \"=r\"(count) : \"r\"(x));\n" + " return count;\n" + "}\n" + ); + } +}; + +} // end detail namespace +} // end compute namespace +} // end boost namespace + +#endif // BOOST_COMPUTE_FUNCTIONAL_DETAIL_NVIDIA_POPCOUNT_HPP diff --git a/3party/boost/boost/compute/functional/detail/unpack.hpp b/3party/boost/boost/compute/functional/detail/unpack.hpp new file mode 100644 index 0000000000..e64672f142 --- /dev/null +++ b/3party/boost/boost/compute/functional/detail/unpack.hpp @@ -0,0 +1,143 @@ +//---------------------------------------------------------------------------// +// Copyright (c) 2013 Kyle Lutz +// +// 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 +// +// See http://boostorg.github.com/compute for more information. +//---------------------------------------------------------------------------// + +#ifndef BOOST_COMPUTE_FUNCTIONAL_DETAIL_UNPACK_HPP +#define BOOST_COMPUTE_FUNCTIONAL_DETAIL_UNPACK_HPP + +#include +#include +#include +#include +#include + +namespace boost { +namespace compute { +namespace detail { + +template +struct invoked_unpacked +{ + invoked_unpacked(const Function &f, const Arg &arg) + : m_function(f), + m_arg(arg) + { + } + + Function m_function; + Arg m_arg; +}; + +template +inline meta_kernel& operator<<(meta_kernel &k, const invoked_unpacked &expr); + +template +inline meta_kernel& operator<<(meta_kernel &k, const invoked_unpacked &expr) +{ + return k << expr.m_function(get<0>()(expr.m_arg)); +} + +template +inline meta_kernel& operator<<(meta_kernel &k, const invoked_unpacked &expr) +{ + return k << expr.m_function(get<0>()(expr.m_arg), get<1>()(expr.m_arg)); +} + +template +inline meta_kernel& operator<<(meta_kernel &k, const invoked_unpacked &expr) +{ + return k << expr.m_function(get<0>()(expr.m_arg), get<1>()(expr.m_arg), get<2>()(expr.m_arg)); +} + +template +struct unpacked +{ + template + struct aggregate_length + { + BOOST_STATIC_CONSTANT(size_t, value = boost::tuples::length::value); + }; + + template + struct aggregate_length >::type> + { + BOOST_STATIC_CONSTANT(size_t, value = vector_size::value); + }; + + template + struct result_impl {}; + + template + struct result_impl + { + typedef typename detail::get_result_type<0, TupleArg>::type T1; + + typedef typename boost::compute::result_of::type type; + }; + + template + struct result_impl + { + typedef typename detail::get_result_type<0, TupleArg>::type T1; + typedef typename detail::get_result_type<1, TupleArg>::type T2; + + typedef typename boost::compute::result_of::type type; + }; + + template + struct result_impl + { + typedef typename detail::get_result_type<0, TupleArg>::type T1; + typedef typename detail::get_result_type<1, TupleArg>::type T2; + typedef typename detail::get_result_type<2, TupleArg>::type T3; + + typedef typename boost::compute::result_of::type type; + }; + + template + struct result {}; + + template + struct result + { + typedef typename result_impl::value>::type type; + }; + + unpacked(const Function &f) + : m_function(f) + { + } + + template + detail::invoked_unpacked< + Function, Arg, aggregate_length::value + > + operator()(const Arg &arg) const + { + return detail::invoked_unpacked< + Function, + Arg, + aggregate_length::value + >(m_function, arg); + } + + Function m_function; +}; + +template +inline unpacked unpack(const Function &f) +{ + return unpacked(f); +} + +} // end detail namespace +} // end compute namespace +} // end boost namespace + +#endif // BOOST_COMPUTE_FUNCTIONAL_DETAIL_UNPACK_HPP diff --git a/3party/boost/boost/compute/functional/field.hpp b/3party/boost/boost/compute/functional/field.hpp new file mode 100644 index 0000000000..cd9d81541c --- /dev/null +++ b/3party/boost/boost/compute/functional/field.hpp @@ -0,0 +1,86 @@ +//---------------------------------------------------------------------------// +// Copyright (c) 2013 Kyle Lutz +// +// 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 +// +// See http://boostorg.github.com/compute for more information. +//---------------------------------------------------------------------------// + +#ifndef BOOST_COMPUTE_FUNCTIONAL_FIELD_HPP +#define BOOST_COMPUTE_FUNCTIONAL_FIELD_HPP + +#include + +namespace boost { +namespace compute { +namespace detail { + +template +struct invoked_field +{ + typedef T result_type; + + invoked_field(const Arg &arg, const std::string &field) + : m_arg(arg), + m_field(field) + { + } + + Arg m_arg; + std::string m_field; +}; + +} // end detail namespace + +/// Returns the named field from a value. +/// +/// The template-type \c T specifies the field's value type. Note +/// that the value type must match the actual type of the field +/// otherwise runtime compilation or logic errors may occur. +/// +/// For example, to access the \c second field in a +/// \c std::pair object: +/// \code +/// field("second"); +/// \endcode +/// +/// This can also be used with vector types to access individual +/// components as well as perform swizzle operations. +/// +/// For example, to access the first and third components of an +/// \c int vector type (e.g. \c int4): +/// \code +/// field("xz"); +/// \endcode +/// +/// \see \ref get "get" +template +class field +{ +public: + /// Result type. + typedef T result_type; + + /// Creates a new field functor with \p field. + field(const std::string &field) + : m_field(field) + { + } + + /// \internal_ + template + detail::invoked_field operator()(const Arg &arg) const + { + return detail::invoked_field(arg, m_field); + } + +private: + std::string m_field; +}; + +} // end compute namespace +} // end boost namespace + +#endif // BOOST_COMPUTE_FUNCTIONAL_FIELD_HPP diff --git a/3party/boost/boost/compute/functional/geometry.hpp b/3party/boost/boost/compute/functional/geometry.hpp new file mode 100644 index 0000000000..ea37c02bfe --- /dev/null +++ b/3party/boost/boost/compute/functional/geometry.hpp @@ -0,0 +1,32 @@ +//---------------------------------------------------------------------------// +// Copyright (c) 2013 Kyle Lutz +// +// 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 +// +// See http://boostorg.github.com/compute for more information. +//---------------------------------------------------------------------------// + +#ifndef BOOST_COMPUTE_FUNCTIONAL_GEOMETRY_HPP +#define BOOST_COMPUTE_FUNCTIONAL_GEOMETRY_HPP + +#include +#include + +namespace boost { +namespace compute { + +BOOST_COMPUTE_DECLARE_BUILTIN_FUNCTION(cross, T (T, T), class T) +BOOST_COMPUTE_DECLARE_BUILTIN_FUNCTION(dot, typename scalar_type::type (T, T), class T) +BOOST_COMPUTE_DECLARE_BUILTIN_FUNCTION(distance, typename scalar_type::type (T, T), class T) +BOOST_COMPUTE_DECLARE_BUILTIN_FUNCTION(fast_distance, typename scalar_type::type (T, T), class T) +BOOST_COMPUTE_DECLARE_BUILTIN_FUNCTION(length, typename scalar_type::type (T), class T) +BOOST_COMPUTE_DECLARE_BUILTIN_FUNCTION(fast_length, typename scalar_type::type (T), class T) +BOOST_COMPUTE_DECLARE_BUILTIN_FUNCTION(normalize, T (T), class T) +BOOST_COMPUTE_DECLARE_BUILTIN_FUNCTION(fast_normalize, T (T), class T) + +} // end compute namespace +} // end boost namespace + +#endif // BOOST_COMPUTE_FUNCTIONAL_GEOMETRY_HPP diff --git a/3party/boost/boost/compute/functional/get.hpp b/3party/boost/boost/compute/functional/get.hpp new file mode 100644 index 0000000000..2d3b7a489c --- /dev/null +++ b/3party/boost/boost/compute/functional/get.hpp @@ -0,0 +1,76 @@ +//---------------------------------------------------------------------------// +// Copyright (c) 2013 Kyle Lutz +// +// 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 +// +// See http://boostorg.github.com/compute for more information. +//---------------------------------------------------------------------------// + +#ifndef BOOST_COMPUTE_FUNCTIONAL_GET_HPP +#define BOOST_COMPUTE_FUNCTIONAL_GET_HPP + +#include + +#include +#include + +namespace boost { +namespace compute { +namespace detail { + +// meta-function returning the result type for get() +template +struct get_result_type +{ + typedef typename scalar_type::type type; +}; + +template +struct invoked_get +{ + typedef typename get_result_type::type result_type; + + invoked_get(const Arg &arg) + : m_arg(arg) + { + } + + Arg m_arg; +}; + +} // end detail namespace + +/// Returns the \c N'th element of an aggregate type (e.g. scalarN, +/// pair, tuple, etc.). +/// +/// \see \ref field "field" +template +struct get +{ + /// \internal_ + template struct result; + + /// \internal_ + template + struct result + { + typedef typename detail::get_result_type::type type; + }; + + template + detail::invoked_get< + N, Arg, typename boost::remove_cv::type + > operator()(const Arg &arg) const + { + typedef typename boost::remove_cv::type T; + + return detail::invoked_get(arg); + } +}; + +} // end compute namespace +} // end boost namespace + +#endif // BOOST_COMPUTE_FUNCTIONAL_GET_HPP diff --git a/3party/boost/boost/compute/functional/hash.hpp b/3party/boost/boost/compute/functional/hash.hpp new file mode 100644 index 0000000000..830c422fdb --- /dev/null +++ b/3party/boost/boost/compute/functional/hash.hpp @@ -0,0 +1,91 @@ +//---------------------------------------------------------------------------// +// Copyright (c) 2013-2014 Kyle Lutz +// +// 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 +// +// See http://boostorg.github.com/compute for more information. +//---------------------------------------------------------------------------// + +#ifndef BOOST_COMPUTE_FUNCTIONAL_HASH_HPP +#define BOOST_COMPUTE_FUNCTIONAL_HASH_HPP + +#include +#include + +namespace boost { +namespace compute { +namespace detail { + +template +std::string make_hash_function_name() +{ + return std::string("boost_hash_") + type_name(); +} + +template +inline std::string make_hash_function_source() +{ + std::stringstream source; + source << "inline ulong " << make_hash_function_name() + << "(const " << type_name() << " x)\n" + << "{\n" + // note we reinterpret the argument as a 32-bit uint and + // then promote it to a 64-bit ulong for the result type + << " ulong a = as_uint(x);\n" + << " a = (a ^ 61) ^ (a >> 16);\n" + << " a = a + (a << 3);\n" + << " a = a ^ (a >> 4);\n" + << " a = a * 0x27d4eb2d;\n" + << " a = a ^ (a >> 15);\n" + << " return a;\n" + << "}\n"; + return source.str(); +} + +template +struct hash_impl +{ + typedef Key argument_type; + typedef ulong_ result_type; + + hash_impl() + : m_function("") + { + m_function = make_function_from_source( + make_hash_function_name(), + make_hash_function_source() + ); + } + + template + invoked_function > + operator()(const Arg &arg) const + { + return m_function(arg); + } + + function m_function; +}; + +} // end detail namespace + +/// The hash function returns a hash value for the input value. +/// +/// The return type is \c ulong_ (the OpenCL unsigned long type). +template struct hash; + +/// \internal_ +template<> struct hash : detail::hash_impl { }; + +/// \internal_ +template<> struct hash : detail::hash_impl { }; + +/// \internal_ +template<> struct hash : detail::hash_impl { }; + +} // end compute namespace +} // end boost namespace + +#endif // BOOST_COMPUTE_FUNCTIONAL_HASH_HPP diff --git a/3party/boost/boost/compute/functional/identity.hpp b/3party/boost/boost/compute/functional/identity.hpp new file mode 100644 index 0000000000..72740d9788 --- /dev/null +++ b/3party/boost/boost/compute/functional/identity.hpp @@ -0,0 +1,64 @@ +//---------------------------------------------------------------------------// +// Copyright (c) 2013-2014 Kyle Lutz +// +// 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 +// +// See http://boostorg.github.com/compute for more information. +//---------------------------------------------------------------------------// + +#ifndef BOOST_COMPUTE_FUNCTIONAL_IDENTITY_HPP +#define BOOST_COMPUTE_FUNCTIONAL_IDENTITY_HPP + +namespace boost { +namespace compute { +namespace detail { + +template +struct invoked_identity +{ + typedef T result_type; + + invoked_identity(const Arg &arg) + : m_arg(arg) + { + } + + Arg m_arg; +}; + +} // end detail namespace + +/// Identity function which simply returns its input. +/// +/// For example, to directly copy values using the transform() algorithm: +/// \code +/// transform(input.begin(), input.end(), output.begin(), identity(), queue); +/// \endcode +/// +/// \see \ref as "as", \ref convert "convert" +template +class identity +{ +public: + /// Identity function result type. + typedef T result_type; + + /// Creates a new identity function. + identity() + { + } + + /// \internal_ + template + detail::invoked_identity operator()(const Arg &arg) const + { + return detail::invoked_identity(arg); + } +}; + +} // end compute namespace +} // end boost namespace + +#endif // BOOST_COMPUTE_FUNCTIONAL_IDENTITY_HPP diff --git a/3party/boost/boost/compute/functional/integer.hpp b/3party/boost/boost/compute/functional/integer.hpp new file mode 100644 index 0000000000..8ff6c2bd4a --- /dev/null +++ b/3party/boost/boost/compute/functional/integer.hpp @@ -0,0 +1,30 @@ +//---------------------------------------------------------------------------// +// Copyright (c) 2013 Kyle Lutz +// +// 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 +// +// See http://boostorg.github.com/compute for more information. +//---------------------------------------------------------------------------// + +#ifndef BOOST_COMPUTE_FUNCTIONAL_INTEGER_HPP +#define BOOST_COMPUTE_FUNCTIONAL_INTEGER_HPP + +#include + +namespace boost { +namespace compute { + +BOOST_COMPUTE_DECLARE_BUILTIN_FUNCTION(abs, T (T), class T) +BOOST_COMPUTE_DECLARE_BUILTIN_FUNCTION(abs_diff, T (T, T), class T) +BOOST_COMPUTE_DECLARE_BUILTIN_FUNCTION(add_sat, T (T, T), class T) +BOOST_COMPUTE_DECLARE_BUILTIN_FUNCTION(hadd, T (T, T), class T) +BOOST_COMPUTE_DECLARE_BUILTIN_FUNCTION(rhadd, T (T, T), class T) +BOOST_COMPUTE_DECLARE_BUILTIN_FUNCTION(max, T (T, T), class T) +BOOST_COMPUTE_DECLARE_BUILTIN_FUNCTION(min, T (T, T), class T) + +} // end compute namespace +} // end boost namespace + +#endif // BOOST_COMPUTE_FUNCTIONAL_INTEGER_HPP diff --git a/3party/boost/boost/compute/functional/logical.hpp b/3party/boost/boost/compute/functional/logical.hpp new file mode 100644 index 0000000000..2e2c7518b5 --- /dev/null +++ b/3party/boost/boost/compute/functional/logical.hpp @@ -0,0 +1,208 @@ +//---------------------------------------------------------------------------// +// Copyright (c) 2013 Kyle Lutz +// +// 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 +// +// See http://boostorg.github.com/compute for more information. +//---------------------------------------------------------------------------// + +#ifndef BOOST_COMPUTE_FUNCTIONAL_LOGICAL_HPP +#define BOOST_COMPUTE_FUNCTIONAL_LOGICAL_HPP + +namespace boost { +namespace compute { +namespace detail { + +template +class invoked_unary_negate_function +{ +public: + typedef int result_type; + + invoked_unary_negate_function(const Predicate &pred, + const Expr &expr) + : m_pred(pred), + m_expr(expr) + { + } + + Predicate pred() const + { + return m_pred; + } + + Expr expr() const + { + return m_expr; + } + +private: + Predicate m_pred; + Expr m_expr; +}; + +template +class invoked_binary_negate_function +{ +public: + typedef int result_type; + + invoked_binary_negate_function(const Predicate &pred, + const Expr1 &expr1, + const Expr2 &expr2) + : m_pred(pred), + m_expr1(expr1), + m_expr2(expr2) + { + } + + Predicate pred() const + { + return m_pred; + } + + Expr1 expr1() const + { + return m_expr1; + } + + Expr2 expr2() const + { + return m_expr2; + } + +private: + Predicate m_pred; + Expr1 m_expr1; + Expr2 m_expr2; +}; + +} // end detail namespace + +/// \internal_ +template +struct unary_function +{ + typedef Arg argument_type; + typedef Result result_type; +}; + +/// \internal_ +template +struct binary_function +{ + typedef Arg1 first_argument_type; + typedef Arg2 second_argument_type; + typedef Result result_type; +}; + +/// \internal_ +template +struct ternary_function +{ + typedef Arg1 first_argument_type; + typedef Arg2 second_argument_type; + typedef Arg3 third_argument_type; + typedef Result result_type; +}; + +/// The unary_negate function adaptor negates a unary function. +/// +/// \see not1() +template +class unary_negate : public unary_function +{ +public: + explicit unary_negate(Predicate pred) + : m_pred(pred) + { + } + + /// \internal_ + template + detail::invoked_unary_negate_function + operator()(const Arg &arg) const + { + return detail::invoked_unary_negate_function< + Predicate, + Arg + >(m_pred, arg); + } + +private: + Predicate m_pred; +}; + +/// The binnary_negate function adaptor negates a binary function. +/// +/// \see not2() +template +class binary_negate : public binary_function +{ +public: + explicit binary_negate(Predicate pred) + : m_pred(pred) + { + } + + /// \internal_ + template + detail::invoked_binary_negate_function + operator()(const Arg1 &arg1, const Arg2 &arg2) const + { + return detail::invoked_binary_negate_function< + Predicate, + Arg1, + Arg2 + >(m_pred, arg1, arg2); + } + +private: + Predicate m_pred; +}; + +/// Returns a unary_negate adaptor around \p predicate. +/// +/// \param predicate the unary function to wrap +/// +/// \return a unary_negate wrapper around \p predicate +template +inline unary_negate not1(const Predicate &predicate) +{ + return unary_negate(predicate); +} + +/// Returns a binary_negate adaptor around \p predicate. +/// +/// \param predicate the binary function to wrap +/// +/// \return a binary_negate wrapper around \p predicate +template +inline binary_negate not2(const Predicate &predicate) +{ + return binary_negate(predicate); +} + +/// The logical_not function negates its argument and returns it. +/// +/// \see not1(), not2() +template +struct logical_not : public unary_function +{ + /// \internal_ + template + detail::invoked_function > + operator()(const Expr &expr) const + { + return detail::invoked_function >( + "!", std::string(), boost::make_tuple(expr) + ); + } +}; + +} // end compute namespace +} // end boost namespace + +#endif // BOOST_COMPUTE_FUNCTIONAL_LOGICAL_HPP diff --git a/3party/boost/boost/compute/functional/math.hpp b/3party/boost/boost/compute/functional/math.hpp new file mode 100644 index 0000000000..6dea05f6f2 --- /dev/null +++ b/3party/boost/boost/compute/functional/math.hpp @@ -0,0 +1,80 @@ +//---------------------------------------------------------------------------// +// Copyright (c) 2013 Kyle Lutz +// +// 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 +// +// See http://boostorg.github.com/compute for more information. +//---------------------------------------------------------------------------// + +#ifndef BOOST_COMPUTE_FUNCTIONAL_MATH_HPP +#define BOOST_COMPUTE_FUNCTIONAL_MATH_HPP + +#include + +namespace boost { +namespace compute { + +BOOST_COMPUTE_DECLARE_BUILTIN_FUNCTION(acos, T (T), class T) +BOOST_COMPUTE_DECLARE_BUILTIN_FUNCTION(acosh, T (T), class T) +BOOST_COMPUTE_DECLARE_BUILTIN_FUNCTION(acospi, T (T), class T) +BOOST_COMPUTE_DECLARE_BUILTIN_FUNCTION(asin, T (T), class T) +BOOST_COMPUTE_DECLARE_BUILTIN_FUNCTION(asinh, T (T), class T) +BOOST_COMPUTE_DECLARE_BUILTIN_FUNCTION(asinpi, T (T), class T) +BOOST_COMPUTE_DECLARE_BUILTIN_FUNCTION(atan, T (T), class T) +BOOST_COMPUTE_DECLARE_BUILTIN_FUNCTION(atan2, T (T, T), class T) +BOOST_COMPUTE_DECLARE_BUILTIN_FUNCTION(atanh, T (T), class T) +BOOST_COMPUTE_DECLARE_BUILTIN_FUNCTION(atanpi, T (T), class T) +BOOST_COMPUTE_DECLARE_BUILTIN_FUNCTION(atan2pi, T (T, T), class T) +BOOST_COMPUTE_DECLARE_BUILTIN_FUNCTION(cbrt, T (T), class T) +BOOST_COMPUTE_DECLARE_BUILTIN_FUNCTION(ceil, T (T), class T) +BOOST_COMPUTE_DECLARE_BUILTIN_FUNCTION(copysign, T (T, T), class T) +BOOST_COMPUTE_DECLARE_BUILTIN_FUNCTION(cos, T (T), class T) +BOOST_COMPUTE_DECLARE_BUILTIN_FUNCTION(cosh, T (T), class T) +BOOST_COMPUTE_DECLARE_BUILTIN_FUNCTION(cospi, T (T), class T) +BOOST_COMPUTE_DECLARE_BUILTIN_FUNCTION(erf, T (T), class T) +BOOST_COMPUTE_DECLARE_BUILTIN_FUNCTION(erfc, T (T), class T) +BOOST_COMPUTE_DECLARE_BUILTIN_FUNCTION(exp, T (T), class T) +BOOST_COMPUTE_DECLARE_BUILTIN_FUNCTION(exp2, T (T), class T) +BOOST_COMPUTE_DECLARE_BUILTIN_FUNCTION(exp10, T (T), class T) +BOOST_COMPUTE_DECLARE_BUILTIN_FUNCTION(expm1, T (T), class T) +BOOST_COMPUTE_DECLARE_BUILTIN_FUNCTION(fabs, T (T), class T) +BOOST_COMPUTE_DECLARE_BUILTIN_FUNCTION(fdim, T (T, T), class T) +BOOST_COMPUTE_DECLARE_BUILTIN_FUNCTION(floor, T (T), class T) +BOOST_COMPUTE_DECLARE_BUILTIN_FUNCTION(fma, T (T, T, T), class T) +BOOST_COMPUTE_DECLARE_BUILTIN_FUNCTION(fmax, T (T, T), class T) +BOOST_COMPUTE_DECLARE_BUILTIN_FUNCTION(fmin, T (T, T), class T) +BOOST_COMPUTE_DECLARE_BUILTIN_FUNCTION(fmod, T (T, T), class T) +BOOST_COMPUTE_DECLARE_BUILTIN_FUNCTION(hypot, T (T, T), class T) +BOOST_COMPUTE_DECLARE_BUILTIN_FUNCTION(ilogb, T (T), class T) +BOOST_COMPUTE_DECLARE_BUILTIN_FUNCTION(lgamma, T (T), class T) +BOOST_COMPUTE_DECLARE_BUILTIN_FUNCTION(log, T (T), class T) +BOOST_COMPUTE_DECLARE_BUILTIN_FUNCTION(log2, T (T), class T) +BOOST_COMPUTE_DECLARE_BUILTIN_FUNCTION(log10, T (T), class T) +BOOST_COMPUTE_DECLARE_BUILTIN_FUNCTION(log1p, T (T), class T) +BOOST_COMPUTE_DECLARE_BUILTIN_FUNCTION(logb, T (T), class T) +BOOST_COMPUTE_DECLARE_BUILTIN_FUNCTION(mad, T (T, T, T), class T) +BOOST_COMPUTE_DECLARE_BUILTIN_FUNCTION(nextafter, T (T, T), class T) +BOOST_COMPUTE_DECLARE_BUILTIN_FUNCTION(pow, T (T, T), class T) +BOOST_COMPUTE_DECLARE_BUILTIN_FUNCTION(pown, T (T, T), class T) +BOOST_COMPUTE_DECLARE_BUILTIN_FUNCTION(powr, T (T, T), class T) +BOOST_COMPUTE_DECLARE_BUILTIN_FUNCTION(remainder, T (T, T), class T) +BOOST_COMPUTE_DECLARE_BUILTIN_FUNCTION(rint, T (T), class T) +BOOST_COMPUTE_DECLARE_BUILTIN_FUNCTION(rootn, T (T), class T) +BOOST_COMPUTE_DECLARE_BUILTIN_FUNCTION(round, T (T), class T) +BOOST_COMPUTE_DECLARE_BUILTIN_FUNCTION(rsqrt, T (T), class T) +BOOST_COMPUTE_DECLARE_BUILTIN_FUNCTION(sin, T (T), class T) +BOOST_COMPUTE_DECLARE_BUILTIN_FUNCTION(sinh, T (T), class T) +BOOST_COMPUTE_DECLARE_BUILTIN_FUNCTION(sinpi, T (T), class T) +BOOST_COMPUTE_DECLARE_BUILTIN_FUNCTION(sqrt, T (T), class T) +BOOST_COMPUTE_DECLARE_BUILTIN_FUNCTION(tan, T (T), class T) +BOOST_COMPUTE_DECLARE_BUILTIN_FUNCTION(tanh, T (T), class T) +BOOST_COMPUTE_DECLARE_BUILTIN_FUNCTION(tanpi, T (T), class T) +BOOST_COMPUTE_DECLARE_BUILTIN_FUNCTION(tgamma, T (T), class T) +BOOST_COMPUTE_DECLARE_BUILTIN_FUNCTION(trunc, T (T), class T) + +} // end compute namespace +} // end boost namespace + +#endif // BOOST_COMPUTE_FUNCTIONAL_MATH_HPP diff --git a/3party/boost/boost/compute/functional/operator.hpp b/3party/boost/boost/compute/functional/operator.hpp new file mode 100644 index 0000000000..908372a326 --- /dev/null +++ b/3party/boost/boost/compute/functional/operator.hpp @@ -0,0 +1,100 @@ +//---------------------------------------------------------------------------// +// Copyright (c) 2013 Kyle Lutz +// +// 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 +// +// See http://boostorg.github.com/compute for more information. +//---------------------------------------------------------------------------// + +#ifndef BOOST_COMPUTE_FUNCTIONAL_OPERATORS_HPP +#define BOOST_COMPUTE_FUNCTIONAL_OPERATORS_HPP + +#include + +namespace boost { +namespace compute { +namespace detail { + +template +struct invoked_binary_operator +{ + typedef Result result_type; + + invoked_binary_operator(const std::string &op, + const Expr1 &arg1, + const Expr2 &arg2) + : m_op(op), + m_expr1(arg1), + m_expr2(arg2) + { + } + + std::string op() const + { + return m_op; + } + + Expr1 arg1() const + { + return m_expr1; + } + + Expr2 arg2() const + { + return m_expr2; + } + + std::string m_op; + Expr1 m_expr1; + Expr2 m_expr2; +}; + +} // end detail namespace + +/// \internal_ +#define BOOST_COMPUTE_DECLARE_BINARY_OPERATOR(name, op, return_type, arg_type) \ + template \ + class name : public function \ + { \ + public: \ + name() : function(BOOST_PP_STRINGIZE(name)) { } \ + \ + template \ + detail::invoked_binary_operator \ + operator()(const Arg1 &x, const Arg2 &y) const \ + { \ + return detail::invoked_binary_operator(op, x, y); \ + } \ + }; + +// arithmetic operations +BOOST_COMPUTE_DECLARE_BINARY_OPERATOR(plus, "+", T, T) +BOOST_COMPUTE_DECLARE_BINARY_OPERATOR(minus, "-", T, T) +BOOST_COMPUTE_DECLARE_BINARY_OPERATOR(multiplies, "*", T, T) +BOOST_COMPUTE_DECLARE_BINARY_OPERATOR(divides, "/", T, T) +BOOST_COMPUTE_DECLARE_BINARY_OPERATOR(modulus, "%", T, T) + +// comparisons +BOOST_COMPUTE_DECLARE_BINARY_OPERATOR(equal_to, "==", T, T) +BOOST_COMPUTE_DECLARE_BINARY_OPERATOR(not_equal_to, "!=", T, T) +BOOST_COMPUTE_DECLARE_BINARY_OPERATOR(greater, ">", T, T) +BOOST_COMPUTE_DECLARE_BINARY_OPERATOR(less, "<", T, T) +BOOST_COMPUTE_DECLARE_BINARY_OPERATOR(greater_equal, ">=", T, T) +BOOST_COMPUTE_DECLARE_BINARY_OPERATOR(less_equal, "<=", T, T) + +// logical operators +BOOST_COMPUTE_DECLARE_BINARY_OPERATOR(logical_and, "&&", T, T) +BOOST_COMPUTE_DECLARE_BINARY_OPERATOR(logical_or, "||", T, T) + +// bitwise operations +BOOST_COMPUTE_DECLARE_BINARY_OPERATOR(bit_and, "&", T, T) +BOOST_COMPUTE_DECLARE_BINARY_OPERATOR(bit_or, "|", T, T) +BOOST_COMPUTE_DECLARE_BINARY_OPERATOR(bit_xor, "^", T, T) +BOOST_COMPUTE_DECLARE_BINARY_OPERATOR(shift_left, "<<", T, T) +BOOST_COMPUTE_DECLARE_BINARY_OPERATOR(shift_right, ">>", T, T) + +} // end compute namespace +} // end boost namespace +#endif // BOOST_COMPUTE_FUNCTIONAL_OPERATORS_HPP diff --git a/3party/boost/boost/compute/functional/popcount.hpp b/3party/boost/boost/compute/functional/popcount.hpp new file mode 100644 index 0000000000..7326e7022f --- /dev/null +++ b/3party/boost/boost/compute/functional/popcount.hpp @@ -0,0 +1,55 @@ +//---------------------------------------------------------------------------// +// Copyright (c) 2013-2014 Kyle Lutz +// +// 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 +// +// See http://boostorg.github.com/compute for more information. +//---------------------------------------------------------------------------// + +#ifndef BOOST_COMPUTE_FUNCTIONAL_POPCOUNT_HPP +#define BOOST_COMPUTE_FUNCTIONAL_POPCOUNT_HPP + +#include +#include + +namespace boost { +namespace compute { + +/// Returns the number of non-zero bits in \p x. +/// +/// \see_opencl_ref{popcount} +template +class popcount : public function +{ +public: + popcount() + : function("boost_popcount") + { + std::stringstream s; + s << "inline " << type_name() << " boost_popcount" + << "(const " << type_name() << " x)\n" + << "{\n" + // use built-in popcount if opencl 1.2 is supported + << "#if __OPENCL_VERSION__ >= 120\n" + << " return popcount(x);\n" + // fallback to generic popcount() implementation + << "#else\n" + << " " << type_name() << " count = 0;\n" + << " for(" << type_name() << " i = 0; i < sizeof(i) * CHAR_BIT; i++){\n" + << " if(x & (" << type_name() << ") 1 << i){\n" + << " count++;\n" + << " }\n" + << " }\n" + << " return count;\n" + << "#endif\n" + << "}\n"; + this->set_source(s.str()); + } +}; + +} // end compute namespace +} // end boost namespace + +#endif // BOOST_COMPUTE_FUNCTIONAL_POPCOUNT_HPP diff --git a/3party/boost/boost/compute/functional/relational.hpp b/3party/boost/boost/compute/functional/relational.hpp new file mode 100644 index 0000000000..1a88052c05 --- /dev/null +++ b/3party/boost/boost/compute/functional/relational.hpp @@ -0,0 +1,39 @@ +//---------------------------------------------------------------------------// +// Copyright (c) 2013 Kyle Lutz +// +// 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 +// +// See http://boostorg.github.com/compute for more information. +//---------------------------------------------------------------------------// + +#ifndef BOOST_COMPUTE_FUNCTIONAL_RELATIONAL_HPP +#define BOOST_COMPUTE_FUNCTIONAL_RELATIONAL_HPP + +#include + +namespace boost { +namespace compute { + +BOOST_COMPUTE_DECLARE_BUILTIN_FUNCTION_UNDERSCORE(isequal, int (T, T), class T) +BOOST_COMPUTE_DECLARE_BUILTIN_FUNCTION_UNDERSCORE(isnotequal, int (T, T), class T) +BOOST_COMPUTE_DECLARE_BUILTIN_FUNCTION_UNDERSCORE(isgreater, int (T, T), class T) +BOOST_COMPUTE_DECLARE_BUILTIN_FUNCTION_UNDERSCORE(isgreaterequal, int (T, T), class T) +BOOST_COMPUTE_DECLARE_BUILTIN_FUNCTION_UNDERSCORE(isless, int (T, T), class T) +BOOST_COMPUTE_DECLARE_BUILTIN_FUNCTION_UNDERSCORE(islessequal, int (T, T), class T) +BOOST_COMPUTE_DECLARE_BUILTIN_FUNCTION_UNDERSCORE(islessgreater, int (T, T), class T) +BOOST_COMPUTE_DECLARE_BUILTIN_FUNCTION_UNDERSCORE(isfinite, int (T), class T) +BOOST_COMPUTE_DECLARE_BUILTIN_FUNCTION_UNDERSCORE(isinf, int (T), class T) +BOOST_COMPUTE_DECLARE_BUILTIN_FUNCTION_UNDERSCORE(isnan, int (T), class T) +BOOST_COMPUTE_DECLARE_BUILTIN_FUNCTION_UNDERSCORE(isnormal, int (T), class T) +BOOST_COMPUTE_DECLARE_BUILTIN_FUNCTION_UNDERSCORE(isordered, int (T), class T) +BOOST_COMPUTE_DECLARE_BUILTIN_FUNCTION_UNDERSCORE(isunordered, int (T), class T) +BOOST_COMPUTE_DECLARE_BUILTIN_FUNCTION_UNDERSCORE(signbit, int (T), class T) +BOOST_COMPUTE_DECLARE_BUILTIN_FUNCTION(any, int (T), class T) +BOOST_COMPUTE_DECLARE_BUILTIN_FUNCTION(all, int (T), class T) + +} // end compute namespace +} // end boost namespace + +#endif // BOOST_COMPUTE_FUNCTIONAL_RELATIONAL_HPP diff --git a/3party/boost/boost/compute/image.hpp b/3party/boost/boost/compute/image.hpp new file mode 100644 index 0000000000..1a7b9ca061 --- /dev/null +++ b/3party/boost/boost/compute/image.hpp @@ -0,0 +1,25 @@ +//---------------------------------------------------------------------------// +// Copyright (c) 2013-2015 Kyle Lutz +// +// 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 +// +// See http://boostorg.github.com/compute for more information. +//---------------------------------------------------------------------------// + +#ifndef BOOST_COMPUTE_IMAGE_HPP +#define BOOST_COMPUTE_IMAGE_HPP + +/// \file +/// +/// Meta-header to include all Boost.Compute image headers. + +#include +#include +#include +#include +#include +#include + +#endif // BOOST_COMPUTE_IMAGE_HPP diff --git a/3party/boost/boost/compute/image/image1d.hpp b/3party/boost/boost/compute/image/image1d.hpp new file mode 100644 index 0000000000..2d71934ab4 --- /dev/null +++ b/3party/boost/boost/compute/image/image1d.hpp @@ -0,0 +1,204 @@ +//---------------------------------------------------------------------------// +// Copyright (c) 2013-2015 Kyle Lutz +// +// 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 +// +// See http://boostorg.github.com/compute for more information. +//---------------------------------------------------------------------------// + +#ifndef BOOST_COMPUTE_IMAGE_IMAGE1D_HPP +#define BOOST_COMPUTE_IMAGE_IMAGE1D_HPP + +#include + +#include +#include +#include +#include +#include +#include + +namespace boost { +namespace compute { + +// forward declarations +class command_queue; + +/// \class image1d +/// \brief An OpenCL 1D image object +/// +/// \opencl_version_warning{1,2} +/// +/// \see image_format, image2d +class image1d : public image_object +{ +public: + /// Creates a null image1d object. + image1d() + : image_object() + { + } + + /// Creates a new image1d object. + /// + /// \see_opencl_ref{clCreateImage} + image1d(const context &context, + size_t image_width, + const image_format &format, + cl_mem_flags flags = read_write, + void *host_ptr = 0) + { + #ifdef CL_VERSION_1_2 + cl_image_desc desc; + desc.image_type = CL_MEM_OBJECT_IMAGE1D; + desc.image_width = image_width; + desc.image_height = 1; + desc.image_depth = 1; + desc.image_array_size = 0; + desc.image_row_pitch = 0; + desc.image_slice_pitch = 0; + desc.num_mip_levels = 0; + desc.num_samples = 0; + #ifdef CL_VERSION_2_0 + desc.mem_object = 0; + #else + desc.buffer = 0; + #endif + + cl_int error = 0; + + m_mem = clCreateImage( + context, flags, format.get_format_ptr(), &desc, host_ptr, &error + ); + + if(!m_mem){ + BOOST_THROW_EXCEPTION(opencl_error(error)); + } + #else + // image1d objects are only supported in OpenCL 1.2 and later + BOOST_THROW_EXCEPTION(opencl_error(CL_IMAGE_FORMAT_NOT_SUPPORTED)); + #endif + } + + /// Creates a new image1d as a copy of \p other. + image1d(const image1d &other) + : image_object(other) + { + } + + /// Copies the image1d from \p other. + image1d& operator=(const image1d &other) + { + image_object::operator=(other); + + return *this; + } + + #ifndef BOOST_COMPUTE_NO_RVALUE_REFERENCES + /// Move-constructs a new image object from \p other. + image1d(image1d&& other) BOOST_NOEXCEPT + : image_object(std::move(other)) + { + } + + /// Move-assigns the image from \p other to \c *this. + image1d& operator=(image1d&& other) BOOST_NOEXCEPT + { + image_object::operator=(std::move(other)); + + return *this; + } + #endif // BOOST_COMPUTE_NO_RVALUE_REFERENCES + + /// Destroys the image1d object. + ~image1d() + { + } + + /// Returns the size (width) of the image. + extents<1> size() const + { + extents<1> size; + size[0] = get_info(CL_IMAGE_WIDTH); + return size; + } + + /// Returns the origin of the image (\c 0). + extents<1> origin() const + { + return extents<1>(); + } + + /// Returns information about the image. + /// + /// \see_opencl_ref{clGetImageInfo} + template + T get_info(cl_image_info info) const + { + return get_image_info(info); + } + + /// \overload + template + typename detail::get_object_info_type::type + get_info() const; + + /// Returns the supported image formats for the context. + /// + /// \see_opencl_ref{clGetSupportedImageFormats} + static std::vector + get_supported_formats(const context &context, cl_mem_flags flags = read_write) + { + #ifdef CL_VERSION_1_2 + return image_object::get_supported_formats(context, CL_MEM_OBJECT_IMAGE1D, flags); + #else + return std::vector(); + #endif + } + + /// Returns \c true if \p format is a supported 1D image format for + /// \p context. + static bool is_supported_format(const image_format &format, + const context &context, + cl_mem_flags flags = read_write) + { + #ifdef CL_VERSION_1_2 + return image_object::is_supported_format( + format, context, CL_MEM_OBJECT_IMAGE1D, flags + ); + #else + return false; + #endif + } + + /// Creates a new image with a copy of the data in \c *this. Uses \p queue + /// to perform the copy operation. + image1d clone(command_queue &queue) const; +}; + +/// \internal_ define get_info() specializations for image1d +BOOST_COMPUTE_DETAIL_DEFINE_GET_INFO_SPECIALIZATIONS(image1d, + ((cl_image_format, CL_IMAGE_FORMAT)) + ((size_t, CL_IMAGE_ELEMENT_SIZE)) + ((size_t, CL_IMAGE_ROW_PITCH)) + ((size_t, CL_IMAGE_SLICE_PITCH)) + ((size_t, CL_IMAGE_WIDTH)) + ((size_t, CL_IMAGE_HEIGHT)) + ((size_t, CL_IMAGE_DEPTH)) +) + +namespace detail { + +// set_kernel_arg() specialization for image1d +template<> +struct set_kernel_arg : public set_kernel_arg { }; + +} // end detail namespace +} // end compute namespace +} // end boost namespace + +BOOST_COMPUTE_TYPE_NAME(boost::compute::image1d, image1d_t) + +#endif // BOOST_COMPUTE_IMAGE_IMAGE1D_HPP diff --git a/3party/boost/boost/compute/image/image2d.hpp b/3party/boost/boost/compute/image/image2d.hpp new file mode 100644 index 0000000000..c203a9417f --- /dev/null +++ b/3party/boost/boost/compute/image/image2d.hpp @@ -0,0 +1,262 @@ +//---------------------------------------------------------------------------// +// Copyright (c) 2013-2015 Kyle Lutz +// +// 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 +// +// See http://boostorg.github.com/compute for more information. +//---------------------------------------------------------------------------// + +#ifndef BOOST_COMPUTE_IMAGE_IMAGE2D_HPP +#define BOOST_COMPUTE_IMAGE_IMAGE2D_HPP + +#include + +#include +#include +#include +#include +#include +#include +#include +#include + +namespace boost { +namespace compute { + +// forward declarations +class command_queue; + +/// \class image2d +/// \brief An OpenCL 2D image object +/// +/// For example, to create a 640x480 8-bit RGBA image: +/// +/// \snippet test/test_image2d.cpp create_image +/// +/// \see image_format, image3d +class image2d : public image_object +{ +public: + /// Creates a null image2d object. + image2d() + : image_object() + { + } + + /// Creates a new image2d object. + /// + /// \see_opencl_ref{clCreateImage} + image2d(const context &context, + size_t image_width, + size_t image_height, + const image_format &format, + cl_mem_flags flags = read_write, + void *host_ptr = 0, + size_t image_row_pitch = 0) + { + cl_int error = 0; + + #ifdef CL_VERSION_1_2 + cl_image_desc desc; + desc.image_type = CL_MEM_OBJECT_IMAGE2D; + desc.image_width = image_width; + desc.image_height = image_height; + desc.image_depth = 1; + desc.image_array_size = 0; + desc.image_row_pitch = image_row_pitch; + desc.image_slice_pitch = 0; + desc.num_mip_levels = 0; + desc.num_samples = 0; + #ifdef CL_VERSION_2_0 + desc.mem_object = 0; + #else + desc.buffer = 0; + #endif + + m_mem = clCreateImage(context, + flags, + format.get_format_ptr(), + &desc, + host_ptr, + &error); + #else + m_mem = clCreateImage2D(context, + flags, + format.get_format_ptr(), + image_width, + image_height, + image_row_pitch, + host_ptr, + &error); + #endif + + if(!m_mem){ + BOOST_THROW_EXCEPTION(opencl_error(error)); + } + } + + /// \internal_ (deprecated) + image2d(const context &context, + cl_mem_flags flags, + const image_format &format, + size_t image_width, + size_t image_height, + size_t image_row_pitch = 0, + void *host_ptr = 0) + { + cl_int error = 0; + + #ifdef CL_VERSION_1_2 + cl_image_desc desc; + desc.image_type = CL_MEM_OBJECT_IMAGE2D; + desc.image_width = image_width; + desc.image_height = image_height; + desc.image_depth = 1; + desc.image_array_size = 0; + desc.image_row_pitch = image_row_pitch; + desc.image_slice_pitch = 0; + desc.num_mip_levels = 0; + desc.num_samples = 0; + #ifdef CL_VERSION_2_0 + desc.mem_object = 0; + #else + desc.buffer = 0; + #endif + + m_mem = clCreateImage(context, + flags, + format.get_format_ptr(), + &desc, + host_ptr, + &error); + #else + m_mem = clCreateImage2D(context, + flags, + format.get_format_ptr(), + image_width, + image_height, + image_row_pitch, + host_ptr, + &error); + #endif + + if(!m_mem){ + BOOST_THROW_EXCEPTION(opencl_error(error)); + } + } + + /// Creates a new image2d as a copy of \p other. + image2d(const image2d &other) + : image_object(other) + { + } + + /// Copies the image2d from \p other. + image2d& operator=(const image2d &other) + { + image_object::operator=(other); + + return *this; + } + + #ifndef BOOST_COMPUTE_NO_RVALUE_REFERENCES + /// Move-constructs a new image object from \p other. + image2d(image2d&& other) BOOST_NOEXCEPT + : image_object(std::move(other)) + { + } + + /// Move-assigns the image from \p other to \c *this. + image2d& operator=(image2d&& other) BOOST_NOEXCEPT + { + image_object::operator=(std::move(other)); + + return *this; + } + #endif // BOOST_COMPUTE_NO_RVALUE_REFERENCES + + /// Destroys the image2d object. + ~image2d() + { + } + + /// Returns the size (width, height) of the image. + extents<2> size() const + { + extents<2> size; + size[0] = get_info(CL_IMAGE_WIDTH); + size[1] = get_info(CL_IMAGE_HEIGHT); + return size; + } + + /// Returns the origin of the image (\c 0, \c 0). + extents<2> origin() const + { + return extents<2>(); + } + + /// Returns information about the image. + /// + /// \see_opencl_ref{clGetImageInfo} + template + T get_info(cl_image_info info) const + { + return detail::get_object_info(clGetImageInfo, m_mem, info); + } + + /// \overload + template + typename detail::get_object_info_type::type + get_info() const; + + /// Returns the supported image formats for the context. + /// + /// \see_opencl_ref{clGetSupportedImageFormats} + static std::vector + get_supported_formats(const context &context, cl_mem_flags flags = read_write) + { + return image_object::get_supported_formats(context, CL_MEM_OBJECT_IMAGE2D, flags); + } + + /// Returns \c true if \p format is a supported 2D image format for + /// \p context. + static bool is_supported_format(const image_format &format, + const context &context, + cl_mem_flags flags = read_write) + { + return image_object::is_supported_format( + format, context, CL_MEM_OBJECT_IMAGE2D, flags + ); + } + + /// Creates a new image with a copy of the data in \c *this. Uses \p queue + /// to perform the copy operation. + image2d clone(command_queue &queue) const; +}; + +/// \internal_ define get_info() specializations for image2d +BOOST_COMPUTE_DETAIL_DEFINE_GET_INFO_SPECIALIZATIONS(image2d, + ((cl_image_format, CL_IMAGE_FORMAT)) + ((size_t, CL_IMAGE_ELEMENT_SIZE)) + ((size_t, CL_IMAGE_ROW_PITCH)) + ((size_t, CL_IMAGE_SLICE_PITCH)) + ((size_t, CL_IMAGE_WIDTH)) + ((size_t, CL_IMAGE_HEIGHT)) + ((size_t, CL_IMAGE_DEPTH)) +) + +namespace detail { + +// set_kernel_arg() specialization for image2d +template<> +struct set_kernel_arg : public set_kernel_arg { }; + +} // end detail namespace +} // end compute namespace +} // end boost namespace + +BOOST_COMPUTE_TYPE_NAME(boost::compute::image2d, image2d_t) + +#endif // BOOST_COMPUTE_IMAGE_IMAGE2D_HPP diff --git a/3party/boost/boost/compute/image/image3d.hpp b/3party/boost/boost/compute/image/image3d.hpp new file mode 100644 index 0000000000..9463cfaa16 --- /dev/null +++ b/3party/boost/boost/compute/image/image3d.hpp @@ -0,0 +1,265 @@ +//---------------------------------------------------------------------------// +// Copyright (c) 2013-2015 Kyle Lutz +// +// 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 +// +// See http://boostorg.github.com/compute for more information. +//---------------------------------------------------------------------------// + +#ifndef BOOST_COMPUTE_IMAGE_IMAGE3D_HPP +#define BOOST_COMPUTE_IMAGE_IMAGE3D_HPP + +#include + +#include +#include +#include +#include +#include +#include + +namespace boost { +namespace compute { + +// forward declarations +class command_queue; + +/// \class image3d +/// \brief An OpenCL 3D image object +/// +/// \see image_format, image2d +class image3d : public image_object +{ +public: + /// Creates a null image3d object. + image3d() + : image_object() + { + } + + /// Creates a new image3d object. + /// + /// \see_opencl_ref{clCreateImage} + image3d(const context &context, + size_t image_width, + size_t image_height, + size_t image_depth, + const image_format &format, + cl_mem_flags flags = read_write, + void *host_ptr = 0, + size_t image_row_pitch = 0, + size_t image_slice_pitch = 0) + { + cl_int error = 0; + + #ifdef CL_VERSION_1_2 + cl_image_desc desc; + desc.image_type = CL_MEM_OBJECT_IMAGE3D; + desc.image_width = image_width; + desc.image_height = image_height; + desc.image_depth = image_depth; + desc.image_array_size = 0; + desc.image_row_pitch = image_row_pitch; + desc.image_slice_pitch = image_slice_pitch; + desc.num_mip_levels = 0; + desc.num_samples = 0; + #ifdef CL_VERSION_2_0 + desc.mem_object = 0; + #else + desc.buffer = 0; + #endif + + m_mem = clCreateImage(context, + flags, + format.get_format_ptr(), + &desc, + host_ptr, + &error); + #else + m_mem = clCreateImage3D(context, + flags, + format.get_format_ptr(), + image_width, + image_height, + image_depth, + image_row_pitch, + image_slice_pitch, + host_ptr, + &error); + #endif + + if(!m_mem){ + BOOST_THROW_EXCEPTION(opencl_error(error)); + } + } + + /// \internal_ (deprecated) + image3d(const context &context, + cl_mem_flags flags, + const image_format &format, + size_t image_width, + size_t image_height, + size_t image_depth, + size_t image_row_pitch, + size_t image_slice_pitch = 0, + void *host_ptr = 0) + { + cl_int error = 0; + + #ifdef CL_VERSION_1_2 + cl_image_desc desc; + desc.image_type = CL_MEM_OBJECT_IMAGE3D; + desc.image_width = image_width; + desc.image_height = image_height; + desc.image_depth = image_depth; + desc.image_array_size = 0; + desc.image_row_pitch = image_row_pitch; + desc.image_slice_pitch = image_slice_pitch; + desc.num_mip_levels = 0; + desc.num_samples = 0; + #ifdef CL_VERSION_2_0 + desc.mem_object = 0; + #else + desc.buffer = 0; + #endif + + m_mem = clCreateImage(context, + flags, + format.get_format_ptr(), + &desc, + host_ptr, + &error); + #else + m_mem = clCreateImage3D(context, + flags, + format.get_format_ptr(), + image_width, + image_height, + image_depth, + image_row_pitch, + image_slice_pitch, + host_ptr, + &error); + #endif + + if(!m_mem){ + BOOST_THROW_EXCEPTION(opencl_error(error)); + } + } + + /// Creates a new image3d as a copy of \p other. + image3d(const image3d &other) + : image_object(other) + { + } + + /// Copies the image3d from \p other. + image3d& operator=(const image3d &other) + { + image_object::operator=(other); + + return *this; + } + + #ifndef BOOST_COMPUTE_NO_RVALUE_REFERENCES + /// Move-constructs a new image object from \p other. + image3d(image3d&& other) BOOST_NOEXCEPT + : image_object(std::move(other)) + { + } + + /// Move-assigns the image from \p other to \c *this. + image3d& operator=(image3d&& other) BOOST_NOEXCEPT + { + image_object::operator=(std::move(other)); + + return *this; + } + #endif // BOOST_COMPUTE_NO_RVALUE_REFERENCES + + /// Destroys the image3d object. + ~image3d() + { + } + + /// Returns the size (width, height, depth) of the image. + extents<3> size() const + { + extents<3> size; + size[0] = get_info(CL_IMAGE_WIDTH); + size[1] = get_info(CL_IMAGE_HEIGHT); + size[2] = get_info(CL_IMAGE_DEPTH); + return size; + } + + /// Returns the origin of the image (\c 0, \c 0, \c 0). + extents<3> origin() const + { + return extents<3>(); + } + + /// Returns information about the image. + /// + /// \see_opencl_ref{clGetImageInfo} + template + T get_info(cl_image_info info) const + { + return detail::get_object_info(clGetImageInfo, m_mem, info); + } + + /// \overload + template + typename detail::get_object_info_type::type + get_info() const; + + /// Returns the supported 3D image formats for the context. + /// + /// \see_opencl_ref{clGetSupportedImageFormats} + static std::vector + get_supported_formats(const context &context, cl_mem_flags flags = read_write) + { + return image_object::get_supported_formats(context, CL_MEM_OBJECT_IMAGE3D, flags); + } + + /// Returns \c true if \p format is a supported 3D image format for + /// \p context. + static bool is_supported_format(const image_format &format, + const context &context, + cl_mem_flags flags = read_write) + { + return image_object::is_supported_format( + format, context, CL_MEM_OBJECT_IMAGE3D, flags + ); + } + + /// Creates a new image with a copy of the data in \c *this. Uses \p queue + /// to perform the copy operation. + image3d clone(command_queue &queue) const; +}; + +/// \internal_ define get_info() specializations for image3d +BOOST_COMPUTE_DETAIL_DEFINE_GET_INFO_SPECIALIZATIONS(image3d, + ((cl_image_format, CL_IMAGE_FORMAT)) + ((size_t, CL_IMAGE_ELEMENT_SIZE)) + ((size_t, CL_IMAGE_ROW_PITCH)) + ((size_t, CL_IMAGE_SLICE_PITCH)) + ((size_t, CL_IMAGE_WIDTH)) + ((size_t, CL_IMAGE_HEIGHT)) + ((size_t, CL_IMAGE_DEPTH)) +) + +namespace detail { + +// set_kernel_arg() specialization for image3d +template<> +struct set_kernel_arg : public set_kernel_arg { }; + +} // end detail namespace +} // end compute namespace +} // end boost namespace + +BOOST_COMPUTE_TYPE_NAME(boost::compute::image3d, image3d_t) + +#endif // BOOST_COMPUTE_IMAGE_IMAGE3D_HPP diff --git a/3party/boost/boost/compute/image/image_format.hpp b/3party/boost/boost/compute/image/image_format.hpp new file mode 100644 index 0000000000..a6ecf83ef6 --- /dev/null +++ b/3party/boost/boost/compute/image/image_format.hpp @@ -0,0 +1,135 @@ +//---------------------------------------------------------------------------// +// Copyright (c) 2013-2015 Kyle Lutz +// +// 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 +// +// See http://boostorg.github.com/compute for more information. +//---------------------------------------------------------------------------// + +#ifndef BOOST_COMPUTE_IMAGE_IMAGE_FORMAT_HPP +#define BOOST_COMPUTE_IMAGE_IMAGE_FORMAT_HPP + +#include + +namespace boost { +namespace compute { + +/// \class image_format +/// \brief A OpenCL image format +/// +/// For example, to create a format for a 8-bit RGBA image: +/// \code +/// boost::compute::image_format rgba8(CL_RGBA, CL_UNSIGNED_INT8); +/// \endcode +/// +/// After being constructed, image_format objects are usually passed to the +/// constructor of the various image classes (e.g. \ref image2d, \ref image3d) +/// to create an image object on a compute device. +/// +/// Image formats supported by a context can be queried with the static +/// get_supported_formats() in each image class. For example: +/// \code +/// std::vector formats = image2d::get_supported_formats(ctx); +/// \endcode +/// +/// \see image2d +class image_format +{ +public: + enum channel_order { + r = CL_R, + a = CL_A, + intensity = CL_INTENSITY, + luminance = CL_LUMINANCE, + rg = CL_RG, + ra = CL_RA, + rgb = CL_RGB, + rgba = CL_RGBA, + argb = CL_ARGB, + bgra = CL_BGRA + }; + + enum channel_data_type { + snorm_int8 = CL_SNORM_INT8, + snorm_int16 = CL_SNORM_INT16, + unorm_int8 = CL_UNORM_INT8, + unorm_int16 = CL_UNORM_INT16, + unorm_short_565 = CL_UNORM_SHORT_565, + unorm_short_555 = CL_UNORM_SHORT_555, + unorm_int_101010 = CL_UNORM_INT_101010, + signed_int8 = CL_SIGNED_INT8, + signed_int16 = CL_SIGNED_INT16, + signed_int32 = CL_SIGNED_INT32, + unsigned_int8 = CL_UNSIGNED_INT8, + unsigned_int16 = CL_UNSIGNED_INT16, + unsigned_int32 = CL_UNSIGNED_INT32, + float16 = CL_HALF_FLOAT, + float32 = CL_FLOAT + }; + + /// Creates a new image format object with \p order and \p type. + explicit image_format(cl_channel_order order, cl_channel_type type) + { + m_format.image_channel_order = order; + m_format.image_channel_data_type = type; + } + + /// Creates a new image format object from \p format. + explicit image_format(const cl_image_format &format) + { + m_format.image_channel_order = format.image_channel_order; + m_format.image_channel_data_type = format.image_channel_data_type; + } + + /// Creates a new image format object as a copy of \p other. + image_format(const image_format &other) + : m_format(other.m_format) + { + } + + /// Copies the format from \p other to \c *this. + image_format& operator=(const image_format &other) + { + if(this != &other){ + m_format = other.m_format; + } + + return *this; + } + + /// Destroys the image format object. + ~image_format() + { + } + + /// Returns a pointer to the \c cl_image_format object. + const cl_image_format* get_format_ptr() const + { + return &m_format; + } + + /// Returns \c true if \c *this is the same as \p other. + bool operator==(const image_format &other) const + { + return m_format.image_channel_order == + other.m_format.image_channel_order && + m_format.image_channel_data_type == + other.m_format.image_channel_data_type; + } + + /// Returns \c true if \c *this is not the same as \p other. + bool operator!=(const image_format &other) const + { + return !(*this == other); + } + +private: + cl_image_format m_format; +}; + +} // end compute namespace +} // end boost namespace + +#endif // BOOST_COMPUTE_IMAGE_IMAGE_FORMAT_HPP diff --git a/3party/boost/boost/compute/image/image_object.hpp b/3party/boost/boost/compute/image/image_object.hpp new file mode 100644 index 0000000000..451c68568f --- /dev/null +++ b/3party/boost/boost/compute/image/image_object.hpp @@ -0,0 +1,170 @@ +//---------------------------------------------------------------------------// +// Copyright (c) 2013-2015 Kyle Lutz +// +// 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 +// +// See http://boostorg.github.com/compute for more information. +//---------------------------------------------------------------------------// + +#ifndef BOOST_COMPUTE_IMAGE_IMAGE_OBJECT_HPP +#define BOOST_COMPUTE_IMAGE_IMAGE_OBJECT_HPP + +#include +#include + +#include +#include +#include +#include + +namespace boost { +namespace compute { + +/// \class image_object +/// \brief Base-class for image objects. +/// +/// The image_object class is the base-class for image objects on compute +/// devices. +/// +/// \see image1d, image2d, image3d +class image_object : public memory_object +{ +public: + image_object() + : memory_object() + { + } + + explicit image_object(cl_mem mem, bool retain = true) + : memory_object(mem, retain) + { + } + + image_object(const image_object &other) + : memory_object(other) + { + } + + image_object& operator=(const image_object &other) + { + if(this != &other){ + memory_object::operator=(other); + } + + return *this; + } + + #ifndef BOOST_COMPUTE_NO_RVALUE_REFERENCES + image_object(image_object&& other) BOOST_NOEXCEPT + : memory_object(std::move(other)) + { + } + + /// \internal_ + image_object& operator=(image_object&& other) BOOST_NOEXCEPT + { + memory_object::operator=(std::move(other)); + + return *this; + } + #endif // BOOST_COMPUTE_NO_RVALUE_REFERENCES + + /// Destroys the image object. + ~image_object() + { + } + + /// Returns information about the image object. + /// + /// \see_opencl_ref{clGetImageInfo} + template + T get_image_info(cl_mem_info info) const + { + return detail::get_object_info(clGetImageInfo, m_mem, info); + } + + /// Returns the format for the image. + image_format format() const + { + return image_format(get_image_info(CL_IMAGE_FORMAT)); + } + + /// \internal_ (deprecated) + image_format get_format() const + { + return format(); + } + + /// Returns the width of the image. + size_t width() const + { + return get_image_info(CL_IMAGE_WIDTH); + } + + /// Returns the height of the image. + /// + /// For 1D images, this function will return \c 1. + size_t height() const + { + return get_image_info(CL_IMAGE_HEIGHT); + } + + /// Returns the depth of the image. + /// + /// For 1D and 2D images, this function will return \c 1. + size_t depth() const + { + return get_image_info(CL_IMAGE_DEPTH); + } + + /// Returns the supported image formats for the \p type in \p context. + /// + /// \see_opencl_ref{clGetSupportedImageFormats} + static std::vector + get_supported_formats(const context &context, + cl_mem_object_type type, + cl_mem_flags flags = read_write) + { + cl_uint count = 0; + clGetSupportedImageFormats(context, flags, type, 0, 0, &count); + + std::vector cl_formats(count); + clGetSupportedImageFormats(context, flags, type, count, &cl_formats[0], 0); + + std::vector formats; + formats.reserve(count); + + for(cl_uint i = 0; i < count; i++){ + formats.push_back(image_format(cl_formats[i])); + } + + return formats; + } + + /// Returns \c true if \p format is a supported image format for + /// \p type in \p context with \p flags. + static bool is_supported_format(const image_format &format, + const context &context, + cl_mem_object_type type, + cl_mem_flags flags = read_write) + { + const std::vector formats = + get_supported_formats(context, type, flags); + + return std::find(formats.begin(), formats.end(), format) != formats.end(); + } +}; + +namespace detail { + +// set_kernel_arg() specialization for image_object +template<> +struct set_kernel_arg : public set_kernel_arg { }; + +} // end detail namespace +} // end compute namespace +} // end boost namespace + +#endif // BOOST_COMPUTE_IMAGE_IMAGE_OBJECT_HPP diff --git a/3party/boost/boost/compute/image/image_sampler.hpp b/3party/boost/boost/compute/image/image_sampler.hpp new file mode 100644 index 0000000000..4f1bfe9b86 --- /dev/null +++ b/3party/boost/boost/compute/image/image_sampler.hpp @@ -0,0 +1,221 @@ +//---------------------------------------------------------------------------// +// Copyright (c) 2013-2015 Kyle Lutz +// +// 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 +// +// See http://boostorg.github.com/compute for more information. +//---------------------------------------------------------------------------// + +#ifndef BOOST_COMPUTE_IMAGE_IMAGE_SAMPLER_HPP +#define BOOST_COMPUTE_IMAGE_IMAGE_SAMPLER_HPP + +#include + +#include +#include +#include +#include +#include +#include +#include + +namespace boost { +namespace compute { + +/// \class image_sampler +/// \brief An OpenCL image sampler object +/// +/// \see image2d, image_format +class image_sampler +{ +public: + enum addressing_mode { + none = CL_ADDRESS_NONE, + clamp_to_edge = CL_ADDRESS_CLAMP_TO_EDGE, + clamp = CL_ADDRESS_CLAMP, + repeat = CL_ADDRESS_REPEAT + }; + + enum filter_mode { + nearest = CL_FILTER_NEAREST, + linear = CL_FILTER_LINEAR + }; + + image_sampler() + : m_sampler(0) + { + } + + image_sampler(const context &context, + bool normalized_coords, + cl_addressing_mode addressing_mode, + cl_filter_mode filter_mode) + { + cl_int error = 0; + + #ifdef CL_VERSION_2_0 + std::vector sampler_properties; + sampler_properties.push_back(CL_SAMPLER_NORMALIZED_COORDS); + sampler_properties.push_back(cl_sampler_properties(normalized_coords)); + sampler_properties.push_back(CL_SAMPLER_ADDRESSING_MODE); + sampler_properties.push_back(cl_sampler_properties(addressing_mode)); + sampler_properties.push_back(CL_SAMPLER_FILTER_MODE); + sampler_properties.push_back(cl_sampler_properties(filter_mode)); + sampler_properties.push_back(cl_sampler_properties(0)); + + m_sampler = clCreateSamplerWithProperties( + context, &sampler_properties[0], &error + ); + #else + m_sampler = clCreateSampler( + context, normalized_coords, addressing_mode, filter_mode, &error + ); + #endif + + if(!m_sampler){ + BOOST_THROW_EXCEPTION(opencl_error(error)); + } + } + + explicit image_sampler(cl_sampler sampler, bool retain = true) + : m_sampler(sampler) + { + if(m_sampler && retain){ + clRetainSampler(m_sampler); + } + } + + /// Creates a new image sampler object as a copy of \p other. + image_sampler(const image_sampler &other) + : m_sampler(other.m_sampler) + { + if(m_sampler){ + clRetainSampler(m_sampler); + } + } + + /// Copies the image sampler object from \p other to \c *this. + image_sampler& operator=(const image_sampler &other) + { + if(this != &other){ + if(m_sampler){ + clReleaseSampler(m_sampler); + } + + m_sampler = other.m_sampler; + + if(m_sampler){ + clRetainSampler(m_sampler); + } + } + + return *this; + } + + #ifndef BOOST_COMPUTE_NO_RVALUE_REFERENCES + image_sampler(image_sampler&& other) BOOST_NOEXCEPT + : m_sampler(other.m_sampler) + { + other.m_sampler = 0; + } + + image_sampler& operator=(image_sampler&& other) BOOST_NOEXCEPT + { + if(m_sampler){ + clReleaseSampler(m_sampler); + } + + m_sampler = other.m_sampler; + other.m_sampler = 0; + + return *this; + } + #endif // BOOST_COMPUTE_NO_RVALUE_REFERENCES + + /// Destroys the image sampler object. + ~image_sampler() + { + if(m_sampler){ + BOOST_COMPUTE_ASSERT_CL_SUCCESS( + clReleaseSampler(m_sampler) + ); + } + } + + /// Returns the underlying \c cl_sampler object. + cl_sampler& get() const + { + return const_cast(m_sampler); + } + + /// Returns the context for the image sampler object. + context get_context() const + { + return context(get_info(CL_SAMPLER_CONTEXT)); + } + + /// Returns information about the sampler. + /// + /// \see_opencl_ref{clGetSamplerInfo} + template + T get_info(cl_sampler_info info) const + { + return detail::get_object_info(clGetSamplerInfo, m_sampler, info); + } + + /// \overload + template + typename detail::get_object_info_type::type + get_info() const; + + /// Returns \c true if the sampler is the same at \p other. + bool operator==(const image_sampler &other) const + { + return m_sampler == other.m_sampler; + } + + /// Returns \c true if the sampler is different from \p other. + bool operator!=(const image_sampler &other) const + { + return m_sampler != other.m_sampler; + } + + operator cl_sampler() const + { + return m_sampler; + } + +private: + cl_sampler m_sampler; +}; + +/// \internal_ define get_info() specializations for image_sampler +BOOST_COMPUTE_DETAIL_DEFINE_GET_INFO_SPECIALIZATIONS(image_sampler, + ((cl_uint, CL_SAMPLER_REFERENCE_COUNT)) + ((cl_context, CL_SAMPLER_CONTEXT)) + ((cl_addressing_mode, CL_SAMPLER_ADDRESSING_MODE)) + ((cl_filter_mode, CL_SAMPLER_FILTER_MODE)) + ((bool, CL_SAMPLER_NORMALIZED_COORDS)) +) + +namespace detail { + +// set_kernel_arg specialization for image samplers +template<> +struct set_kernel_arg +{ + void operator()(kernel &kernel_, size_t index, const image_sampler &sampler) + { + kernel_.set_arg(index, sampler.get()); + } +}; + +} // end detail namespace +} // end compute namespace +} // end boost namespace + +BOOST_COMPUTE_TYPE_NAME(boost::compute::image_sampler, sampler_t) + +#endif // BOOST_COMPUTE_IMAGE_IMAGE_SAMPLER_HPP diff --git a/3party/boost/boost/compute/image2d.hpp b/3party/boost/boost/compute/image2d.hpp new file mode 100644 index 0000000000..68460813da --- /dev/null +++ b/3party/boost/boost/compute/image2d.hpp @@ -0,0 +1,12 @@ +//---------------------------------------------------------------------------// +// Copyright (c) 2013-2015 Kyle Lutz +// +// 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 +// +// See http://boostorg.github.com/compute for more information. +//---------------------------------------------------------------------------// + +// deprecated, use instead +#include diff --git a/3party/boost/boost/compute/image3d.hpp b/3party/boost/boost/compute/image3d.hpp new file mode 100644 index 0000000000..ab7467c4f3 --- /dev/null +++ b/3party/boost/boost/compute/image3d.hpp @@ -0,0 +1,12 @@ +//---------------------------------------------------------------------------// +// Copyright (c) 2013-2015 Kyle Lutz +// +// 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 +// +// See http://boostorg.github.com/compute for more information. +//---------------------------------------------------------------------------// + +// deprecated, use instead +#include diff --git a/3party/boost/boost/compute/image_format.hpp b/3party/boost/boost/compute/image_format.hpp new file mode 100644 index 0000000000..1ee50014aa --- /dev/null +++ b/3party/boost/boost/compute/image_format.hpp @@ -0,0 +1,12 @@ +//---------------------------------------------------------------------------// +// Copyright (c) 2013-2015 Kyle Lutz +// +// 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 +// +// See http://boostorg.github.com/compute for more information. +//---------------------------------------------------------------------------// + +// deprecated, use instead +#include diff --git a/3party/boost/boost/compute/image_sampler.hpp b/3party/boost/boost/compute/image_sampler.hpp new file mode 100644 index 0000000000..1cd11608b9 --- /dev/null +++ b/3party/boost/boost/compute/image_sampler.hpp @@ -0,0 +1,12 @@ +//---------------------------------------------------------------------------// +// Copyright (c) 2013-2015 Kyle Lutz +// +// 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 +// +// See http://boostorg.github.com/compute for more information. +//---------------------------------------------------------------------------// + +// deprecated, use instead +#include diff --git a/3party/boost/boost/compute/interop/eigen.hpp b/3party/boost/boost/compute/interop/eigen.hpp new file mode 100644 index 0000000000..f616911417 --- /dev/null +++ b/3party/boost/boost/compute/interop/eigen.hpp @@ -0,0 +1,16 @@ +//---------------------------------------------------------------------------// +// Copyright (c) 2013-2014 Kyle Lutz +// +// 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 +// +// See http://boostorg.github.com/compute for more information. +//---------------------------------------------------------------------------// + +#ifndef BOOST_COMPUTE_INTEROP_EIGEN_HPP +#define BOOST_COMPUTE_INTEROP_EIGEN_HPP + +#include + +#endif // BOOST_COMPUTE_INTEROP_EIGEN_HPP diff --git a/3party/boost/boost/compute/interop/eigen/core.hpp b/3party/boost/boost/compute/interop/eigen/core.hpp new file mode 100644 index 0000000000..aa047efd32 --- /dev/null +++ b/3party/boost/boost/compute/interop/eigen/core.hpp @@ -0,0 +1,72 @@ +//---------------------------------------------------------------------------// +// Copyright (c) 2013-2014 Kyle Lutz +// +// 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 +// +// See http://boostorg.github.com/compute for more information. +//---------------------------------------------------------------------------// + +#ifndef BOOST_COMPUTE_INTEROP_EIGEN_EIGEN_HPP +#define BOOST_COMPUTE_INTEROP_EIGEN_EIGEN_HPP + +#include + +#include +#include +#include +#include + +namespace boost { +namespace compute { + +/// Copies \p matrix to \p buffer. +template +inline void eigen_copy_matrix_to_buffer(const Eigen::PlainObjectBase &matrix, + buffer_iterator buffer, + command_queue &queue = system::default_queue()) +{ + ::boost::compute::copy_n(matrix.data(), matrix.size(), buffer, queue); +} + +/// Copies \p buffer to \p matrix. +template +inline void eigen_copy_buffer_to_matrix(const buffer_iterator buffer, + Eigen::PlainObjectBase &matrix, + command_queue &queue = system::default_queue()) +{ + ::boost::compute::copy_n(buffer, matrix.size(), matrix.data(), queue); +} + +/// Converts an \c Eigen::Matrix4f to a \c float16_. +inline float16_ eigen_matrix4f_to_float16(const Eigen::Matrix4f &matrix) +{ + float16_ result; + std::memcpy(&result, matrix.data(), 16 * sizeof(float)); + return result; +} + +/// Converts an \c Eigen::Matrix4d to a \c double16_. +inline double16_ eigen_matrix4d_to_double16(const Eigen::Matrix4d &matrix) +{ + double16_ result; + std::memcpy(&result, matrix.data(), 16 * sizeof(double)); + return result; +} + +} // end compute namespace +} // end boost namespace + +BOOST_COMPUTE_TYPE_NAME(Eigen::Vector2i, int2) +BOOST_COMPUTE_TYPE_NAME(Eigen::Vector4i, int4) +BOOST_COMPUTE_TYPE_NAME(Eigen::Vector2f, float2) +BOOST_COMPUTE_TYPE_NAME(Eigen::Vector4f, float4) +BOOST_COMPUTE_TYPE_NAME(Eigen::Matrix2f, float8) +BOOST_COMPUTE_TYPE_NAME(Eigen::Matrix4f, float16) +BOOST_COMPUTE_TYPE_NAME(Eigen::Vector2d, double2) +BOOST_COMPUTE_TYPE_NAME(Eigen::Vector4d, double4) +BOOST_COMPUTE_TYPE_NAME(Eigen::Matrix2d, double8) +BOOST_COMPUTE_TYPE_NAME(Eigen::Matrix4d, double16) + +#endif // BOOST_COMPUTE_INTEROP_EIGEN_EIGEN_HPP diff --git a/3party/boost/boost/compute/interop/opencv.hpp b/3party/boost/boost/compute/interop/opencv.hpp new file mode 100644 index 0000000000..8cfa3a1c8a --- /dev/null +++ b/3party/boost/boost/compute/interop/opencv.hpp @@ -0,0 +1,17 @@ +//---------------------------------------------------------------------------// +// Copyright (c) 2013-2014 Kyle Lutz +// +// 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 +// +// See http://boostorg.github.com/compute for more information. +//---------------------------------------------------------------------------// + +#ifndef BOOST_COMPUTE_INTEROP_OPENCV_HPP +#define BOOST_COMPUTE_INTEROP_OPENCV_HPP + +#include +#include + +#endif // BOOST_COMPUTE_INTEROP_OPENCV_HPP diff --git a/3party/boost/boost/compute/interop/opencv/core.hpp b/3party/boost/boost/compute/interop/opencv/core.hpp new file mode 100644 index 0000000000..e3c7bf6dda --- /dev/null +++ b/3party/boost/boost/compute/interop/opencv/core.hpp @@ -0,0 +1,141 @@ +//---------------------------------------------------------------------------// +// Copyright (c) 2013-2014 Kyle Lutz +// +// 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 +// +// See http://boostorg.github.com/compute for more information. +//---------------------------------------------------------------------------// + +#ifndef BOOST_COMPUTE_INTEROP_OPENCV_CORE_HPP +#define BOOST_COMPUTE_INTEROP_OPENCV_CORE_HPP + +#include + +#include + +#include +#include +#include +#include +#include + +namespace boost { +namespace compute { + +template +inline void opencv_copy_mat_to_buffer(const cv::Mat &mat, + buffer_iterator buffer, + command_queue &queue = system::default_queue()) +{ + BOOST_ASSERT(mat.isContinuous()); + + ::boost::compute::copy_n( + reinterpret_cast(mat.data), mat.rows * mat.cols, buffer, queue + ); +} + +template +inline void opencv_copy_buffer_to_mat(const buffer_iterator buffer, + cv::Mat &mat, + command_queue &queue = system::default_queue()) +{ + BOOST_ASSERT(mat.isContinuous()); + + ::boost::compute::copy_n( + buffer, mat.cols * mat.rows, reinterpret_cast(mat.data), queue + ); +} + +inline void opencv_copy_mat_to_image(const cv::Mat &mat, + image2d &image, + command_queue &queue = system::default_queue()) +{ + BOOST_ASSERT(mat.data != 0); + BOOST_ASSERT(mat.isContinuous()); + BOOST_ASSERT(image.get_context() == queue.get_context()); + + queue.enqueue_write_image(image, image.origin(), image.size(), mat.data); +} + +inline void opencv_copy_image_to_mat(const image2d &image, + cv::Mat &mat, + command_queue &queue = system::default_queue()) +{ + BOOST_ASSERT(mat.isContinuous()); + BOOST_ASSERT(image.get_context() == queue.get_context()); + + queue.enqueue_read_image(image, image.origin(), image.size(), mat.data); +} + +inline image_format opencv_get_mat_image_format(const cv::Mat &mat) +{ + switch(mat.type()){ + case CV_8UC4: + return image_format(CL_BGRA, CL_UNORM_INT8); + case CV_16UC4: + return image_format(CL_BGRA, CL_UNORM_INT16); + case CV_32F: + return image_format(CL_INTENSITY, CL_FLOAT); + case CV_32FC4: + return image_format(CL_RGBA, CL_FLOAT); + case CV_8UC1: + return image_format(CL_INTENSITY, CL_UNORM_INT8); + } + + BOOST_THROW_EXCEPTION(opencl_error(CL_IMAGE_FORMAT_NOT_SUPPORTED)); +} + +inline cv::Mat opencv_create_mat_with_image2d(const image2d &image, + command_queue &queue = system::default_queue()) +{ + BOOST_ASSERT(image.get_context() == queue.get_context()); + + cv::Mat mat; + image_format format = image.get_format(); + const cl_image_format *cl_image_format = format.get_format_ptr(); + + if(cl_image_format->image_channel_data_type == CL_UNORM_INT8 && + cl_image_format->image_channel_order == CL_BGRA) + { + mat = cv::Mat(image.height(), image.width(), CV_8UC4); + } + else if(cl_image_format->image_channel_data_type == CL_UNORM_INT16 && + cl_image_format->image_channel_order == CL_BGRA) + { + mat = cv::Mat(image.height(), image.width(), CV_16UC4); + } + else if(cl_image_format->image_channel_data_type == CL_FLOAT && + cl_image_format->image_channel_order == CL_INTENSITY) + { + mat = cv::Mat(image.height(), image.width(), CV_32FC1); + } + else + { + mat = cv::Mat(image.height(), image.width(), CV_8UC1); + } + + opencv_copy_image_to_mat(image, mat, queue); + + return mat; +} + +inline image2d opencv_create_image2d_with_mat(const cv::Mat &mat, + cl_mem_flags flags, + command_queue &queue = system::default_queue()) +{ + const context &context = queue.get_context(); + const image_format format = opencv_get_mat_image_format(mat); + + image2d image(context, mat.cols, mat.rows, format, flags); + + opencv_copy_mat_to_image(mat, image, queue); + + return image; +} + +} // end compute namespace +} // end boost namespace + +#endif // BOOST_COMPUTE_INTEROP_OPENCV_CORE_HPP diff --git a/3party/boost/boost/compute/interop/opencv/highgui.hpp b/3party/boost/boost/compute/interop/opencv/highgui.hpp new file mode 100644 index 0000000000..66baa728f6 --- /dev/null +++ b/3party/boost/boost/compute/interop/opencv/highgui.hpp @@ -0,0 +1,33 @@ +//---------------------------------------------------------------------------// +// Copyright (c) 2013-2014 Kyle Lutz +// +// 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 +// +// See http://boostorg.github.com/compute for more information. +//---------------------------------------------------------------------------// + +#ifndef BOOST_COMPUTE_INTEROP_OPENCV_HIGHGUI_HPP +#define BOOST_COMPUTE_INTEROP_OPENCV_HIGHGUI_HPP + +#include + +#include + +namespace boost { +namespace compute { + +inline void opencv_imshow(const std::string &winname, + const image2d &image, + command_queue &queue = system::default_queue()) +{ + const cv::Mat mat = opencv_create_mat_with_image2d(image, queue); + + cv::imshow(winname, mat); +} + +} // end compute namespace +} // end boost namespace + +#endif // BOOST_COMPUTE_INTEROP_OPENCV_HIGHGUI_HPP diff --git a/3party/boost/boost/compute/interop/opencv/ocl.hpp b/3party/boost/boost/compute/interop/opencv/ocl.hpp new file mode 100644 index 0000000000..23d8ac2273 --- /dev/null +++ b/3party/boost/boost/compute/interop/opencv/ocl.hpp @@ -0,0 +1,51 @@ +//---------------------------------------------------------------------------// +// Copyright (c) 2013-2014 Kyle Lutz +// +// 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 +// +// See http://boostorg.github.com/compute for more information. +//---------------------------------------------------------------------------// + +#ifndef BOOST_COMPUTE_INTEROP_OPENCV_OCL_HPP +#define BOOST_COMPUTE_INTEROP_OPENCV_OCL_HPP + +#include + +#include +#include +#include + +namespace boost { +namespace compute { + +context opencv_ocl_get_context() +{ + void *ocl_context = cv::ocl::getoclContext(); + if(!ocl_context){ + return context(); + } + + return context(*(static_cast(ocl_context))); +} + +command_queue opencv_ocl_get_command_queue() +{ + void *ocl_queue = cv::ocl::getoclCommandQueue(); + if(!ocl_queue){ + return command_queue(); + } + + return command_queue(*(static_cast(ocl_queue))); +} + +buffer opencv_ocl_get_buffer(const cv::ocl::oclMat &mat) +{ + return buffer(reinterpret_cast(mat.data)); +} + +} // end compute namespace +} // end boost namespace + +#endif // BOOST_COMPUTE_INTEROP_OPENCV_OCL_HPP diff --git a/3party/boost/boost/compute/interop/opengl.hpp b/3party/boost/boost/compute/interop/opengl.hpp new file mode 100644 index 0000000000..7ae12617ac --- /dev/null +++ b/3party/boost/boost/compute/interop/opengl.hpp @@ -0,0 +1,24 @@ +//---------------------------------------------------------------------------// +// Copyright (c) 2013-2014 Kyle Lutz +// +// 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 +// +// See http://boostorg.github.com/compute for more information. +//---------------------------------------------------------------------------// + +#ifndef BOOST_COMPUTE_INTEROP_OPENGL_HPP +#define BOOST_COMPUTE_INTEROP_OPENGL_HPP + +/// \file +/// +/// Meta-header to include all Boost.Compute OpenGL interop headers. + +#include +#include +#include +#include +#include + +#endif // BOOST_COMPUTE_INTEROP_OPENGL_HPP diff --git a/3party/boost/boost/compute/interop/opengl/acquire.hpp b/3party/boost/boost/compute/interop/opengl/acquire.hpp new file mode 100644 index 0000000000..b9259e0d88 --- /dev/null +++ b/3party/boost/boost/compute/interop/opengl/acquire.hpp @@ -0,0 +1,100 @@ +//---------------------------------------------------------------------------// +// Copyright (c) 2013-2014 Kyle Lutz +// +// 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 +// +// See http://boostorg.github.com/compute for more information. +//---------------------------------------------------------------------------// + +#ifndef BOOST_COMPUTE_INTEROP_OPENGL_ACQUIRE_HPP +#define BOOST_COMPUTE_INTEROP_OPENGL_ACQUIRE_HPP + +#include +#include +#include +#include +#include + +namespace boost { +namespace compute { + +/// Enqueues a command to acquire the specified OpenGL memory objects. +/// +/// \see_opencl_ref{clEnqueueAcquireGLObjects} +inline event opengl_enqueue_acquire_gl_objects(const uint_ num_objects, + const cl_mem *mem_objects, + command_queue &queue, + const wait_list &events = wait_list()) +{ + BOOST_ASSERT(queue != 0); + + event event_; + + cl_int ret = clEnqueueAcquireGLObjects(queue.get(), + num_objects, + mem_objects, + events.size(), + events.get_event_ptr(), + &event_.get()); + if(ret != CL_SUCCESS){ + BOOST_THROW_EXCEPTION(opencl_error(ret)); + } + + return event_; +} + +/// Enqueues a command to release the specified OpenGL memory objects. +/// +/// \see_opencl_ref{clEnqueueReleaseGLObjects} +inline event opengl_enqueue_release_gl_objects(const uint_ num_objects, + const cl_mem *mem_objects, + command_queue &queue, + const wait_list &events = wait_list()) +{ + BOOST_ASSERT(queue != 0); + + event event_; + + cl_int ret = clEnqueueReleaseGLObjects(queue.get(), + num_objects, + mem_objects, + events.size(), + events.get_event_ptr(), + &event_.get()); + if(ret != CL_SUCCESS){ + BOOST_THROW_EXCEPTION(opencl_error(ret)); + } + + return event_; +} + +/// Enqueues a command to acquire the specified OpenGL buffer. +/// +/// \see_opencl_ref{clEnqueueAcquireGLObjects} +inline event opengl_enqueue_acquire_buffer(const opengl_buffer &buffer, + command_queue &queue, + const wait_list &events = wait_list()) +{ + BOOST_ASSERT(buffer.get_context() == queue.get_context()); + + return opengl_enqueue_acquire_gl_objects(1, &buffer.get(), queue, events); +} + +/// Enqueues a command to release the specified OpenGL buffer. +/// +/// \see_opencl_ref{clEnqueueReleaseGLObjects} +inline event opengl_enqueue_release_buffer(const opengl_buffer &buffer, + command_queue &queue, + const wait_list &events = wait_list()) +{ + BOOST_ASSERT(buffer.get_context() == queue.get_context()); + + return opengl_enqueue_release_gl_objects(1, &buffer.get(), queue, events); +} + +} // end compute namespace +} // end boost namespace + +#endif // BOOST_COMPUTE_INTEROP_OPENGL_ACQUIRE_HPP diff --git a/3party/boost/boost/compute/interop/opengl/cl_gl.hpp b/3party/boost/boost/compute/interop/opengl/cl_gl.hpp new file mode 100644 index 0000000000..de82dbd9ab --- /dev/null +++ b/3party/boost/boost/compute/interop/opengl/cl_gl.hpp @@ -0,0 +1,20 @@ +//---------------------------------------------------------------------------// +// Copyright (c) 2013-2014 Kyle Lutz +// +// 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 +// +// See http://boostorg.github.com/compute for more information. +//---------------------------------------------------------------------------// + +#ifndef BOOST_COMPUTE_INTEROP_OPENGL_CL_GL_HPP +#define BOOST_COMPUTE_INTEROP_OPENGL_CL_GL_HPP + +#if defined(__APPLE__) +#include +#else +#include +#endif + +#endif // BOOST_COMPUTE_INTEROP_OPENGL_CL_GL_HPP diff --git a/3party/boost/boost/compute/interop/opengl/cl_gl_ext.hpp b/3party/boost/boost/compute/interop/opengl/cl_gl_ext.hpp new file mode 100644 index 0000000000..3392b051e0 --- /dev/null +++ b/3party/boost/boost/compute/interop/opengl/cl_gl_ext.hpp @@ -0,0 +1,20 @@ +//---------------------------------------------------------------------------// +// Copyright (c) 2013-2014 Kyle Lutz +// +// 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 +// +// See http://boostorg.github.com/compute for more information. +//---------------------------------------------------------------------------// + +#ifndef BOOST_COMPUTE_INTEROP_OPENGL_CL_GL_EXT_HPP +#define BOOST_COMPUTE_INTEROP_OPENGL_CL_GL_EXT_HPP + +#if defined(__APPLE__) +#include +#else +#include +#endif + +#endif // BOOST_COMPUTE_INTEROP_OPENGL_CL_GL_EXT_HPP diff --git a/3party/boost/boost/compute/interop/opengl/context.hpp b/3party/boost/boost/compute/interop/opengl/context.hpp new file mode 100644 index 0000000000..c35fedddfa --- /dev/null +++ b/3party/boost/boost/compute/interop/opengl/context.hpp @@ -0,0 +1,135 @@ +//---------------------------------------------------------------------------// +// Copyright (c) 2013-2014 Kyle Lutz +// +// 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 +// +// See http://boostorg.github.com/compute for more information. +//---------------------------------------------------------------------------// + +#ifndef BOOST_COMPUTE_INTEROP_OPENGL_CONTEXT_HPP +#define BOOST_COMPUTE_INTEROP_OPENGL_CONTEXT_HPP + +#include + +#include +#include +#include +#include +#include + +#ifdef __APPLE__ +#include +#include +#endif + +#ifdef __linux__ +#include +#endif + +namespace boost { +namespace compute { + +/// Creates a shared OpenCL/OpenGL context for the currently active +/// OpenGL context. +/// +/// Once created, the shared context can be used to create OpenCL memory +/// objects which can interact with OpenGL memory objects (e.g. VBOs). +/// +/// \throws unsupported_extension_error if no CL-GL sharing capable devices +/// are found. +inline context opengl_create_shared_context() +{ + // name of the OpenGL sharing extension for the system +#if defined(__APPLE__) + const char *cl_gl_sharing_extension = "cl_APPLE_gl_sharing"; +#else + const char *cl_gl_sharing_extension = "cl_khr_gl_sharing"; +#endif + +#if defined(__APPLE__) + // get OpenGL share group + CGLContextObj cgl_current_context = CGLGetCurrentContext(); + CGLShareGroupObj cgl_share_group = CGLGetShareGroup(cgl_current_context); + + cl_context_properties properties[] = { + CL_CONTEXT_PROPERTY_USE_CGL_SHAREGROUP_APPLE, + (cl_context_properties) cgl_share_group, + 0 + }; + + cl_int error = 0; + cl_context cl_gl_context = clCreateContext(properties, 0, 0, 0, 0, &error); + if(!cl_gl_context){ + BOOST_THROW_EXCEPTION(opencl_error(error)); + } + + return context(cl_gl_context, false); +#else + typedef cl_int(*GetGLContextInfoKHRFunction)( + const cl_context_properties*, cl_gl_context_info, size_t, void *, size_t * + ); + + std::vector platforms = system::platforms(); + for(size_t i = 0; i < platforms.size(); i++){ + const platform &platform = platforms[i]; + + // load clGetGLContextInfoKHR() extension function + GetGLContextInfoKHRFunction GetGLContextInfoKHR = + reinterpret_cast( + reinterpret_cast( + platform.get_extension_function_address("clGetGLContextInfoKHR") + ) + ); + if(!GetGLContextInfoKHR){ + continue; + } + + // create context properties listing the platform and current OpenGL display + cl_context_properties properties[] = { + CL_CONTEXT_PLATFORM, (cl_context_properties) platform.id(), + #if defined(__linux__) + CL_GL_CONTEXT_KHR, (cl_context_properties) glXGetCurrentContext(), + CL_GLX_DISPLAY_KHR, (cl_context_properties) glXGetCurrentDisplay(), + #elif defined(WIN32) + CL_GL_CONTEXT_KHR, (cl_context_properties) wglGetCurrentContext(), + CL_WGL_HDC_KHR, (cl_context_properties) wglGetCurrentDC(), + #endif + 0 + }; + + // lookup current OpenCL device for current OpenGL context + cl_device_id gpu_id; + cl_int ret = GetGLContextInfoKHR( + properties, + CL_CURRENT_DEVICE_FOR_GL_CONTEXT_KHR, + sizeof(cl_device_id), + &gpu_id, + 0 + ); + if(ret != CL_SUCCESS){ + continue; + } + + // create device object for the GPU and ensure it supports CL-GL sharing + device gpu(gpu_id, false); + if(!gpu.supports_extension(cl_gl_sharing_extension)){ + continue; + } + + // return CL-GL sharing context + return context(gpu, properties); + } +#endif + + // no CL-GL sharing capable devices found + BOOST_THROW_EXCEPTION( + unsupported_extension_error(cl_gl_sharing_extension) + ); +} + +} // end compute namespace +} // end boost namespace + +#endif // BOOST_COMPUTE_INTEROP_OPENGL_CONTEXT_HPP diff --git a/3party/boost/boost/compute/interop/opengl/gl.hpp b/3party/boost/boost/compute/interop/opengl/gl.hpp new file mode 100644 index 0000000000..a05c944075 --- /dev/null +++ b/3party/boost/boost/compute/interop/opengl/gl.hpp @@ -0,0 +1,20 @@ +//---------------------------------------------------------------------------// +// Copyright (c) 2013-2014 Kyle Lutz +// +// 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 +// +// See http://boostorg.github.com/compute for more information. +//---------------------------------------------------------------------------// + +#ifndef BOOST_COMPUTE_INTEROP_OPENGL_GL_HPP +#define BOOST_COMPUTE_INTEROP_OPENGL_GL_HPP + +#if defined(__APPLE__) +#include +#else +#include +#endif + +#endif // BOOST_COMPUTE_INTEROP_OPENGL_GL_HPP diff --git a/3party/boost/boost/compute/interop/opengl/opengl_buffer.hpp b/3party/boost/boost/compute/interop/opengl/opengl_buffer.hpp new file mode 100644 index 0000000000..c27347d0d9 --- /dev/null +++ b/3party/boost/boost/compute/interop/opengl/opengl_buffer.hpp @@ -0,0 +1,106 @@ +//---------------------------------------------------------------------------// +// Copyright (c) 2013-2014 Kyle Lutz +// +// 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 +// +// See http://boostorg.github.com/compute for more information. +//---------------------------------------------------------------------------// + +#ifndef BOOST_COMPUTE_INTEROP_OPENGL_OPENGL_BUFFER_HPP +#define BOOST_COMPUTE_INTEROP_OPENGL_OPENGL_BUFFER_HPP + +#include +#include +#include + +namespace boost { +namespace compute { + +/// \class opengl_buffer +/// +/// A OpenCL buffer for accessing an OpenGL memory object. +class opengl_buffer : public buffer +{ +public: + /// Creates a null OpenGL buffer object. + opengl_buffer() + : buffer() + { + } + + /// Creates a new OpenGL buffer object for \p mem. + explicit opengl_buffer(cl_mem mem, bool retain = true) + : buffer(mem, retain) + { + } + + /// Creates a new OpenGL buffer object in \p context for \p bufobj + /// with \p flags. + /// + /// \see_opencl_ref{clCreateFromGLBuffer} + opengl_buffer(const context &context, + GLuint bufobj, + cl_mem_flags flags = read_write) + { + cl_int error = 0; + m_mem = clCreateFromGLBuffer(context, flags, bufobj, &error); + if(!m_mem){ + BOOST_THROW_EXCEPTION(opencl_error(error)); + } + } + + /// Creates a new OpenGL buffer object as a copy of \p other. + opengl_buffer(const opengl_buffer &other) + : buffer(other) + { + } + + /// Copies the OpenGL buffer object from \p other. + opengl_buffer& operator=(const opengl_buffer &other) + { + if(this != &other){ + buffer::operator=(other); + } + + return *this; + } + + /// Destroys the OpenGL buffer object. + ~opengl_buffer() + { + } + + /// Returns the OpenGL memory object ID. + /// + /// \see_opencl_ref{clGetGLObjectInfo} + GLuint get_opengl_object() const + { + GLuint object = 0; + clGetGLObjectInfo(m_mem, 0, &object); + return object; + } + + /// Returns the OpenGL memory object type. + /// + /// \see_opencl_ref{clGetGLObjectInfo} + cl_gl_object_type get_opengl_type() const + { + cl_gl_object_type type; + clGetGLObjectInfo(m_mem, &type, 0); + return type; + } +}; + +namespace detail { + +// set_kernel_arg specialization for opengl_buffer +template<> +struct set_kernel_arg : set_kernel_arg { }; + +} // end detail namespace +} // end compute namespace +} // end boost namespace + +#endif // BOOST_COMPUTE_INTEROP_OPENGL_OPENGL_BUFFER_HPP diff --git a/3party/boost/boost/compute/interop/opengl/opengl_renderbuffer.hpp b/3party/boost/boost/compute/interop/opengl/opengl_renderbuffer.hpp new file mode 100644 index 0000000000..fd4759d0ee --- /dev/null +++ b/3party/boost/boost/compute/interop/opengl/opengl_renderbuffer.hpp @@ -0,0 +1,129 @@ +//---------------------------------------------------------------------------// +// Copyright (c) 2013-2014 Kyle Lutz +// +// 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 +// +// See http://boostorg.github.com/compute for more information. +//---------------------------------------------------------------------------// + +#ifndef BOOST_COMPUTE_INTEROP_OPENGL_OPENGL_RENDERBUFFER_HPP +#define BOOST_COMPUTE_INTEROP_OPENGL_OPENGL_RENDERBUFFER_HPP + +#include +#include +#include +#include +#include + +namespace boost { +namespace compute { + +/// \class opengl_renderbuffer +/// +/// A OpenCL buffer for accessing an OpenGL renderbuffer object. +class opengl_renderbuffer : public image_object +{ +public: + /// Creates a null OpenGL renderbuffer object. + opengl_renderbuffer() + : image_object() + { + } + + /// Creates a new OpenGL renderbuffer object for \p mem. + explicit opengl_renderbuffer(cl_mem mem, bool retain = true) + : image_object(mem, retain) + { + } + + /// Creates a new OpenGL renderbuffer object in \p context for + /// \p renderbuffer with \p flags. + /// + /// \see_opencl_ref{clCreateFromGLRenderbuffer} + opengl_renderbuffer(const context &context, + GLuint renderbuffer, + cl_mem_flags flags = read_write) + { + cl_int error = 0; + + m_mem = clCreateFromGLRenderbuffer( + context, flags, renderbuffer, &error + ); + + if(!m_mem){ + BOOST_THROW_EXCEPTION(opencl_error(error)); + } + } + + /// Creates a new OpenGL renderbuffer object as a copy of \p other. + opengl_renderbuffer(const opengl_renderbuffer &other) + : image_object(other) + { + } + + /// Copies the OpenGL renderbuffer object from \p other. + opengl_renderbuffer& operator=(const opengl_renderbuffer &other) + { + if(this != &other){ + image_object::operator=(other); + } + + return *this; + } + + /// Destroys the OpenGL buffer object. + ~opengl_renderbuffer() + { + } + + /// Returns the size (width, height) of the renderbuffer. + extents<2> size() const + { + extents<2> size; + size[0] = get_image_info(CL_IMAGE_WIDTH); + size[1] = get_image_info(CL_IMAGE_HEIGHT); + return size; + } + + /// Returns the origin of the renderbuffer (\c 0, \c 0). + extents<2> origin() const + { + return extents<2>(); + } + + /// Returns the OpenGL memory object ID. + /// + /// \see_opencl_ref{clGetGLObjectInfo} + GLuint get_opengl_object() const + { + GLuint object = 0; + clGetGLObjectInfo(m_mem, 0, &object); + return object; + } + + /// Returns the OpenGL memory object type. + /// + /// \see_opencl_ref{clGetGLObjectInfo} + cl_gl_object_type get_opengl_type() const + { + cl_gl_object_type type; + clGetGLObjectInfo(m_mem, &type, 0); + return type; + } +}; + +namespace detail { + +// set_kernel_arg() specialization for opengl_renderbuffer +template<> +struct set_kernel_arg : public set_kernel_arg { }; + +} // end detail namespace +} // end compute namespace +} // end boost namespace + +BOOST_COMPUTE_TYPE_NAME(boost::compute::opengl_renderbuffer, image2d_t) + +#endif // BOOST_COMPUTE_INTEROP_OPENGL_OPENGL_RENDERBUFFER_HPP diff --git a/3party/boost/boost/compute/interop/opengl/opengl_texture.hpp b/3party/boost/boost/compute/interop/opengl/opengl_texture.hpp new file mode 100644 index 0000000000..c1f3f4f441 --- /dev/null +++ b/3party/boost/boost/compute/interop/opengl/opengl_texture.hpp @@ -0,0 +1,133 @@ +//---------------------------------------------------------------------------// +// Copyright (c) 2013-2014 Kyle Lutz +// +// 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 +// +// See http://boostorg.github.com/compute for more information. +//---------------------------------------------------------------------------// + +#ifndef BOOST_COMPUTE_INTEROP_OPENGL_OPENGL_TEXTURE_HPP +#define BOOST_COMPUTE_INTEROP_OPENGL_OPENGL_TEXTURE_HPP + +#include +#include +#include +#include +#include +#include + +namespace boost { +namespace compute { + +/// \class opengl_texture +/// +/// A OpenCL image2d for accessing an OpenGL texture object. +class opengl_texture : public image_object +{ +public: + /// Creates a null OpenGL texture object. + opengl_texture() + : image_object() + { + } + + /// Creates a new OpenGL texture object for \p mem. + explicit opengl_texture(cl_mem mem, bool retain = true) + : image_object(mem, retain) + { + } + + /// Creates a new OpenGL texture object in \p context for \p texture + /// with \p flags. + /// + /// \see_opencl_ref{clCreateFromGLTexture} + opengl_texture(const context &context, + GLenum texture_target, + GLint miplevel, + GLuint texture, + cl_mem_flags flags = read_write) + { + cl_int error = 0; + + #ifdef CL_VERSION_1_2 + m_mem = clCreateFromGLTexture(context, + flags, + texture_target, + miplevel, + texture, + &error); + #else + m_mem = clCreateFromGLTexture2D(context, + flags, + texture_target, + miplevel, + texture, + &error); + #endif + + if(!m_mem){ + BOOST_THROW_EXCEPTION(opencl_error(error)); + } + } + + /// Creates a new OpenGL texture object as a copy of \p other. + opengl_texture(const opengl_texture &other) + : image_object(other) + { + } + + /// Copies the OpenGL texture object from \p other. + opengl_texture& operator=(const opengl_texture &other) + { + if(this != &other){ + image_object::operator=(other); + } + + return *this; + } + + /// Destroys the texture object. + ~opengl_texture() + { + } + + /// Returns the size (width, height) of the texture. + extents<2> size() const + { + extents<2> size; + size[0] = get_image_info(CL_IMAGE_WIDTH); + size[1] = get_image_info(CL_IMAGE_HEIGHT); + return size; + } + + /// Returns the origin of the texture (\c 0, \c 0). + extents<2> origin() const + { + return extents<2>(); + } + + /// Returns information about the texture. + /// + /// \see_opencl_ref{clGetGLTextureInfo} + template + T get_texture_info(cl_gl_texture_info info) const + { + return detail::get_object_info(clGetGLTextureInfo, m_mem, info); + } +}; + +namespace detail { + +// set_kernel_arg() specialization for opengl_texture +template<> +struct set_kernel_arg : public set_kernel_arg { }; + +} // end detail namespace +} // end compute namespace +} // end boost namespace + +BOOST_COMPUTE_TYPE_NAME(boost::compute::opengl_texture, image2d_t) + +#endif // BOOST_COMPUTE_INTEROP_OPENGL_OPENGL_TEXTURE_HPP diff --git a/3party/boost/boost/compute/interop/qt.hpp b/3party/boost/boost/compute/interop/qt.hpp new file mode 100644 index 0000000000..f53691cc34 --- /dev/null +++ b/3party/boost/boost/compute/interop/qt.hpp @@ -0,0 +1,17 @@ +//---------------------------------------------------------------------------// +// Copyright (c) 2013-2014 Kyle Lutz +// +// 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 +// +// See http://boostorg.github.com/compute for more information. +//---------------------------------------------------------------------------// + +#ifndef BOOST_COMPUTE_INTEROP_QT_HPP +#define BOOST_COMPUTE_INTEROP_QT_HPP + +#include +#include + +#endif // BOOST_COMPUTE_INTEROP_QT_HPP diff --git a/3party/boost/boost/compute/interop/qt/qimage.hpp b/3party/boost/boost/compute/interop/qt/qimage.hpp new file mode 100644 index 0000000000..faa6f98cc8 --- /dev/null +++ b/3party/boost/boost/compute/interop/qt/qimage.hpp @@ -0,0 +1,69 @@ +//---------------------------------------------------------------------------// +// Copyright (c) 2013-2014 Kyle Lutz +// +// 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 +// +// See http://boostorg.github.com/compute for more information. +//---------------------------------------------------------------------------// + +#ifndef BOOST_COMPUTE_INTEROP_QT_QIMAGE_HPP +#define BOOST_COMPUTE_INTEROP_QT_QIMAGE_HPP + +#include + +#include +#include +#include +#include +#include + +#include + +namespace boost { +namespace compute { + +inline image_format qt_qimage_format_to_image_format(const QImage::Format &format) +{ + if(format == QImage::Format_RGB32){ + return image_format(image_format::bgra, image_format::unorm_int8); + } + + BOOST_THROW_EXCEPTION(opencl_error(CL_IMAGE_FORMAT_NOT_SUPPORTED)); +} + +inline QImage::Format qt_image_format_to_qimage_format(const image_format &format) +{ + if(format == image_format(image_format::bgra, image_format::unorm_int8)){ + return QImage::Format_RGB32; + } + + return QImage::Format_Invalid; +} + +inline image_format qt_qimage_get_format(const QImage &image) +{ + return qt_qimage_format_to_image_format(image.format()); +} + +inline void qt_copy_qimage_to_image2d(const QImage &qimage, + image2d &image, + command_queue &queue) +{ + queue.enqueue_write_image(image, image.origin(), image.size(), qimage.constBits()); +} + +inline void qt_copy_image2d_to_qimage(const image2d &image, + QImage &qimage, + command_queue &queue) +{ + queue.enqueue_read_image( + image, dim(0, 0), dim(qimage.width(), qimage.height()), qimage.bits() + ); +} + +} // end compute namespace +} // end boost namespace + +#endif // BOOST_COMPUTE_INTEROP_QT_QIMAGE_HPP diff --git a/3party/boost/boost/compute/interop/qt/qpoint.hpp b/3party/boost/boost/compute/interop/qt/qpoint.hpp new file mode 100644 index 0000000000..d867fc7a43 --- /dev/null +++ b/3party/boost/boost/compute/interop/qt/qpoint.hpp @@ -0,0 +1,20 @@ +//---------------------------------------------------------------------------// +// Copyright (c) 2013-2014 Kyle Lutz +// +// 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 +// +// See http://boostorg.github.com/compute for more information. +//---------------------------------------------------------------------------// + +#ifndef BOOST_COMPUTE_INTEROP_QT_QPOINT_HPP +#define BOOST_COMPUTE_INTEROP_QT_QPOINT_HPP + +#include + +#include + +BOOST_COMPUTE_TYPE_NAME(QPoint, "int2") + +#endif // BOOST_COMPUTE_INTEROP_QT_QPOINT_HPP diff --git a/3party/boost/boost/compute/interop/qt/qpointf.hpp b/3party/boost/boost/compute/interop/qt/qpointf.hpp new file mode 100644 index 0000000000..fd7392a804 --- /dev/null +++ b/3party/boost/boost/compute/interop/qt/qpointf.hpp @@ -0,0 +1,20 @@ +//---------------------------------------------------------------------------// +// Copyright (c) 2013-2014 Kyle Lutz +// +// 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 +// +// See http://boostorg.github.com/compute for more information. +//---------------------------------------------------------------------------// + +#ifndef BOOST_COMPUTE_INTEROP_QT_QPOINTF_HPP +#define BOOST_COMPUTE_INTEROP_QT_QPOINTF_HPP + +#include + +#include + +BOOST_COMPUTE_TYPE_NAME(QPointF, "float2") + +#endif // BOOST_COMPUTE_INTEROP_QT_QPOINTF_HPP diff --git a/3party/boost/boost/compute/interop/qt/qtcore.hpp b/3party/boost/boost/compute/interop/qt/qtcore.hpp new file mode 100644 index 0000000000..b8978180e0 --- /dev/null +++ b/3party/boost/boost/compute/interop/qt/qtcore.hpp @@ -0,0 +1,18 @@ +//---------------------------------------------------------------------------// +// Copyright (c) 2013-2014 Kyle Lutz +// +// 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 +// +// See http://boostorg.github.com/compute for more information. +//---------------------------------------------------------------------------// + +#ifndef BOOST_COMPUTE_INTEROP_QT_QTCORE_HPP +#define BOOST_COMPUTE_INTEROP_QT_QTCORE_HPP + +#include +#include +#include + +#endif // BOOST_COMPUTE_INTEROP_QT_QTCORE_HPP diff --git a/3party/boost/boost/compute/interop/qt/qtgui.hpp b/3party/boost/boost/compute/interop/qt/qtgui.hpp new file mode 100644 index 0000000000..f1078f48b9 --- /dev/null +++ b/3party/boost/boost/compute/interop/qt/qtgui.hpp @@ -0,0 +1,16 @@ +//---------------------------------------------------------------------------// +// Copyright (c) 2013-2014 Kyle Lutz +// +// 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 +// +// See http://boostorg.github.com/compute for more information. +//---------------------------------------------------------------------------// + +#ifndef BOOST_COMPUTE_INTEROP_QT_QTGUI_HPP +#define BOOST_COMPUTE_INTEROP_QT_QTGUI_HPP + +#include + +#endif // BOOST_COMPUTE_INTEROP_QT_QTGUI_HPP diff --git a/3party/boost/boost/compute/interop/qt/qvector.hpp b/3party/boost/boost/compute/interop/qt/qvector.hpp new file mode 100644 index 0000000000..3ac93d2aaa --- /dev/null +++ b/3party/boost/boost/compute/interop/qt/qvector.hpp @@ -0,0 +1,48 @@ +//---------------------------------------------------------------------------// +// Copyright (c) 2013-2014 Kyle Lutz +// +// 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 +// +// See http://boostorg.github.com/compute for more information. +//---------------------------------------------------------------------------// + +#ifndef BOOST_COMPUTE_INTEROP_QT_QVECTOR_HPP +#define BOOST_COMPUTE_INTEROP_QT_QVECTOR_HPP + +#include + +#include + +namespace boost { +namespace compute { +namespace detail { + +template +struct _is_contiguous_iterator< + Iterator, + typename boost::enable_if< + typename boost::is_same< + Iterator, + typename QVector::iterator + >::type + >::type +> : public boost::true_type {}; + +template +struct _is_contiguous_iterator< + Iterator, + typename boost::enable_if< + typename boost::is_same< + Iterator, + typename QVector::const_iterator + >::type + >::type +> : public boost::true_type {}; + +} // end detail namespace +} // end compute namespace +} // end boost namespace + +#endif // BOOST_COMPUTE_INTEROP_QT_QVECTOR_HPP diff --git a/3party/boost/boost/compute/interop/vtk.hpp b/3party/boost/boost/compute/interop/vtk.hpp new file mode 100644 index 0000000000..3f866e5f8f --- /dev/null +++ b/3party/boost/boost/compute/interop/vtk.hpp @@ -0,0 +1,19 @@ +//---------------------------------------------------------------------------// +// Copyright (c) 2013-2014 Kyle Lutz +// +// 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 +// +// See http://boostorg.github.com/compute for more information. +//---------------------------------------------------------------------------// + +#ifndef BOOST_COMPUTE_INTEROP_VTK_HPP +#define BOOST_COMPUTE_INTEROP_VTK_HPP + +#include +#include +#include +#include + +#endif // BOOST_COMPUTE_INTEROP_VTK_HPP diff --git a/3party/boost/boost/compute/interop/vtk/bounds.hpp b/3party/boost/boost/compute/interop/vtk/bounds.hpp new file mode 100644 index 0000000000..360a9061f9 --- /dev/null +++ b/3party/boost/boost/compute/interop/vtk/bounds.hpp @@ -0,0 +1,59 @@ +//---------------------------------------------------------------------------// +// Copyright (c) 2013-2014 Kyle Lutz +// +// 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 +// +// See http://boostorg.github.com/compute for more information. +//---------------------------------------------------------------------------// + +#ifndef BOOST_COMPUTE_INTEROP_VTK_BOUNDS_HPP +#define BOOST_COMPUTE_INTEROP_VTK_BOUNDS_HPP + +#include +#include + +#include +#include +#include +#include +#include + +namespace boost { +namespace compute { + +/// Calculates the bounds for the points in the range [\p first, \p last) and +/// stores the result in \p bounds. +/// +/// For example, this can be used to implement the GetBounds() method for a +/// vtkMapper subclass. +template +inline void vtk_compute_bounds(PointIterator first, + PointIterator last, + double bounds[6], + command_queue &queue = system::default_queue()) +{ + typedef typename std::iterator_traits::value_type T; + + const context &context = queue.get_context(); + + // compute min and max point + array extrema(context); + reduce(first, last, extrema.begin() + 0, min(), queue); + reduce(first, last, extrema.begin() + 1, max(), queue); + + // copy results to host buffer + std::vector buffer(2); + copy_n(extrema.begin(), 2, buffer.begin(), queue); + + // copy to vtk-style bounds + bounds[0] = buffer[0][0]; bounds[1] = buffer[1][0]; + bounds[2] = buffer[0][1]; bounds[3] = buffer[1][1]; + bounds[4] = buffer[0][2]; bounds[5] = buffer[1][2]; +} + +} // end compute namespace +} // end boost namespace + +#endif // BOOST_COMPUTE_INTEROP_VTK_BOUNDS_HPP diff --git a/3party/boost/boost/compute/interop/vtk/data_array.hpp b/3party/boost/boost/compute/interop/vtk/data_array.hpp new file mode 100644 index 0000000000..7b909b1a3f --- /dev/null +++ b/3party/boost/boost/compute/interop/vtk/data_array.hpp @@ -0,0 +1,65 @@ +//---------------------------------------------------------------------------// +// Copyright (c) 2013-2014 Kyle Lutz +// +// 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 +// +// See http://boostorg.github.com/compute for more information. +//---------------------------------------------------------------------------// + +#ifndef BOOST_COMPUTE_INTEROP_VTK_DATA_ARRAY_HPP +#define BOOST_COMPUTE_INTEROP_VTK_DATA_ARRAY_HPP + +#include +#include + +#include +#include +#include +#include +#include + +namespace boost { +namespace compute { + +/// Copies the values in \p data to \p buffer. +template +inline void vtk_copy_data_array_to_buffer(const vtkDataArray *data, + buffer_iterator buffer, + command_queue &queue = system::default_queue()); + +/// \internal_ +template +inline void vtk_copy_data_array_to_buffer(const vtkDataArrayTemplate *data, + buffer_iterator buffer, + command_queue &queue = system::default_queue()) +{ + vtkDataArrayTemplate *data_ = const_cast *>(data); + const T *data_ptr = static_cast(data_->GetVoidPointer(0)); + size_t data_size = data_->GetNumberOfComponents() * data_->GetNumberOfTuples(); + ::boost::compute::copy_n(data_ptr, data_size, buffer, queue); +} + +/// Copies the values in the range [\p first, \p last) to \p data. +template +inline void vtk_copy_buffer_to_data_array(buffer_iterator first, + buffer_iterator last, + vtkDataArray *data, + command_queue &queue = system::default_queue()); + +/// \internal_ +template +inline void vtk_copy_buffer_to_data_array(buffer_iterator first, + buffer_iterator last, + vtkDataArrayTemplate *data, + command_queue &queue = system::default_queue()) +{ + T *data_ptr = static_cast(data->GetVoidPointer(0)); + ::boost::compute::copy(first, last, data_ptr, queue); +} + +} // end compute namespace +} // end boost namespace + +#endif // BOOST_COMPUTE_INTEROP_VTK_DATA_ARRAY_HPP diff --git a/3party/boost/boost/compute/interop/vtk/matrix4x4.hpp b/3party/boost/boost/compute/interop/vtk/matrix4x4.hpp new file mode 100644 index 0000000000..550c49f19f --- /dev/null +++ b/3party/boost/boost/compute/interop/vtk/matrix4x4.hpp @@ -0,0 +1,46 @@ +//---------------------------------------------------------------------------// +// Copyright (c) 2013-2014 Kyle Lutz +// +// 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 +// +// See http://boostorg.github.com/compute for more information. +//---------------------------------------------------------------------------// + +#ifndef BOOST_COMPUTE_INTEROP_VTK_MATRIX4X4_HPP +#define BOOST_COMPUTE_INTEROP_VTK_MATRIX4X4_HPP + +#include + +#include + +namespace boost { +namespace compute { + +/// Converts a \c vtkMatrix4x4 to a \c float16_. +inline float16_ vtk_matrix4x4_to_float16(const vtkMatrix4x4 *matrix) +{ + float16_ result; + + for(int i = 0; i < 4; i++){ + for(int j = 0; j < 4; j++){ + result[i*4+j] = matrix->GetElement(i, j); + } + } + + return result; +} + +/// Converts a \c vtkMatrix4x4 to a \c double16_; +inline double16_ vtk_matrix4x4_to_double16(const vtkMatrix4x4 *matrix) +{ + double16_ result; + std::memcpy(&result, matrix->Element, 16 * sizeof(double)); + return result; +} + +} // end compute namespace +} // end boost namespace + +#endif // BOOST_COMPUTE_INTEROP_VTK_MATRIX4X4_HPP diff --git a/3party/boost/boost/compute/interop/vtk/points.hpp b/3party/boost/boost/compute/interop/vtk/points.hpp new file mode 100644 index 0000000000..fefbbb9874 --- /dev/null +++ b/3party/boost/boost/compute/interop/vtk/points.hpp @@ -0,0 +1,55 @@ +//---------------------------------------------------------------------------// +// Copyright (c) 2013-2014 Kyle Lutz +// +// 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 +// +// See http://boostorg.github.com/compute for more information. +//---------------------------------------------------------------------------// + +#ifndef BOOST_COMPUTE_INTEROP_VTK_POINTS_HPP +#define BOOST_COMPUTE_INTEROP_VTK_POINTS_HPP + +#include + +#include + +#include +#include +#include +#include + +namespace boost { +namespace compute { + +/// Copies \p points to \p buffer. +/// +/// For example, to copy from a \c vtkPoints object to a \c vector: +/// \code +/// vtkPoints *points = ... +/// vector vector(points->GetNumberOfPoints(), context); +/// vtk_copy_points_to_buffer(points, vector.begin(), queue); +/// \endcode +template +inline void vtk_copy_points_to_buffer(const vtkPoints *points, + buffer_iterator buffer, + command_queue &queue = system::default_queue()) +{ + vtkPoints *points_ = const_cast(points); + + // copy points to aligned buffer + std::vector tmp(points_->GetNumberOfPoints()); + for(vtkIdType i = 0; i < points_->GetNumberOfPoints(); i++){ + double *p = points_->GetPoint(i); + tmp[i] = PointType(p[0], p[1], p[2], 1); + } + + // copy data to device + copy(tmp.begin(), tmp.end(), buffer, queue); +} + +} // end compute namespace +} // end boost namespace + +#endif // BOOST_COMPUTE_INTEROP_VTK_POINTS_HPP diff --git a/3party/boost/boost/compute/iterator.hpp b/3party/boost/boost/compute/iterator.hpp new file mode 100644 index 0000000000..59442b1599 --- /dev/null +++ b/3party/boost/boost/compute/iterator.hpp @@ -0,0 +1,28 @@ +//---------------------------------------------------------------------------// +// Copyright (c) 2013 Kyle Lutz +// +// 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 +// +// See http://boostorg.github.com/compute for more information. +//---------------------------------------------------------------------------// + +#ifndef BOOST_COMPUTE_ITERATOR_HPP +#define BOOST_COMPUTE_ITERATOR_HPP + +/// \file +/// +/// Meta-header to include all Boost.Compute iterator headers. + +#include +#include +#include +#include +#include +#include +#include +#include +#include + +#endif // BOOST_COMPUTE_ITERATOR_HPP diff --git a/3party/boost/boost/compute/iterator/buffer_iterator.hpp b/3party/boost/boost/compute/iterator/buffer_iterator.hpp new file mode 100644 index 0000000000..cd68058f64 --- /dev/null +++ b/3party/boost/boost/compute/iterator/buffer_iterator.hpp @@ -0,0 +1,280 @@ +//---------------------------------------------------------------------------// +// Copyright (c) 2013 Kyle Lutz +// +// 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 +// +// See http://boostorg.github.com/compute for more information. +//---------------------------------------------------------------------------// + +#ifndef BOOST_COMPUTE_ITERATOR_BUFFER_ITERATOR_HPP +#define BOOST_COMPUTE_ITERATOR_BUFFER_ITERATOR_HPP + +#include +#include + +#include +#include +#include +#include +#include + +#include +#include +#include +#include +#include +#include + +namespace boost { +namespace compute { + +// forward declaration for buffer_iterator +template class buffer_iterator; + +namespace detail { + +// helper class which defines the iterator_facade super-class +// type for buffer_iterator +template +class buffer_iterator_base +{ +public: + typedef ::boost::iterator_facade< + ::boost::compute::buffer_iterator, + T, + ::std::random_access_iterator_tag, + ::boost::compute::detail::buffer_value + > type; +}; + +template +struct buffer_iterator_index_expr +{ + typedef T result_type; + + buffer_iterator_index_expr(const buffer &buffer, + size_t index, + const memory_object::address_space address_space, + const IndexExpr &expr) + : m_buffer(buffer), + m_index(index), + m_address_space(address_space), + m_expr(expr) + { + } + + operator T() const + { + BOOST_STATIC_ASSERT_MSG(boost::is_integral::value, + "Index expression must be integral"); + + return buffer_value(m_buffer, size_t(m_expr) * sizeof(T)); + } + + const buffer &m_buffer; + size_t m_index; + memory_object::address_space m_address_space; + IndexExpr m_expr; +}; + +template +inline meta_kernel& operator<<(meta_kernel &kernel, + const buffer_iterator_index_expr &expr) +{ + if(expr.m_index == 0){ + return kernel << + kernel.get_buffer_identifier(expr.m_buffer, expr.m_address_space) << + '[' << expr.m_expr << ']'; + } + else { + return kernel << + kernel.get_buffer_identifier(expr.m_buffer, expr.m_address_space) << + '[' << uint_(expr.m_index) << "+(" << expr.m_expr << ")]"; + } +} + +} // end detail namespace + +/// \class buffer_iterator +/// \brief An iterator for values in a buffer. +/// +/// The buffer_iterator class iterates over values in a memory buffer on a +/// compute device. It is the most commonly used iterator in Boost.Compute +/// and is used by the \ref vector "vector" and \ref array "array" +/// container classes. +/// +/// Buffer iterators store a reference to a memory buffer along with an index +/// into that memory buffer. +/// +/// The buffer_iterator class allows for arbitrary OpenCL memory objects +/// (including those created outside of Boost.Compute) to be used with the +/// Boost.Compute algorithms (such as transform() and sort()). For example, +/// to reverse the contents of an OpenCL memory buffer containing a set of +/// integers: +/// +/// \snippet test/test_buffer_iterator.cpp reverse_external_buffer +/// +/// \see buffer, make_buffer_iterator() +template +class buffer_iterator : public detail::buffer_iterator_base::type +{ +public: + typedef typename detail::buffer_iterator_base::type super_type; + typedef typename super_type::reference reference; + typedef typename super_type::difference_type difference_type; + + buffer_iterator() + : m_index(0) + { + } + + buffer_iterator(const buffer &buffer, size_t index) + : m_buffer(buffer.get(), false), + m_index(index) + { + } + + buffer_iterator(const buffer_iterator &other) + : m_buffer(other.m_buffer.get(), false), + m_index(other.m_index) + { + } + + buffer_iterator& operator=(const buffer_iterator &other) + { + if(this != &other){ + m_buffer.get() = other.m_buffer.get(); + m_index = other.m_index; + } + + return *this; + } + + ~buffer_iterator() + { + // set buffer to null so that its reference count will + // not be decremented when its destructor is called + m_buffer.get() = 0; + } + + const buffer& get_buffer() const + { + return m_buffer; + } + + size_t get_index() const + { + return m_index; + } + + T read(command_queue &queue) const + { + BOOST_ASSERT(m_buffer.get()); + BOOST_ASSERT(m_index < m_buffer.size() / sizeof(T)); + + return detail::read_single_value(m_buffer, m_index, queue); + } + + void write(const T &value, command_queue &queue) + { + BOOST_ASSERT(m_buffer.get()); + BOOST_ASSERT(m_index < m_buffer.size() / sizeof(T)); + + detail::write_single_value(value, m_buffer, m_index, queue); + } + + /// \internal_ + template + detail::buffer_iterator_index_expr + operator[](const Expr &expr) const + { + BOOST_ASSERT(m_buffer.get()); + + return detail::buffer_iterator_index_expr( + m_buffer, m_index, memory_object::global_memory, expr + ); + } + +private: + friend class ::boost::iterator_core_access; + + /// \internal_ + reference dereference() const + { + return detail::buffer_value(m_buffer, m_index * sizeof(T)); + } + + /// \internal_ + bool equal(const buffer_iterator &other) const + { + return m_buffer.get() == other.m_buffer.get() && + m_index == other.m_index; + } + + /// \internal_ + void increment() + { + m_index++; + } + + /// \internal_ + void decrement() + { + m_index--; + } + + /// \internal_ + void advance(difference_type n) + { + m_index = static_cast(static_cast(m_index) + n); + } + + /// \internal_ + difference_type distance_to(const buffer_iterator &other) const + { + return static_cast(other.m_index - m_index); + } + +private: + const buffer m_buffer; + size_t m_index; +}; + +/// Creates a new \ref buffer_iterator for \p buffer at \p index. +/// +/// \param buffer the \ref buffer object +/// \param index the index in the buffer +/// +/// \return a \c buffer_iterator for \p buffer at \p index +template +inline buffer_iterator +make_buffer_iterator(const buffer &buffer, size_t index = 0) +{ + return buffer_iterator(buffer, index); +} + +/// \internal_ (is_device_iterator specialization for buffer_iterator) +template +struct is_device_iterator > : boost::true_type {}; + +namespace detail { + +// is_buffer_iterator specialization for buffer_iterator +template +struct is_buffer_iterator< + Iterator, + typename boost::enable_if< + boost::is_same< + buffer_iterator, + typename boost::remove_const::type + > + >::type +> : public boost::true_type {}; + +} // end detail namespace +} // end compute namespace +} // end boost namespace + +#endif // BOOST_COMPUTE_ITERATOR_BUFFER_ITERATOR_HPP diff --git a/3party/boost/boost/compute/iterator/constant_buffer_iterator.hpp b/3party/boost/boost/compute/iterator/constant_buffer_iterator.hpp new file mode 100644 index 0000000000..ef9a2ac959 --- /dev/null +++ b/3party/boost/boost/compute/iterator/constant_buffer_iterator.hpp @@ -0,0 +1,209 @@ +//---------------------------------------------------------------------------// +// Copyright (c) 2013 Kyle Lutz +// +// 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 +// +// See http://boostorg.github.com/compute for more information. +//---------------------------------------------------------------------------// + +#ifndef BOOST_COMPUTE_ITERATOR_CONSTANT_BUFFER_ITERATOR_HPP +#define BOOST_COMPUTE_ITERATOR_CONSTANT_BUFFER_ITERATOR_HPP + +#include +#include + +#include + +#include +#include +#include + +namespace boost { +namespace compute { + +// forward declaration for constant_buffer_iterator +template class constant_buffer_iterator; + +namespace detail { + +// helper class which defines the iterator_facade super-class +// type for constant_buffer_iterator +template +class constant_buffer_iterator_base +{ +public: + typedef ::boost::iterator_facade< + ::boost::compute::constant_buffer_iterator, + T, + ::std::random_access_iterator_tag, + ::boost::compute::detail::buffer_value + > type; +}; + +} // end detail namespace + +/// \class constant_buffer_iterator +/// \brief An iterator for a buffer in the \c constant memory space. +/// +/// The constant_buffer_iterator class provides an iterator for values in a +/// buffer in the \c constant memory space. +/// +/// For iterating over values in the \c global memory space (the most common +/// case), use the buffer_iterator class. +/// +/// \see buffer_iterator +template +class constant_buffer_iterator : + public detail::constant_buffer_iterator_base::type +{ +public: + typedef typename detail::constant_buffer_iterator_base::type super_type; + typedef typename super_type::reference reference; + typedef typename super_type::difference_type difference_type; + + constant_buffer_iterator() + : m_buffer(0), + m_index(0) + { + } + + constant_buffer_iterator(const buffer &buffer, size_t index) + : m_buffer(&buffer), + m_index(index) + { + } + + constant_buffer_iterator(const constant_buffer_iterator &other) + : m_buffer(other.m_buffer), + m_index(other.m_index) + { + } + + constant_buffer_iterator& operator=(const constant_buffer_iterator &other) + { + if(this != &other){ + m_buffer = other.m_buffer; + m_index = other.m_index; + } + + return *this; + } + + ~constant_buffer_iterator() + { + } + + const buffer& get_buffer() const + { + return *m_buffer; + } + + size_t get_index() const + { + return m_index; + } + + T read(command_queue &queue) const + { + BOOST_ASSERT(m_buffer && m_buffer->get()); + BOOST_ASSERT(m_index < m_buffer->size() / sizeof(T)); + + return detail::read_single_value(m_buffer, m_index, queue); + } + + void write(const T &value, command_queue &queue) + { + BOOST_ASSERT(m_buffer && m_buffer->get()); + BOOST_ASSERT(m_index < m_buffer->size() / sizeof(T)); + + detail::write_single_value(m_buffer, m_index, queue); + } + + template + detail::buffer_iterator_index_expr + operator[](const Expr &expr) const + { + BOOST_ASSERT(m_buffer); + BOOST_ASSERT(m_buffer->get()); + + return detail::buffer_iterator_index_expr( + *m_buffer, m_index, memory_object::constant_memory, expr + ); + } + +private: + friend class ::boost::iterator_core_access; + + reference dereference() const + { + return detail::buffer_value(*m_buffer, m_index); + } + + bool equal(const constant_buffer_iterator &other) const + { + return m_buffer == other.m_buffer && m_index == other.m_index; + } + + void increment() + { + m_index++; + } + + void decrement() + { + m_index--; + } + + void advance(difference_type n) + { + m_index = static_cast(static_cast(m_index) + n); + } + + difference_type distance_to(const constant_buffer_iterator &other) const + { + return static_cast(other.m_index - m_index); + } + +private: + const buffer *m_buffer; + size_t m_index; +}; + +/// Creates a new constant_buffer_iterator for \p buffer at \p index. +/// +/// \param buffer the \ref buffer object +/// \param index the index in the buffer +/// +/// \return a \c constant_buffer_iterator for \p buffer at \p index +template +inline constant_buffer_iterator +make_constant_buffer_iterator(const buffer &buffer, size_t index = 0) +{ + return constant_buffer_iterator(buffer, index); +} + +/// \internal_ (is_device_iterator specialization for constant_buffer_iterator) +template +struct is_device_iterator > : boost::true_type {}; + +namespace detail { + +// is_buffer_iterator specialization for constant_buffer_iterator +template +struct is_buffer_iterator< + Iterator, + typename boost::enable_if< + boost::is_same< + constant_buffer_iterator, + typename boost::remove_const::type + > + >::type +> : public boost::true_type {}; + +} // end detail namespace +} // end compute namespace +} // end boost namespace + +#endif // BOOST_COMPUTE_ITERATOR_CONSTANT_BUFFER_ITERATOR_HPP diff --git a/3party/boost/boost/compute/iterator/constant_iterator.hpp b/3party/boost/boost/compute/iterator/constant_iterator.hpp new file mode 100644 index 0000000000..f0d45c02c0 --- /dev/null +++ b/3party/boost/boost/compute/iterator/constant_iterator.hpp @@ -0,0 +1,171 @@ +//---------------------------------------------------------------------------// +// Copyright (c) 2013 Kyle Lutz +// +// 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 +// +// See http://boostorg.github.com/compute for more information. +//---------------------------------------------------------------------------// + +#ifndef BOOST_COMPUTE_ITERATOR_CONSTANT_ITERATOR_HPP +#define BOOST_COMPUTE_ITERATOR_CONSTANT_ITERATOR_HPP + +#include +#include +#include + +#include +#include + +#include +#include + +namespace boost { +namespace compute { + +// forward declaration for constant_iterator +template class constant_iterator; + +namespace detail { + +// helper class which defines the iterator_facade super-class +// type for constant_iterator +template +class constant_iterator_base +{ +public: + typedef ::boost::iterator_facade< + ::boost::compute::constant_iterator, + T, + ::std::random_access_iterator_tag + > type; +}; + +} // end detail namespace + +/// \class constant_iterator +/// \brief An iterator with a constant value. +/// +/// The constant_iterator class provides an iterator which returns a constant +/// value when dereferenced. +/// +/// For example, this could be used to implement the fill() algorithm in terms +/// of the copy() algorithm by copying from a range of constant iterators: +/// +/// \snippet test/test_constant_iterator.cpp fill_with_copy +/// +/// \see make_constant_iterator() +template +class constant_iterator : public detail::constant_iterator_base::type +{ +public: + typedef typename detail::constant_iterator_base::type super_type; + typedef typename super_type::reference reference; + typedef typename super_type::difference_type difference_type; + + constant_iterator(const T &value, size_t index = 0) + : m_value(value), + m_index(index) + { + } + + constant_iterator(const constant_iterator &other) + : m_value(other.m_value), + m_index(other.m_index) + { + } + + constant_iterator& operator=(const constant_iterator &other) + { + if(this != &other){ + m_value = other.m_value; + m_index = other.m_index; + } + + return *this; + } + + ~constant_iterator() + { + } + + size_t get_index() const + { + return m_index; + } + + /// \internal_ + template + detail::meta_kernel_literal operator[](const Expr &expr) const + { + (void) expr; + + return detail::meta_kernel::make_lit(m_value); + } + +private: + friend class ::boost::iterator_core_access; + + /// \internal_ + reference dereference() const + { + return m_value; + } + + /// \internal_ + bool equal(const constant_iterator &other) const + { + return m_value == other.m_value && m_index == other.m_index; + } + + /// \internal_ + void increment() + { + m_index++; + } + + /// \internal_ + void decrement() + { + m_index--; + } + + /// \internal_ + void advance(difference_type n) + { + m_index = static_cast(static_cast(m_index) + n); + } + + /// \internal_ + difference_type distance_to(const constant_iterator &other) const + { + return static_cast(other.m_index - m_index); + } + +private: + T m_value; + size_t m_index; +}; + +/// Returns a new constant_iterator with \p value at \p index. +/// +/// \param value the constant value +/// \param index the iterators index +/// +/// \return a \c constant_iterator with \p value +template +inline constant_iterator +make_constant_iterator(const T &value, size_t index = 0) +{ + return constant_iterator(value, index); +} + +/// \internal_ (is_device_iterator specialization for constant_iterator) +template +struct is_device_iterator > : boost::true_type {}; + +} // end compute namespace +} // end boost namespace + +#endif // BOOST_COMPUTE_ITERATOR_CONSTANT_ITERATOR_HPP diff --git a/3party/boost/boost/compute/iterator/counting_iterator.hpp b/3party/boost/boost/compute/iterator/counting_iterator.hpp new file mode 100644 index 0000000000..304c1e05cf --- /dev/null +++ b/3party/boost/boost/compute/iterator/counting_iterator.hpp @@ -0,0 +1,185 @@ +//---------------------------------------------------------------------------// +// Copyright (c) 2013 Kyle Lutz +// +// 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 +// +// See http://boostorg.github.com/compute for more information. +//---------------------------------------------------------------------------// + +#ifndef BOOST_COMPUTE_ITERATOR_COUNTING_ITERATOR_HPP +#define BOOST_COMPUTE_ITERATOR_COUNTING_ITERATOR_HPP + +#include +#include +#include + +#include +#include + +#include +#include + +namespace boost { +namespace compute { + +// forward declaration for counting_iterator +template class counting_iterator; + +namespace detail { + +// helper class which defines the iterator_facade super-class +// type for counting_iterator +template +class counting_iterator_base +{ +public: + typedef ::boost::iterator_facade< + ::boost::compute::counting_iterator, + T, + ::std::random_access_iterator_tag + > type; +}; + +template +struct counting_iterator_index_expr +{ + typedef T result_type; + + counting_iterator_index_expr(const T &init, const IndexExpr &expr) + : m_init(init), + m_expr(expr) + { + } + + const T &m_init; + IndexExpr m_expr; +}; + +template +inline meta_kernel& operator<<(meta_kernel &kernel, + const counting_iterator_index_expr &expr) +{ + return kernel << '(' << expr.m_init << '+' << expr.m_expr << ')'; +} + +} // end detail namespace + +/// \class counting_iterator +/// \brief The counting_iterator class implements a counting iterator. +/// +/// A counting iterator returns an internal value (initialized with \p init) +/// which is incremented each time the iterator is incremented. +/// +/// For example, this could be used to implement the iota() algorithm in terms +/// of the copy() algorithm by copying from a range of counting iterators: +/// +/// \snippet test/test_counting_iterator.cpp iota_with_copy +/// +/// \see make_counting_iterator() +template +class counting_iterator : public detail::counting_iterator_base::type +{ +public: + typedef typename detail::counting_iterator_base::type super_type; + typedef typename super_type::reference reference; + typedef typename super_type::difference_type difference_type; + + counting_iterator(const T &init) + : m_init(init) + { + } + + counting_iterator(const counting_iterator &other) + : m_init(other.m_init) + { + } + + counting_iterator& operator=(const counting_iterator &other) + { + if(this != &other){ + m_init = other.m_init; + } + + return *this; + } + + ~counting_iterator() + { + } + + size_t get_index() const + { + return 0; + } + + template + detail::counting_iterator_index_expr + operator[](const Expr &expr) const + { + return detail::counting_iterator_index_expr(m_init, expr); + } + +private: + friend class ::boost::iterator_core_access; + + reference dereference() const + { + return m_init; + } + + bool equal(const counting_iterator &other) const + { + return m_init == other.m_init; + } + + void increment() + { + m_init++; + } + + void decrement() + { + m_init--; + } + + void advance(difference_type n) + { + m_init += static_cast(n); + } + + difference_type distance_to(const counting_iterator &other) const + { + return difference_type(other.m_init) - difference_type(m_init); + } + +private: + T m_init; +}; + +/// Returns a new counting_iterator starting at \p init. +/// +/// \param init the initial value +/// +/// \return a counting_iterator with \p init. +/// +/// For example, to create a counting iterator which returns unsigned integers +/// and increments from one: +/// \code +/// auto iter = make_counting_iterator(1); +/// \endcode +template +inline counting_iterator make_counting_iterator(const T &init) +{ + return counting_iterator(init); +} + +/// \internal_ (is_device_iterator specialization for counting_iterator) +template +struct is_device_iterator > : boost::true_type {}; + +} // end compute namespace +} // end boost namespace + +#endif // BOOST_COMPUTE_ITERATOR_COUNTING_ITERATOR_HPP diff --git a/3party/boost/boost/compute/iterator/detail/get_base_iterator_buffer.hpp b/3party/boost/boost/compute/iterator/detail/get_base_iterator_buffer.hpp new file mode 100644 index 0000000000..3d14355115 --- /dev/null +++ b/3party/boost/boost/compute/iterator/detail/get_base_iterator_buffer.hpp @@ -0,0 +1,52 @@ +//---------------------------------------------------------------------------// +// Copyright (c) 2013 Kyle Lutz +// +// 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 +// +// See http://boostorg.github.com/compute for more information. +//---------------------------------------------------------------------------// + +#ifndef BOOST_COMPUTE_ITERATOR_DETAIL_GET_BASE_ITERATOR_BUFFER_HPP +#define BOOST_COMPUTE_ITERATOR_DETAIL_GET_BASE_ITERATOR_BUFFER_HPP + +namespace boost { +namespace compute { +namespace detail { + +// returns the buffer for an iterator adaptor's base iterator if +// it exists, otherwise returns a null buffer object. +template +inline const buffer& +get_base_iterator_buffer(const Iterator &iter, + typename boost::enable_if< + is_buffer_iterator< + typename Iterator::base_type + > + >::type* = 0) +{ + return iter.base().get_buffer(); +} + +template +inline const buffer& +get_base_iterator_buffer(const Iterator &iter, + typename boost::disable_if< + is_buffer_iterator< + typename Iterator::base_type + > + >::type* = 0) +{ + (void) iter; + + static buffer null_buffer; + + return null_buffer; +} + +} // end detail namespace +} // end compute namespace +} // end boost namespace + +#endif // BOOST_COMPUTE_ITERATOR_DETAIL_GET_BASE_ITERATOR_BUFFER_HPP diff --git a/3party/boost/boost/compute/iterator/detail/swizzle_iterator.hpp b/3party/boost/boost/compute/iterator/detail/swizzle_iterator.hpp new file mode 100644 index 0000000000..c7c3c45340 --- /dev/null +++ b/3party/boost/boost/compute/iterator/detail/swizzle_iterator.hpp @@ -0,0 +1,188 @@ +//---------------------------------------------------------------------------// +// Copyright (c) 2013 Kyle Lutz +// +// 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 +// +// See http://boostorg.github.com/compute for more information. +//---------------------------------------------------------------------------// + +#ifndef BOOST_COMPUTE_ITERATOR_DETAIL_SWIZZLE_ITERATOR_HPP +#define BOOST_COMPUTE_ITERATOR_DETAIL_SWIZZLE_ITERATOR_HPP + +#include +#include +#include + +#include +#include + +#include +#include +#include +#include +#include +#include +#include + +namespace boost { +namespace compute { +namespace detail { + +// forward declaration for swizzle_iterator +template +class swizzle_iterator; + +// meta-function returing the value_type for a swizzle_iterator +template +struct make_swizzle_iterator_value_type +{ + typedef + typename make_vector_type< + typename scalar_type< + typename std::iterator_traits::value_type + >::type, + Size + >::type type; +}; + +// helper class which defines the iterator_adaptor super-class +// type for swizzle_iterator +template +class swizzle_iterator_base +{ +public: + typedef ::boost::iterator_adaptor< + swizzle_iterator, + InputIterator, + typename make_swizzle_iterator_value_type::type, + typename std::iterator_traits::iterator_category, + typename make_swizzle_iterator_value_type::type + > type; +}; + +template +struct swizzle_iterator_index_expr +{ + typedef typename make_swizzle_iterator_value_type::type result_type; + + swizzle_iterator_index_expr(const InputIterator &input_iter, + const IndexExpr &index_expr, + const std::string &components) + : m_input_iter(input_iter), + m_index_expr(index_expr), + m_components(components) + { + } + + InputIterator m_input_iter; + IndexExpr m_index_expr; + std::string m_components; +}; + +template +inline meta_kernel& operator<<(meta_kernel &kernel, + const swizzle_iterator_index_expr &expr) +{ + return kernel << expr.m_input_iter[expr.m_index_expr] + << "." << expr.m_components; +} + +template +class swizzle_iterator : + public swizzle_iterator_base::type +{ +public: + typedef typename + swizzle_iterator_base::type + super_type; + typedef typename super_type::value_type value_type; + typedef typename super_type::reference reference; + typedef typename super_type::base_type base_type; + typedef typename super_type::difference_type difference_type; + + BOOST_STATIC_CONSTANT(size_t, vector_size = Size); + + swizzle_iterator(InputIterator iterator, const std::string &components) + : super_type(iterator), + m_components(components) + { + BOOST_ASSERT(components.size() == Size); + } + + swizzle_iterator(const swizzle_iterator &other) + : super_type(other.base()), + m_components(other.m_components) + { + BOOST_ASSERT(m_components.size() == Size); + } + + swizzle_iterator& + operator=(const swizzle_iterator &other) + { + if(this != &other){ + super_type::operator=(other); + + m_components = other.m_components; + } + + return *this; + } + + ~swizzle_iterator() + { + } + + size_t get_index() const + { + return super_type::base().get_index(); + } + + const buffer& get_buffer() const + { + return get_base_iterator_buffer(*this); + } + + template + swizzle_iterator_index_expr + operator[](const IndexExpression &expr) const + { + return swizzle_iterator_index_expr(super_type::base(), + expr, + m_components); + } + +private: + friend class ::boost::iterator_core_access; + + reference dereference() const + { + return reference(); + } + +private: + std::string m_components; +}; + +template +inline swizzle_iterator +make_swizzle_iterator(InputIterator iterator, const std::string &components) +{ + return swizzle_iterator(iterator, components); +} + +} // end detail namespace + +// is_device_iterator specialization for swizzle_iterator +template +struct is_device_iterator > : boost::true_type {}; + +} // end compute namespace +} // end boost namespace + +#endif // BOOST_COMPUTE_ITERATOR_SWIZZLE_ITERATOR_HPP diff --git a/3party/boost/boost/compute/iterator/discard_iterator.hpp b/3party/boost/boost/compute/iterator/discard_iterator.hpp new file mode 100644 index 0000000000..e002cf2ac2 --- /dev/null +++ b/3party/boost/boost/compute/iterator/discard_iterator.hpp @@ -0,0 +1,170 @@ +//---------------------------------------------------------------------------// +// Copyright (c) 2013-2014 Kyle Lutz +// +// 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 +// +// See http://boostorg.github.com/compute for more information. +//---------------------------------------------------------------------------// + +#ifndef BOOST_COMPUTE_ITERATOR_DISCARD_ITERATOR_HPP +#define BOOST_COMPUTE_ITERATOR_DISCARD_ITERATOR_HPP + +#include +#include +#include + +#include +#include + +#include +#include + +namespace boost { +namespace compute { + +// forward declaration for discard_iterator +class discard_iterator; + +namespace detail { + +// helper class which defines the iterator_facade super-class +// type for discard_iterator +struct discard_iterator_base +{ + typedef ::boost::iterator_facade< + ::boost::compute::discard_iterator, + void, + ::std::random_access_iterator_tag, + void * + > type; +}; + +template +struct discard_iterator_index_expr +{ + typedef void result_type; + + discard_iterator_index_expr(const IndexExpr &expr) + : m_expr(expr) + { + } + + IndexExpr m_expr; +}; + +template +inline meta_kernel& operator<<(meta_kernel &kernel, + const discard_iterator_index_expr &expr) +{ + (void) expr; + + return kernel; +} + +} // end detail namespace + +/// \class discard_iterator +/// \brief An iterator which discards all values written to it. +/// +/// \see make_discard_iterator(), constant_iterator +class discard_iterator : public detail::discard_iterator_base::type +{ +public: + typedef detail::discard_iterator_base::type super_type; + typedef super_type::reference reference; + typedef super_type::difference_type difference_type; + + discard_iterator(size_t index = 0) + : m_index(index) + { + } + + discard_iterator(const discard_iterator &other) + : m_index(other.m_index) + { + } + + discard_iterator& operator=(const discard_iterator &other) + { + if(this != &other){ + m_index = other.m_index; + } + + return *this; + } + + ~discard_iterator() + { + } + + /// \internal_ + template + detail::discard_iterator_index_expr + operator[](const Expr &expr) const + { + return detail::discard_iterator_index_expr(expr); + } + +private: + friend class ::boost::iterator_core_access; + + /// \internal_ + reference dereference() const + { + return 0; + } + + /// \internal_ + bool equal(const discard_iterator &other) const + { + return m_index == other.m_index; + } + + /// \internal_ + void increment() + { + m_index++; + } + + /// \internal_ + void decrement() + { + m_index--; + } + + /// \internal_ + void advance(difference_type n) + { + m_index = static_cast(static_cast(m_index) + n); + } + + /// \internal_ + difference_type distance_to(const discard_iterator &other) const + { + return static_cast(other.m_index - m_index); + } + +private: + size_t m_index; +}; + +/// Returns a new discard_iterator with \p index. +/// +/// \param index the index of the iterator +/// +/// \return a \c discard_iterator at \p index +inline discard_iterator make_discard_iterator(size_t index = 0) +{ + return discard_iterator(index); +} + +/// internal_ (is_device_iterator specialization for discard_iterator) +template<> +struct is_device_iterator : boost::true_type {}; + +} // end compute namespace +} // end boost namespace + +#endif // BOOST_COMPUTE_ITERATOR_DISCARD_ITERATOR_HPP diff --git a/3party/boost/boost/compute/iterator/function_input_iterator.hpp b/3party/boost/boost/compute/iterator/function_input_iterator.hpp new file mode 100644 index 0000000000..bd89b6c0fc --- /dev/null +++ b/3party/boost/boost/compute/iterator/function_input_iterator.hpp @@ -0,0 +1,186 @@ +//---------------------------------------------------------------------------// +// Copyright (c) 2013 Kyle Lutz +// +// 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 +// +// See http://boostorg.github.com/compute for more information. +//---------------------------------------------------------------------------// + +#ifndef BOOST_COMPUTE_ITERATOR_FUNCTION_INPUT_ITERATOR_HPP +#define BOOST_COMPUTE_ITERATOR_FUNCTION_INPUT_ITERATOR_HPP + +#include +#include + +#include +#include + +#include +#include +#include + +namespace boost { +namespace compute { + +// forward declaration for function_input_iterator +template class function_input_iterator; + +namespace detail { + +// helper class which defines the iterator_facade super-class +// type for function_input_iterator +template +class function_input_iterator_base +{ +public: + typedef ::boost::iterator_facade< + ::boost::compute::function_input_iterator, + typename ::boost::compute::result_of::type, + ::std::random_access_iterator_tag, + typename ::boost::compute::result_of::type + > type; +}; + +template +struct function_input_iterator_expr +{ + typedef typename ::boost::compute::result_of::type result_type; + + function_input_iterator_expr(const Function &function) + : m_function(function) + { + } + + Function m_function; +}; + +template +inline meta_kernel& operator<<(meta_kernel &kernel, + const function_input_iterator_expr &expr) +{ + return kernel << expr.m_function(); +} + +} // end detail namespace + +/// \class function_input_iterator +/// \brief Iterator which returns the result of a function when dereferenced +/// +/// For example: +/// +/// \snippet test/test_function_input_iterator.cpp generate_42 +/// +/// \see make_function_input_iterator() +template +class function_input_iterator : + public detail::function_input_iterator_base::type +{ +public: + typedef typename detail::function_input_iterator_base::type super_type; + typedef typename super_type::reference reference; + typedef typename super_type::difference_type difference_type; + typedef Function function; + + function_input_iterator(const Function &function, size_t index = 0) + : m_function(function), + m_index(index) + { + } + + function_input_iterator(const function_input_iterator &other) + : m_function(other.m_function), + m_index(other.m_index) + { + } + + function_input_iterator& + operator=(const function_input_iterator &other) + { + if(this != &other){ + m_function = other.m_function; + m_index = other.m_index; + } + + return *this; + } + + ~function_input_iterator() + { + } + + size_t get_index() const + { + return m_index; + } + + template + detail::function_input_iterator_expr + operator[](const Expr &expr) const + { + (void) expr; + + return detail::function_input_iterator_expr(m_function); + } + +private: + friend class ::boost::iterator_core_access; + + reference dereference() const + { + return reference(); + } + + bool equal(const function_input_iterator &other) const + { + return m_function == other.m_function && m_index == other.m_index; + } + + void increment() + { + m_index++; + } + + void decrement() + { + m_index--; + } + + void advance(difference_type n) + { + m_index = static_cast(static_cast(m_index) + n); + } + + difference_type + distance_to(const function_input_iterator &other) const + { + return static_cast(other.m_index - m_index); + } + +private: + Function m_function; + size_t m_index; +}; + +/// Returns a function_input_iterator with \p function. +/// +/// \param function function to execute when dereferenced +/// \param index index of the iterator +/// +/// \return a \c function_input_iterator with \p function +template +inline function_input_iterator +make_function_input_iterator(const Function &function, size_t index = 0) +{ + return function_input_iterator(function, index); +} + +/// \internal_ (is_device_iterator specialization for function_input_iterator) +template +struct is_device_iterator > : boost::true_type {}; + +} // end compute namespace +} // end boost namespace + +#endif // BOOST_COMPUTE_ITERATOR_FUNCTION_INPUT_ITERATOR_HPP diff --git a/3party/boost/boost/compute/iterator/permutation_iterator.hpp b/3party/boost/boost/compute/iterator/permutation_iterator.hpp new file mode 100644 index 0000000000..8a7f97a402 --- /dev/null +++ b/3party/boost/boost/compute/iterator/permutation_iterator.hpp @@ -0,0 +1,192 @@ +//---------------------------------------------------------------------------// +// Copyright (c) 2013 Kyle Lutz +// +// 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 +// +// See http://boostorg.github.com/compute for more information. +//---------------------------------------------------------------------------// + +#ifndef BOOST_COMPUTE_ITERATOR_PERMUTATION_ITERATOR_HPP +#define BOOST_COMPUTE_ITERATOR_PERMUTATION_ITERATOR_HPP + +#include +#include +#include + +#include +#include + +#include +#include +#include +#include +#include +#include + +namespace boost { +namespace compute { + +// forward declaration for transform_iterator +template +class permutation_iterator; + +namespace detail { + +// helper class which defines the iterator_adaptor super-class +// type for permutation_iterator +template +class permutation_iterator_base +{ +public: + typedef ::boost::iterator_adaptor< + ::boost::compute::permutation_iterator, + ElementIterator + > type; +}; + +template +struct permutation_iterator_access_expr +{ + typedef typename std::iterator_traits::value_type result_type; + + permutation_iterator_access_expr(const ElementIterator &e, + const IndexIterator &i, + const IndexExpr &expr) + : m_element_iter(e), + m_index_iter(i), + m_expr(expr) + { + } + + ElementIterator m_element_iter; + IndexIterator m_index_iter; + IndexExpr m_expr; +}; + +template +inline meta_kernel& operator<<(meta_kernel &kernel, + const permutation_iterator_access_expr &expr) +{ + return kernel << expr.m_element_iter[expr.m_index_iter[expr.m_expr]]; +} + +} // end detail namespace + +/// \class permutation_iterator +/// \brief The permutation_iterator class provides a permuation iterator +/// +/// A permutation iterator iterates over a value range and an index range. When +/// dereferenced, it returns the value from the value range using the current +/// index from the index range. +/// +/// For example, to reverse a range using the copy() algorithm and a permutation +/// sequence: +/// +/// \snippet test/test_permutation_iterator.cpp reverse_range +/// +/// \see make_permutation_iterator() +template +class permutation_iterator + : public detail::permutation_iterator_base::type +{ +public: + typedef typename + detail::permutation_iterator_base::type super_type; + typedef typename super_type::value_type value_type; + typedef typename super_type::reference reference; + typedef typename super_type::base_type base_type; + typedef typename super_type::difference_type difference_type; + typedef IndexIterator index_iterator; + + permutation_iterator(ElementIterator e, IndexIterator i) + : super_type(e), + m_map(i) + { + } + + permutation_iterator(const permutation_iterator &other) + : super_type(other), + m_map(other.m_map) + { + } + + permutation_iterator& + operator=(const permutation_iterator &other) + { + if(this != &other){ + super_type::operator=(other); + m_map = other.m_map; + } + + return *this; + } + + ~permutation_iterator() + { + } + + size_t get_index() const + { + return super_type::base().get_index(); + } + + const buffer& get_buffer() const + { + return detail::get_base_iterator_buffer(*this); + } + + template + detail::permutation_iterator_access_expr + operator[](const IndexExpr &expr) const + { + return detail::permutation_iterator_access_expr(super_type::base(), + m_map, + expr); + } + +private: + friend class ::boost::iterator_core_access; + + reference dereference() const + { + return reference(); + } + +private: + IndexIterator m_map; +}; + +/// Returns a permutation_iterator for \p e using indices from \p i. +/// +/// \param e the element range iterator +/// \param i the index range iterator +/// +/// \return a \c permutation_iterator for \p e using \p i +template +inline permutation_iterator +make_permutation_iterator(ElementIterator e, IndexIterator i) +{ + return permutation_iterator(e, i); +} + +/// \internal_ (is_device_iterator specialization for permutation_iterator) +template +struct is_device_iterator< + permutation_iterator > : boost::true_type {}; + +} // end compute namespace +} // end boost namespace + +#endif // BOOST_COMPUTE_ITERATOR_PERMUTATION_ITERATOR_HPP diff --git a/3party/boost/boost/compute/iterator/strided_iterator.hpp b/3party/boost/boost/compute/iterator/strided_iterator.hpp new file mode 100644 index 0000000000..52e7f07bd8 --- /dev/null +++ b/3party/boost/boost/compute/iterator/strided_iterator.hpp @@ -0,0 +1,296 @@ +//---------------------------------------------------------------------------// +// Copyright (c) 2015 Jakub Szuppe +// +// 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 +// +// See http://boostorg.github.com/compute for more information. +//---------------------------------------------------------------------------// + +#ifndef BOOST_COMPUTE_ITERATOR_STRIDED_ITERATOR_HPP +#define BOOST_COMPUTE_ITERATOR_STRIDED_ITERATOR_HPP + +#include +#include + +#include +#include + +#include +#include +#include +#include +#include +#include +#include + +namespace boost { +namespace compute { + +// forward declaration for strided_iterator +template +class strided_iterator; + +namespace detail { + +// helper class which defines the iterator_adaptor super-class +// type for strided_iterator +template +class strided_iterator_base +{ +public: + typedef ::boost::iterator_adaptor< + ::boost::compute::strided_iterator, + Iterator + > type; +}; + +// helper class for including stride value in index expression +template +struct stride_expr +{ + stride_expr(const IndexExpr &expr, const Stride &stride) + : m_index_expr(expr), + m_stride(stride) + { + } + + IndexExpr m_index_expr; + Stride m_stride; +}; + +template +inline stride_expr make_stride_expr(const IndexExpr &expr, + const Stride &stride) +{ + return stride_expr(expr, stride); +} + +template +inline meta_kernel& operator<<(meta_kernel &kernel, + const stride_expr &expr) +{ + // (expr.m_stride * (expr.m_index_expr)) + return kernel << "(" << static_cast(expr.m_stride) + << " * (" << expr.m_index_expr << "))"; +} + +template +struct strided_iterator_index_expr +{ + typedef typename std::iterator_traits::value_type result_type; + + strided_iterator_index_expr(const Iterator &input_iter, + const Stride &stride, + const IndexExpr &index_expr) + : m_input_iter(input_iter), + m_stride(stride), + m_index_expr(index_expr) + { + } + + Iterator m_input_iter; + const Stride& m_stride; + IndexExpr m_index_expr; +}; + +template +inline meta_kernel& operator<<(meta_kernel &kernel, + const strided_iterator_index_expr &expr) +{ + return kernel << expr.m_input_iter[make_stride_expr(expr.m_index_expr, expr.m_stride)]; +} + +} // end detail namespace + +/// \class strided_iterator +/// \brief An iterator adaptor with adjustable iteration step. +/// +/// The strided iterator adaptor skips over multiple elements each time +/// it is incremented or decremented. +/// +/// \see buffer_iterator, make_strided_iterator(), make_strided_iterator_end() +template +class strided_iterator : + public detail::strided_iterator_base::type +{ +public: + typedef typename + detail::strided_iterator_base::type super_type; + typedef typename super_type::value_type value_type; + typedef typename super_type::reference reference; + typedef typename super_type::base_type base_type; + typedef typename super_type::difference_type difference_type; + + strided_iterator(Iterator iterator, difference_type stride) + : super_type(iterator), + m_stride(static_cast(stride)) + { + // stride must be greater than zero + BOOST_ASSERT_MSG(stride > 0, "Stride must be greater than zero"); + } + + strided_iterator(const strided_iterator &other) + : super_type(other.base()), + m_stride(other.m_stride) + { + } + + strided_iterator& + operator=(const strided_iterator &other) + { + if(this != &other){ + super_type::operator=(other); + + m_stride = other.m_stride; + } + + return *this; + } + + ~strided_iterator() + { + } + + size_t get_index() const + { + return super_type::base().get_index(); + } + + const buffer& get_buffer() const + { + return detail::get_base_iterator_buffer(*this); + } + + template + detail::strided_iterator_index_expr + operator[](const IndexExpression &expr) const + { + typedef + typename detail::strided_iterator_index_expr + StridedIndexExprType; + return StridedIndexExprType(super_type::base(),m_stride, expr); + } + +private: + friend class ::boost::iterator_core_access; + + reference dereference() const + { + return reference(); + } + + bool equal(const strided_iterator &other) const + { + return (other.m_stride == m_stride) + && (other.base_reference() == this->base_reference()); + } + + void increment() + { + std::advance(super_type::base_reference(), m_stride); + } + + void decrement() + { + std::advance(super_type::base_reference(),-m_stride); + } + + void advance(typename super_type::difference_type n) + { + std::advance(super_type::base_reference(), n * m_stride); + } + + difference_type distance_to(const strided_iterator &other) const + { + return std::distance(this->base_reference(), other.base_reference()) / m_stride; + } + +private: + difference_type m_stride; +}; + +/// Returns a strided_iterator for \p iterator with \p stride. +/// +/// \param iterator the underlying iterator +/// \param stride the iteration step for strided_iterator +/// +/// \return a \c strided_iterator for \p iterator with \p stride. +/// +/// For example, to create an iterator which iterates over every other +/// element in a \c vector: +/// \code +/// auto strided_iterator = make_strided_iterator(vec.begin(), 2); +/// \endcode +template +inline strided_iterator +make_strided_iterator(Iterator iterator, + typename std::iterator_traits::difference_type stride) +{ + return strided_iterator(iterator, stride); +} + +/// Returns a strided_iterator which refers to element that would follow +/// the last element accessible through strided_iterator for \p first iterator +/// with \p stride. +/// +/// Parameter \p stride must be greater than zero. +/// +/// \param first the iterator referring to the first element accessible +/// through strided_iterator for \p first with \p stride +/// \param last the iterator referring to the last element that may be +//// accessible through strided_iterator for \p first with \p stride +/// \param stride the iteration step +/// +/// \return a \c strided_iterator referring to element that would follow +/// the last element accessible through strided_iterator for \p first +/// iterator with \p stride. +/// +/// It can be helpful when iterating over strided_iterator: +/// \code +/// // vec.size() may not be divisible by 3 +/// auto strided_iterator_begin = make_strided_iterator(vec.begin(), 3); +/// auto strided_iterator_end = make_strided_iterator_end(vec.begin(), vec.end(), 3); +/// +/// // copy every 3rd element to result +/// boost::compute::copy( +/// strided_iterator_begin, +/// strided_iterator_end, +/// result.begin(), +/// queue +/// ); +/// \endcode +template +strided_iterator +make_strided_iterator_end(Iterator first, + Iterator last, + typename std::iterator_traits::difference_type stride) +{ + typedef typename std::iterator_traits::difference_type difference_type; + + // calculate distance from end to the last element that would be + // accessible through strided_iterator. + difference_type range = std::distance(first, last); + difference_type d = (range - 1) / stride; + d *= stride; + d -= range; + // advance from end to the element that would follow the last + // accessible element + Iterator end_for_strided_iterator = last; + std::advance(end_for_strided_iterator, d + stride); + return strided_iterator(end_for_strided_iterator, stride); +} + +/// \internal_ (is_device_iterator specialization for strided_iterator) +template +struct is_device_iterator > : boost::true_type {}; + +} // end compute namespace +} // end boost namespace + +#endif // BOOST_COMPUTE_ITERATOR_STRIDED_ITERATOR_HPP diff --git a/3party/boost/boost/compute/iterator/transform_iterator.hpp b/3party/boost/boost/compute/iterator/transform_iterator.hpp new file mode 100644 index 0000000000..c040922f9d --- /dev/null +++ b/3party/boost/boost/compute/iterator/transform_iterator.hpp @@ -0,0 +1,227 @@ +//---------------------------------------------------------------------------// +// Copyright (c) 2013 Kyle Lutz +// +// 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 +// +// See http://boostorg.github.com/compute for more information. +//---------------------------------------------------------------------------// + +#ifndef BOOST_COMPUTE_ITERATOR_TRANSFORM_ITERATOR_HPP +#define BOOST_COMPUTE_ITERATOR_TRANSFORM_ITERATOR_HPP + +#include +#include + +#include +#include + +#include +#include +#include +#include +#include +#include +#include + +namespace boost { +namespace compute { + +// forward declaration for transform_iterator +template +class transform_iterator; + +namespace detail { + +// meta-function returning the value_type for a transform_iterator +template +struct make_transform_iterator_value_type +{ + typedef typename std::iterator_traits::value_type value_type; + + typedef typename boost::compute::result_of::type type; +}; + +// helper class which defines the iterator_adaptor super-class +// type for transform_iterator +template +class transform_iterator_base +{ +public: + typedef ::boost::iterator_adaptor< + ::boost::compute::transform_iterator, + InputIterator, + typename make_transform_iterator_value_type::type, + typename std::iterator_traits::iterator_category, + typename make_transform_iterator_value_type::type + > type; +}; + +template +struct transform_iterator_index_expr +{ + typedef typename + make_transform_iterator_value_type< + InputIterator, + UnaryFunction + >::type result_type; + + transform_iterator_index_expr(const InputIterator &input_iter, + const UnaryFunction &transform_expr, + const IndexExpr &index_expr) + : m_input_iter(input_iter), + m_transform_expr(transform_expr), + m_index_expr(index_expr) + { + } + + InputIterator m_input_iter; + UnaryFunction m_transform_expr; + IndexExpr m_index_expr; +}; + +template +inline meta_kernel& operator<<(meta_kernel &kernel, + const transform_iterator_index_expr &expr) +{ + return kernel << expr.m_transform_expr(expr.m_input_iter[expr.m_index_expr]); +} + +} // end detail namespace + +/// \class transform_iterator +/// \brief A transform iterator adaptor. +/// +/// The transform_iterator adaptor applies a unary function to each element +/// produced from the underlying iterator when dereferenced. +/// +/// For example, to copy from an input range to an output range while taking +/// the absolute value of each element: +/// +/// \snippet test/test_transform_iterator.cpp copy_abs +/// +/// \see buffer_iterator, make_transform_iterator() +template +class transform_iterator : + public detail::transform_iterator_base::type +{ +public: + typedef typename + detail::transform_iterator_base::type super_type; + typedef typename super_type::value_type value_type; + typedef typename super_type::reference reference; + typedef typename super_type::base_type base_type; + typedef typename super_type::difference_type difference_type; + typedef UnaryFunction unary_function; + + transform_iterator(InputIterator iterator, UnaryFunction transform) + : super_type(iterator), + m_transform(transform) + { + } + + transform_iterator(const transform_iterator &other) + : super_type(other.base()), + m_transform(other.m_transform) + { + } + + transform_iterator& + operator=(const transform_iterator &other) + { + if(this != &other){ + super_type::operator=(other); + + m_transform = other.m_transform; + } + + return *this; + } + + ~transform_iterator() + { + } + + size_t get_index() const + { + return super_type::base().get_index(); + } + + const buffer& get_buffer() const + { + return detail::get_base_iterator_buffer(*this); + } + + template + detail::transform_iterator_index_expr + operator[](const IndexExpression &expr) const + { + return detail::transform_iterator_index_expr(super_type::base(), + m_transform, + expr); + } + +private: + friend class ::boost::iterator_core_access; + + reference dereference() const + { + const context &context = super_type::base().get_buffer().get_context(); + command_queue queue(context, context.get_device()); + + detail::meta_kernel k("read"); + size_t output_arg = k.add_arg(memory_object::global_memory, "output"); + k << "*output = " << m_transform(super_type::base()[k.lit(0)]) << ";"; + + kernel kernel = k.compile(context); + + buffer output_buffer(context, sizeof(value_type)); + + kernel.set_arg(output_arg, output_buffer); + + queue.enqueue_task(kernel); + + return detail::read_single_value(output_buffer, queue); + } + +private: + UnaryFunction m_transform; +}; + +/// Returns a transform_iterator for \p iterator with \p transform. +/// +/// \param iterator the underlying iterator +/// \param transform the unary transform function +/// +/// \return a \c transform_iterator for \p iterator with \p transform +/// +/// For example, to create an iterator which returns the square-root of each +/// value in a \c vector: +/// \code +/// auto sqrt_iterator = make_transform_iterator(vec.begin(), sqrt()); +/// \endcode +template +inline transform_iterator +make_transform_iterator(InputIterator iterator, UnaryFunction transform) +{ + return transform_iterator(iterator, transform); +} + +/// \internal_ (is_device_iterator specialization for transform_iterator) +template +struct is_device_iterator< + transform_iterator > : boost::true_type {}; + +} // end compute namespace +} // end boost namespace + +#endif // BOOST_COMPUTE_ITERATOR_TRANSFORM_ITERATOR_HPP diff --git a/3party/boost/boost/compute/iterator/zip_iterator.hpp b/3party/boost/boost/compute/iterator/zip_iterator.hpp new file mode 100644 index 0000000000..2860d73a93 --- /dev/null +++ b/3party/boost/boost/compute/iterator/zip_iterator.hpp @@ -0,0 +1,316 @@ +//---------------------------------------------------------------------------// +// Copyright (c) 2013 Kyle Lutz +// +// 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 +// +// See http://boostorg.github.com/compute for more information. +//---------------------------------------------------------------------------// + +#ifndef BOOST_COMPUTE_ITERATOR_ZIP_ITERATOR_HPP +#define BOOST_COMPUTE_ITERATOR_ZIP_ITERATOR_HPP + +#include +#include + +#include +#include +#include +#include +#include +#include +#include +#include +#include + +#include +#include +#include +#include +#include +#include +#include + +namespace boost { +namespace compute { + +// forward declaration for zip_iterator +template +class zip_iterator; + +namespace detail { + +namespace mpl = boost::mpl; + +// meta-function returning the value_type for an iterator +template +struct make_iterator_value_type +{ + typedef typename std::iterator_traits::value_type type; +}; + +// meta-function returning the value_type for a zip_iterator +template +struct make_zip_iterator_value_type +{ + typedef typename + detail::mpl_vector_to_tuple< + typename mpl::transform< + IteratorTuple, + make_iterator_value_type, + mpl::back_inserter > + >::type + >::type type; +}; + +// helper class which defines the iterator_facade super-class +// type for zip_iterator +template +class zip_iterator_base +{ +public: + typedef ::boost::iterator_facade< + ::boost::compute::zip_iterator, + typename make_zip_iterator_value_type::type, + ::std::random_access_iterator_tag, + typename make_zip_iterator_value_type::type + > type; +}; + +template +struct zip_iterator_index_expr +{ + typedef typename + make_zip_iterator_value_type::type + result_type; + + zip_iterator_index_expr(const IteratorTuple &iterators, + const IndexExpr &index_expr) + : m_iterators(iterators), + m_index_expr(index_expr) + { + } + + IteratorTuple m_iterators; + IndexExpr m_index_expr; +}; + +/// \internal_ +#define BOOST_COMPUTE_PRINT_ELEM(z, n, unused) \ + BOOST_PP_EXPR_IF(n, << ", ") \ + << boost::get(expr.m_iterators)[expr.m_index_expr] + +/// \internal_ +#define BOOST_COMPUTE_PRINT_ZIP_IDX(z, n, unused) \ +template \ +inline meta_kernel& operator<<( \ + meta_kernel &kernel, \ + const zip_iterator_index_expr< \ + boost::tuple, \ + IndexExpr \ + > &expr) \ +{ \ + typedef typename \ + boost::tuple \ + tuple_type; \ + typedef typename \ + make_zip_iterator_value_type::type \ + value_type; \ + kernel.inject_type(); \ + return kernel \ + << "(" << type_name() << ")" \ + << "{ " \ + BOOST_PP_REPEAT(n, BOOST_COMPUTE_PRINT_ELEM, ~) \ + << "}"; \ +} + +BOOST_PP_REPEAT_FROM_TO(1, BOOST_COMPUTE_MAX_ARITY, BOOST_COMPUTE_PRINT_ZIP_IDX, ~) + +#undef BOOST_COMPUTE_PRINT_ZIP_IDX +#undef BOOST_COMPUTE_PRINT_ELEM + +struct iterator_advancer +{ + iterator_advancer(size_t n) + : m_distance(n) + { + } + + template + void operator()(Iterator &i) const + { + std::advance(i, m_distance); + } + + size_t m_distance; +}; + +template +void increment_iterator(Iterator &i) +{ + i++; +} + +template +void decrement_iterator(Iterator &i) +{ + i--; +} + +} // end detail namespace + +/// \class zip_iterator +/// \brief A zip iterator adaptor. +/// +/// The zip_iterator class combines values from multiple input iterators. When +/// dereferenced it returns a tuple containing each value at the current +/// position in each input range. +/// +/// \see make_zip_iterator() +template +class zip_iterator : public detail::zip_iterator_base::type +{ +public: + typedef typename + detail::zip_iterator_base::type + super_type; + typedef typename super_type::value_type value_type; + typedef typename super_type::reference reference; + typedef typename super_type::difference_type difference_type; + typedef IteratorTuple iterator_tuple; + + zip_iterator(IteratorTuple iterators) + : m_iterators(iterators) + { + } + + zip_iterator(const zip_iterator &other) + : m_iterators(other.m_iterators) + { + } + + zip_iterator& + operator=(const zip_iterator &other) + { + if(this != &other){ + super_type::operator=(other); + + m_iterators = other.m_iterators; + } + + return *this; + } + + ~zip_iterator() + { + } + + const IteratorTuple& get_iterator_tuple() const + { + return m_iterators; + } + + template + detail::zip_iterator_index_expr + operator[](const IndexExpression &expr) const + { + return detail::zip_iterator_index_expr(m_iterators, + expr); + } + +private: + friend class ::boost::iterator_core_access; + + reference dereference() const + { + return reference(); + } + + bool equal(const zip_iterator &other) const + { + return m_iterators == other.m_iterators; + } + + void increment() + { + boost::fusion::for_each(m_iterators, detail::increment_iterator); + } + + void decrement() + { + boost::fusion::for_each(m_iterators, detail::decrement_iterator); + } + + void advance(difference_type n) + { + boost::fusion::for_each(m_iterators, detail::iterator_advancer(n)); + } + + difference_type distance_to(const zip_iterator &other) const + { + return std::distance(boost::get<0>(m_iterators), + boost::get<0>(other.m_iterators)); + } + +private: + IteratorTuple m_iterators; +}; + +/// Creates a zip_iterator for \p iterators. +/// +/// \param iterators a tuple of input iterators to zip together +/// +/// \return a \c zip_iterator for \p iterators +/// +/// For example, to zip together iterators from three vectors (\c a, \c b, and +/// \p c): +/// \code +/// auto zipped = boost::compute::make_zip_iterator( +/// boost::make_tuple(a.begin(), b.begin(), c.begin()) +/// ); +/// \endcode +template +inline zip_iterator +make_zip_iterator(IteratorTuple iterators) +{ + return zip_iterator(iterators); +} + +/// \internal_ (is_device_iterator specialization for zip_iterator) +template +struct is_device_iterator > : boost::true_type {}; + +namespace detail { + +// get() specialization for zip_iterator +/// \internal_ +#define BOOST_COMPUTE_ZIP_GET_N(z, n, unused) \ +template \ +inline meta_kernel& \ +operator<<(meta_kernel &kernel, \ + const invoked_get< \ + N, \ + zip_iterator_index_expr, \ + boost::tuple \ + > &expr) \ +{ \ + typedef typename boost::tuple Tuple; \ + typedef typename boost::tuples::element::type T; \ + BOOST_STATIC_ASSERT(N < size_t(boost::tuples::length::value)); \ + kernel.inject_type(); \ + return kernel \ + << boost::get(expr.m_arg.m_iterators)[expr.m_arg.m_index_expr]; \ +} + +BOOST_PP_REPEAT_FROM_TO(1, BOOST_COMPUTE_MAX_ARITY, BOOST_COMPUTE_ZIP_GET_N, ~) + +#undef BOOST_COMPUTE_ZIP_GET_N + +} // end detail namespace +} // end compute namespace +} // end boost namespace + +#endif // BOOST_COMPUTE_ITERATOR_ZIP_ITERATOR_HPP diff --git a/3party/boost/boost/compute/kernel.hpp b/3party/boost/boost/compute/kernel.hpp new file mode 100644 index 0000000000..72f21a0378 --- /dev/null +++ b/3party/boost/boost/compute/kernel.hpp @@ -0,0 +1,418 @@ +//---------------------------------------------------------------------------// +// Copyright (c) 2013 Kyle Lutz +// +// 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 +// +// See http://boostorg.github.com/compute for more information. +//---------------------------------------------------------------------------// + +#ifndef BOOST_COMPUTE_KERNEL_HPP +#define BOOST_COMPUTE_KERNEL_HPP + +#include + +#include +#include + +#include +#include +#include +#include +#include +#include + +namespace boost { +namespace compute { +namespace detail { + +template struct set_kernel_arg; + +} // end detail namespace + +/// \class kernel +/// \brief A compute kernel. +/// +/// \see command_queue, program +class kernel +{ +public: + /// Creates a null kernel object. + kernel() + : m_kernel(0) + { + } + + /// Creates a new kernel object for \p kernel. If \p retain is + /// \c true, the reference count for \p kernel will be incremented. + explicit kernel(cl_kernel kernel, bool retain = true) + : m_kernel(kernel) + { + if(m_kernel && retain){ + clRetainKernel(m_kernel); + } + } + + /// Creates a new kernel object with \p name from \p program. + kernel(const program &program, const std::string &name) + { + cl_int error = 0; + m_kernel = clCreateKernel(program.get(), name.c_str(), &error); + + if(!m_kernel){ + BOOST_THROW_EXCEPTION(opencl_error(error)); + } + } + + /// Creates a new kernel object as a copy of \p other. + kernel(const kernel &other) + : m_kernel(other.m_kernel) + { + if(m_kernel){ + clRetainKernel(m_kernel); + } + } + + /// Copies the kernel object from \p other to \c *this. + kernel& operator=(const kernel &other) + { + if(this != &other){ + if(m_kernel){ + clReleaseKernel(m_kernel); + } + + m_kernel = other.m_kernel; + + if(m_kernel){ + clRetainKernel(m_kernel); + } + } + + return *this; + } + + #ifndef BOOST_COMPUTE_NO_RVALUE_REFERENCES + /// Move-constructs a new kernel object from \p other. + kernel(kernel&& other) BOOST_NOEXCEPT + : m_kernel(other.m_kernel) + { + other.m_kernel = 0; + } + + /// Move-assigns the kernel from \p other to \c *this. + kernel& operator=(kernel&& other) BOOST_NOEXCEPT + { + if(m_kernel){ + clReleaseKernel(m_kernel); + } + + m_kernel = other.m_kernel; + other.m_kernel = 0; + + return *this; + } + #endif // BOOST_COMPUTE_NO_RVALUE_REFERENCES + + /// Destroys the kernel object. + ~kernel() + { + if(m_kernel){ + BOOST_COMPUTE_ASSERT_CL_SUCCESS( + clReleaseKernel(m_kernel) + ); + } + } + + /// Returns a reference to the underlying OpenCL kernel object. + cl_kernel& get() const + { + return const_cast(m_kernel); + } + + /// Returns the function name for the kernel. + std::string name() const + { + return get_info(CL_KERNEL_FUNCTION_NAME); + } + + /// Returns the number of arguments for the kernel. + size_t arity() const + { + return get_info(CL_KERNEL_NUM_ARGS); + } + + /// Returns the program for the kernel. + program get_program() const + { + return program(get_info(CL_KERNEL_PROGRAM)); + } + + /// Returns the context for the kernel. + context get_context() const + { + return context(get_info(CL_KERNEL_CONTEXT)); + } + + /// Returns information about the kernel. + /// + /// \see_opencl_ref{clGetKernelInfo} + template + T get_info(cl_kernel_info info) const + { + return detail::get_object_info(clGetKernelInfo, m_kernel, info); + } + + /// \overload + template + typename detail::get_object_info_type::type + get_info() const; + + #if defined(CL_VERSION_1_2) || defined(BOOST_COMPUTE_DOXYGEN_INVOKED) + /// Returns information about the argument at \p index. + /// + /// For example, to get the name of the first argument: + /// \code + /// std::string arg = kernel.get_arg_info(0, CL_KERNEL_ARG_NAME); + /// \endcode + /// + /// Note, this function requires that the program be compiled with the + /// \c "-cl-kernel-arg-info" flag. For example: + /// \code + /// program.build("-cl-kernel-arg-info"); + /// \endcode + /// + /// \opencl_version_warning{1,2} + /// + /// \see_opencl_ref{clGetKernelArgInfo} + template + T get_arg_info(size_t index, cl_kernel_arg_info info) const + { + return detail::get_object_info( + clGetKernelArgInfo, m_kernel, info, static_cast(index) + ); + } + + /// \overload + template + typename detail::get_object_info_type::type + get_arg_info(size_t index) const; + #endif // CL_VERSION_1_2 + + /// Returns work-group information for the kernel with \p device. + /// + /// \see_opencl_ref{clGetKernelWorkGroupInfo} + template + T get_work_group_info(const device &device, cl_kernel_work_group_info info) const + { + return detail::get_object_info(clGetKernelWorkGroupInfo, m_kernel, info, device.id()); + } + + /// Sets the argument at \p index to \p value with \p size. + /// + /// \see_opencl_ref{clSetKernelArg} + void set_arg(size_t index, size_t size, const void *value) + { + BOOST_ASSERT(index < arity()); + + cl_int ret = clSetKernelArg(m_kernel, + static_cast(index), + size, + value); + if(ret != CL_SUCCESS){ + BOOST_THROW_EXCEPTION(opencl_error(ret)); + } + } + + /// Sets the argument at \p index to \p value. + /// + /// For built-in types (e.g. \c float, \c int4_), this is equivalent to + /// calling set_arg(index, sizeof(type), &value). + /// + /// Additionally, this method is specialized for device memory objects + /// such as buffer and image2d. This allows for them to be passed directly + /// without having to extract their underlying cl_mem object. + /// + /// This method is also specialized for device container types such as + /// vector and array. This allows for them to be passed directly + /// as kernel arguments without having to extract their underlying buffer. + /// + /// For setting local memory arguments (e.g. "__local float *buf"), the + /// local_buffer class may be used: + /// \code + /// // set argument to a local buffer with storage for 32 float's + /// kernel.set_arg(0, local_buffer(32)); + /// \endcode + template + void set_arg(size_t index, const T &value) + { + // if you get a compilation error pointing here it means you + // attempted to set a kernel argument from an invalid type. + detail::set_kernel_arg()(*this, index, value); + } + + /// \internal_ + void set_arg(size_t index, const cl_mem mem) + { + set_arg(index, sizeof(cl_mem), static_cast(&mem)); + } + + /// \internal_ + void set_arg(size_t index, const cl_sampler sampler) + { + set_arg(index, sizeof(cl_sampler), static_cast(&sampler)); + } + + /// \internal_ + void set_arg_svm_ptr(size_t index, void* ptr) + { + #ifdef CL_VERSION_2_0 + cl_int ret = clSetKernelArgSVMPointer(m_kernel, static_cast(index), ptr); + if(ret != CL_SUCCESS){ + BOOST_THROW_EXCEPTION(opencl_error(ret)); + } + #else + (void) index; + (void) ptr; + BOOST_THROW_EXCEPTION(opencl_error(CL_INVALID_ARG_VALUE)); + #endif + } + + #ifndef BOOST_COMPUTE_NO_VARIADIC_TEMPLATES + /// Sets the arguments for the kernel to \p args. + template + void set_args(T&&... args) + { + BOOST_ASSERT(sizeof...(T) <= arity()); + + _set_args<0>(args...); + } + #endif // BOOST_COMPUTE_NO_VARIADIC_TEMPLATES + + #if defined(CL_VERSION_2_0) || defined(BOOST_COMPUTE_DOXYGEN_INVOKED) + /// Sets additional execution information for the kernel. + /// + /// \opencl_version_warning{2,0} + /// + /// \see_opencl2_ref{clSetKernelExecInfo} + void set_exec_info(cl_kernel_exec_info info, size_t size, const void *value) + { + cl_int ret = clSetKernelExecInfo(m_kernel, info, size, value); + if(ret != CL_SUCCESS){ + BOOST_THROW_EXCEPTION(opencl_error(ret)); + } + } + #endif // CL_VERSION_2_0 + + /// Returns \c true if the kernel is the same at \p other. + bool operator==(const kernel &other) const + { + return m_kernel == other.m_kernel; + } + + /// Returns \c true if the kernel is different from \p other. + bool operator!=(const kernel &other) const + { + return m_kernel != other.m_kernel; + } + + /// \internal_ + operator cl_kernel() const + { + return m_kernel; + } + + /// \internal_ + static kernel create_with_source(const std::string &source, + const std::string &name, + const context &context) + { + return program::build_with_source(source, context).create_kernel(name); + } + +private: + #ifndef BOOST_COMPUTE_NO_VARIADIC_TEMPLATES + /// \internal_ + template + void _set_args() + { + } + + /// \internal_ + template + void _set_args(T&& arg, Args&&... rest) + { + set_arg(N, arg); + _set_args(rest...); + } + #endif // BOOST_COMPUTE_NO_VARIADIC_TEMPLATES + +private: + cl_kernel m_kernel; +}; + +inline kernel program::create_kernel(const std::string &name) const +{ + return kernel(*this, name); +} + +/// \internal_ define get_info() specializations for kernel +BOOST_COMPUTE_DETAIL_DEFINE_GET_INFO_SPECIALIZATIONS(kernel, + ((std::string, CL_KERNEL_FUNCTION_NAME)) + ((cl_uint, CL_KERNEL_NUM_ARGS)) + ((cl_uint, CL_KERNEL_REFERENCE_COUNT)) + ((cl_context, CL_KERNEL_CONTEXT)) + ((cl_program, CL_KERNEL_PROGRAM)) +) + +#ifdef CL_VERSION_1_2 +BOOST_COMPUTE_DETAIL_DEFINE_GET_INFO_SPECIALIZATIONS(kernel, + ((std::string, CL_KERNEL_ATTRIBUTES)) +) +#endif // CL_VERSION_1_2 + +/// \internal_ define get_arg_info() specializations for kernel +#ifdef CL_VERSION_1_2 +#define BOOST_COMPUTE_DETAIL_DEFINE_KERNEL_GET_ARG_INFO_SPECIALIZATION(result_type, value) \ + namespace detail { \ + template<> struct get_object_info_type { typedef result_type type; }; \ + } \ + template<> inline result_type kernel::get_arg_info(size_t index) const { \ + return get_arg_info(index, value); \ + } + +BOOST_COMPUTE_DETAIL_DEFINE_KERNEL_GET_ARG_INFO_SPECIALIZATION(cl_kernel_arg_address_qualifier, CL_KERNEL_ARG_ADDRESS_QUALIFIER) +BOOST_COMPUTE_DETAIL_DEFINE_KERNEL_GET_ARG_INFO_SPECIALIZATION(cl_kernel_arg_access_qualifier, CL_KERNEL_ARG_ACCESS_QUALIFIER) +BOOST_COMPUTE_DETAIL_DEFINE_KERNEL_GET_ARG_INFO_SPECIALIZATION(std::string, CL_KERNEL_ARG_TYPE_NAME) +BOOST_COMPUTE_DETAIL_DEFINE_KERNEL_GET_ARG_INFO_SPECIALIZATION(cl_kernel_arg_type_qualifier, CL_KERNEL_ARG_TYPE_QUALIFIER) +BOOST_COMPUTE_DETAIL_DEFINE_KERNEL_GET_ARG_INFO_SPECIALIZATION(std::string, CL_KERNEL_ARG_NAME) +#endif // CL_VERSION_1_2 + +namespace detail { + +// set_kernel_arg implementation for built-in types +template +struct set_kernel_arg +{ + typename boost::enable_if >::type + operator()(kernel &kernel_, size_t index, const T &value) + { + kernel_.set_arg(index, sizeof(T), &value); + } +}; + +// set_kernel_arg specialization for char (different from built-in cl_char) +template<> +struct set_kernel_arg +{ + void operator()(kernel &kernel_, size_t index, const char c) + { + kernel_.set_arg(index, sizeof(char), &c); + } +}; + +} // end detail namespace +} // end namespace compute +} // end namespace boost + +#endif // BOOST_COMPUTE_KERNEL_HPP diff --git a/3party/boost/boost/compute/lambda.hpp b/3party/boost/boost/compute/lambda.hpp new file mode 100644 index 0000000000..24bedfd721 --- /dev/null +++ b/3party/boost/boost/compute/lambda.hpp @@ -0,0 +1,22 @@ +//---------------------------------------------------------------------------// +// Copyright (c) 2013 Kyle Lutz +// +// 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 +// +// See http://boostorg.github.com/compute for more information. +//---------------------------------------------------------------------------// + +#ifndef BOOST_COMPUTE_LAMBDA_HPP +#define BOOST_COMPUTE_LAMBDA_HPP + +#include +#include +#include +#include +#include +#include +#include + +#endif // BOOST_COMPUTE_LAMBDA_HPP diff --git a/3party/boost/boost/compute/lambda/context.hpp b/3party/boost/boost/compute/lambda/context.hpp new file mode 100644 index 0000000000..ed25b79475 --- /dev/null +++ b/3party/boost/boost/compute/lambda/context.hpp @@ -0,0 +1,329 @@ +//---------------------------------------------------------------------------// +// Copyright (c) 2013 Kyle Lutz +// +// 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 +// +// See http://boostorg.github.com/compute for more information. +//---------------------------------------------------------------------------// + +#ifndef BOOST_COMPUTE_LAMBDA_CONTEXT_HPP +#define BOOST_COMPUTE_LAMBDA_CONTEXT_HPP + +#include +#include +#include +#include + +#include +#include +#include +#include +#include +#include +#include + +namespace boost { +namespace compute { +namespace lambda { + +namespace mpl = boost::mpl; +namespace proto = boost::proto; + +#define BOOST_COMPUTE_LAMBDA_CONTEXT_DEFINE_BINARY_OPERATOR(tag, op) \ + template \ + void operator()(tag, const LHS &lhs, const RHS &rhs) \ + { \ + if(proto::arity_of::value > 0){ \ + stream << '('; \ + proto::eval(lhs, *this); \ + stream << ')'; \ + } \ + else { \ + proto::eval(lhs, *this); \ + } \ + \ + stream << op; \ + \ + if(proto::arity_of::value > 0){ \ + stream << '('; \ + proto::eval(rhs, *this); \ + stream << ')'; \ + } \ + else { \ + proto::eval(rhs, *this); \ + } \ + } + +// lambda expression context +template +struct context : proto::callable_context > +{ + typedef void result_type; + typedef Args args_tuple; + + // create a lambda context for kernel with args + context(boost::compute::detail::meta_kernel &kernel, const Args &args_) + : stream(kernel), + args(args_) + { + } + + // handle terminals + template + void operator()(proto::tag::terminal, const T &x) + { + // terminal values in lambda expressions are always literals + stream << stream.lit(x); + } + + // handle placeholders + template + void operator()(proto::tag::terminal, placeholder) + { + stream << boost::get(args); + } + + // handle functions + #define BOOST_COMPUTE_LAMBDA_CONTEXT_FUNCTION_ARG(z, n, unused) \ + BOOST_PP_COMMA_IF(n) BOOST_PP_CAT(const Arg, n) BOOST_PP_CAT(&arg, n) + + #define BOOST_COMPUTE_LAMBDA_CONTEXT_FUNCTION(z, n, unused) \ + template \ + void operator()( \ + proto::tag::function, \ + const F &function, \ + BOOST_PP_REPEAT(n, BOOST_COMPUTE_LAMBDA_CONTEXT_FUNCTION_ARG, ~) \ + ) \ + { \ + proto::value(function).apply(*this, BOOST_PP_ENUM_PARAMS(n, arg)); \ + } + + BOOST_PP_REPEAT_FROM_TO(1, BOOST_COMPUTE_MAX_ARITY, BOOST_COMPUTE_LAMBDA_CONTEXT_FUNCTION, ~) + + #undef BOOST_COMPUTE_LAMBDA_CONTEXT_FUNCTION + + // operators + BOOST_COMPUTE_LAMBDA_CONTEXT_DEFINE_BINARY_OPERATOR(proto::tag::plus, '+') + BOOST_COMPUTE_LAMBDA_CONTEXT_DEFINE_BINARY_OPERATOR(proto::tag::minus, '-') + BOOST_COMPUTE_LAMBDA_CONTEXT_DEFINE_BINARY_OPERATOR(proto::tag::multiplies, '*') + BOOST_COMPUTE_LAMBDA_CONTEXT_DEFINE_BINARY_OPERATOR(proto::tag::divides, '/') + BOOST_COMPUTE_LAMBDA_CONTEXT_DEFINE_BINARY_OPERATOR(proto::tag::modulus, '%') + BOOST_COMPUTE_LAMBDA_CONTEXT_DEFINE_BINARY_OPERATOR(proto::tag::less, '<') + BOOST_COMPUTE_LAMBDA_CONTEXT_DEFINE_BINARY_OPERATOR(proto::tag::greater, '>') + BOOST_COMPUTE_LAMBDA_CONTEXT_DEFINE_BINARY_OPERATOR(proto::tag::less_equal, "<=") + BOOST_COMPUTE_LAMBDA_CONTEXT_DEFINE_BINARY_OPERATOR(proto::tag::greater_equal, ">=") + BOOST_COMPUTE_LAMBDA_CONTEXT_DEFINE_BINARY_OPERATOR(proto::tag::equal_to, "==") + BOOST_COMPUTE_LAMBDA_CONTEXT_DEFINE_BINARY_OPERATOR(proto::tag::not_equal_to, "!=") + BOOST_COMPUTE_LAMBDA_CONTEXT_DEFINE_BINARY_OPERATOR(proto::tag::logical_and, "&&") + BOOST_COMPUTE_LAMBDA_CONTEXT_DEFINE_BINARY_OPERATOR(proto::tag::logical_or, "||") + BOOST_COMPUTE_LAMBDA_CONTEXT_DEFINE_BINARY_OPERATOR(proto::tag::bitwise_and, '&') + BOOST_COMPUTE_LAMBDA_CONTEXT_DEFINE_BINARY_OPERATOR(proto::tag::bitwise_or, '|') + BOOST_COMPUTE_LAMBDA_CONTEXT_DEFINE_BINARY_OPERATOR(proto::tag::bitwise_xor, '^') + BOOST_COMPUTE_LAMBDA_CONTEXT_DEFINE_BINARY_OPERATOR(proto::tag::assign, '=') + + // subscript operator + template + void operator()(proto::tag::subscript, const LHS &lhs, const RHS &rhs) + { + proto::eval(lhs, *this); + stream << '['; + proto::eval(rhs, *this); + stream << ']'; + } + + // ternary conditional operator + template + void operator()(proto::tag::if_else_, const Pred &p, const Arg1 &x, const Arg2 &y) + { + proto::eval(p, *this); + stream << '?'; + proto::eval(x, *this); + stream << ':'; + proto::eval(y, *this); + } + + boost::compute::detail::meta_kernel &stream; + Args args; +}; + +namespace detail { + +template +struct invoked_unary_expression +{ + typedef typename ::boost::compute::result_of::type result_type; + + invoked_unary_expression(const Expr &expr, const Arg &arg) + : m_expr(expr), + m_arg(arg) + { + } + + Expr m_expr; + Arg m_arg; +}; + +template +boost::compute::detail::meta_kernel& +operator<<(boost::compute::detail::meta_kernel &kernel, + const invoked_unary_expression &expr) +{ + context > ctx(kernel, boost::make_tuple(expr.m_arg)); + proto::eval(expr.m_expr, ctx); + + return kernel; +} + +template +struct invoked_binary_expression +{ + typedef typename ::boost::compute::result_of::type result_type; + + invoked_binary_expression(const Expr &expr, + const Arg1 &arg1, + const Arg2 &arg2) + : m_expr(expr), + m_arg1(arg1), + m_arg2(arg2) + { + } + + Expr m_expr; + Arg1 m_arg1; + Arg2 m_arg2; +}; + +template +boost::compute::detail::meta_kernel& +operator<<(boost::compute::detail::meta_kernel &kernel, + const invoked_binary_expression &expr) +{ + context > ctx( + kernel, + boost::make_tuple(expr.m_arg1, expr.m_arg2) + ); + proto::eval(expr.m_expr, ctx); + + return kernel; +} + +} // end detail namespace + +// forward declare domain +struct domain; + +// lambda expression wrapper +template +struct expression : proto::extends, domain> +{ + typedef proto::extends, domain> base_type; + + BOOST_PROTO_EXTENDS_USING_ASSIGN(expression) + + expression(const Expr &expr = Expr()) + : base_type(expr) + { + } + + // result_of protocol + template + struct result + { + }; + + template + struct result + { + typedef + typename ::boost::compute::lambda::result_of::type type; + }; + + template + struct result + { + typedef + typename ::boost::compute::lambda::result_of< + Expr, + typename boost::tuple + >::type type; + }; + + template + struct result + { + typedef typename + ::boost::compute::lambda::result_of< + Expr, + typename boost::tuple + >::type type; + }; + + template + detail::invoked_unary_expression, Arg> + operator()(const Arg &x) const + { + return detail::invoked_unary_expression, Arg>(*this, x); + } + + template + detail::invoked_binary_expression, Arg1, Arg2> + operator()(const Arg1 &x, const Arg2 &y) const + { + return detail::invoked_binary_expression< + expression, + Arg1, + Arg2 + >(*this, x, y); + } + + // function<> conversion operator + template + operator function() const + { + using ::boost::compute::detail::meta_kernel; + + std::stringstream source; + + ::boost::compute::detail::meta_kernel_variable arg1("x"); + + source << "inline " << type_name() << " lambda" + << ::boost::compute::detail::generate_argument_list('x') + << "{\n" + << " return " << meta_kernel::expr_to_string((*this)(arg1)) << ";\n" + << "}\n"; + + return make_function_from_source("lambda", source.str()); + } + + template + operator function() const + { + using ::boost::compute::detail::meta_kernel; + + std::stringstream source; + + ::boost::compute::detail::meta_kernel_variable arg1("x"); + ::boost::compute::detail::meta_kernel_variable arg2("y"); + + source << "inline " << type_name() << " lambda" + << ::boost::compute::detail::generate_argument_list('x') + << "{\n" + << " return " << meta_kernel::expr_to_string((*this)(arg1, arg2)) << ";\n" + << "}\n"; + + return make_function_from_source("lambda", source.str()); + } +}; + +// lambda expression domain +struct domain : proto::domain > +{ +}; + +} // end lambda namespace +} // end compute namespace +} // end boost namespace + +#endif // BOOST_COMPUTE_LAMBDA_CONTEXT_HPP diff --git a/3party/boost/boost/compute/lambda/functional.hpp b/3party/boost/boost/compute/lambda/functional.hpp new file mode 100644 index 0000000000..dd7190e4d9 --- /dev/null +++ b/3party/boost/boost/compute/lambda/functional.hpp @@ -0,0 +1,242 @@ +//---------------------------------------------------------------------------// +// Copyright (c) 2013 Kyle Lutz +// +// 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 +// +// See http://boostorg.github.com/compute for more information. +//---------------------------------------------------------------------------// + +#ifndef BOOST_COMPUTE_LAMBDA_FUNCTIONAL_HPP +#define BOOST_COMPUTE_LAMBDA_FUNCTIONAL_HPP + +#include +#include + +#include +#include +#include + +#include +#include +#include + +namespace boost { +namespace compute { +namespace lambda { + +namespace mpl = boost::mpl; +namespace proto = boost::proto; + +// wraps a unary boolean function +#define BOOST_COMPUTE_LAMBDA_WRAP_BOOLEAN_UNARY_FUNCTION(name) \ + namespace detail { \ + struct BOOST_PP_CAT(name, _func) \ + { \ + template \ + struct lambda_result \ + { \ + typedef int type; \ + }; \ + \ + template \ + static void apply(Context &ctx, const Arg &arg) \ + { \ + ctx.stream << #name << "("; \ + proto::eval(arg, ctx); \ + ctx.stream << ")"; \ + } \ + }; \ + } \ + template \ + inline typename proto::result_of::make_expr< \ + proto::tag::function, BOOST_PP_CAT(detail::name, _func), const Arg& \ + >::type const \ + name(const Arg &arg) \ + { \ + return proto::make_expr( \ + BOOST_PP_CAT(detail::name, _func)(), ::boost::ref(arg) \ + ); \ + } + +// wraps a unary function who's return type is the same as the argument type +#define BOOST_COMPUTE_LAMBDA_WRAP_UNARY_FUNCTION_T(name) \ + namespace detail { \ + struct BOOST_PP_CAT(name, _func) \ + { \ + template \ + struct lambda_result \ + { \ + typedef typename proto::result_of::child_c::type Arg1; \ + typedef typename ::boost::compute::lambda::result_of::type type; \ + }; \ + \ + template \ + static void apply(Context &ctx, const Arg &arg) \ + { \ + ctx.stream << #name << "("; \ + proto::eval(arg, ctx); \ + ctx.stream << ")"; \ + } \ + }; \ + } \ + template \ + inline typename proto::result_of::make_expr< \ + proto::tag::function, BOOST_PP_CAT(detail::name, _func), const Arg& \ + >::type const \ + name(const Arg &arg) \ + { \ + return proto::make_expr( \ + BOOST_PP_CAT(detail::name, _func)(), ::boost::ref(arg) \ + ); \ + } + +// wraps a binary function +#define BOOST_COMPUTE_LAMBDA_WRAP_BINARY_FUNCTION(name) \ + namespace detail { \ + struct BOOST_PP_CAT(name, _func) \ + { \ + template \ + struct lambda_result \ + { \ + typedef typename proto::result_of::child_c::type Arg1; \ + typedef typename ::boost::compute::lambda::result_of::type type; \ + }; \ + \ + template \ + static void apply(Context &ctx, const Arg1 &arg1, const Arg2 &arg2) \ + { \ + ctx.stream << #name << "("; \ + proto::eval(arg1, ctx); \ + ctx.stream << ", "; \ + proto::eval(arg2, ctx); \ + ctx.stream << ")"; \ + } \ + }; \ + } \ + template \ + inline typename proto::result_of::make_expr< \ + proto::tag::function, BOOST_PP_CAT(detail::name, _func), const Arg1&, const Arg2& \ + >::type const \ + name(const Arg1 &arg1, const Arg2 &arg2) \ + { \ + return proto::make_expr( \ + BOOST_PP_CAT(detail::name, _func)(), ::boost::ref(arg1), ::boost::ref(arg2) \ + ); \ + } + +// wraps a binary function who's result type is the scalar type of the first argument +#define BOOST_COMPUTE_LAMBDA_WRAP_BINARY_FUNCTION_ST(name) \ + namespace detail { \ + struct BOOST_PP_CAT(name, _func) \ + { \ + template \ + struct lambda_result \ + { \ + typedef typename proto::result_of::child_c::type Arg1; \ + typedef typename ::boost::compute::lambda::result_of::type result_type; \ + typedef typename ::boost::compute::scalar_type::type type; \ + }; \ + \ + template \ + static void apply(Context &ctx, const Arg1 &arg1, const Arg2 &arg2) \ + { \ + ctx.stream << #name << "("; \ + proto::eval(arg1, ctx); \ + ctx.stream << ", "; \ + proto::eval(arg2, ctx); \ + ctx.stream << ")"; \ + } \ + }; \ + } \ + template \ + inline typename proto::result_of::make_expr< \ + proto::tag::function, BOOST_PP_CAT(detail::name, _func), const Arg1&, const Arg2& \ + >::type const \ + name(const Arg1 &arg1, const Arg2 &arg2) \ + { \ + return proto::make_expr( \ + BOOST_PP_CAT(detail::name, _func)(), ::boost::ref(arg1), ::boost::ref(arg2) \ + ); \ + } + +// wraps a ternary function +#define BOOST_COMPUTE_LAMBDA_WRAP_TERNARY_FUNCTION(name) \ + namespace detail { \ + struct BOOST_PP_CAT(name, _func) \ + { \ + template \ + struct lambda_result \ + { \ + typedef typename proto::result_of::child_c::type Arg1; \ + typedef typename ::boost::compute::lambda::result_of::type type; \ + }; \ + \ + template \ + static void apply(Context &ctx, const Arg1 &arg1, const Arg2 &arg2, const Arg3 &arg3) \ + { \ + ctx.stream << #name << "("; \ + proto::eval(arg1, ctx); \ + ctx.stream << ", "; \ + proto::eval(arg2, ctx); \ + ctx.stream << ", "; \ + proto::eval(arg3, ctx); \ + ctx.stream << ")"; \ + } \ + }; \ + } \ + template \ + inline typename proto::result_of::make_expr< \ + proto::tag::function, BOOST_PP_CAT(detail::name, _func), const Arg1&, const Arg2&, const Arg3& \ + >::type const \ + name(const Arg1 &arg1, const Arg2 &arg2, const Arg3 &arg3) \ + { \ + return proto::make_expr( \ + BOOST_PP_CAT(detail::name, _func)(), ::boost::ref(arg1), ::boost::ref(arg2), ::boost::ref(arg3) \ + ); \ + } + + +BOOST_COMPUTE_LAMBDA_WRAP_BOOLEAN_UNARY_FUNCTION(all) +BOOST_COMPUTE_LAMBDA_WRAP_BOOLEAN_UNARY_FUNCTION(any) +BOOST_COMPUTE_LAMBDA_WRAP_BOOLEAN_UNARY_FUNCTION(isinf) +BOOST_COMPUTE_LAMBDA_WRAP_BOOLEAN_UNARY_FUNCTION(isnan) +BOOST_COMPUTE_LAMBDA_WRAP_BOOLEAN_UNARY_FUNCTION(isfinite) + +BOOST_COMPUTE_LAMBDA_WRAP_UNARY_FUNCTION_T(abs) +BOOST_COMPUTE_LAMBDA_WRAP_UNARY_FUNCTION_T(cos) +BOOST_COMPUTE_LAMBDA_WRAP_UNARY_FUNCTION_T(acos) +BOOST_COMPUTE_LAMBDA_WRAP_UNARY_FUNCTION_T(sin) +BOOST_COMPUTE_LAMBDA_WRAP_UNARY_FUNCTION_T(asin) +BOOST_COMPUTE_LAMBDA_WRAP_UNARY_FUNCTION_T(tan) +BOOST_COMPUTE_LAMBDA_WRAP_UNARY_FUNCTION_T(atan) +BOOST_COMPUTE_LAMBDA_WRAP_UNARY_FUNCTION_T(sqrt) +BOOST_COMPUTE_LAMBDA_WRAP_UNARY_FUNCTION_T(rsqrt) +BOOST_COMPUTE_LAMBDA_WRAP_UNARY_FUNCTION_T(exp) +BOOST_COMPUTE_LAMBDA_WRAP_UNARY_FUNCTION_T(exp2) +BOOST_COMPUTE_LAMBDA_WRAP_UNARY_FUNCTION_T(exp10) +BOOST_COMPUTE_LAMBDA_WRAP_UNARY_FUNCTION_T(log) +BOOST_COMPUTE_LAMBDA_WRAP_UNARY_FUNCTION_T(log2) +BOOST_COMPUTE_LAMBDA_WRAP_UNARY_FUNCTION_T(log10) +BOOST_COMPUTE_LAMBDA_WRAP_UNARY_FUNCTION_T(round) +BOOST_COMPUTE_LAMBDA_WRAP_UNARY_FUNCTION_T(length) + +BOOST_COMPUTE_LAMBDA_WRAP_BINARY_FUNCTION(cross) +BOOST_COMPUTE_LAMBDA_WRAP_BINARY_FUNCTION(pow) +BOOST_COMPUTE_LAMBDA_WRAP_BINARY_FUNCTION(pown) +BOOST_COMPUTE_LAMBDA_WRAP_BINARY_FUNCTION(powr) + +BOOST_COMPUTE_LAMBDA_WRAP_BINARY_FUNCTION_ST(dot) +BOOST_COMPUTE_LAMBDA_WRAP_BINARY_FUNCTION_ST(distance) + +BOOST_COMPUTE_LAMBDA_WRAP_TERNARY_FUNCTION(clamp) +BOOST_COMPUTE_LAMBDA_WRAP_TERNARY_FUNCTION(fma) +BOOST_COMPUTE_LAMBDA_WRAP_TERNARY_FUNCTION(mad) +BOOST_COMPUTE_LAMBDA_WRAP_TERNARY_FUNCTION(smoothstep) + +} // end lambda namespace +} // end compute namespace +} // end boost namespace + +#endif // BOOST_COMPUTE_LAMBDA_FUNCTIONAL_HPP diff --git a/3party/boost/boost/compute/lambda/get.hpp b/3party/boost/boost/compute/lambda/get.hpp new file mode 100644 index 0000000000..547c208e95 --- /dev/null +++ b/3party/boost/boost/compute/lambda/get.hpp @@ -0,0 +1,148 @@ +//---------------------------------------------------------------------------// +// Copyright (c) 2013-2014 Kyle Lutz +// +// 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 +// +// See http://boostorg.github.com/compute for more information. +//---------------------------------------------------------------------------// + +#ifndef BOOST_COMPUTE_LAMBDA_GET_HPP +#define BOOST_COMPUTE_LAMBDA_GET_HPP + +#include + +#include +#include +#include + +namespace boost { +namespace compute { +namespace lambda { +namespace detail { + +// function wrapper for get() in lambda expressions +template +struct get_func +{ + template + struct lambda_result + { + typedef typename proto::result_of::child_c::type Arg; + typedef typename ::boost::compute::lambda::result_of::type T; + typedef typename ::boost::compute::detail::get_result_type::type type; + }; + + template + struct make_get_result_type + { + typedef typename boost::remove_cv< + typename boost::compute::lambda::result_of< + Arg, typename Context::args_tuple + >::type + >::type type; + }; + + // returns the suffix string for get() in lambda expressions + // (e.g. ".x" for get<0>() with float4) + template + struct make_get_suffix + { + static std::string value() + { + BOOST_STATIC_ASSERT(N < 16); + + std::stringstream stream; + + if(N < 10){ + stream << ".s" << uint_(N); + } + else if(N < 16){ + stream << ".s" << char('a' + (N - 10)); + } + + return stream.str(); + } + }; + + // get() specialization for std::pair + template + struct make_get_suffix > + { + static std::string value() + { + BOOST_STATIC_ASSERT(N < 2); + + if(N == 0){ + return ".first"; + } + else { + return ".second"; + } + }; + }; + + // get() specialization for boost::tuple + #define BOOST_COMPUTE_LAMBDA_GET_MAKE_TUPLE_SUFFIX(z, n, unused) \ + template \ + struct make_get_suffix > \ + { \ + static std::string value() \ + { \ + BOOST_STATIC_ASSERT(N < n); \ + return ".v" + boost::lexical_cast(N); \ + } \ + }; + + BOOST_PP_REPEAT_FROM_TO(1, BOOST_COMPUTE_MAX_ARITY, BOOST_COMPUTE_LAMBDA_GET_MAKE_TUPLE_SUFFIX, ~) + + #undef BOOST_COMPUTE_LAMBDA_GET_MAKE_TUPLE_SUFFIX + + template + static void dispatch_apply_terminal(Context &ctx, const Arg &arg) + { + typedef typename make_get_result_type::type T; + + proto::eval(arg, ctx); + ctx.stream << make_get_suffix::value(); + } + + template + static void dispatch_apply_terminal(Context &ctx, placeholder) + { + ctx.stream << ::boost::compute::get()(::boost::get(ctx.args)); + } + + template + static void dispatch_apply(Context &ctx, const Arg &arg, proto::tag::terminal) + { + dispatch_apply_terminal(ctx, proto::value(arg)); + } + + template + static void apply(Context &ctx, const Arg &arg) + { + dispatch_apply(ctx, arg, typename proto::tag_of::type()); + } +}; + +} // end detail namespace + +// get() +template +inline typename proto::result_of::make_expr< + proto::tag::function, detail::get_func, const Arg& +>::type const +get(const Arg &arg) +{ + return proto::make_expr( + detail::get_func(), ::boost::ref(arg) + ); +} + +} // end lambda namespace +} // end compute namespace +} // end boost namespace + +#endif // BOOST_COMPUTE_LAMBDA_GET_HPP diff --git a/3party/boost/boost/compute/lambda/make_pair.hpp b/3party/boost/boost/compute/lambda/make_pair.hpp new file mode 100644 index 0000000000..3adca97c71 --- /dev/null +++ b/3party/boost/boost/compute/lambda/make_pair.hpp @@ -0,0 +1,70 @@ +//---------------------------------------------------------------------------// +// Copyright (c) 2013-2014 Kyle Lutz +// +// 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 +// +// See http://boostorg.github.com/compute for more information. +//---------------------------------------------------------------------------// + +#ifndef BOOST_COMPUTE_LAMBDA_MAKE_PAIR_HPP +#define BOOST_COMPUTE_LAMBDA_MAKE_PAIR_HPP + +#include + +namespace boost { +namespace compute { +namespace lambda { +namespace detail { + +// function wrapper for make_pair() in lambda expressions +struct make_pair_func +{ + template + struct lambda_result + { + typedef typename proto::result_of::child_c::type Arg1; + typedef typename proto::result_of::child_c::type Arg2; + + typedef typename lambda::result_of::type T1; + typedef typename lambda::result_of::type T2; + + typedef std::pair type; + }; + + template + static void apply(Context &ctx, const Arg1 &arg1, const Arg2 &arg2) + { + typedef typename lambda::result_of::type T1; + typedef typename lambda::result_of::type T2; + + ctx.stream << "boost_make_pair("; + ctx.stream << type_name() << ", "; + proto::eval(arg1, ctx); + ctx.stream << ", "; + ctx.stream << type_name() << ", "; + proto::eval(arg2, ctx); + ctx.stream << ")"; + } +}; + +} // end detail namespace + +// make_pair(first, second) +template +inline typename proto::result_of::make_expr< + proto::tag::function, detail::make_pair_func, const Arg1&, const Arg2& +>::type const +make_pair(const Arg1 &first, const Arg2 &second) +{ + return proto::make_expr( + detail::make_pair_func(), ::boost::ref(first), ::boost::ref(second) + ); +} + +} // end lambda namespace +} // end compute namespace +} // end boost namespace + +#endif // BOOST_COMPUTE_LAMBDA_MAKE_PAIR_HPP diff --git a/3party/boost/boost/compute/lambda/make_tuple.hpp b/3party/boost/boost/compute/lambda/make_tuple.hpp new file mode 100644 index 0000000000..2d065a999a --- /dev/null +++ b/3party/boost/boost/compute/lambda/make_tuple.hpp @@ -0,0 +1,127 @@ +//---------------------------------------------------------------------------// +// Copyright (c) 2013-2014 Kyle Lutz +// +// 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 +// +// See http://boostorg.github.com/compute for more information. +//---------------------------------------------------------------------------// + +#ifndef BOOST_COMPUTE_LAMBDA_MAKE_TUPLE_HPP +#define BOOST_COMPUTE_LAMBDA_MAKE_TUPLE_HPP + +#include + +#include +#include + +namespace boost { +namespace compute { +namespace lambda { +namespace detail { + +// function wrapper for make_tuple() in lambda expressions +struct make_tuple_func +{ + template + struct make_tuple_result_type; + + #define BOOST_COMPUTE_MAKE_TUPLE_RESULT_GET_ARG(z, n, unused) \ + typedef typename proto::result_of::child_c::type BOOST_PP_CAT(Arg, n); + + #define BOOST_COMPUTE_MAKE_TUPLE_RESULT_GET_ARG_TYPE(z, n, unused) \ + typedef typename lambda::result_of::type BOOST_PP_CAT(T, n); + + #define BOOST_COMPUTE_MAKE_TUPLE_RESULT_TYPE(z, n, unused) \ + template \ + struct make_tuple_result_type \ + { \ + BOOST_PP_REPEAT(n, BOOST_COMPUTE_MAKE_TUPLE_RESULT_GET_ARG, ~) \ + BOOST_PP_REPEAT(n, BOOST_COMPUTE_MAKE_TUPLE_RESULT_GET_ARG_TYPE, ~) \ + typedef boost::tuple type; \ + }; + + BOOST_PP_REPEAT_FROM_TO(1, BOOST_COMPUTE_MAX_ARITY, BOOST_COMPUTE_MAKE_TUPLE_RESULT_TYPE, ~) + + #undef BOOST_COMPUTE_MAKE_TUPLE_RESULT_GET_ARG + #undef BOOST_COMPUTE_MAKE_TUPLE_RESULT_GET_ARG_TYPE + #undef BOOST_COMPUTE_MAKE_TUPLE_RESULT_TYPE + + template + struct lambda_result + { + typedef typename make_tuple_result_type< + Expr, Args, proto::arity_of::value - 1 + >::type type; + }; + + #define BOOST_COMPUTE_MAKE_TUPLE_GET_ARG_TYPE(z, n, unused) \ + typedef typename lambda::result_of< \ + BOOST_PP_CAT(Arg, n), typename Context::args_tuple \ + >::type BOOST_PP_CAT(T, n); + + #define BOOST_COMPUTE_LAMBDA_MAKE_TUPLE_APPLY_ARG(z, n, unused) \ + BOOST_PP_COMMA_IF(n) BOOST_PP_CAT(const Arg, n) BOOST_PP_CAT(&arg, n) + + #define BOOST_COMPUTE_LAMBDA_MAKE_TUPLE_APPLY_EVAL_ARG(z, n, unused) \ + BOOST_PP_EXPR_IF(n, ctx.stream << ", ";) proto::eval(BOOST_PP_CAT(arg, n), ctx); + + #define BOOST_COMPUTE_MAKE_TUPLE_APPLY(z, n, unused) \ + template \ + static void apply(Context &ctx, BOOST_PP_REPEAT(n, BOOST_COMPUTE_LAMBDA_MAKE_TUPLE_APPLY_ARG, ~)) \ + { \ + BOOST_PP_REPEAT(n, BOOST_COMPUTE_MAKE_TUPLE_GET_ARG_TYPE, ~) \ + typedef typename boost::tuple tuple_type; \ + ctx.stream.template inject_type(); \ + ctx.stream << "((" << type_name() << "){"; \ + BOOST_PP_REPEAT(n, BOOST_COMPUTE_LAMBDA_MAKE_TUPLE_APPLY_EVAL_ARG, ~) \ + ctx.stream << "})"; \ + } + + BOOST_PP_REPEAT_FROM_TO(1, BOOST_COMPUTE_MAX_ARITY, BOOST_COMPUTE_MAKE_TUPLE_APPLY, ~) + + #undef BOOST_COMPUTE_MAKE_TUPLE_GET_ARG_TYPE + #undef BOOST_COMPUTE_LAMBDA_MAKE_TUPLE_APPLY_ARG + #undef BOOST_COMPUTE_LAMBDA_MAKE_TUPLE_APPLY_EVAL_ARG + #undef BOOST_COMPUTE_LAMBDA_MAKE_TUPLE_APPLY +}; + +} // end detail namespace + +#define BOOST_COMPUTE_LAMBDA_MAKE_TUPLE_ARG(z, n, unused) \ + BOOST_PP_COMMA_IF(n) BOOST_PP_CAT(const Arg, n) BOOST_PP_CAT(&arg, n) + +#define BOOST_COMPUTE_LAMBDA_MAKE_TUPLE_ARG_TYPE(z, n, unused) \ + BOOST_PP_COMMA_IF(n) BOOST_PP_CAT(const Arg, n) & + +#define BOOST_COMPUTE_LAMBDA_MAKE_TUPLE_REF_ARG(z, n, unused) \ + BOOST_PP_COMMA_IF(n) ::boost::ref(BOOST_PP_CAT(arg, n)) + +#define BOOST_COMPUTE_LAMBDA_MAKE_TUPLE(z, n, unused) \ +template \ +inline typename proto::result_of::make_expr< \ + proto::tag::function, \ + detail::make_tuple_func, \ + BOOST_PP_REPEAT(n, BOOST_COMPUTE_LAMBDA_MAKE_TUPLE_ARG_TYPE, ~) \ +>::type \ +make_tuple(BOOST_PP_REPEAT(n, BOOST_COMPUTE_LAMBDA_MAKE_TUPLE_ARG, ~)) \ +{ \ + return proto::make_expr( \ + detail::make_tuple_func(), \ + BOOST_PP_REPEAT(n, BOOST_COMPUTE_LAMBDA_MAKE_TUPLE_REF_ARG, ~) \ + ); \ +} + +BOOST_PP_REPEAT_FROM_TO(1, BOOST_COMPUTE_MAX_ARITY, BOOST_COMPUTE_LAMBDA_MAKE_TUPLE, ~) + +#undef BOOST_COMPUTE_LAMBDA_MAKE_TUPLE_ARG +#undef BOOST_COMPUTE_LAMBDA_MAKE_TUPLE_ARG_TYPE +#undef BOOST_COMPUTE_LAMBDA_MAKE_TUPLE_REF_ARG +#undef BOOST_COMPUTE_LAMBDA_MAKE_TUPLE + +} // end lambda namespace +} // end compute namespace +} // end boost namespace + +#endif // BOOST_COMPUTE_LAMBDA_MAKE_TUPLE_HPP diff --git a/3party/boost/boost/compute/lambda/placeholder.hpp b/3party/boost/boost/compute/lambda/placeholder.hpp new file mode 100644 index 0000000000..4774b1b4f3 --- /dev/null +++ b/3party/boost/boost/compute/lambda/placeholder.hpp @@ -0,0 +1,28 @@ +//---------------------------------------------------------------------------// +// Copyright (c) 2013-2014 Kyle Lutz +// +// 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 +// +// See http://boostorg.github.com/compute for more information. +//---------------------------------------------------------------------------// + +#ifndef BOOST_COMPUTE_LAMBDA_PLACEHOLDER_HPP +#define BOOST_COMPUTE_LAMBDA_PLACEHOLDER_HPP + +namespace boost { +namespace compute { +namespace lambda { + +// lambda placeholder type +template +struct placeholder +{ +}; + +} // end lambda namespace +} // end compute namespace +} // end boost namespace + +#endif // BOOST_COMPUTE_LAMBDA_PLACEHOLDER_HPP diff --git a/3party/boost/boost/compute/lambda/placeholders.hpp b/3party/boost/boost/compute/lambda/placeholders.hpp new file mode 100644 index 0000000000..5c3fe531d1 --- /dev/null +++ b/3party/boost/boost/compute/lambda/placeholders.hpp @@ -0,0 +1,93 @@ +//---------------------------------------------------------------------------// +// Copyright (c) 2013 Kyle Lutz +// +// 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 +// +// See http://boostorg.github.com/compute for more information. +//---------------------------------------------------------------------------// + +#ifndef BOOST_COMPUTE_LAMBDA_PLACEHOLDERS_HPP +#define BOOST_COMPUTE_LAMBDA_PLACEHOLDERS_HPP + +#include + +#include +#include + +namespace boost { +namespace compute { +namespace lambda { + +namespace mpl = boost::mpl; +namespace proto = boost::proto; + +// lambda placeholders +expression >::type> const _1; +expression >::type> const _2; +expression >::type> const _3; + +namespace detail { + +BOOST_MPL_HAS_XXX_TRAIT_DEF(result_type) + +template +struct terminal_type_impl; + +template +struct terminal_type_impl +{ + typedef typename T::result_type type; +}; + +template +struct terminal_type_impl +{ + typedef T type; +}; + +template +struct terminal_type +{ + typedef typename terminal_type_impl::value>::type type; +}; + +} // end detail namespace + +// result_of placeholders +template +struct result_of >::type>, Args, proto::tag::terminal> +{ + typedef typename boost::tuples::element<0, Args>::type arg_type; + + typedef typename detail::terminal_type::type type; +}; + +template +struct result_of >::type>, Args, proto::tag::terminal> +{ + typedef typename boost::tuples::element<1, Args>::type arg_type; + + typedef typename detail::terminal_type::type type; +}; + +template +struct result_of >::type>, Args, proto::tag::terminal> +{ + typedef typename boost::tuples::element<2, Args>::type arg_type; + + typedef typename detail::terminal_type::type type; +}; + +} // end lambda namespace + +// lift lambda placeholders up to the boost::compute namespace +using lambda::_1; +using lambda::_2; +using lambda::_3; + +} // end compute namespace +} // end boost namespace + +#endif // BOOST_COMPUTE_LAMBDA_PLACEHOLDERS_HPP diff --git a/3party/boost/boost/compute/lambda/result_of.hpp b/3party/boost/boost/compute/lambda/result_of.hpp new file mode 100644 index 0000000000..baae87f05c --- /dev/null +++ b/3party/boost/boost/compute/lambda/result_of.hpp @@ -0,0 +1,113 @@ +//---------------------------------------------------------------------------// +// Copyright (c) 2013 Kyle Lutz +// +// 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 +// +// See http://boostorg.github.com/compute for more information. +//---------------------------------------------------------------------------// + +#ifndef BOOST_COMPUTE_LAMBDA_RESULT_OF_HPP +#define BOOST_COMPUTE_LAMBDA_RESULT_OF_HPP + +#include +#include + +#include + +namespace boost { +namespace compute { +namespace lambda { + +namespace mpl = boost::mpl; +namespace proto = boost::proto; + +// meta-function returning the result type of a lambda expression +template::type> +struct result_of +{ +}; + +// terminals +template +struct result_of +{ + typedef typename proto::result_of::value::type type; +}; + +// binary operators +#define BOOST_COMPUTE_LAMBDA_RESULT_OF_BINARY_OPERATOR(tag) \ + template \ + struct result_of \ + { \ + typedef typename proto::result_of::child_c::type left; \ + typedef typename proto::result_of::child_c::type right; \ + \ + typedef typename boost::common_type< \ + typename ::boost::compute::lambda::result_of< \ + left, \ + Args, \ + typename proto::tag_of::type>::type, \ + typename ::boost::compute::lambda::result_of< \ + right, \ + Args, \ + typename proto::tag_of::type>::type \ + >::type type; \ + }; + +BOOST_COMPUTE_LAMBDA_RESULT_OF_BINARY_OPERATOR(proto::tag::plus) +BOOST_COMPUTE_LAMBDA_RESULT_OF_BINARY_OPERATOR(proto::tag::minus) +BOOST_COMPUTE_LAMBDA_RESULT_OF_BINARY_OPERATOR(proto::tag::multiplies) +BOOST_COMPUTE_LAMBDA_RESULT_OF_BINARY_OPERATOR(proto::tag::divides) +BOOST_COMPUTE_LAMBDA_RESULT_OF_BINARY_OPERATOR(proto::tag::modulus) +BOOST_COMPUTE_LAMBDA_RESULT_OF_BINARY_OPERATOR(proto::tag::bitwise_and) +BOOST_COMPUTE_LAMBDA_RESULT_OF_BINARY_OPERATOR(proto::tag::bitwise_or) +BOOST_COMPUTE_LAMBDA_RESULT_OF_BINARY_OPERATOR(proto::tag::bitwise_xor) + +// comparision operators +#define BOOST_COMPUTE_LAMBDA_RESULT_OF_COMPARISON_OPERATOR(tag) \ + template \ + struct result_of \ + { \ + typedef bool type; \ + }; + +BOOST_COMPUTE_LAMBDA_RESULT_OF_COMPARISON_OPERATOR(proto::tag::less) +BOOST_COMPUTE_LAMBDA_RESULT_OF_COMPARISON_OPERATOR(proto::tag::greater) +BOOST_COMPUTE_LAMBDA_RESULT_OF_COMPARISON_OPERATOR(proto::tag::less_equal) +BOOST_COMPUTE_LAMBDA_RESULT_OF_COMPARISON_OPERATOR(proto::tag::greater_equal) +BOOST_COMPUTE_LAMBDA_RESULT_OF_COMPARISON_OPERATOR(proto::tag::equal_to) +BOOST_COMPUTE_LAMBDA_RESULT_OF_COMPARISON_OPERATOR(proto::tag::not_equal_to) +BOOST_COMPUTE_LAMBDA_RESULT_OF_COMPARISON_OPERATOR(proto::tag::logical_and) +BOOST_COMPUTE_LAMBDA_RESULT_OF_COMPARISON_OPERATOR(proto::tag::logical_or) + +// assignment operator +template +struct result_of +{ + typedef typename proto::result_of::child_c::type left; + typedef typename proto::result_of::child_c::type right; + + typedef typename ::boost::compute::lambda::result_of< + right, Args, typename proto::tag_of::type + >::type type; +}; + +// functions +template +struct result_of +{ + typedef typename proto::result_of::child_c::type func_expr; + typedef typename proto::result_of::value::type func; + + typedef typename func::template lambda_result::type type; +}; + +} // end lambda namespace +} // end compute namespace +} // end boost namespace + +#endif // BOOST_COMPUTE_LAMBDA_RESULT_OF_HPP diff --git a/3party/boost/boost/compute/memory.hpp b/3party/boost/boost/compute/memory.hpp new file mode 100644 index 0000000000..b4dccf4890 --- /dev/null +++ b/3party/boost/boost/compute/memory.hpp @@ -0,0 +1,21 @@ +//---------------------------------------------------------------------------// +// Copyright (c) 2013-2014 Kyle Lutz +// +// 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 +// +// See http://boostorg.github.com/compute for more information. +//---------------------------------------------------------------------------// + +#ifndef BOOST_COMPUTE_MEMORY_HPP +#define BOOST_COMPUTE_MEMORY_HPP + +/// \file +/// +/// Meta-header to include all Boost.Compute memory headers. + +#include +#include + +#endif // BOOST_COMPUTE_MEMORY_HPP diff --git a/3party/boost/boost/compute/memory/local_buffer.hpp b/3party/boost/boost/compute/memory/local_buffer.hpp new file mode 100644 index 0000000000..aaf631317a --- /dev/null +++ b/3party/boost/boost/compute/memory/local_buffer.hpp @@ -0,0 +1,91 @@ +//---------------------------------------------------------------------------// +// Copyright (c) 2013-2014 Kyle Lutz +// +// 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 +// +// See http://boostorg.github.com/compute for more information. +//---------------------------------------------------------------------------// + +#ifndef BOOST_COMPUTE_MEMORY_LOCAL_BUFFER_HPP +#define BOOST_COMPUTE_MEMORY_LOCAL_BUFFER_HPP + +#include +#include + +namespace boost { +namespace compute { + +/// \class local_buffer +/// \brief Represents a local memory buffer on the device. +/// +/// The local_buffer class represents a block of local memory on a compute +/// device. +/// +/// This class is most commonly used to set local memory arguments for compute +/// kernels: +/// \code +/// // set argument to a local buffer with storage for 32 float's +/// kernel.set_arg(0, local_buffer(32)); +/// \endcode +/// +/// \see buffer, kernel +template +class local_buffer +{ +public: + /// Creates a local buffer object for \p size elements. + local_buffer(const size_t size) + : m_size(size) + { + } + + /// Creates a local buffer object as a copy of \p other. + local_buffer(const local_buffer &other) + : m_size(other.m_size) + { + } + + /// Copies \p other to \c *this. + local_buffer& operator=(const local_buffer &other) + { + if(this != &other){ + m_size = other.m_size; + } + + return *this; + } + + /// Destroys the local memory object. + ~local_buffer() + { + } + + /// Returns the number of elements in the local buffer. + size_t size() const + { + return m_size; + } + +private: + size_t m_size; +}; + +namespace detail { + +// set_kernel_arg specialization for local_buffer +template +struct set_kernel_arg > +{ + void operator()(kernel &kernel_, size_t index, const local_buffer &buffer) + { + kernel_.set_arg(index, buffer.size() * sizeof(T), 0); + } +}; + +} // end detail namespace +} // end compute namespace +} // end boost namespace + +#endif // BOOST_COMPUTE_MEMORY_SVM_PTR_HPP diff --git a/3party/boost/boost/compute/memory/svm_ptr.hpp b/3party/boost/boost/compute/memory/svm_ptr.hpp new file mode 100644 index 0000000000..0c9d88035c --- /dev/null +++ b/3party/boost/boost/compute/memory/svm_ptr.hpp @@ -0,0 +1,174 @@ +//---------------------------------------------------------------------------// +// Copyright (c) 2013-2014 Kyle Lutz +// +// 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 +// +// See http://boostorg.github.com/compute for more information. +//---------------------------------------------------------------------------// + +#ifndef BOOST_COMPUTE_MEMORY_SVM_PTR_HPP +#define BOOST_COMPUTE_MEMORY_SVM_PTR_HPP + +#include +#include +#include + +#include +#include +#include +#include +#include + +namespace boost { +namespace compute { + +// forward declaration for svm_ptr +template +class svm_ptr; + +// svm functions require OpenCL 2.0 +#if defined(CL_VERSION_2_0) || defined(BOOST_COMPUTE_DOXYGEN_INVOKED) +namespace detail { + +template +struct svm_ptr_index_expr +{ + typedef T result_type; + + svm_ptr_index_expr(const svm_ptr &svm_ptr, + const IndexExpr &expr) + : m_svm_ptr(svm_ptr), + m_expr(expr) + { + } + + operator T() const + { + BOOST_STATIC_ASSERT_MSG(boost::is_integral::value, + "Index expression must be integral"); + + BOOST_ASSERT(m_svm_ptr.get()); + + const context &context = m_svm_ptr.get_context(); + const device &device = context.get_device(); + command_queue queue(context, device); + + T value; + T* ptr = + static_cast(m_svm_ptr.get()) + static_cast(m_expr); + queue.enqueue_svm_map(static_cast(ptr), sizeof(T), CL_MAP_READ); + value = *(ptr); + queue.enqueue_svm_unmap(static_cast(ptr)).wait(); + + return value; + } + + const svm_ptr &m_svm_ptr; + IndexExpr m_expr; +}; + +} // end detail namespace +#endif + +template +class svm_ptr +{ +public: + typedef T value_type; + typedef std::ptrdiff_t difference_type; + typedef T* pointer; + typedef T& reference; + typedef std::random_access_iterator_tag iterator_category; + + svm_ptr() + : m_ptr(0) + { + } + + svm_ptr(void *ptr, const context &context) + : m_ptr(static_cast(ptr)), + m_context(context) + { + } + + svm_ptr(const svm_ptr &other) + : m_ptr(other.m_ptr), + m_context(other.m_context) + { + } + + svm_ptr& operator=(const svm_ptr &other) + { + m_ptr = other.m_ptr; + m_context = other.m_context; + return *this; + } + + ~svm_ptr() + { + } + + void* get() const + { + return m_ptr; + } + + svm_ptr operator+(difference_type n) + { + return svm_ptr(m_ptr + n, m_context); + } + + difference_type operator-(svm_ptr other) + { + BOOST_ASSERT(other.m_context == m_context); + return m_ptr - other.m_ptr; + } + + context& get_context() const + { + return m_context; + } + + // svm functions require OpenCL 2.0 + #if defined(CL_VERSION_2_0) || defined(BOOST_COMPUTE_DOXYGEN_INVOKED) + /// \internal_ + template + detail::svm_ptr_index_expr + operator[](const Expr &expr) const + { + BOOST_ASSERT(m_ptr); + + return detail::svm_ptr_index_expr(*this, + expr); + } + #endif + +private: + T *m_ptr; + context m_context; +}; + +namespace detail { + +/// \internal_ +template +struct set_kernel_arg > +{ + void operator()(kernel &kernel_, size_t index, const svm_ptr &ptr) + { + kernel_.set_arg_svm_ptr(index, ptr.get()); + } +}; + +} // end detail namespace + +/// \internal_ (is_device_iterator specialization for svm_ptr) +template +struct is_device_iterator > : boost::true_type {}; + +} // end compute namespace +} // end boost namespace + +#endif // BOOST_COMPUTE_MEMORY_SVM_PTR_HPP diff --git a/3party/boost/boost/compute/memory_object.hpp b/3party/boost/boost/compute/memory_object.hpp new file mode 100644 index 0000000000..14c4cf4c7e --- /dev/null +++ b/3party/boost/boost/compute/memory_object.hpp @@ -0,0 +1,264 @@ +//---------------------------------------------------------------------------// +// Copyright (c) 2013 Kyle Lutz +// +// 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 +// +// See http://boostorg.github.com/compute for more information. +//---------------------------------------------------------------------------// + +#ifndef BOOST_COMPUTE_MEMORY_OBJECT_HPP +#define BOOST_COMPUTE_MEMORY_OBJECT_HPP + +#include +#include +#include +#include +#include + +namespace boost { +namespace compute { + +/// \class memory_object +/// \brief Base-class for memory objects. +/// +/// The memory_object class is the base-class for memory objects on +/// compute devices. +/// +/// \see buffer, vector +class memory_object +{ +public: + /// Flags for the creation of memory objects. + enum mem_flags { + read_write = CL_MEM_READ_WRITE, + read_only = CL_MEM_READ_ONLY, + write_only = CL_MEM_WRITE_ONLY, + use_host_ptr = CL_MEM_USE_HOST_PTR, + alloc_host_ptr = CL_MEM_ALLOC_HOST_PTR, + copy_host_ptr = CL_MEM_COPY_HOST_PTR + #ifdef CL_VERSION_1_2 + , + host_write_only = CL_MEM_HOST_WRITE_ONLY, + host_read_only = CL_MEM_HOST_READ_ONLY, + host_no_access = CL_MEM_HOST_NO_ACCESS + #endif + }; + + /// Symbolic names for the OpenCL address spaces. + enum address_space { + global_memory, + local_memory, + private_memory, + constant_memory + }; + + /// Returns the underlying OpenCL memory object. + cl_mem& get() const + { + return const_cast(m_mem); + } + + /// Returns the size of the memory object in bytes. + size_t get_memory_size() const + { + return get_memory_info(CL_MEM_SIZE); + } + + /// Returns the type for the memory object. + cl_mem_object_type get_memory_type() const + { + return get_memory_info(CL_MEM_TYPE); + } + + /// Returns the flags for the memory object. + cl_mem_flags get_memory_flags() const + { + return get_memory_info(CL_MEM_FLAGS); + } + + /// Returns the context for the memory object. + context get_context() const + { + return context(get_memory_info(CL_MEM_CONTEXT)); + } + + /// Returns the host pointer associated with the memory object. + void* get_host_ptr() const + { + return get_memory_info(CL_MEM_HOST_PTR); + } + + /// Returns the reference count for the memory object. + uint_ reference_count() const + { + return get_memory_info(CL_MEM_REFERENCE_COUNT); + } + + /// Returns information about the memory object. + /// + /// \see_opencl_ref{clGetMemObjectInfo} + template + T get_memory_info(cl_mem_info info) const + { + return detail::get_object_info(clGetMemObjectInfo, m_mem, info); + } + + #if defined(CL_VERSION_1_1) || defined(BOOST_COMPUTE_DOXYGEN_INVOKED) + /// Registers a function to be called when the memory object is deleted + /// and its resources freed. + /// + /// \see_opencl_ref{clSetMemObjectDestructorCallback} + /// + /// \opencl_version_warning{1,1} + void set_destructor_callback(void (BOOST_COMPUTE_CL_CALLBACK *callback)( + cl_mem memobj, void *user_data + ), + void *user_data = 0) + { + cl_int ret = clSetMemObjectDestructorCallback(m_mem, callback, user_data); + if(ret != CL_SUCCESS){ + BOOST_THROW_EXCEPTION(opencl_error(ret)); + } + } + /// Registers a function to be called when the memory object is deleted + /// and its resources freed. + /// + /// The function specified by \p callback must be invokable with zero + /// arguments (e.g. \c callback()). + /// + /// \opencl_version_warning{1,1} + template + void set_destructor_callback(Function callback) + { + set_destructor_callback( + destructor_callback_invoker, + new boost::function(callback) + ); + } + #endif // CL_VERSION_1_1 + + /// Returns \c true if the memory object is the same as \p other. + bool operator==(const memory_object &other) const + { + return m_mem == other.m_mem; + } + + /// Returns \c true if the memory object is different from \p other. + bool operator!=(const memory_object &other) const + { + return m_mem != other.m_mem; + } + +private: + #ifdef CL_VERSION_1_1 + /// \internal_ + static void BOOST_COMPUTE_CL_CALLBACK + destructor_callback_invoker(cl_mem, void *user_data) + { + boost::function *callback = + static_cast *>(user_data); + + (*callback)(); + + delete callback; + } + #endif // CL_VERSION_1_1 + +protected: + /// \internal_ + memory_object() + : m_mem(0) + { + } + + /// \internal_ + explicit memory_object(cl_mem mem, bool retain = true) + : m_mem(mem) + { + if(m_mem && retain){ + clRetainMemObject(m_mem); + } + } + + /// \internal_ + memory_object(const memory_object &other) + : m_mem(other.m_mem) + { + if(m_mem){ + clRetainMemObject(m_mem); + } + } + + /// \internal_ + memory_object& operator=(const memory_object &other) + { + if(this != &other){ + if(m_mem){ + clReleaseMemObject(m_mem); + } + + m_mem = other.m_mem; + + if(m_mem){ + clRetainMemObject(m_mem); + } + } + + return *this; + } + + #ifndef BOOST_COMPUTE_NO_RVALUE_REFERENCES + /// \internal_ + memory_object(memory_object&& other) BOOST_NOEXCEPT + : m_mem(other.m_mem) + { + other.m_mem = 0; + } + + /// \internal_ + memory_object& operator=(memory_object&& other) BOOST_NOEXCEPT + { + if(m_mem){ + clReleaseMemObject(m_mem); + } + + m_mem = other.m_mem; + other.m_mem = 0; + + return *this; + } + #endif // BOOST_COMPUTE_NO_RVALUE_REFERENCES + + /// \internal_ + ~memory_object() + { + if(m_mem){ + BOOST_COMPUTE_ASSERT_CL_SUCCESS( + clReleaseMemObject(m_mem) + ); + } + } + +protected: + cl_mem m_mem; +}; + +namespace detail { + +// set_kernel_arg specialization for memory_object +template<> +struct set_kernel_arg +{ + void operator()(kernel &kernel_, size_t index, const memory_object &mem) + { + kernel_.set_arg(index, mem.get()); + } +}; + +} // end detail namespace +} // end compute namespace +} // end boost namespace + +#endif // BOOST_COMPUTE_MEMORY_OBJECT_HPP diff --git a/3party/boost/boost/compute/pipe.hpp b/3party/boost/boost/compute/pipe.hpp new file mode 100644 index 0000000000..944674e622 --- /dev/null +++ b/3party/boost/boost/compute/pipe.hpp @@ -0,0 +1,154 @@ +//---------------------------------------------------------------------------// +// Copyright (c) 2013-2014 Kyle Lutz +// +// 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 +// +// See http://boostorg.github.com/compute for more information. +//---------------------------------------------------------------------------// + +#ifndef BOOST_COMPUTE_PIPE_HPP +#define BOOST_COMPUTE_PIPE_HPP + +#include +#include +#include +#include +#include + +// pipe objects require opencl 2.0 +#if defined(CL_VERSION_2_0) || defined(BOOST_COMPUTE_DOXYGEN_INVOKED) + +namespace boost { +namespace compute { + +/// \class pipe +/// \brief A FIFO data pipe +/// +/// \opencl_version_warning{2,0} +/// +/// \see memory_object +class pipe : public memory_object +{ +public: + /// Creates a null pipe object. + pipe() + : memory_object() + { + } + + /// Creates a pipe object for \p mem. If \p retain is \c true, the + /// reference count for \p mem will be incremented. + explicit pipe(cl_mem mem, bool retain = true) + : memory_object(mem, retain) + { + } + + /// Creates a new pipe in \p context. + pipe(const context &context, + uint_ pipe_packet_size, + uint_ pipe_max_packets, + cl_mem_flags flags = read_write, + const cl_pipe_properties *properties = 0) + { + cl_int error = 0; + m_mem = clCreatePipe(context, + flags, + pipe_packet_size, + pipe_max_packets, + properties, + &error); + if(!m_mem){ + BOOST_THROW_EXCEPTION(opencl_error(error)); + } + } + + /// Creates a new pipe object as a copy of \p other. + pipe(const pipe &other) + : memory_object(other) + { + } + + /// Copies the pipe object from \p other to \c *this. + pipe& operator=(const pipe &other) + { + if(this != &other){ + memory_object::operator=(other); + } + + return *this; + } + + #ifndef BOOST_COMPUTE_NO_RVALUE_REFERENCES + /// Move-constructs a new pipe object from \p other. + pipe(pipe&& other) BOOST_NOEXCEPT + : memory_object(std::move(other)) + { + } + + /// Move-assigns the pipe from \p other to \c *this. + pipe& operator=(pipe&& other) BOOST_NOEXCEPT + { + memory_object::operator=(std::move(other)); + + return *this; + } + #endif // BOOST_COMPUTE_NO_RVALUE_REFERENCES + + /// Destroys the pipe object. + ~pipe() + { + } + + /// Returns the packet size. + uint_ packet_size() const + { + return get_info(CL_PIPE_PACKET_SIZE); + } + + /// Returns the max number of packets. + uint_ max_packets() const + { + return get_info(CL_PIPE_MAX_PACKETS); + } + + /// Returns information about the pipe. + /// + /// \see_opencl2_ref{clGetPipeInfo} + template + T get_info(cl_pipe_info info) const + { + return detail::get_object_info(clGetPipeInfo, m_mem, info); + } + + /// \overload + template + typename detail::get_object_info_type::type get_info() const; +}; + +/// \internal_ define get_info() specializations for pipe +BOOST_COMPUTE_DETAIL_DEFINE_GET_INFO_SPECIALIZATIONS(pipe, + ((cl_uint, CL_PIPE_PACKET_SIZE)) + ((cl_uint, CL_PIPE_MAX_PACKETS)) +) + +namespace detail { + +// set_kernel_arg specialization for pipe +template<> +struct set_kernel_arg +{ + void operator()(kernel &kernel_, size_t index, const pipe &pipe_) + { + kernel_.set_arg(index, pipe_.get()); + } +}; + +} // end detail namespace +} // end compute namespace +} // end boost namespace + +#endif // CL_VERSION_2_0 + +#endif // BOOST_COMPUTE_PIPE_HPP diff --git a/3party/boost/boost/compute/platform.hpp b/3party/boost/boost/compute/platform.hpp new file mode 100644 index 0000000000..65fda84e11 --- /dev/null +++ b/3party/boost/boost/compute/platform.hpp @@ -0,0 +1,235 @@ +//---------------------------------------------------------------------------// +// Copyright (c) 2013 Kyle Lutz +// +// 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 +// +// See http://boostorg.github.com/compute for more information. +//---------------------------------------------------------------------------// + +#ifndef BOOST_COMPUTE_PLATFORM_HPP +#define BOOST_COMPUTE_PLATFORM_HPP + +#include +#include +#include + +#include +#include + +#include +#include +#include + +namespace boost { +namespace compute { + +/// \class platform +/// \brief A compute platform. +/// +/// The platform class provides an interface to an OpenCL platform. +/// +/// To obtain a list of all platforms on the system use the +/// system::platforms() method. +/// +/// \see device, context +class platform +{ +public: + /// Creates a new platform object for \p id. + explicit platform(cl_platform_id id) + : m_platform(id) + { + } + + /// Creates a new platform as a copy of \p other. + platform(const platform &other) + : m_platform(other.m_platform) + { + } + + /// Copies the platform id from \p other. + platform& operator=(const platform &other) + { + if(this != &other){ + m_platform = other.m_platform; + } + + return *this; + } + + /// Destroys the platform object. + ~platform() + { + } + + /// Returns the ID of the platform. + cl_platform_id id() const + { + return m_platform; + } + + /// Returns the name of the platform. + std::string name() const + { + return get_info(CL_PLATFORM_NAME); + } + + /// Returns the name of the vendor for the platform. + std::string vendor() const + { + return get_info(CL_PLATFORM_VENDOR); + } + + /// Returns the profile string for the platform. + std::string profile() const + { + return get_info(CL_PLATFORM_PROFILE); + } + + /// Returns the version string for the platform. + std::string version() const + { + return get_info(CL_PLATFORM_VERSION); + } + + /// Returns a list of extensions supported by the platform. + std::vector extensions() const + { + std::string extensions_string = + get_info(CL_PLATFORM_EXTENSIONS); + std::vector extensions_vector; + boost::split(extensions_vector, + extensions_string, + boost::is_any_of("\t "), + boost::token_compress_on); + return extensions_vector; + } + + /// Returns \c true if the platform supports the extension with + /// \p name. + bool supports_extension(const std::string &name) const + { + const std::vector extensions = this->extensions(); + + return std::find( + extensions.begin(), extensions.end(), name) != extensions.end(); + } + + /// Returns a list of devices on the platform. + std::vector devices(cl_device_type type = CL_DEVICE_TYPE_ALL) const + { + size_t count = device_count(type); + if(count == 0){ + // no devices for this platform + return std::vector(); + } + + std::vector device_ids(count); + cl_int ret = clGetDeviceIDs(m_platform, + type, + static_cast(count), + &device_ids[0], + 0); + if(ret != CL_SUCCESS){ + BOOST_THROW_EXCEPTION(opencl_error(ret)); + } + + std::vector devices; + for(cl_uint i = 0; i < count; i++){ + devices.push_back(device(device_ids[i])); + } + + return devices; + } + + /// Returns the number of devices on the platform. + size_t device_count(cl_device_type type = CL_DEVICE_TYPE_ALL) const + { + cl_uint count = 0; + cl_int ret = clGetDeviceIDs(m_platform, type, 0, 0, &count); + if(ret != CL_SUCCESS){ + if(ret == CL_DEVICE_NOT_FOUND){ + // no devices for this platform + return 0; + } + else { + // something else went wrong + BOOST_THROW_EXCEPTION(opencl_error(ret)); + } + } + + return count; + } + + /// Returns information about the platform. + /// + /// \see_opencl_ref{clGetPlatformInfo} + template + T get_info(cl_platform_info info) const + { + return detail::get_object_info(clGetPlatformInfo, m_platform, info); + } + + /// \overload + template + typename detail::get_object_info_type::type + get_info() const; + + /// Returns the address of the \p function_name extension + /// function. Returns \c 0 if \p function_name is invalid. + void* get_extension_function_address(const char *function_name) const + { + #ifdef CL_VERSION_1_2 + return clGetExtensionFunctionAddressForPlatform(m_platform, + function_name); + #else + return clGetExtensionFunctionAddress(function_name); + #endif + } + + /// Requests that the platform unload any compiler resources. + void unload_compiler() + { + #ifdef CL_VERSION_1_2 + clUnloadPlatformCompiler(m_platform); + #else + clUnloadCompiler(); + #endif + } + + /// Returns \c true if the platform is the same at \p other. + bool operator==(const platform &other) const + { + return m_platform == other.m_platform; + } + + /// Returns \c true if the platform is different from \p other. + bool operator!=(const platform &other) const + { + return m_platform != other.m_platform; + } + +private: + cl_platform_id m_platform; +}; + +/// \internal_ define get_info() specializations for platform +BOOST_COMPUTE_DETAIL_DEFINE_GET_INFO_SPECIALIZATIONS(platform, + ((std::string, CL_PLATFORM_PROFILE)) + ((std::string, CL_PLATFORM_VERSION)) + ((std::string, CL_PLATFORM_NAME)) + ((std::string, CL_PLATFORM_VENDOR)) + ((std::string, CL_PLATFORM_EXTENSIONS)) +) + +inline boost::compute::platform device::platform() const +{ + return boost::compute::platform(get_info()); +} + +} // end compute namespace +} // end boost namespace + +#endif // BOOST_COMPUTE_PLATFORM_HPP diff --git a/3party/boost/boost/compute/program.hpp b/3party/boost/boost/compute/program.hpp new file mode 100644 index 0000000000..7573aa02e6 --- /dev/null +++ b/3party/boost/boost/compute/program.hpp @@ -0,0 +1,650 @@ +//---------------------------------------------------------------------------// +// Copyright (c) 2013 Kyle Lutz +// +// 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 +// +// See http://boostorg.github.com/compute for more information. +//---------------------------------------------------------------------------// + +#ifndef BOOST_COMPUTE_PROGRAM_HPP +#define BOOST_COMPUTE_PROGRAM_HPP + +#include +#include +#include +#include + +#ifdef BOOST_COMPUTE_DEBUG_KERNEL_COMPILATION +#include +#endif + +#include +#include +#include +#include + +#ifdef BOOST_COMPUTE_USE_OFFLINE_CACHE +#include +#include +#include +#include +#include +#include +#endif + +namespace boost { +namespace compute { + +class kernel; + +/// \class program +/// \brief A compute program. +/// +/// The program class represents an OpenCL program. +/// +/// Program objects are created with one of the static \c create_with_* +/// functions. For example, to create a program from a source string: +/// +/// \snippet test/test_program.cpp create_with_source +/// +/// And to create a program from a source file: +/// \code +/// boost::compute::program bar_program = +/// boost::compute::program::create_with_source_file("/path/to/bar.cl", context); +/// \endcode +/// +/// Once a program object has been succesfully created, it can be compiled +/// using the \c build() method: +/// \code +/// // build the program +/// foo_program.build(); +/// \endcode +/// +/// Once the program is built, \ref kernel objects can be created using the +/// \c create_kernel() method by passing their name: +/// \code +/// // create a kernel from the compiled program +/// boost::compute::kernel foo_kernel = foo_program.create_kernel("foo"); +/// \endcode +/// +/// \see kernel +class program +{ +public: + /// Creates a null program object. + program() + : m_program(0) + { + } + + /// Creates a program object for \p program. If \p retain is \c true, + /// the reference count for \p program will be incremented. + explicit program(cl_program program, bool retain = true) + : m_program(program) + { + if(m_program && retain){ + clRetainProgram(m_program); + } + } + + /// Creates a new program object as a copy of \p other. + program(const program &other) + : m_program(other.m_program) + { + if(m_program){ + clRetainProgram(m_program); + } + } + + /// Copies the program object from \p other to \c *this. + program& operator=(const program &other) + { + if(this != &other){ + if(m_program){ + clReleaseProgram(m_program); + } + + m_program = other.m_program; + + if(m_program){ + clRetainProgram(m_program); + } + } + + return *this; + } + + #ifndef BOOST_COMPUTE_NO_RVALUE_REFERENCES + /// Move-constructs a new program object from \p other. + program(program&& other) BOOST_NOEXCEPT + : m_program(other.m_program) + { + other.m_program = 0; + } + + /// Move-assigns the program from \p other to \c *this. + program& operator=(program&& other) BOOST_NOEXCEPT + { + if(m_program){ + clReleaseProgram(m_program); + } + + m_program = other.m_program; + other.m_program = 0; + + return *this; + } + #endif // BOOST_COMPUTE_NO_RVALUE_REFERENCES + + /// Destroys the program object. + ~program() + { + if(m_program){ + BOOST_COMPUTE_ASSERT_CL_SUCCESS( + clReleaseProgram(m_program) + ); + } + } + + /// Returns the underlying OpenCL program. + cl_program& get() const + { + return const_cast(m_program); + } + + /// Returns the source code for the program. + std::string source() const + { + return get_info(CL_PROGRAM_SOURCE); + } + + /// Returns the binary for the program. + std::vector binary() const + { + size_t binary_size = get_info(CL_PROGRAM_BINARY_SIZES); + std::vector binary(binary_size); + + unsigned char *binary_ptr = &binary[0]; + cl_int error = clGetProgramInfo(m_program, + CL_PROGRAM_BINARIES, + sizeof(unsigned char **), + &binary_ptr, + 0); + if(error != CL_SUCCESS){ + BOOST_THROW_EXCEPTION(opencl_error(error)); + } + + return binary; + } + + std::vector get_devices() const + { + std::vector device_ids = + get_info >(CL_PROGRAM_DEVICES); + + std::vector devices; + for(size_t i = 0; i < device_ids.size(); i++){ + devices.push_back(device(device_ids[i])); + } + + return devices; + } + + /// Returns the context for the program. + context get_context() const + { + return context(get_info(CL_PROGRAM_CONTEXT)); + } + + /// Returns information about the program. + /// + /// \see_opencl_ref{clGetProgramInfo} + template + T get_info(cl_program_info info) const + { + return detail::get_object_info(clGetProgramInfo, m_program, info); + } + + /// \overload + template + typename detail::get_object_info_type::type + get_info() const; + + /// Returns build information about the program. + /// + /// For example, this function can be used to retreive the options used + /// to build the program: + /// \code + /// std::string build_options = + /// program.get_build_info(CL_PROGRAM_BUILD_OPTIONS); + /// \endcode + /// + /// \see_opencl_ref{clGetProgramInfo} + template + T get_build_info(cl_program_build_info info, const device &device) const + { + return detail::get_object_info(clGetProgramBuildInfo, m_program, info, device.id()); + } + + /// Builds the program with \p options. + /// + /// If the program fails to compile, this function will throw an + /// opencl_error exception. + /// \code + /// try { + /// // attempt to compile to program + /// program.build(); + /// } + /// catch(boost::compute::opencl_error &e){ + /// // program failed to compile, print out the build log + /// std::cout << program.build_log() << std::endl; + /// } + /// \endcode + /// + /// \see_opencl_ref{clBuildProgram} + void build(const std::string &options = std::string()) + { + const char *options_string = 0; + + if(!options.empty()){ + options_string = options.c_str(); + } + + cl_int ret = clBuildProgram(m_program, 0, 0, options_string, 0, 0); + + #ifdef BOOST_COMPUTE_DEBUG_KERNEL_COMPILATION + if(ret != CL_SUCCESS){ + // print the error, source code and build log + std::cerr << "Boost.Compute: " + << "kernel compilation failed (" << ret << ")\n" + << "--- source ---\n" + << source() + << "\n--- build log ---\n" + << build_log() + << std::endl; + } + #endif + + if(ret != CL_SUCCESS){ + BOOST_THROW_EXCEPTION(opencl_error(ret)); + } + } + + #if defined(CL_VERSION_1_2) || defined(BOOST_COMPUTE_DOXYGEN_INVOKED) + /// Compiles the program with \p options. + /// + /// \opencl_version_warning{1,2} + /// + /// \see_opencl_ref{clCompileProgram} + void compile(const std::string &options = std::string()) + { + const char *options_string = 0; + + if(!options.empty()){ + options_string = options.c_str(); + } + + cl_int ret = clCompileProgram( + m_program, 0, 0, options_string, 0, 0, 0, 0, 0 + ); + + if(ret != CL_SUCCESS){ + BOOST_THROW_EXCEPTION(opencl_error(ret)); + } + } + + /// Links the programs in \p programs with \p options in \p context. + /// + /// \opencl_version_warning{1,2} + /// + /// \see_opencl_ref{clLinkProgram} + static program link(const std::vector &programs, + const context &context, + const std::string &options = std::string()) + { + const char *options_string = 0; + + if(!options.empty()){ + options_string = options.c_str(); + } + + cl_int ret; + cl_program program_ = clLinkProgram( + context.get(), + 0, + 0, + options_string, + static_cast(programs.size()), + reinterpret_cast(&programs[0]), + 0, + 0, + &ret + ); + + if(!program_){ + BOOST_THROW_EXCEPTION(opencl_error(ret)); + } + + return program(program_, false); + } + #endif // CL_VERSION_1_2 + + /// Returns the build log. + std::string build_log() const + { + return get_build_info(CL_PROGRAM_BUILD_LOG, get_devices().front()); + } + + /// Creates and returns a new kernel object for \p name. + /// + /// For example, to create the \c "foo" kernel (after the program has been + /// created and built): + /// \code + /// boost::compute::kernel foo_kernel = foo_program.create_kernel("foo"); + /// \endcode + kernel create_kernel(const std::string &name) const; + + /// Returns \c true if the program is the same at \p other. + bool operator==(const program &other) const + { + return m_program == other.m_program; + } + + /// Returns \c true if the program is different from \p other. + bool operator!=(const program &other) const + { + return m_program != other.m_program; + } + + /// \internal_ + operator cl_program() const + { + return m_program; + } + + /// Creates a new program with \p source in \p context. + /// + /// \see_opencl_ref{clCreateProgramWithSource} + static program create_with_source(const std::string &source, + const context &context) + { + const char *source_string = source.c_str(); + + cl_int error = 0; + cl_program program_ = clCreateProgramWithSource(context, + uint_(1), + &source_string, + 0, + &error); + if(!program_){ + BOOST_THROW_EXCEPTION(opencl_error(error)); + } + + return program(program_, false); + } + + /// Creates a new program with \p sources in \p context. + /// + /// \see_opencl_ref{clCreateProgramWithSource} + static program create_with_source(const std::vector &sources, + const context &context) + { + std::vector source_strings(sources.size()); + for(size_t i = 0; i < sources.size(); i++){ + source_strings[i] = sources[i].c_str(); + } + + cl_int error = 0; + cl_program program_ = clCreateProgramWithSource(context, + uint_(sources.size()), + &source_strings[0], + 0, + &error); + if(!program_){ + BOOST_THROW_EXCEPTION(opencl_error(error)); + } + + return program(program_, false); + } + + /// Creates a new program with \p file in \p context. + /// + /// \see_opencl_ref{clCreateProgramWithSource} + static program create_with_source_file(const std::string &file, + const context &context) + { + // open file stream + std::ifstream stream(file.c_str()); + + if(stream.fail()){ + BOOST_THROW_EXCEPTION(std::ios_base::failure("failed to create stream.")); + } + + // read source + std::string source( + (std::istreambuf_iterator(stream)), + std::istreambuf_iterator() + ); + + // create program + return create_with_source(source, context); + } + + /// Creates a new program with \p binary of \p binary_size in + /// \p context. + /// + /// \see_opencl_ref{clCreateProgramWithBinary} + static program create_with_binary(const unsigned char *binary, + size_t binary_size, + const context &context) + { + const cl_device_id device = context.get_device().id(); + + cl_int error = 0; + cl_int binary_status = 0; + cl_program program_ = clCreateProgramWithBinary(context, + uint_(1), + &device, + &binary_size, + &binary, + &binary_status, + &error); + if(!program_){ + BOOST_THROW_EXCEPTION(opencl_error(error)); + } + if(binary_status != CL_SUCCESS){ + BOOST_THROW_EXCEPTION(opencl_error(binary_status)); + } + + return program(program_, false); + } + + /// Creates a new program with \p binary in \p context. + /// + /// \see_opencl_ref{clCreateProgramWithBinary} + static program create_with_binary(const std::vector &binary, + const context &context) + { + return create_with_binary(&binary[0], binary.size(), context); + } + + /// Creates a new program with \p file in \p context. + /// + /// \see_opencl_ref{clCreateProgramWithBinary} + static program create_with_binary_file(const std::string &file, + const context &context) + { + // open file stream + std::ifstream stream(file.c_str(), std::ios::in | std::ios::binary); + + // read binary + std::vector binary( + (std::istreambuf_iterator(stream)), + std::istreambuf_iterator() + ); + + // create program + return create_with_binary(&binary[0], binary.size(), context); + } + + #if defined(CL_VERSION_1_2) || defined(BOOST_COMPUTE_DOXYGEN_INVOKED) + /// Creates a new program with the built-in kernels listed in + /// \p kernel_names for \p devices in \p context. + /// + /// \opencl_version_warning{1,2} + /// + /// \see_opencl_ref{clCreateProgramWithBuiltInKernels} + static program create_with_builtin_kernels(const context &context, + const std::vector &devices, + const std::string &kernel_names) + { + cl_int error = 0; + + cl_program program_ = clCreateProgramWithBuiltInKernels( + context.get(), + static_cast(devices.size()), + reinterpret_cast(&devices[0]), + kernel_names.c_str(), + &error + ); + + if(!program_){ + BOOST_THROW_EXCEPTION(opencl_error(error)); + } + + return program(program_, false); + } + #endif // CL_VERSION_1_2 + + /// Create a new program with \p source in \p context and builds it with \p options. + /** + * In case BOOST_COMPUTE_USE_OFFLINE_CACHE macro is defined, + * the compiled binary is stored for reuse in the offline cache located in + * $HOME/.boost_compute on UNIX-like systems and in %APPDATA%/boost_compute + * on Windows. + */ + static program build_with_source( + const std::string &source, + const context &context, + const std::string &options = std::string() + ) + { +#ifdef BOOST_COMPUTE_USE_OFFLINE_CACHE + // Get hash string for the kernel. + device d = context.get_device(); + platform p = d.platform(); + + detail::sha1 hash; + hash.process( p.name() ) + .process( p.version() ) + .process( d.name() ) + .process( options ) + .process( source ) + ; + + // Try to get cached program binaries: + try { + boost::optional prog = load_program_binary(hash, context); + + if (prog) { + prog->build(options); + return *prog; + } + } catch (...) { + // Something bad happened. Fallback to normal compilation. + } + + // Cache is apparently not available. Just compile the sources. +#endif + const char *source_string = source.c_str(); + + cl_int error = 0; + cl_program program_ = clCreateProgramWithSource(context, + uint_(1), + &source_string, + 0, + &error); + if(!program_){ + BOOST_THROW_EXCEPTION(opencl_error(error)); + } + + program prog(program_, false); + prog.build(options); + +#ifdef BOOST_COMPUTE_USE_OFFLINE_CACHE + // Save program binaries for future reuse. + save_program_binary(hash, prog); +#endif + + return prog; + } + +private: +#ifdef BOOST_COMPUTE_USE_OFFLINE_CACHE + // Saves program binaries for future reuse. + static void save_program_binary(const std::string &hash, const program &prog) + { + std::string fname = detail::program_binary_path(hash, true) + "kernel"; + std::ofstream bfile(fname.c_str(), std::ios::binary); + if (!bfile) return; + + std::vector binary = prog.binary(); + + size_t binary_size = binary.size(); + bfile.write((char*)&binary_size, sizeof(size_t)); + bfile.write((char*)binary.data(), binary_size); + } + + // Tries to read program binaries from file cache. + static boost::optional load_program_binary( + const std::string &hash, const context &ctx + ) + { + std::string fname = detail::program_binary_path(hash) + "kernel"; + std::ifstream bfile(fname.c_str(), std::ios::binary); + if (!bfile) return boost::optional(); + + size_t binary_size; + std::vector binary; + + bfile.read((char*)&binary_size, sizeof(size_t)); + + binary.resize(binary_size); + bfile.read((char*)binary.data(), binary_size); + + return boost::optional( + program::create_with_binary( + binary.data(), binary_size, ctx + ) + ); + } +#endif // BOOST_COMPUTE_USE_OFFLINE_CACHE + +private: + cl_program m_program; +}; + +/// \internal_ define get_info() specializations for program +BOOST_COMPUTE_DETAIL_DEFINE_GET_INFO_SPECIALIZATIONS(program, + ((cl_uint, CL_PROGRAM_REFERENCE_COUNT)) + ((cl_context, CL_PROGRAM_CONTEXT)) + ((cl_uint, CL_PROGRAM_NUM_DEVICES)) + ((std::vector, CL_PROGRAM_DEVICES)) + ((std::string, CL_PROGRAM_SOURCE)) + ((std::vector, CL_PROGRAM_BINARY_SIZES)) + ((std::vector, CL_PROGRAM_BINARIES)) +) + +#ifdef CL_VERSION_1_2 +BOOST_COMPUTE_DETAIL_DEFINE_GET_INFO_SPECIALIZATIONS(program, + ((size_t, CL_PROGRAM_NUM_KERNELS)) + ((std::string, CL_PROGRAM_KERNEL_NAMES)) +) +#endif // CL_VERSION_1_2 + +} // end compute namespace +} // end boost namespace + +#endif // BOOST_COMPUTE_PROGRAM_HPP diff --git a/3party/boost/boost/compute/random.hpp b/3party/boost/boost/compute/random.hpp new file mode 100644 index 0000000000..1a361fe48b --- /dev/null +++ b/3party/boost/boost/compute/random.hpp @@ -0,0 +1,28 @@ +//---------------------------------------------------------------------------// +// Copyright (c) 2013 Kyle Lutz +// +// 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 +// +// See http://boostorg.github.com/compute for more information. +//---------------------------------------------------------------------------// + +#ifndef BOOST_COMPUTE_RANDOM_HPP +#define BOOST_COMPUTE_RANDOM_HPP + +/// \file +/// +/// Meta-header to include all Boost.Compute random headers. + +#include +#include +#include +#include +#include +#include +#include +#include +#include + +#endif // BOOST_COMPUTE_RANDOM_HPP diff --git a/3party/boost/boost/compute/random/bernoulli_distribution.hpp b/3party/boost/boost/compute/random/bernoulli_distribution.hpp new file mode 100644 index 0000000000..50bf27f591 --- /dev/null +++ b/3party/boost/boost/compute/random/bernoulli_distribution.hpp @@ -0,0 +1,100 @@ +//---------------------------------------------------------------------------// +// Copyright (c) 2014 Roshan +// +// 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 +// +// See http://boostorg.github.com/compute for more information. +//---------------------------------------------------------------------------// + +#ifndef BOOST_COMPUTE_RANDOM_BERNOULLI_DISTRIBUTION_HPP +#define BOOST_COMPUTE_RANDOM_BERNOULLI_DISTRIBUTION_HPP + +#include +#include + +#include +#include +#include +#include +#include + +namespace boost { +namespace compute { + +/// +/// \class bernoulli_distribution +/// \brief Produces random boolean values according to the following +/// discrete probability function with parameter p : +/// P(true/p) = p and P(false/p) = (1 - p) +/// +/// The following example shows how to setup a bernoulli distribution to +/// produce random boolean values with parameter p = 0.25 +/// +/// \snippet test/test_bernoulli_distribution.cpp generate +/// +template +class bernoulli_distribution +{ +public: + + /// Creates a new bernoulli distribution + bernoulli_distribution(RealType p = 0.5f) + : m_p(p) + { + } + + /// Destroys the bernoulli_distribution object + ~bernoulli_distribution() + { + } + + /// Returns the value of the parameter p + RealType p() const + { + return m_p; + } + + /// Generates bernoulli distributed booleans and stores + /// them in the range [\p first, \p last). + template + void generate(OutputIterator first, + OutputIterator last, + Generator &generator, + command_queue &queue) + { + size_t count = detail::iterator_range_size(first, last); + + vector tmp(count, queue.get_context()); + generator.generate(tmp.begin(), tmp.end(), queue); + + BOOST_COMPUTE_FUNCTION(bool, scale_random, (const uint_ x), + { + return (convert_RealType(x) / MAX_RANDOM) < PARAM; + }); + + scale_random.define("PARAM", detail::make_literal(m_p)); + scale_random.define("MAX_RANDOM", "UINT_MAX"); + scale_random.define( + "convert_RealType", std::string("convert_") + type_name() + ); + + transform( + tmp.begin(), tmp.end(), first, scale_random, queue + ); + } + +private: + RealType m_p; + + BOOST_STATIC_ASSERT_MSG( + boost::is_floating_point::value, + "Template argument must be a floating point type" + ); +}; + +} // end compute namespace +} // end boost namespace + +#endif // BOOST_COMPUTE_RANDOM_BERNOULLI_DISTRIBUTION_HPP diff --git a/3party/boost/boost/compute/random/default_random_engine.hpp b/3party/boost/boost/compute/random/default_random_engine.hpp new file mode 100644 index 0000000000..b34dbd01fa --- /dev/null +++ b/3party/boost/boost/compute/random/default_random_engine.hpp @@ -0,0 +1,24 @@ +//---------------------------------------------------------------------------// +// Copyright (c) 2013 Kyle Lutz +// +// 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 +// +// See http://boostorg.github.com/compute for more information. +//---------------------------------------------------------------------------// + +#ifndef BOOST_COMPUTE_RANDOM_DEFAULT_RANDOM_ENGINE_HPP +#define BOOST_COMPUTE_RANDOM_DEFAULT_RANDOM_ENGINE_HPP + +#include + +namespace boost { +namespace compute { + +typedef mt19937 default_random_engine; + +} // end compute namespace +} // end boost namespace + +#endif // BOOST_COMPUTE_RANDOM_DEFAULT_RANDOM_ENGINE_HPP diff --git a/3party/boost/boost/compute/random/discrete_distribution.hpp b/3party/boost/boost/compute/random/discrete_distribution.hpp new file mode 100644 index 0000000000..86249538ac --- /dev/null +++ b/3party/boost/boost/compute/random/discrete_distribution.hpp @@ -0,0 +1,160 @@ +//---------------------------------------------------------------------------// +// Copyright (c) 2014 Roshan +// +// 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 +// +// See http://boostorg.github.com/compute for more information. +//---------------------------------------------------------------------------// + +#ifndef BOOST_COMPUTE_RANDOM_DISCRETE_DISTRIBUTION_HPP +#define BOOST_COMPUTE_RANDOM_DISCRETE_DISTRIBUTION_HPP + +#include + +#include +#include +#include + +#include +#include +#include +#include +#include +#include +#include + +namespace boost { +namespace compute { + +/// \class discrete_distribution +/// \brief Produces random integers on the interval [0, n), where +/// probability of each integer is given by the weight of the ith +/// integer divided by the sum of all weights. +/// +/// The following example shows how to setup a discrete distribution to +/// produce 0 and 1 with equal probability +/// +/// \snippet test/test_discrete_distribution.cpp generate +/// +template +class discrete_distribution +{ +public: + typedef IntType result_type; + + /// Creates a new discrete distribution with a single weight p = { 1 }. + /// This distribution produces only zeroes. + discrete_distribution() + : m_probabilities(1, double(1)), + m_scanned_probabilities(1, double(1)) + { + + } + + /// Creates a new discrete distribution with weights given by + /// the range [\p first, \p last). + template + discrete_distribution(InputIterator first, InputIterator last) + : m_probabilities(first, last), + m_scanned_probabilities(std::distance(first, last)) + { + if(first != last) { + // after this m_scanned_probabilities.back() is a sum of all + // weights from the range [first, last) + std::partial_sum(first, last, m_scanned_probabilities.begin()); + + std::vector::iterator i = m_probabilities.begin(); + std::vector::iterator j = m_scanned_probabilities.begin(); + for(; i != m_probabilities.end(); ++i, ++j) + { + // dividing each weight by sum of all weights to + // get probabilities + *i = *i / m_scanned_probabilities.back(); + // dividing each partial sum of weights by sum of + // all weights to get partial sums of probabilities + *j = *j / m_scanned_probabilities.back(); + } + } + else { + m_probabilities.push_back(double(1)); + m_scanned_probabilities.push_back(double(1)); + } + } + + /// Destroys the discrete_distribution object. + ~discrete_distribution() + { + } + + /// Returns the probabilities + ::std::vector probabilities() const + { + return m_probabilities; + } + + /// Returns the minimum potentially generated value. + result_type min BOOST_PREVENT_MACRO_SUBSTITUTION () const + { + return result_type(0); + } + + /// Returns the maximum potentially generated value. + result_type max BOOST_PREVENT_MACRO_SUBSTITUTION () const + { + size_t type_max = static_cast( + (std::numeric_limits::max)() + ); + if(m_probabilities.size() - 1 > type_max) { + return (std::numeric_limits::max)(); + } + return static_cast(m_probabilities.size() - 1); + } + + /// Generates uniformly distributed integers and stores + /// them to the range [\p first, \p last). + template + void generate(OutputIterator first, + OutputIterator last, + Generator &generator, + command_queue &queue) + { + std::string source = "inline IntType scale_random(uint x)\n"; + + source = source + + "{\n" + + "float rno = convert_float(x) / UINT_MAX;\n"; + for(size_t i = 0; i < m_scanned_probabilities.size() - 1; i++) + { + source = source + + "if(rno <= " + detail::make_literal(m_scanned_probabilities[i]) + ")\n" + + " return " + detail::make_literal(i) + ";\n"; + } + + source = source + + "return " + detail::make_literal(m_scanned_probabilities.size() - 1) + ";\n" + + "}\n"; + + BOOST_COMPUTE_FUNCTION(IntType, scale_random, (const uint_ x), {}); + + scale_random.set_source(source); + scale_random.define("IntType", type_name()); + + generator.generate(first, last, scale_random, queue); + } + +private: + ::std::vector m_probabilities; + ::std::vector m_scanned_probabilities; + + BOOST_STATIC_ASSERT_MSG( + boost::is_integral::value, + "Template argument must be integral" + ); +}; + +} // end compute namespace +} // end boost namespace + +#endif // BOOST_COMPUTE_RANDOM_UNIFORM_INT_DISTRIBUTION_HPP diff --git a/3party/boost/boost/compute/random/linear_congruential_engine.hpp b/3party/boost/boost/compute/random/linear_congruential_engine.hpp new file mode 100644 index 0000000000..173a6c2881 --- /dev/null +++ b/3party/boost/boost/compute/random/linear_congruential_engine.hpp @@ -0,0 +1,238 @@ +//---------------------------------------------------------------------------// +// Copyright (c) 2014 Roshan +// +// 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 +// +// See http://boostorg.github.com/compute for more information. +//---------------------------------------------------------------------------// + +#ifndef BOOST_COMPUTE_RANDOM_LINEAR_CONGRUENTIAL_ENGINE_HPP +#define BOOST_COMPUTE_RANDOM_LINEAR_CONGRUENTIAL_ENGINE_HPP + +#include + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +namespace boost { +namespace compute { + +/// +/// \class linear_congruential_engine +/// \brief 'Quick and Dirty' linear congruential engine +/// +/// Quick and dirty linear congruential engine to generate low quality +/// random numbers very quickly. For uses in which good quality of random +/// numbers is required(Monte-Carlo Simulations), use other engines like +/// Mersenne Twister instead. +/// +template +class linear_congruential_engine +{ +public: + typedef T result_type; + static const T default_seed = 1; + static const T a = 1099087573; + static const size_t threads = 1024; + + /// Creates a new linear_congruential_engine and seeds it with \p value. + explicit linear_congruential_engine(command_queue &queue, + result_type value = default_seed) + : m_context(queue.get_context()), + m_multiplicands(m_context, threads * sizeof(result_type)) + { + // setup program + load_program(); + + // seed state + seed(value, queue); + + // generate multiplicands + generate_multiplicands(queue); + } + + /// Creates a new linear_congruential_engine object as a copy of \p other. + linear_congruential_engine(const linear_congruential_engine &other) + : m_context(other.m_context), + m_program(other.m_program), + m_seed(other.m_seed), + m_multiplicands(other.m_multiplicands) + { + } + + /// Copies \p other to \c *this. + linear_congruential_engine& + operator=(const linear_congruential_engine &other) + { + if(this != &other){ + m_context = other.m_context; + m_program = other.m_program; + m_seed = other.m_seed; + m_multiplicands = other.m_multiplicands; + } + + return *this; + } + + /// Destroys the linear_congruential_engine object. + ~linear_congruential_engine() + { + } + + /// Seeds the random number generator with \p value. + /// + /// \param value seed value for the random-number generator + /// \param queue command queue to perform the operation + /// + /// If no seed value is provided, \c default_seed is used. + void seed(result_type value, command_queue &queue) + { + (void) queue; + + m_seed = value; + } + + /// \overload + void seed(command_queue &queue) + { + seed(default_seed, queue); + } + + /// Generates random numbers and stores them to the range [\p first, \p last). + template + void generate(OutputIterator first, OutputIterator last, command_queue &queue) + { + size_t size = detail::iterator_range_size(first, last); + + kernel fill_kernel(m_program, "fill"); + fill_kernel.set_arg(1, m_multiplicands); + fill_kernel.set_arg(2, first.get_buffer()); + + size_t offset = 0; + + for(;;){ + size_t count = 0; + if(size > threads){ + count = (std::min)(static_cast(threads), size - offset); + } + else { + count = size; + } + fill_kernel.set_arg(0, static_cast(m_seed)); + fill_kernel.set_arg(3, static_cast(offset)); + queue.enqueue_1d_range_kernel(fill_kernel, 0, count, 0); + + offset += count; + + if(offset >= size){ + break; + } + + update_seed(queue); + } + } + + /// \internal_ + void generate(discard_iterator first, discard_iterator last, command_queue &queue) + { + (void) queue; + + size_t size = detail::iterator_range_size(first, last); + uint_ max_mult = + detail::read_single_value(m_multiplicands, threads-1, queue); + while(size >= threads) { + m_seed *= max_mult; + size -= threads; + } + m_seed *= + detail::read_single_value(m_multiplicands, size-1, queue); + } + + /// Generates random numbers, transforms them with \p op, and then stores + /// them to the range [\p first, \p last). + template + void generate(OutputIterator first, OutputIterator last, Function op, command_queue &queue) + { + vector tmp(std::distance(first, last), queue.get_context()); + generate(tmp.begin(), tmp.end(), queue); + transform(tmp.begin(), tmp.end(), first, op, queue); + } + + /// Generates \p z random numbers and discards them. + void discard(size_t z, command_queue &queue) + { + generate(discard_iterator(0), discard_iterator(z), queue); + } + +private: + /// \internal_ + /// Generates the multiplicands for each thread + void generate_multiplicands(command_queue &queue) + { + kernel multiplicand_kernel = + m_program.create_kernel("multiplicand"); + multiplicand_kernel.set_arg(0, m_multiplicands); + + queue.enqueue_task(multiplicand_kernel); + } + + /// \internal_ + void update_seed(command_queue &queue) + { + m_seed *= + detail::read_single_value(m_multiplicands, threads-1, queue); + } + + /// \internal_ + void load_program() + { + boost::shared_ptr cache = + program_cache::get_global_cache(m_context); + + std::string cache_key = + std::string("__boost_linear_congruential_engine_") + type_name(); + + const char source[] = + "__kernel void multiplicand(__global uint *multiplicands)\n" + "{\n" + " uint a = 1099087573;\n" + " multiplicands[0] = a;\n" + " for(uint i = 1; i < 1024; i++){\n" + " multiplicands[i] = a * multiplicands[i-1];\n" + " }\n" + "}\n" + + "__kernel void fill(const uint seed,\n" + " __global uint *multiplicands,\n" + " __global uint *result," + " const uint offset)\n" + "{\n" + " const uint i = get_global_id(0);\n" + " result[offset+i] = seed * multiplicands[i];\n" + "}\n"; + + m_program = cache->get_or_build(cache_key, std::string(), source, m_context); + } + +private: + context m_context; + program m_program; + T m_seed; + buffer m_multiplicands; +}; + +} // end compute namespace +} // end boost namespace + +#endif // BOOST_COMPUTE_RANDOM_LINEAR_CONGRUENTIAL_ENGINE_HPP diff --git a/3party/boost/boost/compute/random/mersenne_twister_engine.hpp b/3party/boost/boost/compute/random/mersenne_twister_engine.hpp new file mode 100644 index 0000000000..db8560e53d --- /dev/null +++ b/3party/boost/boost/compute/random/mersenne_twister_engine.hpp @@ -0,0 +1,254 @@ +//---------------------------------------------------------------------------// +// Copyright (c) 2013 Kyle Lutz +// +// 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 +// +// See http://boostorg.github.com/compute for more information. +//---------------------------------------------------------------------------// + +#ifndef BOOST_COMPUTE_RANDOM_MERSENNE_TWISTER_ENGINE_HPP +#define BOOST_COMPUTE_RANDOM_MERSENNE_TWISTER_ENGINE_HPP + +#include + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +namespace boost { +namespace compute { + +/// \class mersenne_twister_engine +/// \brief Mersenne twister pseudorandom number generator. +template +class mersenne_twister_engine +{ +public: + typedef T result_type; + static const T default_seed = 5489U; + static const T n = 624; + static const T m = 397; + + /// Creates a new mersenne_twister_engine and seeds it with \p value. + explicit mersenne_twister_engine(command_queue &queue, + result_type value = default_seed) + : m_context(queue.get_context()), + m_state_buffer(m_context, n * sizeof(result_type)) + { + // setup program + load_program(); + + // seed state + seed(value, queue); + } + + /// Creates a new mersenne_twister_engine object as a copy of \p other. + mersenne_twister_engine(const mersenne_twister_engine &other) + : m_context(other.m_context), + m_state_index(other.m_state_index), + m_program(other.m_program), + m_state_buffer(other.m_state_buffer) + { + } + + /// Copies \p other to \c *this. + mersenne_twister_engine& operator=(const mersenne_twister_engine &other) + { + if(this != &other){ + m_context = other.m_context; + m_state_index = other.m_state_index; + m_program = other.m_program; + m_state_buffer = other.m_state_buffer; + } + + return *this; + } + + /// Destroys the mersenne_twister_engine object. + ~mersenne_twister_engine() + { + } + + /// Seeds the random number generator with \p value. + /// + /// \param value seed value for the random-number generator + /// \param queue command queue to perform the operation + /// + /// If no seed value is provided, \c default_seed is used. + void seed(result_type value, command_queue &queue) + { + kernel seed_kernel = m_program.create_kernel("seed"); + seed_kernel.set_arg(0, value); + seed_kernel.set_arg(1, m_state_buffer); + + queue.enqueue_task(seed_kernel); + + m_state_index = 0; + } + + /// \overload + void seed(command_queue &queue) + { + seed(default_seed, queue); + } + + /// Generates random numbers and stores them to the range [\p first, \p last). + template + void generate(OutputIterator first, OutputIterator last, command_queue &queue) + { + const size_t size = detail::iterator_range_size(first, last); + + kernel fill_kernel(m_program, "fill"); + fill_kernel.set_arg(0, m_state_buffer); + fill_kernel.set_arg(2, first.get_buffer()); + + size_t offset = 0; + size_t &p = m_state_index; + + for(;;){ + size_t count = 0; + if(size > n){ + count = (std::min)(static_cast(n), size - offset); + } + else { + count = size; + } + fill_kernel.set_arg(1, static_cast(p)); + fill_kernel.set_arg(3, static_cast(offset)); + queue.enqueue_1d_range_kernel(fill_kernel, 0, count, 0); + + p += count; + offset += count; + + if(offset >= size){ + break; + } + + generate_state(queue); + p = 0; + } + } + + /// \internal_ + void generate(discard_iterator first, discard_iterator last, command_queue &queue) + { + (void) queue; + + m_state_index += std::distance(first, last); + } + + /// Generates random numbers, transforms them with \p op, and then stores + /// them to the range [\p first, \p last). + template + void generate(OutputIterator first, OutputIterator last, Function op, command_queue &queue) + { + vector tmp(std::distance(first, last), queue.get_context()); + generate(tmp.begin(), tmp.end(), queue); + transform(tmp.begin(), tmp.end(), first, op, queue); + } + + /// Generates \p z random numbers and discards them. + void discard(size_t z, command_queue &queue) + { + generate(discard_iterator(0), discard_iterator(z), queue); + } + + /// \internal_ (deprecated) + template + void fill(OutputIterator first, OutputIterator last, command_queue &queue) + { + generate(first, last, queue); + } + +private: + /// \internal_ + void generate_state(command_queue &queue) + { + kernel generate_state_kernel = + m_program.create_kernel("generate_state"); + generate_state_kernel.set_arg(0, m_state_buffer); + queue.enqueue_task(generate_state_kernel); + } + + /// \internal_ + void load_program() + { + boost::shared_ptr cache = + program_cache::get_global_cache(m_context); + + std::string cache_key = + std::string("__boost_mersenne_twister_engine_") + type_name(); + + const char source[] = + "static uint twiddle(uint u, uint v)\n" + "{\n" + " return (((u & 0x80000000U) | (v & 0x7FFFFFFFU)) >> 1) ^\n" + " ((v & 1U) ? 0x9908B0DFU : 0x0U);\n" + "}\n" + + "__kernel void generate_state(__global uint *state)\n" + "{\n" + " const uint n = 624;\n" + " const uint m = 397;\n" + " for(uint i = 0; i < (n - m); i++)\n" + " state[i] = state[i+m] ^ twiddle(state[i], state[i+1]);\n" + " for(uint i = n - m; i < (n - 1); i++)\n" + " state[i] = state[i+m-n] ^ twiddle(state[i], state[i+1]);\n" + " state[n-1] = state[m-1] ^ twiddle(state[n-1], state[0]);\n" + "}\n" + + "__kernel void seed(const uint s, __global uint *state)\n" + "{\n" + " const uint n = 624;\n" + " state[0] = s & 0xFFFFFFFFU;\n" + " for(uint i = 1; i < n; i++){\n" + " state[i] = 1812433253U * (state[i-1] ^ (state[i-1] >> 30)) + i;\n" + " state[i] &= 0xFFFFFFFFU;\n" + " }\n" + " generate_state(state);\n" + "}\n" + + "static uint random_number(__global uint *state, const uint p)\n" + "{\n" + " uint x = state[p];\n" + " x ^= (x >> 11);\n" + " x ^= (x << 7) & 0x9D2C5680U;\n" + " x ^= (x << 15) & 0xEFC60000U;\n" + " return x ^ (x >> 18);\n" + "}\n" + + "__kernel void fill(__global uint *state,\n" + " const uint state_index,\n" + " __global uint *vector,\n" + " const uint offset)\n" + "{\n" + " const uint i = get_global_id(0);\n" + " vector[offset+i] = random_number(state, state_index + i);\n" + "}\n"; + + m_program = cache->get_or_build(cache_key, std::string(), source, m_context); + } + +private: + context m_context; + size_t m_state_index; + program m_program; + buffer m_state_buffer; +}; + +typedef mersenne_twister_engine mt19937; + +} // end compute namespace +} // end boost namespace + +#endif // BOOST_COMPUTE_RANDOM_MERSENNE_TWISTER_ENGINE_HPP diff --git a/3party/boost/boost/compute/random/normal_distribution.hpp b/3party/boost/boost/compute/random/normal_distribution.hpp new file mode 100644 index 0000000000..4693e4fffe --- /dev/null +++ b/3party/boost/boost/compute/random/normal_distribution.hpp @@ -0,0 +1,140 @@ +//---------------------------------------------------------------------------// +// Copyright (c) 2013-2014 Kyle Lutz +// +// 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 +// +// See http://boostorg.github.com/compute for more information. +//---------------------------------------------------------------------------// + +#ifndef BOOST_COMPUTE_RANDOM_NORMAL_DISTRIBUTION_HPP +#define BOOST_COMPUTE_RANDOM_NORMAL_DISTRIBUTION_HPP + +#include + +#include +#include + +#include +#include +#include +#include + +namespace boost { +namespace compute { + +/// \class normal_distribution +/// \brief Produces random, normally-distributed floating-point numbers. +/// +/// The following example shows how to setup a normal distribution to +/// produce random \c float values centered at \c 5: +/// +/// \snippet test/test_normal_distribution.cpp generate +/// +/// \see default_random_engine, uniform_real_distribution +template +class normal_distribution +{ +public: + typedef RealType result_type; + + /// Creates a new normal distribution producing numbers with the given + /// \p mean and \p stddev. + normal_distribution(RealType mean = 0.f, RealType stddev = 1.f) + : m_mean(mean), + m_stddev(stddev) + { + } + + /// Destroys the normal distribution object. + ~normal_distribution() + { + } + + /// Returns the mean value of the distribution. + result_type mean() const + { + return m_mean; + } + + /// Returns the standard-deviation of the distribution. + result_type stddev() const + { + return m_stddev; + } + + /// Returns the minimum value of the distribution. + result_type min BOOST_PREVENT_MACRO_SUBSTITUTION () const + { + return -std::numeric_limits::infinity(); + } + + /// Returns the maximum value of the distribution. + result_type max BOOST_PREVENT_MACRO_SUBSTITUTION () const + { + return std::numeric_limits::infinity(); + } + + /// Generates normally-distributed floating-point numbers and stores + /// them to the range [\p first, \p last). + template + void generate(OutputIterator first, + OutputIterator last, + Generator &generator, + command_queue &queue) + { + typedef typename make_vector_type::type RealType2; + + size_t count = detail::iterator_range_size(first, last); + + vector tmp(count, queue.get_context()); + generator.generate(tmp.begin(), tmp.end(), queue); + + BOOST_COMPUTE_FUNCTION(RealType2, box_muller, (const uint2_ x), + { + const RealType one = 1; + const RealType two = 2; + + // Use nextafter to push values down into [0,1) range; without this, floating point rounding can + // lead to have x1 = 1, but that would lead to taking the log of 0, which would result in negative + // infinities; by pushing the values off 1 towards 0, we ensure this won't happen. + const RealType x1 = nextafter(x.x / (RealType) UINT_MAX, (RealType) 0); + const RealType x2 = x.y / (RealType) UINT_MAX; + + const RealType rho = sqrt(-two * log(one-x1)); + + const RealType z1 = rho * cos(two * M_PI_F * x2); + const RealType z2 = rho * sin(two * M_PI_F * x2); + + return (RealType2)(MEAN, MEAN) + (RealType2)(z1, z2) * (RealType2)(STDDEV, STDDEV); + }); + + box_muller.define("MEAN", boost::lexical_cast(m_mean)); + box_muller.define("STDDEV", boost::lexical_cast(m_stddev)); + box_muller.define("RealType", type_name()); + box_muller.define("RealType2", type_name()); + + transform( + make_buffer_iterator(tmp.get_buffer(), 0), + make_buffer_iterator(tmp.get_buffer(), count / 2), + make_buffer_iterator(first.get_buffer(), 0), + box_muller, + queue + ); + } + +private: + RealType m_mean; + RealType m_stddev; + + BOOST_STATIC_ASSERT_MSG( + boost::is_floating_point::value, + "Template argument must be a floating point type" + ); +}; + +} // end compute namespace +} // end boost namespace + +#endif // BOOST_COMPUTE_RANDOM_NORMAL_DISTRIBUTION_HPP diff --git a/3party/boost/boost/compute/random/threefry_engine.hpp b/3party/boost/boost/compute/random/threefry_engine.hpp new file mode 100644 index 0000000000..917bb72c06 --- /dev/null +++ b/3party/boost/boost/compute/random/threefry_engine.hpp @@ -0,0 +1,311 @@ +//---------------------------------------------------------------------------// +// Copyright (c) 2015 Muhammad Junaid Muzammil +// +// 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 +// +// See http://boostorg.github.com/compute for more information. +//---------------------------------------------------------------------------// + +#ifndef BOOST_COMPUTE_RANDOM_THREEFRY_HPP +#define BOOST_COMPUTE_RANDOM_THREEFRY_HPP + +#include + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +namespace boost { +namespace compute { + +/// \class threefry_engine +/// \brief Threefry pseudorandom number generator. +template +class threefry_engine +{ +public: + static const size_t threads = 1024; + typedef T result_type; + + /// Creates a new threefry_engine and seeds it with \p value. + explicit threefry_engine(command_queue &queue) + : m_context(queue.get_context()) + { + // setup program + load_program(); + } + + /// Creates a new threefry_engine object as a copy of \p other. + threefry_engine(const threefry_engine &other) + : m_context(other.m_context), + m_program(other.m_program) + { + } + + /// Copies \p other to \c *this. + threefry_engine& operator=(const threefry_engine &other) + { + if(this != &other){ + m_context = other.m_context; + m_program = other.m_program; + } + + return *this; + } + + /// Destroys the threefry_engine object. + ~threefry_engine() + { + } + +private: + /// \internal_ + void load_program() + { + boost::shared_ptr cache = + program_cache::get_global_cache(m_context); + std::string cache_key = + std::string("threefry_engine_32x2"); + + // Copyright 2010-2012, D. E. Shaw Research. + // All rights reserved. + + // Redistribution and use in source and binary forms, with or without + // modification, are permitted provided that the following conditions are + // met: + + // * Redistributions of source code must retain the above copyright + // notice, this list of conditions, and the following disclaimer. + + // * Redistributions in binary form must reproduce the above copyright + // notice, this list of conditions, and the following disclaimer in the + // documentation and/or other materials provided with the distribution. + + // * Neither the name of D. E. Shaw Research nor the names of its + // contributors may be used to endorse or promote products derived from + // this software without specific prior written permission. + + // THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS + // "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT + // LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR + // A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT + // OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, + // SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT + // LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, + // DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY + // THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + // (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE + // OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + const char source[] = + "#define THREEFRY2x32_DEFAULT_ROUNDS 20\n" + "#define SKEIN_KS_PARITY_32 0x1BD11BDA\n" + + "enum r123_enum_threefry32x2 {\n" + " R_32x2_0_0=13,\n" + " R_32x2_1_0=15,\n" + " R_32x2_2_0=26,\n" + " R_32x2_3_0= 6,\n" + " R_32x2_4_0=17,\n" + " R_32x2_5_0=29,\n" + " R_32x2_6_0=16,\n" + " R_32x2_7_0=24\n" + "};\n" + + "static uint RotL_32(uint x, uint N)\n" + "{\n" + " return (x << (N & 31)) | (x >> ((32-N) & 31));\n" + "}\n" + + "struct r123array2x32 {\n" + " uint v[2];\n" + "};\n" + "typedef struct r123array2x32 threefry2x32_ctr_t;\n" + "typedef struct r123array2x32 threefry2x32_key_t;\n" + + "threefry2x32_ctr_t threefry2x32_R(unsigned int Nrounds, threefry2x32_ctr_t in, threefry2x32_key_t k)\n" + "{\n" + " threefry2x32_ctr_t X;\n" + " uint ks[3];\n" + " uint i; \n" + " ks[2] = SKEIN_KS_PARITY_32;\n" + " for (i=0;i < 2; i++) {\n" + " ks[i] = k.v[i];\n" + " X.v[i] = in.v[i];\n" + " ks[2] ^= k.v[i];\n" + " }\n" + " X.v[0] += ks[0]; X.v[1] += ks[1];\n" + " if(Nrounds>0){ X.v[0] += X.v[1]; X.v[1] = RotL_32(X.v[1],R_32x2_0_0); X.v[1] ^= X.v[0]; }\n" + " if(Nrounds>1){ X.v[0] += X.v[1]; X.v[1] = RotL_32(X.v[1],R_32x2_1_0); X.v[1] ^= X.v[0]; }\n" + " if(Nrounds>2){ X.v[0] += X.v[1]; X.v[1] = RotL_32(X.v[1],R_32x2_2_0); X.v[1] ^= X.v[0]; }\n" + " if(Nrounds>3){ X.v[0] += X.v[1]; X.v[1] = RotL_32(X.v[1],R_32x2_3_0); X.v[1] ^= X.v[0]; }\n" + " if(Nrounds>3){\n" + " X.v[0] += ks[1]; X.v[1] += ks[2];\n" + " X.v[1] += 1;\n" + " }\n" + " if(Nrounds>4){ X.v[0] += X.v[1]; X.v[1] = RotL_32(X.v[1],R_32x2_4_0); X.v[1] ^= X.v[0]; }\n" + " if(Nrounds>5){ X.v[0] += X.v[1]; X.v[1] = RotL_32(X.v[1],R_32x2_5_0); X.v[1] ^= X.v[0]; }\n" + " if(Nrounds>6){ X.v[0] += X.v[1]; X.v[1] = RotL_32(X.v[1],R_32x2_6_0); X.v[1] ^= X.v[0]; }\n" + " if(Nrounds>7){ X.v[0] += X.v[1]; X.v[1] = RotL_32(X.v[1],R_32x2_7_0); X.v[1] ^= X.v[0]; }\n" + " if(Nrounds>7){\n" + " X.v[0] += ks[2]; X.v[1] += ks[0];\n" + " X.v[1] += 2;\n" + " }\n" + " if(Nrounds>8){ X.v[0] += X.v[1]; X.v[1] = RotL_32(X.v[1],R_32x2_0_0); X.v[1] ^= X.v[0]; }\n" + " if(Nrounds>9){ X.v[0] += X.v[1]; X.v[1] = RotL_32(X.v[1],R_32x2_1_0); X.v[1] ^= X.v[0]; }\n" + " if(Nrounds>10){ X.v[0] += X.v[1]; X.v[1] = RotL_32(X.v[1],R_32x2_2_0); X.v[1] ^= X.v[0]; }\n" + " if(Nrounds>11){ X.v[0] += X.v[1]; X.v[1] = RotL_32(X.v[1],R_32x2_3_0); X.v[1] ^= X.v[0]; }\n" + " if(Nrounds>11){\n" + " X.v[0] += ks[0]; X.v[1] += ks[1];\n" + " X.v[1] += 3;\n" + " }\n" + " if(Nrounds>12){ X.v[0] += X.v[1]; X.v[1] = RotL_32(X.v[1],R_32x2_4_0); X.v[1] ^= X.v[0]; }\n" + " if(Nrounds>13){ X.v[0] += X.v[1]; X.v[1] = RotL_32(X.v[1],R_32x2_5_0); X.v[1] ^= X.v[0]; }\n" + " if(Nrounds>14){ X.v[0] += X.v[1]; X.v[1] = RotL_32(X.v[1],R_32x2_6_0); X.v[1] ^= X.v[0]; }\n" + " if(Nrounds>15){ X.v[0] += X.v[1]; X.v[1] = RotL_32(X.v[1],R_32x2_7_0); X.v[1] ^= X.v[0]; }\n" + " if(Nrounds>15){\n" + " X.v[0] += ks[1]; X.v[1] += ks[2];\n" + " X.v[1] += 4;\n" + " }\n" + " if(Nrounds>16){ X.v[0] += X.v[1]; X.v[1] = RotL_32(X.v[1],R_32x2_0_0); X.v[1] ^= X.v[0]; }\n" + " if(Nrounds>17){ X.v[0] += X.v[1]; X.v[1] = RotL_32(X.v[1],R_32x2_1_0); X.v[1] ^= X.v[0]; }\n" + " if(Nrounds>18){ X.v[0] += X.v[1]; X.v[1] = RotL_32(X.v[1],R_32x2_2_0); X.v[1] ^= X.v[0]; }\n" + " if(Nrounds>19){ X.v[0] += X.v[1]; X.v[1] = RotL_32(X.v[1],R_32x2_3_0); X.v[1] ^= X.v[0]; }\n" + " if(Nrounds>19){\n" + " X.v[0] += ks[2]; X.v[1] += ks[0];\n" + " X.v[1] += 5;\n" + " }\n" + " if(Nrounds>20){ X.v[0] += X.v[1]; X.v[1] = RotL_32(X.v[1],R_32x2_4_0); X.v[1] ^= X.v[0]; }\n" + " if(Nrounds>21){ X.v[0] += X.v[1]; X.v[1] = RotL_32(X.v[1],R_32x2_5_0); X.v[1] ^= X.v[0]; }\n" + " if(Nrounds>22){ X.v[0] += X.v[1]; X.v[1] = RotL_32(X.v[1],R_32x2_6_0); X.v[1] ^= X.v[0]; }\n" + " if(Nrounds>23){ X.v[0] += X.v[1]; X.v[1] = RotL_32(X.v[1],R_32x2_7_0); X.v[1] ^= X.v[0]; }\n" + " if(Nrounds>23){\n" + " X.v[0] += ks[0]; X.v[1] += ks[1];\n" + " X.v[1] += 6;\n" + " }\n" + " if(Nrounds>24){ X.v[0] += X.v[1]; X.v[1] = RotL_32(X.v[1],R_32x2_0_0); X.v[1] ^= X.v[0]; }\n" + " if(Nrounds>25){ X.v[0] += X.v[1]; X.v[1] = RotL_32(X.v[1],R_32x2_1_0); X.v[1] ^= X.v[0]; }\n" + " if(Nrounds>26){ X.v[0] += X.v[1]; X.v[1] = RotL_32(X.v[1],R_32x2_2_0); X.v[1] ^= X.v[0]; }\n" + " if(Nrounds>27){ X.v[0] += X.v[1]; X.v[1] = RotL_32(X.v[1],R_32x2_3_0); X.v[1] ^= X.v[0]; }\n" + " if(Nrounds>27){\n" + " X.v[0] += ks[1]; X.v[1] += ks[2];\n" + " X.v[1] += 7;\n" + " }\n" + " if(Nrounds>28){ X.v[0] += X.v[1]; X.v[1] = RotL_32(X.v[1],R_32x2_4_0); X.v[1] ^= X.v[0]; }\n" + " if(Nrounds>29){ X.v[0] += X.v[1]; X.v[1] = RotL_32(X.v[1],R_32x2_5_0); X.v[1] ^= X.v[0]; }\n" + " if(Nrounds>30){ X.v[0] += X.v[1]; X.v[1] = RotL_32(X.v[1],R_32x2_6_0); X.v[1] ^= X.v[0]; }\n" + " if(Nrounds>31){ X.v[0] += X.v[1]; X.v[1] = RotL_32(X.v[1],R_32x2_7_0); X.v[1] ^= X.v[0]; }\n" + " if(Nrounds>31){\n" + " X.v[0] += ks[2]; X.v[1] += ks[0];\n" + " X.v[1] += 8;\n" + " }\n" + " return X;\n" + "}\n" + + "__kernel void generate_rng(__global uint *ctr, __global uint *key, const uint offset) {\n" + " threefry2x32_ctr_t in;\n" + " threefry2x32_key_t k;\n" + " const uint i = get_global_id(0);\n" + " in.v[0] = ctr[2 * (offset + i)];\n" + " in.v[1] = ctr[2 * (offset + i) + 1];\n" + " k.v[0] = key[2 * (offset + i)];\n" + " k.v[1] = key[2 * (offset + i) + 1];\n" + " in = threefry2x32_R(20, in, k);\n" + " ctr[2 * (offset + i)] = in.v[0];\n" + " ctr[2 * (offset + i) + 1] = in.v[1];\n" + "}\n"; + + m_program = cache->get_or_build(cache_key, std::string(), source, m_context); + } + +public: + + + /// Generates Threefry random numbers using both the counter and key values, and then stores + /// them to the range [\p first_ctr, \p last_ctr). + template + void generate(OutputIterator first_ctr, OutputIterator last_ctr, OutputIterator first_key, OutputIterator last_key, command_queue &queue) { + const size_t size_ctr = detail::iterator_range_size(first_ctr, last_ctr); + const size_t size_key = detail::iterator_range_size(first_key, last_key); + if(!size_ctr || !size_key || (size_ctr != size_key)) { + return; + } + kernel rng_kernel = m_program.create_kernel("generate_rng"); + + rng_kernel.set_arg(0, first_ctr.get_buffer()); + rng_kernel.set_arg(1, first_key.get_buffer()); + size_t offset = 0; + + for(;;){ + size_t count = 0; + size_t size = size_ctr/2; + if(size > threads){ + count = (std::min)(static_cast(threads), size - offset); + } + else { + count = size; + } + rng_kernel.set_arg(2, static_cast(offset)); + queue.enqueue_1d_range_kernel(rng_kernel, 0, count, 0); + + offset += count; + + if(offset >= size){ + break; + } + + } + } + + template + void generate(OutputIterator first_ctr, OutputIterator last_ctr, command_queue &queue) { + const size_t size_ctr = detail::iterator_range_size(first_ctr, last_ctr); + if(!size_ctr) { + return; + } + boost::compute::vector vector_key(size_ctr, m_context); + vector_key.assign(size_ctr, 0, queue); + kernel rng_kernel = m_program.create_kernel("generate_rng"); + + rng_kernel.set_arg(0, first_ctr.get_buffer()); + rng_kernel.set_arg(1, vector_key); + size_t offset = 0; + + for(;;){ + size_t count = 0; + size_t size = size_ctr/2; + if(size > threads){ + count = (std::min)(static_cast(threads), size - offset); + } + else { + count = size; + } + rng_kernel.set_arg(2, static_cast(offset)); + queue.enqueue_1d_range_kernel(rng_kernel, 0, count, 0); + + offset += count; + + if(offset >= size){ + break; + } + + } + } +private: + context m_context; + program m_program; +}; + +} // end compute namespace +} // end boost namespace + +#endif // BOOST_COMPUTE_RANDOM_THREEFRY_HPP diff --git a/3party/boost/boost/compute/random/uniform_int_distribution.hpp b/3party/boost/boost/compute/random/uniform_int_distribution.hpp new file mode 100644 index 0000000000..20448afec0 --- /dev/null +++ b/3party/boost/boost/compute/random/uniform_int_distribution.hpp @@ -0,0 +1,119 @@ +//---------------------------------------------------------------------------// +// Copyright (c) 2014 Roshan +// +// 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 +// +// See http://boostorg.github.com/compute for more information. +//---------------------------------------------------------------------------// + +#ifndef BOOST_COMPUTE_RANDOM_UNIFORM_INT_DISTRIBUTION_HPP +#define BOOST_COMPUTE_RANDOM_UNIFORM_INT_DISTRIBUTION_HPP + +#include + +#include +#include + +#include +#include +#include +#include +#include +#include + +namespace boost { +namespace compute { + +/// \class uniform_int_distribution +/// \brief Produces uniformily distributed random integers +/// +/// The following example shows how to setup a uniform int distribution to +/// produce random integers 0 and 1. +/// +/// \snippet test/test_uniform_int_distribution.cpp generate +/// +template +class uniform_int_distribution +{ +public: + typedef IntType result_type; + + /// Creates a new uniform distribution producing numbers in the range + /// [\p a, \p b]. + explicit uniform_int_distribution(IntType a = 0, + IntType b = (std::numeric_limits::max)()) + : m_a(a), + m_b(b) + { + } + + /// Destroys the uniform_int_distribution object. + ~uniform_int_distribution() + { + } + + /// Returns the minimum value of the distribution. + result_type a() const + { + return m_a; + } + + /// Returns the maximum value of the distribution. + result_type b() const + { + return m_b; + } + + /// Generates uniformily distributed integers and stores + /// them to the range [\p first, \p last). + template + void generate(OutputIterator first, + OutputIterator last, + Generator &generator, + command_queue &queue) + { + size_t size = std::distance(first, last); + typedef typename Generator::result_type g_result_type; + + vector tmp(size, queue.get_context()); + vector tmp2(size, queue.get_context()); + + uint_ bound = ((uint_(-1))/(m_b-m_a+1))*(m_b-m_a+1); + + buffer_iterator tmp2_iter; + + while(size>0) + { + generator.generate(tmp.begin(), tmp.begin() + size, queue); + tmp2_iter = copy_if(tmp.begin(), tmp.begin() + size, tmp2.begin(), + _1 <= bound, queue); + size = std::distance(tmp2_iter, tmp2.end()); + } + + BOOST_COMPUTE_FUNCTION(IntType, scale_random, (const g_result_type x), + { + return LO + (x % (HI-LO+1)); + }); + + scale_random.define("LO", boost::lexical_cast(m_a)); + scale_random.define("HI", boost::lexical_cast(m_b)); + + transform(tmp2.begin(), tmp2.end(), first, scale_random, queue); + } + +private: + IntType m_a; + IntType m_b; + + BOOST_STATIC_ASSERT_MSG( + boost::is_integral::value, + "Template argument must be integral" + ); +}; + +} // end compute namespace +} // end boost namespace + +#endif // BOOST_COMPUTE_RANDOM_UNIFORM_INT_DISTRIBUTION_HPP diff --git a/3party/boost/boost/compute/random/uniform_real_distribution.hpp b/3party/boost/boost/compute/random/uniform_real_distribution.hpp new file mode 100644 index 0000000000..75d9659d6a --- /dev/null +++ b/3party/boost/boost/compute/random/uniform_real_distribution.hpp @@ -0,0 +1,116 @@ +//---------------------------------------------------------------------------// +// Copyright (c) 2013 Kyle Lutz +// +// 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 +// +// See http://boostorg.github.com/compute for more information. +//---------------------------------------------------------------------------// + +#ifndef BOOST_COMPUTE_RANDOM_UNIFORM_REAL_DISTRIBUTION_HPP +#define BOOST_COMPUTE_RANDOM_UNIFORM_REAL_DISTRIBUTION_HPP + +#include +#include + +#include +#include +#include +#include + +namespace boost { +namespace compute { + +/// \class uniform_real_distribution +/// \brief Produces uniformly distributed random floating-point numbers. +/// +/// The following example shows how to setup a uniform real distribution to +/// produce random \c float values between \c 1 and \c 100. +/// +/// \snippet test/test_uniform_real_distribution.cpp generate +/// +/// \see default_random_engine, normal_distribution +template +class uniform_real_distribution +{ +public: + typedef RealType result_type; + + /// Creates a new uniform distribution producing numbers in the range + /// [\p a, \p b). + /// Requires a < b + uniform_real_distribution(RealType a = 0.f, RealType b = 1.f) + : m_a(a), + m_b(b) + { + BOOST_ASSERT(a < b); + } + + /// Destroys the uniform_real_distribution object. + ~uniform_real_distribution() + { + } + + /// Returns the minimum value of the distribution. + result_type a() const + { + return m_a; + } + + /// Returns the maximum value of the distribution. + result_type b() const + { + return m_b; + } + + /// Generates uniformly distributed floating-point numbers and stores + /// them to the range [\p first, \p last). + template + void generate(OutputIterator first, + OutputIterator last, + Generator &generator, + command_queue &queue) + { + BOOST_COMPUTE_FUNCTION(RealType, scale_random, (const uint_ x), + { + return nextafter(LO + (convert_RealType(x) / MAX_RANDOM) * (HI - LO), (RealType) LO); + }); + + scale_random.define("LO", detail::make_literal(m_a)); + scale_random.define("HI", detail::make_literal(m_b)); + scale_random.define("MAX_RANDOM", "UINT_MAX"); + scale_random.define( + "convert_RealType", std::string("convert_") + type_name() + ); + scale_random.define("RealType", type_name()); + + generator.generate( + first, last, scale_random, queue + ); + } + + /// \internal_ (deprecated) + template + void fill(OutputIterator first, + OutputIterator last, + Generator &g, + command_queue &queue) + { + generate(first, last, g, queue); + } + +private: + RealType m_a; + RealType m_b; + + BOOST_STATIC_ASSERT_MSG( + boost::is_floating_point::value, + "Template argument must be a floating point type" + ); +}; + +} // end compute namespace +} // end boost namespace + +#endif // BOOST_COMPUTE_RANDOM_UNIFORM_REAL_DISTRIBUTION_HPP diff --git a/3party/boost/boost/compute/source.hpp b/3party/boost/boost/compute/source.hpp new file mode 100644 index 0000000000..844dfa49ea --- /dev/null +++ b/3party/boost/boost/compute/source.hpp @@ -0,0 +1,12 @@ +//---------------------------------------------------------------------------// +// Copyright (c) 2013-2014 Kyle Lutz +// +// 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 +// +// See http://boostorg.github.com/compute for more information. +//---------------------------------------------------------------------------// + +// deprecated, use instead +#include diff --git a/3party/boost/boost/compute/svm.hpp b/3party/boost/boost/compute/svm.hpp new file mode 100644 index 0000000000..4bc3a74237 --- /dev/null +++ b/3party/boost/boost/compute/svm.hpp @@ -0,0 +1,72 @@ +//---------------------------------------------------------------------------// +// Copyright (c) 2013-2014 Kyle Lutz +// +// 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 +// +// See http://boostorg.github.com/compute for more information. +//---------------------------------------------------------------------------// + +#ifndef BOOST_COMPUTE_SVM_HPP +#define BOOST_COMPUTE_SVM_HPP + +#include +#include +#include + +// svm functions require OpenCL 2.0 +#if defined(CL_VERSION_2_0) || defined(BOOST_COMPUTE_DOXYGEN_INVOKED) + +namespace boost { +namespace compute { + +/// Allocates a shared virtual memory (SVM) buffer. +// +/// \opencl_version_warning{2,0} +/// +/// \see_opencl2_ref{clSVMAlloc} +/// +/// \see svm_free() +template +inline svm_ptr svm_alloc(const context &context, + size_t size, + cl_svm_mem_flags flags = CL_MEM_READ_WRITE, + unsigned int alignment = 0) +{ + svm_ptr ptr( + clSVMAlloc(context.get(), flags, size * sizeof(T), alignment), + context + ); + if(!ptr.get()){ + BOOST_THROW_EXCEPTION(opencl_error(CL_MEM_OBJECT_ALLOCATION_FAILURE)); + } + return ptr; +} + +/// Deallocates a shared virtual memory (SVM) buffer. +/// +/// \opencl_version_warning{2,0} +/// +/// \see_opencl2_ref{clSVMFree} +/// +/// \see svm_alloc(), command_queue::enqueue_svm_free() +template +inline void svm_free(svm_ptr ptr) +{ + clSVMFree(ptr.get_context(), ptr.get()); +} + +/// \overload +template +inline void svm_free(const context &context, svm_ptr ptr) +{ + clSVMFree(context.get(), ptr.get()); +} + +} // end compute namespace +} // end boost namespace + +#endif // CL_VERSION_2_0 + +#endif // BOOST_COMPUTE_PIPE_HPP diff --git a/3party/boost/boost/compute/system.hpp b/3party/boost/boost/compute/system.hpp new file mode 100644 index 0000000000..e6ed353d68 --- /dev/null +++ b/3party/boost/boost/compute/system.hpp @@ -0,0 +1,280 @@ +//---------------------------------------------------------------------------// +// Copyright (c) 2013 Kyle Lutz +// +// 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 +// +// See http://boostorg.github.com/compute for more information. +//---------------------------------------------------------------------------// + +#ifndef BOOST_COMPUTE_SYSTEM_HPP +#define BOOST_COMPUTE_SYSTEM_HPP + +#include +#include +#include + +#include + +#include +#include +#include +#include +#include +#include +#include + +namespace boost { +namespace compute { + +/// \class system +/// \brief Provides access to platforms and devices on the system. +/// +/// The system class contains a set of static functions which provide access to +/// the OpenCL platforms and compute devices on the host system. +/// +/// The default_device() convenience method automatically selects and returns +/// the "best" compute device for the system following a set of heuristics and +/// environment variables. This simplifies setup of the OpenCL enviornment. +/// +/// \see platform, device, context +class system +{ +public: + /// Returns the default compute device for the system. + /// + /// The default device is selected based on a set of heuristics and can be + /// influenced using one of the following environment variables: + /// + /// \li \c BOOST_COMPUTE_DEFAULT_DEVICE - + /// name of the compute device (e.g. "GTX TITAN") + /// \li \c BOOST_COMPUTE_DEFAULT_DEVICE_TYPE + /// type of the compute device (e.g. "GPU" or "CPU") + /// \li \c BOOST_COMPUTE_DEFAULT_PLATFORM - + /// name of the platform (e.g. "NVIDIA CUDA") + /// \li \c BOOST_COMPUTE_DEFAULT_VENDOR - + /// name of the device vendor (e.g. "NVIDIA") + /// + /// The default device is determined once on the first time this function + /// is called. Calling this function multiple times will always result in + /// the same device being returned. + /// + /// If no OpenCL device is found on the system, a no_device_found exception + /// is thrown. + /// + /// For example, to print the name of the default compute device on the + /// system: + /// \code + /// // get the default compute device + /// boost::compute::device device = boost::compute::system::default_device(); + /// + /// // print the name of the device + /// std::cout << "default device: " << device.name() << std::endl; + /// \endcode + static device default_device() + { + static device default_device = find_default_device(); + + return default_device; + } + + /// Returns the device with \p name. + /// + /// \throws no_device_found if no device with \p name is found. + static device find_device(const std::string &name) + { + const std::vector devices = system::devices(); + for(size_t i = 0; i < devices.size(); i++){ + const device& device = devices[i]; + + if(device.name() == name){ + return device; + } + } + + BOOST_THROW_EXCEPTION(no_device_found()); + } + + /// Returns a vector containing all of the compute devices on + /// the system. + /// + /// For example, to print out the name of each OpenCL-capable device + /// available on the system: + /// \code + /// for(const auto &device : boost::compute::system::devices()){ + /// std::cout << device.name() << std::endl; + /// } + /// \endcode + static std::vector devices() + { + std::vector devices; + + const std::vector platforms = system::platforms(); + for(size_t i = 0; i < platforms.size(); i++){ + const std::vector platform_devices = platforms[i].devices(); + + devices.insert( + devices.end(), platform_devices.begin(), platform_devices.end() + ); + } + + return devices; + } + + /// Returns the number of compute devices on the system. + static size_t device_count() + { + size_t count = 0; + + const std::vector platforms = system::platforms(); + for(size_t i = 0; i < platforms.size(); i++){ + count += platforms[i].device_count(); + } + + return count; + } + + /// Returns the default context for the system. + /// + /// The default context is created for the default device on the system + /// (as returned by default_device()). + /// + /// The default context is created once on the first time this function is + /// called. Calling this function multiple times will always result in the + /// same context object being returned. + static context default_context() + { + static context default_context(default_device()); + + return default_context; + } + + /// Returns the default command queue for the system. + static command_queue& default_queue() + { + static command_queue queue(default_context(), default_device()); + + return queue; + } + + /// Blocks until all outstanding computations on the default + /// command queue are complete. + /// + /// This is equivalent to: + /// \code + /// system::default_queue().finish(); + /// \endcode + static void finish() + { + default_queue().finish(); + } + + /// Returns a vector containing each of the OpenCL platforms on the system. + /// + /// For example, to print out the name of each OpenCL platform present on + /// the system: + /// \code + /// for(const auto &platform : boost::compute::system::platforms()){ + /// std::cout << platform.name() << std::endl; + /// } + /// \endcode + static std::vector platforms() + { + cl_uint count = 0; + clGetPlatformIDs(0, 0, &count); + + std::vector platforms; + if(count > 0) + { + std::vector platform_ids(count); + clGetPlatformIDs(count, &platform_ids[0], 0); + + for(size_t i = 0; i < platform_ids.size(); i++){ + platforms.push_back(platform(platform_ids[i])); + } + } + return platforms; + } + + /// Returns the number of compute platforms on the system. + static size_t platform_count() + { + cl_uint count = 0; + clGetPlatformIDs(0, 0, &count); + return static_cast(count); + } + +private: + /// \internal_ + static device find_default_device() + { + // get a list of all devices on the system + const std::vector devices_ = devices(); + if(devices_.empty()){ + BOOST_THROW_EXCEPTION(no_device_found()); + } + + // check for device from environment variable + const char *name = detail::getenv("BOOST_COMPUTE_DEFAULT_DEVICE"); + const char *type = detail::getenv("BOOST_COMPUTE_DEFAULT_DEVICE_TYPE"); + const char *platform = detail::getenv("BOOST_COMPUTE_DEFAULT_PLATFORM"); + const char *vendor = detail::getenv("BOOST_COMPUTE_DEFAULT_VENDOR"); + + if(name || type || platform || vendor){ + for(size_t i = 0; i < devices_.size(); i++){ + const device& device = devices_[i]; + if (name && !matches(device.name(), name)) + continue; + + if (type && matches(std::string("GPU"), type)) + if (!(device.type() & device::gpu)) + continue; + + if (type && matches(std::string("CPU"), type)) + if (!(device.type() & device::cpu)) + continue; + + if (platform && !matches(device.platform().name(), platform)) + continue; + + if (vendor && !matches(device.vendor(), vendor)) + continue; + + return device; + } + } + + // find the first gpu device + for(size_t i = 0; i < devices_.size(); i++){ + const device& device = devices_[i]; + + if(device.type() & device::gpu){ + return device; + } + } + + // find the first cpu device + for(size_t i = 0; i < devices_.size(); i++){ + const device& device = devices_[i]; + + if(device.type() & device::cpu){ + return device; + } + } + + // return the first device found + return devices_[0]; + } + + /// \internal_ + static bool matches(const std::string &str, const std::string &pattern) + { + return str.find(pattern) != std::string::npos; + } +}; + +} // end compute namespace +} // end boost namespace + +#endif // BOOST_COMPUTE_SYSTEM_HPP diff --git a/3party/boost/boost/compute/type_traits.hpp b/3party/boost/boost/compute/type_traits.hpp new file mode 100644 index 0000000000..9ba98d9c2c --- /dev/null +++ b/3party/boost/boost/compute/type_traits.hpp @@ -0,0 +1,25 @@ +//---------------------------------------------------------------------------// +// Copyright (c) 2013 Kyle Lutz +// +// 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 +// +// See http://boostorg.github.com/compute for more information. +//---------------------------------------------------------------------------// + +#ifndef BOOST_COMPUTE_TYPE_TRAITS_HPP +#define BOOST_COMPUTE_TYPE_TRAITS_HPP + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +#endif // BOOST_COMPUTE_TYPE_TRAITS_HPP diff --git a/3party/boost/boost/compute/type_traits/common_type.hpp b/3party/boost/boost/compute/type_traits/common_type.hpp new file mode 100644 index 0000000000..49a81ff3fd --- /dev/null +++ b/3party/boost/boost/compute/type_traits/common_type.hpp @@ -0,0 +1,55 @@ +//---------------------------------------------------------------------------// +// Copyright (c) 2013 Kyle Lutz +// +// 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 +// +// See http://boostorg.github.com/compute for more information. +//---------------------------------------------------------------------------// + +#ifndef BOOST_COMPUTE_TYPE_TRAITS_COMMON_TYPE_HPP +#define BOOST_COMPUTE_TYPE_TRAITS_COMMON_TYPE_HPP + +#include + +#include + +namespace boost { + +/// \internal_ +#define BOOST_COMPUTE_DECLARE_SCALAR_VECTOR_COMMON_TYPE(scalar, size) \ + template<> \ + struct common_type \ + { \ + typedef BOOST_COMPUTE_MAKE_VECTOR_TYPE(scalar, size) type; \ + }; \ + template<> \ + struct common_type \ + { \ + typedef BOOST_COMPUTE_MAKE_VECTOR_TYPE(scalar, size) type; \ + }; + +/// \internal_ +#define BOOST_COMPUTE_DECLARE_SCALAR_VECTOR_COMMON_TYPES(scalar) \ + BOOST_COMPUTE_DECLARE_SCALAR_VECTOR_COMMON_TYPE(scalar, 2) \ + BOOST_COMPUTE_DECLARE_SCALAR_VECTOR_COMMON_TYPE(scalar, 4) \ + BOOST_COMPUTE_DECLARE_SCALAR_VECTOR_COMMON_TYPE(scalar, 8) \ + BOOST_COMPUTE_DECLARE_SCALAR_VECTOR_COMMON_TYPE(scalar, 16) \ + +BOOST_COMPUTE_DECLARE_SCALAR_VECTOR_COMMON_TYPES(char) +BOOST_COMPUTE_DECLARE_SCALAR_VECTOR_COMMON_TYPES(uchar) +BOOST_COMPUTE_DECLARE_SCALAR_VECTOR_COMMON_TYPES(short) +BOOST_COMPUTE_DECLARE_SCALAR_VECTOR_COMMON_TYPES(ushort) +BOOST_COMPUTE_DECLARE_SCALAR_VECTOR_COMMON_TYPES(int) +BOOST_COMPUTE_DECLARE_SCALAR_VECTOR_COMMON_TYPES(uint) +BOOST_COMPUTE_DECLARE_SCALAR_VECTOR_COMMON_TYPES(long) +BOOST_COMPUTE_DECLARE_SCALAR_VECTOR_COMMON_TYPES(ulong) +BOOST_COMPUTE_DECLARE_SCALAR_VECTOR_COMMON_TYPES(float) +BOOST_COMPUTE_DECLARE_SCALAR_VECTOR_COMMON_TYPES(double) + +} // end boost namespace + +#endif // BOOST_COMPUTE_TYPE_TRAITS_COMMON_TYPE_HPP diff --git a/3party/boost/boost/compute/type_traits/detail/capture_traits.hpp b/3party/boost/boost/compute/type_traits/detail/capture_traits.hpp new file mode 100644 index 0000000000..e790f80696 --- /dev/null +++ b/3party/boost/boost/compute/type_traits/detail/capture_traits.hpp @@ -0,0 +1,33 @@ +//---------------------------------------------------------------------------// +// Copyright (c) 2013-2014 Kyle Lutz +// +// 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 +// +// See http://boostorg.github.com/compute for more information. +//---------------------------------------------------------------------------// + +#ifndef BOOST_COMPUTE_TYPE_TRAITS_DETAIL_CAPTURE_TRAITS_HPP +#define BOOST_COMPUTE_TYPE_TRAITS_DETAIL_CAPTURE_TRAITS_HPP + +#include + +namespace boost { +namespace compute { +namespace detail { + +template +struct capture_traits +{ + static std::string type_name() + { + return ::boost::compute::type_name(); + } +}; + +} // end detail namespace +} // end compute namespace +} // end boost namespace + +#endif // BOOST_COMPUTE_TYPE_TRAITS_DETAIL_CAPTURE_TRAITS_HPP diff --git a/3party/boost/boost/compute/type_traits/is_device_iterator.hpp b/3party/boost/boost/compute/type_traits/is_device_iterator.hpp new file mode 100644 index 0000000000..5e7021f2e8 --- /dev/null +++ b/3party/boost/boost/compute/type_traits/is_device_iterator.hpp @@ -0,0 +1,39 @@ +//---------------------------------------------------------------------------// +// Copyright (c) 2013-2014 Kyle Lutz +// +// 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 +// +// See http://boostorg.github.com/compute for more information. +//---------------------------------------------------------------------------// + +#ifndef BOOST_COMPUTE_TYPE_TRAITS_IS_DEVICE_ITERATOR_HPP +#define BOOST_COMPUTE_TYPE_TRAITS_IS_DEVICE_ITERATOR_HPP + +#include + +namespace boost { +namespace compute { + +/// Meta-function returning \c true if \c Iterator is a device-iterator. +/// +/// By default, this function returns false. Device iterator types (such as +/// buffer_iterator) should specialize this trait and return \c true. +/// +/// For example: +/// \code +/// is_device_iterator>::value == true +/// is_device_iterator::iterator>::value == false +/// \endcode +template +struct is_device_iterator : boost::false_type {}; + +/// \internal_ +template +struct is_device_iterator : is_device_iterator {}; + +} // end compute namespace +} // end boost namespace + +#endif // BOOST_COMPUTE_TYPE_TRAITS_IS_DEVICE_ITERATOR_HPP diff --git a/3party/boost/boost/compute/type_traits/is_fundamental.hpp b/3party/boost/boost/compute/type_traits/is_fundamental.hpp new file mode 100644 index 0000000000..6386f1184d --- /dev/null +++ b/3party/boost/boost/compute/type_traits/is_fundamental.hpp @@ -0,0 +1,58 @@ +//---------------------------------------------------------------------------// +// Copyright (c) 2013-2014 Kyle Lutz +// +// 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 +// +// See http://boostorg.github.com/compute for more information. +//---------------------------------------------------------------------------// + +#ifndef BOOST_COMPUTE_TYPE_TRAITS_IS_FUNDAMENTAL_HPP +#define BOOST_COMPUTE_TYPE_TRAITS_IS_FUNDAMENTAL_HPP + +#include + +namespace boost { +namespace compute { + +/// Meta-function returning \c true if \p T is a fundamental (i.e. +/// built-in) type. +/// +/// For example, +/// \code +/// is_fundamental::value == true +/// is_fundamental>::value == false +/// \endcode +template +struct is_fundamental : public boost::false_type {}; + +/// \internal_ +#define BOOST_COMPUTE_DETAIL_DECLARE_FUNDAMENTAL(type) \ + template<> struct is_fundamental : boost::true_type {}; \ + template<> struct is_fundamental : boost::true_type {}; \ + template<> struct is_fundamental : boost::true_type {}; \ + template<> struct is_fundamental : boost::true_type {}; \ + template<> struct is_fundamental : boost::true_type {}; \ + template<> struct is_fundamental : boost::true_type {}; \ + template<> struct is_fundamental : boost::true_type {}; \ + template<> struct is_fundamental : boost::true_type {}; \ + template<> struct is_fundamental : boost::true_type {}; + +BOOST_COMPUTE_DETAIL_DECLARE_FUNDAMENTAL(char) +BOOST_COMPUTE_DETAIL_DECLARE_FUNDAMENTAL(uchar) +BOOST_COMPUTE_DETAIL_DECLARE_FUNDAMENTAL(short) +BOOST_COMPUTE_DETAIL_DECLARE_FUNDAMENTAL(ushort) +BOOST_COMPUTE_DETAIL_DECLARE_FUNDAMENTAL(int) +BOOST_COMPUTE_DETAIL_DECLARE_FUNDAMENTAL(uint) +BOOST_COMPUTE_DETAIL_DECLARE_FUNDAMENTAL(long) +BOOST_COMPUTE_DETAIL_DECLARE_FUNDAMENTAL(ulong) +BOOST_COMPUTE_DETAIL_DECLARE_FUNDAMENTAL(float) +BOOST_COMPUTE_DETAIL_DECLARE_FUNDAMENTAL(double) + +#undef BOOST_COMPUTE_DETAIL_DECLARE_FUNDAMENTAL + +} // end compute namespace +} // end boost namespace + +#endif // BOOST_COMPUTE_TYPE_TRAITS_IS_FUNDAMENTAL_HPP diff --git a/3party/boost/boost/compute/type_traits/is_vector_type.hpp b/3party/boost/boost/compute/type_traits/is_vector_type.hpp new file mode 100644 index 0000000000..f4382f0e2b --- /dev/null +++ b/3party/boost/boost/compute/type_traits/is_vector_type.hpp @@ -0,0 +1,38 @@ +//---------------------------------------------------------------------------// +// Copyright (c) 2013 Kyle Lutz +// +// 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 +// +// See http://boostorg.github.com/compute for more information. +//---------------------------------------------------------------------------// + +#ifndef BOOST_COMPUTE_TYPE_TRAITS_IS_VECTOR_TYPE_HPP +#define BOOST_COMPUTE_TYPE_TRAITS_IS_VECTOR_TYPE_HPP + +#include + +#include + +namespace boost { +namespace compute { + +/// Meta-function returning \c true if \p T is a vector type. +/// +/// For example, +/// \code +/// is_vector_type::value == false +/// is_vector_type::value == true +/// \endcode +/// +/// \see make_vector_type, vector_size +template +struct is_vector_type : boost::mpl::bool_::value != 1> +{ +}; + +} // end compute namespace +} // end boost namespace + +#endif // BOOST_COMPUTE_TYPE_TRAITS_IS_VECTOR_TYPE_HPP diff --git a/3party/boost/boost/compute/type_traits/make_vector_type.hpp b/3party/boost/boost/compute/type_traits/make_vector_type.hpp new file mode 100644 index 0000000000..6494ff267f --- /dev/null +++ b/3party/boost/boost/compute/type_traits/make_vector_type.hpp @@ -0,0 +1,71 @@ +//---------------------------------------------------------------------------// +// Copyright (c) 2013 Kyle Lutz +// +// 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 +// +// See http://boostorg.github.com/compute for more information. +//---------------------------------------------------------------------------// + +#ifndef BOOST_COMPUTE_TYPE_TRAITS_MAKE_VECTOR_TYPE_HPP +#define BOOST_COMPUTE_TYPE_TRAITS_MAKE_VECTOR_TYPE_HPP + +#include + +#include + +namespace boost { +namespace compute { + +/// Meta-function which returns a vector type for \p Scalar with \p Size. +/// +/// For example, +/// \code +/// make_vector_type::type == int2_ +/// make_vector_type::type == float4_ +/// \endcode +/// +/// \see is_vector_type +template +struct make_vector_type +{ +}; + +/// \internal_ +template +struct make_vector_type +{ + typedef Scalar type; +}; + +/// \internal_ +#define BOOST_COMPUTE_DECLARE_MAKE_VECTOR_TYPE_FUNCTION(scalar, size) \ + template<> \ + struct make_vector_type \ + { \ + typedef BOOST_PP_CAT(BOOST_PP_CAT(scalar, size), _) type; \ + }; + +/// \internal_ +#define BOOST_COMPUTE_DECLARE_MAKE_VECTOR_TYPE_FUNCTIONS(scalar) \ + BOOST_COMPUTE_DECLARE_MAKE_VECTOR_TYPE_FUNCTION(scalar, 2) \ + BOOST_COMPUTE_DECLARE_MAKE_VECTOR_TYPE_FUNCTION(scalar, 4) \ + BOOST_COMPUTE_DECLARE_MAKE_VECTOR_TYPE_FUNCTION(scalar, 8) \ + BOOST_COMPUTE_DECLARE_MAKE_VECTOR_TYPE_FUNCTION(scalar, 16) + +BOOST_COMPUTE_DECLARE_MAKE_VECTOR_TYPE_FUNCTIONS(char) +BOOST_COMPUTE_DECLARE_MAKE_VECTOR_TYPE_FUNCTIONS(uchar) +BOOST_COMPUTE_DECLARE_MAKE_VECTOR_TYPE_FUNCTIONS(short) +BOOST_COMPUTE_DECLARE_MAKE_VECTOR_TYPE_FUNCTIONS(ushort) +BOOST_COMPUTE_DECLARE_MAKE_VECTOR_TYPE_FUNCTIONS(int) +BOOST_COMPUTE_DECLARE_MAKE_VECTOR_TYPE_FUNCTIONS(uint) +BOOST_COMPUTE_DECLARE_MAKE_VECTOR_TYPE_FUNCTIONS(long) +BOOST_COMPUTE_DECLARE_MAKE_VECTOR_TYPE_FUNCTIONS(ulong) +BOOST_COMPUTE_DECLARE_MAKE_VECTOR_TYPE_FUNCTIONS(float) +BOOST_COMPUTE_DECLARE_MAKE_VECTOR_TYPE_FUNCTIONS(double) + +} // end compute namespace +} // end boost namespace + +#endif // BOOST_COMPUTE_TYPE_TRAITS_MAKE_VECTOR_TYPE_HPP diff --git a/3party/boost/boost/compute/type_traits/result_of.hpp b/3party/boost/boost/compute/type_traits/result_of.hpp new file mode 100644 index 0000000000..3f475a35da --- /dev/null +++ b/3party/boost/boost/compute/type_traits/result_of.hpp @@ -0,0 +1,39 @@ +//---------------------------------------------------------------------------// +// Copyright (c) 2013-2014 Kyle Lutz +// +// 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 +// +// See http://boostorg.github.com/compute for more information. +//---------------------------------------------------------------------------// + +#ifndef BOOST_COMPUTE_TYPE_TRAITS_RESULT_OF_HPP +#define BOOST_COMPUTE_TYPE_TRAITS_RESULT_OF_HPP + +#include + +namespace boost { +namespace compute { + +/// Returns the result of \c Function when called with \c Args. +/// +/// For example, +/// \code +/// // int + int = int +/// result_of::type == int +/// \endcode +template +struct result_of +{ + // the default implementation uses the TR1-style result_of protocol. note + // that we explicitly do *not* use the C++11 decltype operator as we want + // the result type as it would be on an OpenCL device, not the actual C++ + // type resulting from "invoking" the function on the host. + typedef typename ::boost::tr1_result_of::type type; +}; + +} // end compute namespace +} // end boost namespace + +#endif // BOOST_COMPUTE_TYPE_TRAITS_RESULT_OF_HPP diff --git a/3party/boost/boost/compute/type_traits/scalar_type.hpp b/3party/boost/boost/compute/type_traits/scalar_type.hpp new file mode 100644 index 0000000000..c40682fd27 --- /dev/null +++ b/3party/boost/boost/compute/type_traits/scalar_type.hpp @@ -0,0 +1,72 @@ +//---------------------------------------------------------------------------// +// Copyright (c) 2013 Kyle Lutz +// +// 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 +// +// See http://boostorg.github.com/compute for more information. +//---------------------------------------------------------------------------// + +#ifndef BOOST_COMPUTE_TYPE_TRAITS_SCALAR_TYPE_HPP +#define BOOST_COMPUTE_TYPE_TRAITS_SCALAR_TYPE_HPP + +#include + +#include + +namespace boost { +namespace compute { + +/// Meta-function returning the scalar type for a vector type. +/// +/// For example, +/// \code +/// scalar_type::type == float +/// \endcode +template +struct scalar_type +{ + /// \internal_ + typedef void type; +}; + +/// \internal_ +#define BOOST_COMPUTE_DECLARE_SCALAR_TYPE_FUNCTION(scalar) \ + template<> \ + struct scalar_type \ + { \ + typedef BOOST_PP_CAT(scalar, _) type; \ + }; + +/// \internal_ +#define BOOST_COMPUTE_DECLARE_VECTOR_SCALAR_TYPE_FUNCTION(scalar, size) \ + template<> \ + struct scalar_type \ + { \ + typedef BOOST_PP_CAT(scalar, _) type; \ + }; + +/// \internal_ +#define BOOST_COMPUTE_DECLARE_SCALAR_TYPE_FUNCTIONS(scalar) \ + BOOST_COMPUTE_DECLARE_SCALAR_TYPE_FUNCTION(scalar) \ + BOOST_COMPUTE_DECLARE_VECTOR_SCALAR_TYPE_FUNCTION(scalar, 2) \ + BOOST_COMPUTE_DECLARE_VECTOR_SCALAR_TYPE_FUNCTION(scalar, 4) \ + BOOST_COMPUTE_DECLARE_VECTOR_SCALAR_TYPE_FUNCTION(scalar, 8) \ + BOOST_COMPUTE_DECLARE_VECTOR_SCALAR_TYPE_FUNCTION(scalar, 16) + +BOOST_COMPUTE_DECLARE_SCALAR_TYPE_FUNCTIONS(char) +BOOST_COMPUTE_DECLARE_SCALAR_TYPE_FUNCTIONS(uchar) +BOOST_COMPUTE_DECLARE_SCALAR_TYPE_FUNCTIONS(short) +BOOST_COMPUTE_DECLARE_SCALAR_TYPE_FUNCTIONS(ushort) +BOOST_COMPUTE_DECLARE_SCALAR_TYPE_FUNCTIONS(int) +BOOST_COMPUTE_DECLARE_SCALAR_TYPE_FUNCTIONS(uint) +BOOST_COMPUTE_DECLARE_SCALAR_TYPE_FUNCTIONS(long) +BOOST_COMPUTE_DECLARE_SCALAR_TYPE_FUNCTIONS(ulong) +BOOST_COMPUTE_DECLARE_SCALAR_TYPE_FUNCTIONS(float) +BOOST_COMPUTE_DECLARE_SCALAR_TYPE_FUNCTIONS(double) + +} // end compute namespace +} // end boost namespace + +#endif // BOOST_COMPUTE_TYPE_TRAITS_SCALAR_TYPE_HPP diff --git a/3party/boost/boost/compute/type_traits/type_definition.hpp b/3party/boost/boost/compute/type_traits/type_definition.hpp new file mode 100644 index 0000000000..de9095fbd2 --- /dev/null +++ b/3party/boost/boost/compute/type_traits/type_definition.hpp @@ -0,0 +1,39 @@ +//---------------------------------------------------------------------------// +// Copyright (c) 2013-2014 Kyle Lutz +// +// 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 +// +// See http://boostorg.github.com/compute for more information. +//---------------------------------------------------------------------------// + +#ifndef BOOST_COMPUTE_TYPE_TRAITS_TYPE_DEFINITION_HPP +#define BOOST_COMPUTE_TYPE_TRAITS_TYPE_DEFINITION_HPP + +#include + +namespace boost { +namespace compute { +namespace detail { + +template +struct type_definition_trait; + +} // end detail namespace + +/// Returns the OpenCL type definition for \c T. +/// +/// \return a string containing the type definition for \c T +/// +/// \see type_name() +template +inline std::string type_definition() +{ + return detail::type_definition_trait::value(); +} + +} // end compute namespace +} // end boost namespace + +#endif // BOOST_COMPUTE_TYPE_TRAITS_TYPE_DEFINITION_HPP diff --git a/3party/boost/boost/compute/type_traits/type_name.hpp b/3party/boost/boost/compute/type_traits/type_name.hpp new file mode 100644 index 0000000000..86ac7bc8bc --- /dev/null +++ b/3party/boost/boost/compute/type_traits/type_name.hpp @@ -0,0 +1,124 @@ +//---------------------------------------------------------------------------// +// Copyright (c) 2013 Kyle Lutz +// +// 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 +// +// See http://boostorg.github.com/compute for more information. +//---------------------------------------------------------------------------// + +#ifndef BOOST_COMPUTE_TYPE_TRAITS_TYPE_NAME_HPP +#define BOOST_COMPUTE_TYPE_TRAITS_TYPE_NAME_HPP + +#include +#include + +#include + +namespace boost { +namespace compute { +namespace detail { + +template +struct type_name_trait; + +/// \internal_ +#define BOOST_COMPUTE_DEFINE_SCALAR_TYPE_NAME_FUNCTION(type) \ + template<> \ + struct type_name_trait \ + { \ + static const char* value() \ + { \ + return BOOST_PP_STRINGIZE(type); \ + } \ + }; + +/// \internal_ +#define BOOST_COMPUTE_DEFINE_VECTOR_TYPE_NAME_FUNCTION(scalar, n) \ + template<> \ + struct type_name_trait \ + { \ + static const char* value() \ + { \ + return BOOST_PP_STRINGIZE(BOOST_PP_CAT(scalar, n)); \ + } \ + }; + +/// \internal_ +#define BOOST_COMPUTE_DEFINE_TYPE_NAME_FUNCTIONS(scalar) \ + BOOST_COMPUTE_DEFINE_SCALAR_TYPE_NAME_FUNCTION(scalar) \ + BOOST_COMPUTE_DEFINE_VECTOR_TYPE_NAME_FUNCTION(scalar, 2) \ + BOOST_COMPUTE_DEFINE_VECTOR_TYPE_NAME_FUNCTION(scalar, 4) \ + BOOST_COMPUTE_DEFINE_VECTOR_TYPE_NAME_FUNCTION(scalar, 8) \ + BOOST_COMPUTE_DEFINE_VECTOR_TYPE_NAME_FUNCTION(scalar, 16) + +BOOST_COMPUTE_DEFINE_TYPE_NAME_FUNCTIONS(char) +BOOST_COMPUTE_DEFINE_TYPE_NAME_FUNCTIONS(uchar) +BOOST_COMPUTE_DEFINE_TYPE_NAME_FUNCTIONS(short) +BOOST_COMPUTE_DEFINE_TYPE_NAME_FUNCTIONS(ushort) +BOOST_COMPUTE_DEFINE_TYPE_NAME_FUNCTIONS(int) +BOOST_COMPUTE_DEFINE_TYPE_NAME_FUNCTIONS(uint) +BOOST_COMPUTE_DEFINE_TYPE_NAME_FUNCTIONS(long) +BOOST_COMPUTE_DEFINE_TYPE_NAME_FUNCTIONS(ulong) +BOOST_COMPUTE_DEFINE_TYPE_NAME_FUNCTIONS(float) +BOOST_COMPUTE_DEFINE_TYPE_NAME_FUNCTIONS(double) + +/// \internal_ +#define BOOST_COMPUTE_DEFINE_BUILTIN_TYPE_NAME_FUNCTION(type) \ + template<> \ + struct type_name_trait \ + { \ + static const char* value() \ + { \ + return #type; \ + } \ + }; + +BOOST_COMPUTE_DEFINE_BUILTIN_TYPE_NAME_FUNCTION(bool) +BOOST_COMPUTE_DEFINE_BUILTIN_TYPE_NAME_FUNCTION(char) +BOOST_COMPUTE_DEFINE_BUILTIN_TYPE_NAME_FUNCTION(void) + +} // end detail namespace + +/// Returns the OpenCL type name for the type \c T as a string. +/// +/// \return a string containing the type name for \c T +/// +/// For example: +/// \code +/// type_name() == "float" +/// type_name() == "float4" +/// \endcode +/// +/// \see type_definition() +template +inline const char* type_name() +{ + return detail::type_name_trait::value(); +} + +} // end compute namespace +} // end boost namespace + +/// Registers the OpenCL type for the C++ \p type to \p name. +/// +/// For example, the following will allow Eigen's \c Vector2f type +/// to be used with Boost.Compute algorithms and containers as the +/// built-in \c float2 type. +/// \code +/// BOOST_COMPUTE_TYPE_NAME(Eigen::Vector2f, float2) +/// \endcode +/// +/// This macro should be invoked in the global namespace. +/// +/// \see type_name() +#define BOOST_COMPUTE_TYPE_NAME(type, name) \ + namespace boost { namespace compute { \ + template<> \ + inline const char* type_name() \ + { \ + return #name; \ + }}} + +#endif // BOOST_COMPUTE_TYPE_TRAITS_TYPE_NAME_HPP diff --git a/3party/boost/boost/compute/type_traits/vector_size.hpp b/3party/boost/boost/compute/type_traits/vector_size.hpp new file mode 100644 index 0000000000..c207a6fedd --- /dev/null +++ b/3party/boost/boost/compute/type_traits/vector_size.hpp @@ -0,0 +1,65 @@ +//---------------------------------------------------------------------------// +// Copyright (c) 2013 Kyle Lutz +// +// 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 +// +// See http://boostorg.github.com/compute for more information. +//---------------------------------------------------------------------------// + +#ifndef BOOST_COMPUTE_TYPE_TRAITS_VECTOR_SIZE_HPP +#define BOOST_COMPUTE_TYPE_TRAITS_VECTOR_SIZE_HPP + +#include + +#include + +namespace boost { +namespace compute { + +/// Meta-function returning the size (number of components) of a vector type +/// \p T. For scalar types this function returns \c 1. +/// +/// For example, +/// \code +/// vector_size::value == 1 +/// vector_size::value == 4 +/// \endcode +template +struct vector_size +{ + /// \internal_ + BOOST_STATIC_CONSTANT(size_t, value = 1); +}; + +/// \internal_ +#define BOOST_COMPUTE_DECLARE_VECTOR_SIZE_FUNCTION(scalar, size) \ + template<> \ + struct vector_size \ + { \ + BOOST_STATIC_CONSTANT(size_t, value = size); \ + }; + +/// \internal_ +#define BOOST_COMPUTE_DECLARE_VECTOR_SIZE_FUNCTIONS(scalar) \ + BOOST_COMPUTE_DECLARE_VECTOR_SIZE_FUNCTION(scalar, 2) \ + BOOST_COMPUTE_DECLARE_VECTOR_SIZE_FUNCTION(scalar, 4) \ + BOOST_COMPUTE_DECLARE_VECTOR_SIZE_FUNCTION(scalar, 8) \ + BOOST_COMPUTE_DECLARE_VECTOR_SIZE_FUNCTION(scalar, 16) + +BOOST_COMPUTE_DECLARE_VECTOR_SIZE_FUNCTIONS(char) +BOOST_COMPUTE_DECLARE_VECTOR_SIZE_FUNCTIONS(uchar) +BOOST_COMPUTE_DECLARE_VECTOR_SIZE_FUNCTIONS(short) +BOOST_COMPUTE_DECLARE_VECTOR_SIZE_FUNCTIONS(ushort) +BOOST_COMPUTE_DECLARE_VECTOR_SIZE_FUNCTIONS(int) +BOOST_COMPUTE_DECLARE_VECTOR_SIZE_FUNCTIONS(uint) +BOOST_COMPUTE_DECLARE_VECTOR_SIZE_FUNCTIONS(long) +BOOST_COMPUTE_DECLARE_VECTOR_SIZE_FUNCTIONS(ulong) +BOOST_COMPUTE_DECLARE_VECTOR_SIZE_FUNCTIONS(float) +BOOST_COMPUTE_DECLARE_VECTOR_SIZE_FUNCTIONS(double) + +} // end compute namespace +} // end boost namespace + +#endif // BOOST_COMPUTE_TYPE_TRAITS_VECTOR_SIZE_HPP diff --git a/3party/boost/boost/compute/types.hpp b/3party/boost/boost/compute/types.hpp new file mode 100644 index 0000000000..3d9120b65c --- /dev/null +++ b/3party/boost/boost/compute/types.hpp @@ -0,0 +1,24 @@ +//---------------------------------------------------------------------------// +// Copyright (c) 2013 Kyle Lutz +// +// 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 +// +// See http://boostorg.github.com/compute for more information. +//---------------------------------------------------------------------------// + +#ifndef BOOST_COMPUTE_TYPES_HPP +#define BOOST_COMPUTE_TYPES_HPP + +/// \file +/// +/// Meta-header to include all Boost.Compute types headers. + +#include +#include +#include +#include +#include + +#endif // BOOST_COMPUTE_TYPES_HPP diff --git a/3party/boost/boost/compute/types/builtin.hpp b/3party/boost/boost/compute/types/builtin.hpp new file mode 100644 index 0000000000..dc30f584eb --- /dev/null +++ b/3party/boost/boost/compute/types/builtin.hpp @@ -0,0 +1,12 @@ +//---------------------------------------------------------------------------// +// Copyright (c) 2013-2014 Kyle Lutz +// +// 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 +// +// See http://boostorg.github.com/compute for more information. +//---------------------------------------------------------------------------// + +// deprecated, use instead +#include diff --git a/3party/boost/boost/compute/types/complex.hpp b/3party/boost/boost/compute/types/complex.hpp new file mode 100644 index 0000000000..1d60cef9e5 --- /dev/null +++ b/3party/boost/boost/compute/types/complex.hpp @@ -0,0 +1,196 @@ +//---------------------------------------------------------------------------// +// Copyright (c) 2013 Kyle Lutz +// +// 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 +// +// See http://boostorg.github.com/compute for more information. +//---------------------------------------------------------------------------// + +#ifndef BOOST_COMPUTE_TYPES_COMPLEX_HPP +#define BOOST_COMPUTE_TYPES_COMPLEX_HPP + +#include + +#include +#include +#include +#include +#include + +namespace boost { +namespace compute { +namespace detail { + +template +meta_kernel& operator<<(meta_kernel &kernel, const std::complex &x) +{ + typedef typename std::complex value_type; + + kernel << "(" << type_name() << ")" + << "(" << x.real() << ", " << x.imag() << ")"; + + return kernel; +} + +// get() result type specialization for std::complex<> +template +struct get_result_type > +{ + typedef T type; +}; + +// get() specialization for std::complex<> +template +inline meta_kernel& operator<<(meta_kernel &kernel, + const invoked_get > &expr) +{ + BOOST_STATIC_ASSERT(N < 2); + + return kernel << expr.m_arg << (N == 0 ? ".x" : ".y"); +} + +} // end detail namespace + +// returns the real component of a complex +template +struct real +{ + typedef T result_type; + + template + detail::invoked_get<0, Arg, std::complex > + operator()(const Arg &x) const + { + return detail::invoked_get<0, Arg, std::complex >(x); + } +}; + +// returns the imaginary component of a complex +template +struct imag +{ + typedef T result_type; + + template + detail::invoked_get<1, Arg, std::complex > + operator()(const Arg &x) const + { + return detail::invoked_get<1, Arg, std::complex >(x); + } +}; + +namespace detail { + +template +struct invoked_complex_multiplies +{ + typedef typename std::complex result_type; + + invoked_complex_multiplies(const Arg1 &x, const Arg2 &y) + : m_x(x), + m_y(y) + { + } + + Arg1 m_x; + Arg2 m_y; +}; + +template +inline meta_kernel& operator<<(meta_kernel &kernel, + const invoked_complex_multiplies &expr) +{ + typedef typename std::complex value_type; + + kernel << "(" << type_name() << ")" + << "(" << expr.m_x << ".x*" << expr.m_y << ".x-" + << expr.m_x << ".y*" << expr.m_y << ".y," + << expr.m_x << ".y*" << expr.m_y << ".x+" + << expr.m_x << ".x*" << expr.m_y << ".y" << ")"; + + return kernel; +} + +template +struct invoked_complex_conj +{ + typedef typename std::complex result_type; + + invoked_complex_conj(const Arg &arg) + : m_arg(arg) + { + } + + Arg m_arg; +}; + +template +inline meta_kernel& operator<<(meta_kernel &kernel, + const invoked_complex_conj &expr) +{ + typedef typename std::complex value_type; + + kernel << "(" << type_name() << ")" + << "(" << expr.m_arg << ".x" << ", -" << expr.m_arg << ".y" << ")"; + + return kernel; +} + +} // end detail namespace + +// specialization for multiplies +template +class multiplies > : + public function (std::complex, std::complex)> +{ +public: + multiplies() : + function< + std::complex (std::complex, std::complex) + >("complex_multiplies") + { + } + + template + detail::invoked_complex_multiplies + operator()(const Arg1 &x, const Arg2 &y) const + { + return detail::invoked_complex_multiplies(x, y); + } +}; + +// returns the complex conjugate of a complex +template +struct conj +{ + typedef typename std::complex result_type; + + template + detail::invoked_complex_conj + operator()(const Arg &x) const + { + return detail::invoked_complex_conj(x); + } +}; + +namespace detail { + +// type_name() specialization for std::complex +template +struct type_name_trait > +{ + static const char* value() + { + typedef typename make_vector_type::type vector_type; + + return type_name(); + } +}; + +} // end detail namespace +} // end compute namespace +} // end boost namespace + +#endif // BOOST_COMPUTE_TYPES_COMPLEX_HPP diff --git a/3party/boost/boost/compute/types/fundamental.hpp b/3party/boost/boost/compute/types/fundamental.hpp new file mode 100644 index 0000000000..c1502e327e --- /dev/null +++ b/3party/boost/boost/compute/types/fundamental.hpp @@ -0,0 +1,172 @@ +//---------------------------------------------------------------------------// +// Copyright (c) 2013-2014 Kyle Lutz +// +// 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 +// +// See http://boostorg.github.com/compute for more information. +//---------------------------------------------------------------------------// + +#ifndef BOOST_COMPUTE_TYPES_FUNDAMENTAL_HPP +#define BOOST_COMPUTE_TYPES_FUNDAMENTAL_HPP + +#include +#include + +#include +#include +#include +#include + +#include + +namespace boost { +namespace compute { + +// scalar data types +typedef cl_char char_; +typedef cl_uchar uchar_; +typedef cl_short short_; +typedef cl_ushort ushort_; +typedef cl_int int_; +typedef cl_uint uint_; +typedef cl_long long_; +typedef cl_ulong ulong_; +typedef cl_float float_; +typedef cl_double double_; + +// converts uchar to ::boost::compute::uchar_ +#define BOOST_COMPUTE_MAKE_SCALAR_TYPE(scalar) \ + BOOST_PP_CAT(::boost::compute::scalar, _) + +// converts float, 4 to ::boost::compute::float4_ +#define BOOST_COMPUTE_MAKE_VECTOR_TYPE(scalar, size) \ + BOOST_PP_CAT(BOOST_PP_CAT(::boost::compute::scalar, size), _) + +// vector data types +template +class vector_type +{ +public: + typedef Scalar scalar_type; + + vector_type() + { + + } + + explicit vector_type(const Scalar scalar) + { + for(size_t i = 0; i < N; i++) + m_value[i] = scalar; + } + + vector_type(const vector_type &other) + { + std::memcpy(m_value, other.m_value, sizeof(m_value)); + } + + vector_type& + operator=(const vector_type &other) + { + std::memcpy(m_value, other.m_value, sizeof(m_value)); + return *this; + } + + size_t size() const + { + return N; + } + + Scalar& operator[](size_t i) + { + return m_value[i]; + } + + Scalar operator[](size_t i) const + { + return m_value[i]; + } + + bool operator==(const vector_type &other) const + { + return std::memcmp(m_value, other.m_value, sizeof(m_value)) == 0; + } + + bool operator!=(const vector_type &other) const + { + return !(*this == other); + } + +protected: + scalar_type m_value[N]; +}; + +#define BOOST_COMPUTE_VECTOR_TYPE_CTOR_ARG_FUNCTION(z, i, _) \ + BOOST_PP_COMMA_IF(i) scalar_type BOOST_PP_CAT(arg, i) +#define BOOST_COMPUTE_VECTOR_TYPE_DECLARE_CTOR_ARGS(scalar, size) \ + BOOST_PP_REPEAT(size, BOOST_COMPUTE_VECTOR_TYPE_CTOR_ARG_FUNCTION, _) +#define BOOST_COMPUTE_VECTOR_TYPE_ASSIGN_CTOR_ARG(z, i, _) \ + m_value[i] = BOOST_PP_CAT(arg, i); +#define BOOST_COMPUTE_VECTOR_TYPE_ASSIGN_CTOR_SINGLE_ARG(z, i, _) \ + m_value[i] = arg; + +#define BOOST_COMPUTE_DECLARE_VECTOR_TYPE_CLASS(cl_scalar, size, class_name) \ + class class_name : public vector_type \ + { \ + public: \ + class_name() { } \ + explicit class_name( scalar_type arg ) \ + { \ + BOOST_PP_REPEAT(size, BOOST_COMPUTE_VECTOR_TYPE_ASSIGN_CTOR_SINGLE_ARG, _) \ + } \ + class_name( \ + BOOST_PP_REPEAT(size, BOOST_COMPUTE_VECTOR_TYPE_CTOR_ARG_FUNCTION, _) \ + ) \ + { \ + BOOST_PP_REPEAT(size, BOOST_COMPUTE_VECTOR_TYPE_ASSIGN_CTOR_ARG, _) \ + } \ + }; + +#define BOOST_COMPUTE_DECLARE_VECTOR_TYPE(scalar, size) \ + BOOST_COMPUTE_DECLARE_VECTOR_TYPE_CLASS(BOOST_PP_CAT(cl_, scalar), \ + size, \ + BOOST_PP_CAT(BOOST_PP_CAT(scalar, size), _)) \ + \ + inline std::ostream& operator<<( \ + std::ostream &s, \ + const BOOST_COMPUTE_MAKE_VECTOR_TYPE(scalar, size) &v) \ + { \ + s << BOOST_PP_STRINGIZE(BOOST_PP_CAT(scalar, size)) << "("; \ + for(size_t i = 0; i < size; i++){\ + s << v[i]; \ + if(i != size - 1){\ + s << ", "; \ + } \ + } \ + s << ")"; \ + return s; \ + } + +#define BOOST_COMPUTE_DECLARE_VECTOR_TYPES(scalar) \ + BOOST_COMPUTE_DECLARE_VECTOR_TYPE(scalar, 2) \ + BOOST_COMPUTE_DECLARE_VECTOR_TYPE(scalar, 4) \ + BOOST_COMPUTE_DECLARE_VECTOR_TYPE(scalar, 8) \ + BOOST_COMPUTE_DECLARE_VECTOR_TYPE(scalar, 16) \ + +BOOST_COMPUTE_DECLARE_VECTOR_TYPES(char) +BOOST_COMPUTE_DECLARE_VECTOR_TYPES(uchar) +BOOST_COMPUTE_DECLARE_VECTOR_TYPES(short) +BOOST_COMPUTE_DECLARE_VECTOR_TYPES(ushort) +BOOST_COMPUTE_DECLARE_VECTOR_TYPES(int) +BOOST_COMPUTE_DECLARE_VECTOR_TYPES(uint) +BOOST_COMPUTE_DECLARE_VECTOR_TYPES(long) +BOOST_COMPUTE_DECLARE_VECTOR_TYPES(ulong) +BOOST_COMPUTE_DECLARE_VECTOR_TYPES(float) +BOOST_COMPUTE_DECLARE_VECTOR_TYPES(double) + +} // end compute namespace +} // end boost namespace + +#endif // BOOST_COMPUTE_TYPES_FUNDAMENTAL_HPP diff --git a/3party/boost/boost/compute/types/pair.hpp b/3party/boost/boost/compute/types/pair.hpp new file mode 100644 index 0000000000..96db6539f1 --- /dev/null +++ b/3party/boost/boost/compute/types/pair.hpp @@ -0,0 +1,117 @@ +//---------------------------------------------------------------------------// +// Copyright (c) 2013 Kyle Lutz +// +// 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 +// +// See http://boostorg.github.com/compute for more information. +//---------------------------------------------------------------------------// + +#ifndef BOOST_COMPUTE_TYPES_PAIR_HPP +#define BOOST_COMPUTE_TYPES_PAIR_HPP + +#include +#include + +#include +#include +#include +#include + +namespace boost { +namespace compute { +namespace detail { + +// meta_kernel operator for std::pair literals +template +inline meta_kernel& +operator<<(meta_kernel &kernel, const std::pair &x) +{ + kernel << "(" << type_name >() << ")" + << "{" << kernel.make_lit(x.first) << ", " + << kernel.make_lit(x.second) << "}"; + + return kernel; +} + +// inject_type() specialization for std::pair +template +struct inject_type_impl > +{ + void operator()(meta_kernel &kernel) + { + typedef std::pair pair_type; + + kernel.inject_type(); + kernel.inject_type(); + + kernel.add_type_declaration(type_definition()); + } +}; + +// get() result type specialization for std::pair<> +template +struct get_result_type<0, std::pair > +{ + typedef T1 type; +}; + +template +struct get_result_type<1, std::pair > +{ + typedef T2 type; +}; + +// get() specialization for std::pair<> +template +inline meta_kernel& operator<<(meta_kernel &kernel, + const invoked_get > &expr) +{ + kernel.inject_type >(); + + return kernel << expr.m_arg << (N == 0 ? ".first" : ".second"); +} + +} // end detail namespace + +namespace detail { + +// type_name() specialization for std::pair +template +struct type_name_trait > +{ + static const char* value() + { + static std::string name = + std::string("_pair_") + + type_name() + "_" + type_name() + + "_t"; + + return name.c_str(); + } +}; + +// type_definition() specialization for std::pair +template +struct type_definition_trait > +{ + static std::string value() + { + typedef std::pair pair_type; + + std::stringstream declaration; + declaration << "typedef struct {\n" + << " " << type_name() << " first;\n" + << " " << type_name() << " second;\n" + << "} " << type_name() << ";\n"; + + return declaration.str(); + } +}; + +} // end detail namespace +} // end compute namespace +} // end boost namespace + +#endif // BOOST_COMPUTE_TYPES_PAIR_HPP diff --git a/3party/boost/boost/compute/types/struct.hpp b/3party/boost/boost/compute/types/struct.hpp new file mode 100644 index 0000000000..92aeaedf22 --- /dev/null +++ b/3party/boost/boost/compute/types/struct.hpp @@ -0,0 +1,173 @@ +//---------------------------------------------------------------------------// +// Copyright (c) 2013-2014 Kyle Lutz +// +// 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 +// +// See http://boostorg.github.com/compute for more information. +//---------------------------------------------------------------------------// + +#ifndef BOOST_COMPUTE_TYPES_STRUCT_HPP +#define BOOST_COMPUTE_TYPES_STRUCT_HPP + +#include + +#include + +#include +#include +#include +#include +#include + +#include +#include +#include +#include + +namespace boost { +namespace compute { +namespace detail { + +template +inline std::string adapt_struct_insert_member(T Struct::*, const char *name) +{ + std::stringstream s; + s << " " << type_name() << " " << name << ";\n"; + return s.str(); +} + + +template +inline std::string adapt_struct_insert_member(T (Struct::*)[N], const char *name) +{ + std::stringstream s; + s << " " << type_name() << " " << name << "[" << N << "]" << ";\n"; + return s.str(); +} + +} // end detail namespace +} // end compute namespace +} // end boost namespace + +/// \internal_ +#define BOOST_COMPUTE_DETAIL_ADAPT_STRUCT_INSERT_MEMBER(r, type, member) \ + << ::boost::compute::detail::adapt_struct_insert_member( \ + &type::member, BOOST_PP_STRINGIZE(member) \ + ) + +/// \internal_ +#define BOOST_COMPUTE_DETAIL_ADAPT_STRUCT_STREAM_MEMBER(r, data, i, elem) \ + BOOST_PP_EXPR_IF(i, << ", ") << data.elem + +/// \internal_ +#define BOOST_COMPUTE_DETAIL_STRUCT_MEMBER_SIZE(s, struct_, member_) \ + sizeof(((struct_ *)0)->member_) + +/// \internal_ +#define BOOST_COMPUTE_DETAIL_STRUCT_MEMBER_SIZE_ADD(s, x, y) (x+y) + +/// \internal_ +#define BOOST_COMPUTE_DETAIL_STRUCT_MEMBER_SIZE_SUM(struct_, members_) \ + BOOST_PP_SEQ_FOLD_LEFT( \ + BOOST_COMPUTE_DETAIL_STRUCT_MEMBER_SIZE_ADD, \ + 0, \ + BOOST_PP_SEQ_TRANSFORM( \ + BOOST_COMPUTE_DETAIL_STRUCT_MEMBER_SIZE, struct_, members_ \ + ) \ + ) + +/// \internal_ +/// +/// Returns true if struct_ contains no internal padding bytes (i.e. it is +/// packed). members_ is a sequence of the names of the struct members. +#define BOOST_COMPUTE_DETAIL_STRUCT_IS_PACKED(struct_, members_) \ + (sizeof(struct_) == BOOST_COMPUTE_DETAIL_STRUCT_MEMBER_SIZE_SUM(struct_, members_)) + +/// The BOOST_COMPUTE_ADAPT_STRUCT() macro makes a C++ struct/class available +/// to OpenCL kernels. +/// +/// \param type The C++ type. +/// \param name The OpenCL name. +/// \param members A tuple of the struct's members. +/// +/// For example, to adapt a 2D particle struct with position (x, y) and +/// velocity (dx, dy): +/// \code +/// // c++ struct definition +/// struct Particle +/// { +/// float x, y; +/// float dx, dy; +/// }; +/// +/// // adapt struct for OpenCL +/// BOOST_COMPUTE_ADAPT_STRUCT(Particle, Particle, (x, y, dx, dy)) +/// \endcode +/// +/// After adapting the struct it can be used in Boost.Compute containers +/// and with Boost.Compute algorithms: +/// \code +/// // create vector of particles +/// boost::compute::vector particles = ... +/// +/// // function to compare particles by their x-coordinate +/// BOOST_COMPUTE_FUNCTION(bool, sort_by_x, (Particle a, Particle b), +/// { +/// return a.x < b.x; +/// }); +/// +/// // sort particles by their x-coordinate +/// boost::compute::sort( +/// particles.begin(), particles.end(), sort_by_x, queue +/// ); +/// \endcode +/// +/// Due to differences in struct padding between the host compiler and the +/// device compiler, the \c BOOST_COMPUTE_ADAPT_STRUCT() macro requires that +/// the adapted struct is packed (i.e. no padding bytes between members). +/// +/// \see type_name() +#define BOOST_COMPUTE_ADAPT_STRUCT(type, name, members) \ + BOOST_STATIC_ASSERT_MSG( \ + BOOST_COMPUTE_DETAIL_STRUCT_IS_PACKED(type, BOOST_COMPUTE_PP_TUPLE_TO_SEQ(members)), \ + "BOOST_COMPUTE_ADAPT_STRUCT() does not support structs with internal padding." \ + ); \ + BOOST_COMPUTE_TYPE_NAME(type, name) \ + namespace boost { namespace compute { \ + template<> \ + inline std::string type_definition() \ + { \ + std::stringstream declaration; \ + declaration << "typedef struct __attribute__((packed)) {\n" \ + BOOST_PP_SEQ_FOR_EACH( \ + BOOST_COMPUTE_DETAIL_ADAPT_STRUCT_INSERT_MEMBER, \ + type, \ + BOOST_COMPUTE_PP_TUPLE_TO_SEQ(members) \ + ) \ + << "} " << type_name() << ";\n"; \ + return declaration.str(); \ + } \ + namespace detail { \ + template<> \ + struct inject_type_impl \ + { \ + void operator()(meta_kernel &kernel) \ + { \ + kernel.add_type_declaration(type_definition()); \ + } \ + }; \ + inline meta_kernel& operator<<(meta_kernel &k, type s) \ + { \ + return k << "(" << #name << "){" \ + BOOST_PP_SEQ_FOR_EACH_I( \ + BOOST_COMPUTE_DETAIL_ADAPT_STRUCT_STREAM_MEMBER, \ + s, \ + BOOST_COMPUTE_PP_TUPLE_TO_SEQ(members) \ + ) \ + << "}"; \ + } \ + }}} + +#endif // BOOST_COMPUTE_TYPES_STRUCT_HPP diff --git a/3party/boost/boost/compute/types/tuple.hpp b/3party/boost/boost/compute/types/tuple.hpp new file mode 100644 index 0000000000..095bd95448 --- /dev/null +++ b/3party/boost/boost/compute/types/tuple.hpp @@ -0,0 +1,220 @@ +//---------------------------------------------------------------------------// +// Copyright (c) 2013 Kyle Lutz +// +// 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 +// +// See http://boostorg.github.com/compute for more information. +//---------------------------------------------------------------------------// + +#ifndef BOOST_COMPUTE_TYPES_TUPLE_HPP +#define BOOST_COMPUTE_TYPES_TUPLE_HPP + +#include +#include + +#include +#include +#include +#include + +#include +#include +#include +#include + +#ifndef BOOST_COMPUTE_NO_STD_TUPLE +#include +#endif + +namespace boost { +namespace compute { +namespace detail { + +// meta_kernel operators for boost::tuple literals +#define BOOST_COMPUTE_PRINT_ELEM(z, n, unused) \ + BOOST_PP_EXPR_IF(n, << ", ") \ + << kernel.make_lit(boost::get(x)) + +#define BOOST_COMPUTE_PRINT_TUPLE(z, n, unused) \ +template \ +inline meta_kernel& \ +operator<<(meta_kernel &kernel, \ + const boost::tuple &x) \ +{ \ + return kernel \ + << "(" \ + << type_name >() \ + << ")" \ + << "{" \ + BOOST_PP_REPEAT(n, BOOST_COMPUTE_PRINT_ELEM, ~) \ + << "}"; \ +} + +BOOST_PP_REPEAT_FROM_TO(1, BOOST_COMPUTE_MAX_ARITY, BOOST_COMPUTE_PRINT_TUPLE, ~) + +#undef BOOST_COMPUTE_PRINT_TUPLE +#undef BOOST_COMPUTE_PRINT_ELEM + +// inject_type() specializations for boost::tuple +#define BOOST_COMPUTE_INJECT_TYPE(z, n, unused) \ + kernel.inject_type(); + +#define BOOST_COMPUTE_INJECT_DECL(z, n, unused) \ + << " " << type_name() << " v" #n ";\n" + +#define BOOST_COMPUTE_INJECT_IMPL(z, n, unused) \ +template \ +struct inject_type_impl > \ +{ \ + void operator()(meta_kernel &kernel) \ + { \ + typedef boost::tuple tuple_type; \ + BOOST_PP_REPEAT(n, BOOST_COMPUTE_INJECT_TYPE, ~) \ + std::stringstream declaration; \ + declaration << "typedef struct {\n" \ + BOOST_PP_REPEAT(n, BOOST_COMPUTE_INJECT_DECL, ~) \ + << "} " << type_name() << ";\n"; \ + kernel.add_type_declaration(declaration.str()); \ + } \ +}; + +BOOST_PP_REPEAT_FROM_TO(1, BOOST_COMPUTE_MAX_ARITY, BOOST_COMPUTE_INJECT_IMPL, ~) + +#undef BOOST_COMPUTE_INJECT_IMPL +#undef BOOST_COMPUTE_INJECT_DECL +#undef BOOST_COMPUTE_INJECT_TYPE + +#ifdef BOOST_COMPUTE_NO_VARIADIC_TEMPLATES +// type_name() specializations for boost::tuple (without variadic templates) +#define BOOST_COMPUTE_PRINT_TYPE(z, n, unused) \ + + type_name() + "_" + +#define BOOST_COMPUTE_PRINT_TYPE_NAME(z, n, unused) \ +template \ +struct type_name_trait > \ +{ \ + static const char* value() \ + { \ + static std::string name = \ + std::string("boost_tuple_") \ + BOOST_PP_REPEAT(n, BOOST_COMPUTE_PRINT_TYPE, ~) \ + "t"; \ + return name.c_str(); \ + } \ +}; + +BOOST_PP_REPEAT_FROM_TO(1, BOOST_COMPUTE_MAX_ARITY, BOOST_COMPUTE_PRINT_TYPE_NAME, ~) + +#undef BOOST_COMPUTE_PRINT_TYPE_NAME +#undef BOOST_COMPUTE_PRINT_TYPE + +#else +template +struct write_tuple_type_names +{ + void operator()(std::ostream &os) + { + os << type_name() << "_"; + write_tuple_type_names()(os); + } +}; + +template +struct write_tuple_type_names<1, T, Rest...> +{ + void operator()(std::ostream &os) + { + os << type_name(); + } +}; + +// type_name<> specialization for boost::tuple<...> (with variadic templates) +template +struct type_name_trait> +{ + static const char* value() + { + static std::string str = make_type_name(); + + return str.c_str(); + } + + static std::string make_type_name() + { + typedef typename boost::tuple tuple_type; + + std::stringstream s; + s << "boost_tuple_"; + write_tuple_type_names< + boost::tuples::length::value, T... + >()(s); + s << "_t"; + return s.str(); + } +}; +#endif // BOOST_COMPUTE_NO_VARIADIC_TEMPLATES + +#ifndef BOOST_COMPUTE_NO_STD_TUPLE +// type_name<> specialization for std::tuple +template +struct type_name_trait> +{ + static const char* value() + { + static std::string str = make_type_name(); + + return str.c_str(); + } + + static std::string make_type_name() + { + typedef typename std::tuple tuple_type; + + std::stringstream s; + s << "std_tuple_"; + write_tuple_type_names< + std::tuple_size::value, T... + >()(s); + s << "_t"; + return s.str(); + } +}; +#endif // BOOST_COMPUTE_NO_STD_TUPLE + +// get() result type specialization for boost::tuple<> +#define BOOST_COMPUTE_GET_RESULT_TYPE(z, n, unused) \ +template \ +struct get_result_type > \ +{ \ + typedef typename boost::tuple T; \ + typedef typename boost::tuples::element::type type; \ +}; + +BOOST_PP_REPEAT_FROM_TO(1, BOOST_COMPUTE_MAX_ARITY, BOOST_COMPUTE_GET_RESULT_TYPE, ~) + +#undef BOOST_COMPUTE_GET_RESULT_TYPE + + +// get() specialization for boost::tuple<> +#define BOOST_COMPUTE_GET_N(z, n, unused) \ +template \ +inline meta_kernel& operator<<(meta_kernel &kernel, \ + const invoked_get > &expr) \ +{ \ + typedef typename boost::tuple T; \ + BOOST_STATIC_ASSERT(N < size_t(boost::tuples::length::value)); \ + kernel.inject_type(); \ + return kernel << expr.m_arg << ".v" << uint_(N); \ +} + +BOOST_PP_REPEAT_FROM_TO(1, BOOST_COMPUTE_MAX_ARITY, BOOST_COMPUTE_GET_N, ~) + +#undef BOOST_COMPUTE_GET_N + +} // end detail namespace +} // end compute namespace +} // end boost namespace + +#endif // BOOST_COMPUTE_TYPES_TUPLE_HPP diff --git a/3party/boost/boost/compute/user_event.hpp b/3party/boost/boost/compute/user_event.hpp new file mode 100644 index 0000000000..a3fdba033e --- /dev/null +++ b/3party/boost/boost/compute/user_event.hpp @@ -0,0 +1,88 @@ +//---------------------------------------------------------------------------// +// Copyright (c) 2013-2014 Kyle Lutz +// +// 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 +// +// See http://boostorg.github.com/compute for more information. +//---------------------------------------------------------------------------// + +#ifndef BOOST_COMPUTE_USER_EVENT_HPP +#define BOOST_COMPUTE_USER_EVENT_HPP + +#include +#include + +namespace boost { +namespace compute { + +#if defined(CL_VERSION_1_1) || defined(BOOST_COMPUTE_DOXYGEN_INVOKED) +/// \class user_event +/// \brief An user-created event. +/// +/// \opencl_version_warning{1,1} +/// +/// \see event +class user_event : public event +{ +public: + /// Creates a new user-event object. + /// + /// \see_opencl_ref{clCreateUserEvent} + explicit user_event(const context &context) + { + cl_int error; + m_event = clCreateUserEvent(context.get(), &error); + if(!m_event){ + BOOST_THROW_EXCEPTION(opencl_error(error)); + } + } + + /// Creates a new user-event from \p other. + user_event(const user_event &other) + : event(other) + { + } + + /// Copies the user-event from \p other to \c *this. + user_event& operator=(const user_event &other) + { + event::operator=(other); + + return *this; + } + + #ifndef BOOST_COMPUTE_NO_RVALUE_REFERENCES + /// Move-constructs a new user event object from \p other. + user_event(user_event&& other) BOOST_NOEXCEPT + : event(std::move(other)) + { + } + + /// Move-assigns the user event from \p other to \c *this. + user_event& operator=(user_event&& other) BOOST_NOEXCEPT + { + event::operator=(std::move(other)); + + return *this; + } + #endif // BOOST_COMPUTE_NO_RVALUE_REFERENCES + + /// Sets the execution status for the user-event. + /// + /// \see_opencl_ref{clSetUserEventStatus} + void set_status(cl_int execution_status) + { + cl_int ret = clSetUserEventStatus(m_event, execution_status); + if(ret != CL_SUCCESS){ + BOOST_THROW_EXCEPTION(opencl_error(ret)); + } + } +}; +#endif // CL_VERSION_1_1 + +} // end compute namespace +} // end boost namespace + +#endif // BOOST_COMPUTE_EVENT_HPP diff --git a/3party/boost/boost/compute/utility.hpp b/3party/boost/boost/compute/utility.hpp new file mode 100644 index 0000000000..e6d1f6eab6 --- /dev/null +++ b/3party/boost/boost/compute/utility.hpp @@ -0,0 +1,21 @@ +//---------------------------------------------------------------------------// +// Copyright (c) 2013-2014 Kyle Lutz +// +// 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 +// +// See http://boostorg.github.com/compute for more information. +//---------------------------------------------------------------------------// + +#ifndef BOOST_COMPUTE_UTILITY_HPP +#define BOOST_COMPUTE_UTILITY_HPP + +#include +#include +#include +#include +#include +#include + +#endif // BOOST_COMPUTE_UTILITY_HPP diff --git a/3party/boost/boost/compute/utility/dim.hpp b/3party/boost/boost/compute/utility/dim.hpp new file mode 100644 index 0000000000..210c09cf6e --- /dev/null +++ b/3party/boost/boost/compute/utility/dim.hpp @@ -0,0 +1,76 @@ +//---------------------------------------------------------------------------// +// Copyright (c) 2013-2014 Kyle Lutz +// +// 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 +// +// See http://boostorg.github.com/compute for more information. +//---------------------------------------------------------------------------// + +#ifndef BOOST_COMPUTE_UTILITY_DIM_HPP +#define BOOST_COMPUTE_UTILITY_DIM_HPP + +#include +#include + +namespace boost { +namespace compute { + +#ifndef BOOST_COMPUTE_NO_VARIADIC_TEMPLATES +/// The variadic \c dim() function provides a concise syntax for creating +/// \ref extents objects. +/// +/// For example, +/// \code +/// extents<2> region = dim(640, 480); // region == (640, 480) +/// \endcode +/// +/// \see \ref extents "extents" +template +inline extents dim(Args... args) +{ + return extents({ static_cast(args)... }); +} + +#if BOOST_WORKAROUND(BOOST_MSVC, <= 1800) +// for some inexplicable reason passing one parameter to 'dim' variadic template +// generates compile error on msvc 2013 update 4 +template +inline extents<1> dim(T arg) +{ + return extents<1>(static_cast(arg)); +} +#endif // BOOST_WORKAROUND(BOOST_MSVC, <= 1800) + +#else +// dim() function definitions for non-c++11 compilers +#define BOOST_COMPUTE_DETAIL_ASSIGN_DIM(z, n, var) \ + var[n] = BOOST_PP_CAT(e, n); + +#define BOOST_COMPUTE_DETAIL_DEFINE_DIM(z, n, var) \ + inline extents dim(BOOST_PP_ENUM_PARAMS(n, size_t e)) \ + { \ + extents exts; \ + BOOST_PP_REPEAT(n, BOOST_COMPUTE_DETAIL_ASSIGN_DIM, exts) \ + return exts; \ + } + +BOOST_PP_REPEAT(BOOST_COMPUTE_MAX_ARITY, BOOST_COMPUTE_DETAIL_DEFINE_DIM, ~) + +#undef BOOST_COMPUTE_DETAIL_ASSIGN_DIM +#undef BOOST_COMPUTE_DETAIL_DEFINE_DIM + +#endif // BOOST_COMPUTE_NO_VARIADIC_TEMPLATES + +/// \internal_ +template +inline extents dim() +{ + return extents(); +} + +} // end compute namespace +} // end boost namespace + +#endif // BOOST_COMPUTE_UTILITY_DIM_HPP diff --git a/3party/boost/boost/compute/utility/extents.hpp b/3party/boost/boost/compute/utility/extents.hpp new file mode 100644 index 0000000000..9666d47abc --- /dev/null +++ b/3party/boost/boost/compute/utility/extents.hpp @@ -0,0 +1,164 @@ +//---------------------------------------------------------------------------// +// Copyright (c) 2013-2014 Kyle Lutz +// +// 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 +// +// See http://boostorg.github.com/compute for more information. +//---------------------------------------------------------------------------// + +#ifndef BOOST_COMPUTE_UTILITY_EXTENTS_HPP +#define BOOST_COMPUTE_UTILITY_EXTENTS_HPP + +#include +#include + +#include + +#ifndef BOOST_COMPUTE_NO_HDR_INITIALIZER_LIST +#include +#endif + +#include + +namespace boost { +namespace compute { + +/// The extents class contains an array of n-dimensional extents. +/// +/// \see dim() +template +class extents +{ +public: + typedef size_t size_type; + static const size_type static_size = N; + typedef boost::array array_type; + typedef typename array_type::iterator iterator; + typedef typename array_type::const_iterator const_iterator; + + /// Creates an extents object with each component set to zero. + /// + /// For example: + /// \code + /// extents<3> exts(); // (0, 0, 0) + /// \endcode + extents() + { + m_extents.fill(0); + } + + /// Creates an extents object with each component set to \p value. + /// + /// For example: + /// \code + /// extents<3> exts(1); // (1, 1, 1) + /// \endcode + explicit extents(size_t value) + { + m_extents.fill(value); + } + + #ifndef BOOST_COMPUTE_NO_HDR_INITIALIZER_LIST + /// Creates an extents object with \p values. + extents(std::initializer_list values) + { + BOOST_ASSERT(values.size() == N); + + std::copy(values.begin(), values.end(), m_extents.begin()); + } + #endif // BOOST_COMPUTE_NO_HDR_INITIALIZER_LIST + + /// Returns the size (i.e. dimensionality) of the extents array. + size_type size() const + { + return N; + } + + /// Returns the linear size of the extents. This is equivalent to the + /// product of each extent in each dimension. + size_type linear() const + { + return std::accumulate( + m_extents.begin(), m_extents.end(), 1, std::multiplies() + ); + } + + /// Returns a pointer to the extents data array. + /// + /// This is useful for passing the extents data to OpenCL APIs which + /// expect an array of \c size_t. + size_t* data() + { + return m_extents.data(); + } + + /// \overload + const size_t* data() const + { + return m_extents.data(); + } + + iterator begin() + { + return m_extents.begin(); + } + + const_iterator begin() const + { + return m_extents.begin(); + } + + const_iterator cbegin() const + { + return m_extents.cbegin(); + } + + iterator end() + { + return m_extents.end(); + } + + const_iterator end() const + { + return m_extents.end(); + } + + const_iterator cend() const + { + return m_extents.cend(); + } + + /// Returns a reference to the extent at \p index. + size_t& operator[](size_t index) + { + return m_extents[index]; + } + + /// \overload + const size_t& operator[](size_t index) const + { + return m_extents[index]; + } + + /// Returns \c true if the extents in \c *this are the same as \p other. + bool operator==(const extents &other) const + { + return m_extents == other.m_extents; + } + + /// Returns \c true if the extents in \c *this are not the same as \p other. + bool operator!=(const extents &other) const + { + return m_extents != other.m_extents; + } + +private: + array_type m_extents; +}; + +} // end compute namespace +} // end boost namespace + +#endif // BOOST_COMPUTE_UTILITY_EXTENTS_HPP diff --git a/3party/boost/boost/compute/utility/invoke.hpp b/3party/boost/boost/compute/utility/invoke.hpp new file mode 100644 index 0000000000..b03162aa2b --- /dev/null +++ b/3party/boost/boost/compute/utility/invoke.hpp @@ -0,0 +1,71 @@ +//---------------------------------------------------------------------------// +// Copyright (c) 2013-2015 Kyle Lutz +// +// 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 +// +// See http://kylelutz.github.com/compute for more information. +//---------------------------------------------------------------------------// + +#ifndef BOOST_COMPUTE_UTILITY_INVOKE_HPP +#define BOOST_COMPUTE_UTILITY_INVOKE_HPP + +#include +#include + +#include +#include +#include +#include +#include + +namespace boost { +namespace compute { + +#define BOOST_COMPUTE_DETAIL_INVOKE_ARG(z, n, unused) \ + BOOST_PP_COMMA_IF(n) k.var("arg" BOOST_PP_STRINGIZE(n)) + +#define BOOST_COMPUTE_DETAIL_INVOKE_ADD_ARG(z, n, unused) \ + k.add_set_arg("arg" BOOST_PP_STRINGIZE(n), BOOST_PP_CAT(arg, n)); + +#define BOOST_COMPUTE_DETAIL_DEFINE_INVOKE(z, n, unused) \ +template \ +inline typename result_of::type \ +invoke(const Function& function, command_queue& queue, BOOST_PP_ENUM_BINARY_PARAMS(n, const T, &arg)) \ +{ \ + typedef typename result_of::type result_type; \ + detail::meta_kernel k("invoke"); \ + detail::scalar result(queue.get_context()); \ + const size_t result_arg = k.add_arg(memory_object::global_memory, "result"); \ + BOOST_PP_REPEAT(n, BOOST_COMPUTE_DETAIL_INVOKE_ADD_ARG, ~) \ + k << "*result = " << function( \ + BOOST_PP_REPEAT(n, BOOST_COMPUTE_DETAIL_INVOKE_ARG, ~) \ + ) << ";"; \ + k.set_arg(result_arg, result.get_buffer()); \ + k.exec(queue); \ + return result.read(queue); \ +} + +BOOST_PP_REPEAT_FROM_TO(1, BOOST_COMPUTE_MAX_ARITY, BOOST_COMPUTE_DETAIL_DEFINE_INVOKE, ~) + +#undef BOOST_COMPUTE_DETAIL_INVOKE_ARG +#undef BOOST_COMPUTE_DETAIL_INVOKE_ADD_ARG +#undef BOOST_COMPUTE_DETAIL_DEFINE_INVOKE + +#ifdef BOOST_COMPUTE_DOXYGEN_INVOKED +/// Invokes \p function with \p args on \p queue. +/// +/// For example, to invoke the builtin abs() function: +/// \code +/// int result = invoke(abs(), queue, -10); // returns 10 +/// \endcode +template +inline typename result_of::type +invoke(const Function& function, command_queue& queue, const Args&... args); +#endif // BOOST_COMPUTE_DOXYGEN_INVOKED + +} // end compute namespace +} // end boost namespace + +#endif // BOOST_COMPUTE_UTILITY_INVOKE_HPP diff --git a/3party/boost/boost/compute/utility/program_cache.hpp b/3party/boost/boost/compute/utility/program_cache.hpp new file mode 100644 index 0000000000..c80e1a3b1e --- /dev/null +++ b/3party/boost/boost/compute/utility/program_cache.hpp @@ -0,0 +1,172 @@ +//---------------------------------------------------------------------------// +// Copyright (c) 2013-2014 Kyle Lutz +// +// 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 +// +// See http://boostorg.github.com/compute for more information. +//---------------------------------------------------------------------------// + +#ifndef BOOST_COMPUTE_UTILITY_PROGRAM_CACHE_HPP +#define BOOST_COMPUTE_UTILITY_PROGRAM_CACHE_HPP + +#include +#include + +#include +#include +#include + +#include +#include +#include +#include + +namespace boost { +namespace compute { + +/// The program_cache class stores \ref program objects in a LRU cache. +/// +/// This class can be used to help mitigate the overhead of OpenCL's run-time +/// kernel compilation model. Commonly used programs can be stored persistently +/// in the cache and only compiled once on their first use. +/// +/// Program objects are stored and retreived based on a user-defined cache key +/// along with the options used to build the program (if any). +/// +/// For example, to insert a program into the cache: +/// \code +/// cache.insert("foo", foo_program); +/// \endcode +/// +/// And to retreive the program later: +/// \code +/// boost::optional p = cache.get("foo"); +/// if(p){ +/// // program found in cache +/// } +/// \endcode +/// +/// \see program +class program_cache : boost::noncopyable +{ +public: + /// Creates a new program cache with space for \p capacity number of + /// program objects. + program_cache(size_t capacity) + : m_cache(capacity) + { + } + + /// Destroys the program cache. + ~program_cache() + { + } + + /// Returns the number of program objects currently stored in the cache. + size_t size() const + { + return m_cache.size(); + } + + /// Returns the total capacity of the cache. + size_t capacity() const + { + return m_cache.capacity(); + } + + /// Clears the program cache. + void clear() + { + m_cache.clear(); + } + + /// Returns the program object with \p key. Returns a null optional if no + /// program with \p key exists in the cache. + boost::optional get(const std::string &key) + { + return m_cache.get(std::make_pair(key, std::string())); + } + + /// Returns the program object with \p key and \p options. Returns a null + /// optional if no program with \p key and \p options exists in the cache. + boost::optional get(const std::string &key, const std::string &options) + { + return m_cache.get(std::make_pair(key, options)); + } + + /// Inserts \p program into the cache with \p key. + void insert(const std::string &key, const program &program) + { + insert(key, std::string(), program); + } + + /// Inserts \p program into the cache with \p key and \p options. + void insert(const std::string &key, const std::string &options, const program &program) + { + m_cache.insert(std::make_pair(key, options), program); + } + + /// Loads the program with \p key from the cache if it exists. Otherwise + /// builds a new program with \p source and \p options, stores it in the + /// cache, and returns it. + /// + /// This is a convenience function to simplify the common pattern of + /// attempting to load a program from the cache and, if not present, + /// building the program from source and storing it in the cache. + /// + /// Equivalent to: + /// \code + /// boost::optional p = get(key, options); + /// if(!p){ + /// p = program::create_with_source(source, context); + /// p->build(options); + /// insert(key, options, *p); + /// } + /// return *p; + /// \endcode + program get_or_build(const std::string &key, + const std::string &options, + const std::string &source, + const context &context) + { + boost::optional p = get(key, options); + if(!p){ + p = program::build_with_source(source, context, options); + + insert(key, options, *p); + } + return *p; + } + + /// Returns the global program cache for \p context. + /// + /// This global cache is used internally by Boost.Compute to store compiled + /// program objects used by its algorithms. All Boost.Compute programs are + /// stored with a cache key beginning with \c "__boost". User programs + /// should avoid using the same prefix in order to prevent collisions. + static boost::shared_ptr get_global_cache(const context &context) + { + typedef detail::lru_cache > cache_map; + + BOOST_COMPUTE_DETAIL_GLOBAL_STATIC(cache_map, caches, (8)); + + boost::optional > cache = caches.get(context.get()); + if(!cache){ + cache = boost::make_shared(64); + + caches.insert(context.get(), *cache); + } + + return *cache; + } + +private: + detail::lru_cache, program> m_cache; +}; + +} // end compute namespace +} // end boost namespace + +#endif // BOOST_COMPUTE_UTILITY_PROGRAM_CACHE_HPP diff --git a/3party/boost/boost/compute/utility/source.hpp b/3party/boost/boost/compute/utility/source.hpp new file mode 100644 index 0000000000..3b073fbc82 --- /dev/null +++ b/3party/boost/boost/compute/utility/source.hpp @@ -0,0 +1,39 @@ +//---------------------------------------------------------------------------// +// Copyright (c) 2013-2014 Kyle Lutz +// +// 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 +// +// See http://boostorg.github.com/compute for more information. +//---------------------------------------------------------------------------// + +#ifndef BOOST_COMPUTE_UTILITY_SOURCE_HPP +#define BOOST_COMPUTE_UTILITY_SOURCE_HPP + +/// Stringizes OpenCL source code. +/// +/// For example, to create a simple kernel which squares each input value: +/// \code +/// const char source[] = BOOST_COMPUTE_STRINGIZE_SOURCE( +/// __kernel void square(const float *input, float *output) +/// { +/// const uint i = get_global_id(0); +/// const float x = input[i]; +/// output[i] = x * x; +/// } +/// ); +/// +/// // create and build square program +/// program square_program = program::build_with_source(source, context); +/// +/// // create square kernel +/// kernel square_kernel(square_program, "square"); +/// \endcode +#ifdef BOOST_COMPUTE_DOXYGEN_INVOKED +#define BOOST_COMPUTE_STRINGIZE_SOURCE(source) +#else +#define BOOST_COMPUTE_STRINGIZE_SOURCE(...) #__VA_ARGS__ +#endif + +#endif // BOOST_COMPUTE_UTILITY_SOURCE_HPP diff --git a/3party/boost/boost/compute/utility/wait_list.hpp b/3party/boost/boost/compute/utility/wait_list.hpp new file mode 100644 index 0000000000..8b81924d63 --- /dev/null +++ b/3party/boost/boost/compute/utility/wait_list.hpp @@ -0,0 +1,217 @@ +//---------------------------------------------------------------------------// +// Copyright (c) 2013-2014 Kyle Lutz +// +// 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 +// +// See http://boostorg.github.com/compute for more information. +//---------------------------------------------------------------------------// + +#ifndef BOOST_COMPUTE_UTILITY_WAIT_LIST_HPP +#define BOOST_COMPUTE_UTILITY_WAIT_LIST_HPP + +#include + +#include + +#ifndef BOOST_COMPUTE_NO_HDR_INITIALIZER_LIST +#include +#endif + +#include + +namespace boost { +namespace compute { + +template class future; + +/// \class wait_list +/// \brief Stores a list of events. +/// +/// The wait_list class stores a set of event objects and can be used to +/// specify dependencies for OpenCL operations or to wait on the host until +/// all of the events have completed. +/// +/// This class also provides convenience functions for interacting with +/// OpenCL APIs which typically accept event dependencies as a \c cl_event* +/// pointer and a \c cl_uint size. For example: +/// \code +/// wait_list events = ...; +/// +/// clEnqueueNDRangeKernel(..., events.get_event_ptr(), events.size(), ...); +/// \endcode +/// +/// \see event, \ref future "future" +class wait_list +{ +public: + typedef std::vector::iterator iterator; + typedef std::vector::const_iterator const_iterator; + + /// Creates an empty wait-list. + wait_list() + { + } + + /// Creates a wait-list containing \p event. + wait_list(const event &event) + { + insert(event); + } + + /// Creates a new wait-list as a copy of \p other. + wait_list(const wait_list &other) + : m_events(other.m_events) + { + } + + #ifndef BOOST_COMPUTE_NO_HDR_INITIALIZER_LIST + /// Creates a wait-list from \p events + wait_list(std::initializer_list events) + : m_events(events) + { + } + #endif // BOOST_COMPUTE_NO_HDR_INITIALIZER_LIST + + /// Copies the events in the wait-list from \p other. + wait_list& operator=(const wait_list &other) + { + if(this != &other){ + m_events = other.m_events; + } + + return *this; + } + + #ifndef BOOST_COMPUTE_NO_RVALUE_REFERENCES + /// Move-constructs a new wait list object from \p other. + wait_list(wait_list&& other) + : m_events(std::move(other.m_events)) + { + } + + /// Move-assigns the wait list from \p other to \c *this. + wait_list& operator=(wait_list&& other) + { + m_events = std::move(other.m_events); + + return *this; + } + #endif // BOOST_COMPUTE_NO_RVALUE_REFERENCES + + /// Destroys the wait-list. + ~wait_list() + { + } + + /// Returns \c true if the wait-list is empty. + bool empty() const + { + return m_events.empty(); + } + + /// Returns the number of events in the wait-list. + uint_ size() const + { + return static_cast(m_events.size()); + } + + /// Removes all of the events from the wait-list. + void clear() + { + m_events.clear(); + } + + /// Returns a cl_event pointer to the first event in the wait-list. + /// Returns \c 0 if the wait-list is empty. + /// + /// This can be used to pass the wait-list to OpenCL functions which + /// expect a \c cl_event pointer to refer to a list of events. + const cl_event* get_event_ptr() const + { + if(empty()){ + return 0; + } + + return reinterpret_cast(&m_events[0]); + } + + /// Reserves a minimum length of storage for the wait list object. + void reserve(size_t new_capacity) { + m_events.reserve(new_capacity); + } + + /// Inserts \p event into the wait-list. + void insert(const event &event) + { + m_events.push_back(event); + } + + /// Inserts the event from \p future into the wait-list. + template + void insert(const future &future) + { + insert(future.get_event()); + } + + /// Blocks until all of the events in the wait-list have completed. + /// + /// Does nothing if the wait-list is empty. + void wait() const + { + if(!empty()){ + BOOST_COMPUTE_ASSERT_CL_SUCCESS( + clWaitForEvents(size(), get_event_ptr()) + ); + } + } + + /// Returns a reference to the event at specified location \p pos. + const event& operator[](size_t pos) const { + return m_events[pos]; + } + + /// Returns a reference to the event at specified location \p pos. + event& operator[](size_t pos) { + return m_events[pos]; + } + + /// Returns an iterator to the first element of the wait-list. + iterator begin() { + return m_events.begin(); + } + + /// Returns an iterator to the first element of the wait-list. + const_iterator begin() const { + return m_events.begin(); + } + + /// Returns an iterator to the first element of the wait-list. + const_iterator cbegin() const { + return m_events.begin(); + } + + /// Returns an iterator to the element following the last element of the wait-list. + iterator end() { + return m_events.end(); + } + + /// Returns an iterator to the element following the last element of the wait-list. + const_iterator end() const { + return m_events.end(); + } + + /// Returns an iterator to the element following the last element of the wait-list. + const_iterator cend() const { + return m_events.end(); + } + +private: + std::vector m_events; +}; + +} // end compute namespace +} // end boost namespace + +#endif // BOOST_COMPUTE_UTILITY_WAIT_LIST_HPP diff --git a/3party/boost/boost/compute/version.hpp b/3party/boost/boost/compute/version.hpp new file mode 100644 index 0000000000..fdf6caeeaf --- /dev/null +++ b/3party/boost/boost/compute/version.hpp @@ -0,0 +1,18 @@ +//---------------------------------------------------------------------------// +// Copyright (c) 2013-2015 Kyle Lutz +// +// 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 +// +// See http://boostorg.github.com/compute for more information. +//---------------------------------------------------------------------------// + +#ifndef BOOST_COMPUTE_VERSION_HPP +#define BOOST_COMPUTE_VERSION_HPP + +#define BOOST_COMPUTE_VERSION_MAJOR 0 +#define BOOST_COMPUTE_VERSION_MINOR 5 +#define BOOST_COMPUTE_VERSION_PATCH 0 + +#endif // BOOST_COMPUTE_VERSION_HPP diff --git a/3party/boost/boost/compute/wait_list.hpp b/3party/boost/boost/compute/wait_list.hpp new file mode 100644 index 0000000000..a6bda45991 --- /dev/null +++ b/3party/boost/boost/compute/wait_list.hpp @@ -0,0 +1,12 @@ +//---------------------------------------------------------------------------// +// Copyright (c) 2013-2014 Kyle Lutz +// +// 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 +// +// See http://boostorg.github.com/compute for more information. +//---------------------------------------------------------------------------// + +// deprecated, use instead +#include diff --git a/3party/boost/boost/concept_check.hpp b/3party/boost/boost/concept_check.hpp index 2d6fa32332..25f118b643 100644 --- a/3party/boost/boost/concept_check.hpp +++ b/3party/boost/boost/concept_check.hpp @@ -19,7 +19,7 @@ # include -# include +# include # include # include # include @@ -27,7 +27,6 @@ # include # include # include -# include # include # include @@ -504,11 +503,11 @@ namespace boost : Assignable , EqualityComparable { - typedef typename boost::detail::iterator_traits::value_type value_type; - typedef typename boost::detail::iterator_traits::difference_type difference_type; - typedef typename boost::detail::iterator_traits::reference reference; - typedef typename boost::detail::iterator_traits::pointer pointer; - typedef typename boost::detail::iterator_traits::iterator_category iterator_category; + typedef typename std::iterator_traits::value_type value_type; + typedef typename std::iterator_traits::difference_type difference_type; + typedef typename std::iterator_traits::reference reference; + typedef typename std::iterator_traits::pointer pointer; + typedef typename std::iterator_traits::iterator_category iterator_category; BOOST_CONCEPT_USAGE(InputIterator) { @@ -617,7 +616,7 @@ namespace boost private: TT a, b; TT i, j; - typename boost::detail::iterator_traits::difference_type n; + typename std::iterator_traits::difference_type n; }; BOOST_concept(Mutable_RandomAccessIterator,(TT)) @@ -630,7 +629,7 @@ namespace boost } private: TT i; - typename boost::detail::iterator_traits::difference_type n; + typename std::iterator_traits::difference_type n; }; //=========================================================================== diff --git a/3party/boost/boost/config/auto_link.hpp b/3party/boost/boost/config/auto_link.hpp index 56a16b0b38..c71e8035dd 100644 --- a/3party/boost/boost/config/auto_link.hpp +++ b/3party/boost/boost/config/auto_link.hpp @@ -161,10 +161,15 @@ BOOST_LIB_VERSION: The Boost version, in the form x_y, for Boost version x.y. // vc12: # define BOOST_LIB_TOOLSET "vc120" -# elif defined(BOOST_MSVC) +# elif defined(BOOST_MSVC) && (BOOST_MSVC < 1910) - // vc14: -# define BOOST_LIB_TOOLSET "vc140" + // vc14: +# define BOOST_LIB_TOOLSET "vc140" + +# elif defined(BOOST_MSVC) + + // vc14.1: +# define BOOST_LIB_TOOLSET "vc141" # elif defined(__BORLANDC__) diff --git a/3party/boost/boost/config/compiler/borland.hpp b/3party/boost/boost/config/compiler/borland.hpp index 80dd230034..b749496e38 100644 --- a/3party/boost/boost/config/compiler/borland.hpp +++ b/3party/boost/boost/config/compiler/borland.hpp @@ -185,6 +185,7 @@ #define BOOST_NO_CXX11_RVALUE_REFERENCES #define BOOST_NO_CXX11_SCOPED_ENUMS #define BOOST_NO_SFINAE_EXPR +#define BOOST_NO_CXX11_SFINAE_EXPR #define BOOST_NO_CXX11_TEMPLATE_ALIASES #define BOOST_NO_CXX11_UNICODE_LITERALS // UTF-8 still not supported #define BOOST_NO_CXX11_VARIADIC_TEMPLATES @@ -196,6 +197,7 @@ #define BOOST_NO_CXX11_INLINE_NAMESPACES #define BOOST_NO_CXX11_REF_QUALIFIERS #define BOOST_NO_CXX11_FINAL +#define BOOST_NO_CXX11_THREAD_LOCAL // C++ 14: #if !defined(__cpp_aggregate_nsdmi) || (__cpp_aggregate_nsdmi < 201304) diff --git a/3party/boost/boost/config/compiler/clang.hpp b/3party/boost/boost/config/compiler/clang.hpp index 47ea65b0a2..175229c64a 100644 --- a/3party/boost/boost/config/compiler/clang.hpp +++ b/3party/boost/boost/config/compiler/clang.hpp @@ -23,6 +23,10 @@ #define __has_extension __has_feature #endif +#ifndef __has_attribute +#define __has_attribute(x) 0 +#endif + #if !__has_feature(cxx_exceptions) && !defined(BOOST_NO_EXCEPTIONS) # define BOOST_NO_EXCEPTIONS #endif @@ -35,14 +39,25 @@ # define BOOST_NO_TYPEID #endif -#if defined(__int64) && !defined(__GNUC__) +#if !__has_feature(cxx_thread_local) +# define BOOST_NO_CXX11_THREAD_LOCAL +#endif + +#ifdef __is_identifier +#if !__is_identifier(__int64) && !defined(__GNUC__) # define BOOST_HAS_MS_INT64 #endif +#endif + +#if __has_include() +# define BOOST_HAS_STDINT_H +#endif + #define BOOST_HAS_NRVO // Branch prediction hints -#if defined(__has_builtin) +#if !defined (__c2__) && defined(__has_builtin) #if __has_builtin(__builtin_expect) #define BOOST_LIKELY(x) __builtin_expect(x, 1) #define BOOST_UNLIKELY(x) __builtin_expect(x, 0) @@ -53,14 +68,25 @@ #define BOOST_HAS_LONG_LONG // -// We disable this if the compiler is really nvcc as it -// doesn't actually support __int128 as of CUDA_VERSION=5000 +// We disable this if the compiler is really nvcc with C++03 as it +// doesn't actually support __int128 as of CUDA_VERSION=7500 // even though it defines __SIZEOF_INT128__. // See https://svn.boost.org/trac/boost/ticket/10418 +// https://svn.boost.org/trac/boost/ticket/11852 // Only re-enable this for nvcc if you're absolutely sure -// of the circumstances under which it's supported: +// of the circumstances under which it's supported. +// Similarly __SIZEOF_INT128__ is defined when targetting msvc +// compatibility even though the required support functions are absent. // -#if defined(__SIZEOF_INT128__) && !defined(__CUDACC__) +#if defined(__CUDACC__) +# if defined(BOOST_GCC_CXX11) +# define BOOST_NVCC_CXX11 +# else +# define BOOST_NVCC_CXX03 +# endif +#endif + +#if defined(__SIZEOF_INT128__) && !defined(BOOST_NVCC_CXX03) && !defined(_MSC_VER) # define BOOST_HAS_INT128 #endif @@ -92,11 +118,16 @@ // // Currently clang on Windows using VC++ RTL does not support C++11's char16_t or char32_t // -#if defined(_MSC_VER) || !(defined(__GXX_EXPERIMENTAL_CXX0X__) || __cplusplus >= 201103L) +#if (defined(_MSC_VER) && (_MSC_VER < 1900)) || !(defined(__GXX_EXPERIMENTAL_CXX0X__) || __cplusplus >= 201103L) # define BOOST_NO_CXX11_CHAR16_T # define BOOST_NO_CXX11_CHAR32_T #endif +#if defined(_MSC_VER) && (_MSC_VER >= 1800) && !defined(__GNUC__) +#define BOOST_HAS_EXPM1 +#define BOOST_HAS_LOG1P +#endif + #if !__has_feature(cxx_constexpr) # define BOOST_NO_CXX11_CONSTEXPR #endif @@ -251,17 +282,23 @@ # define BOOST_NO_CXX14_VARIABLE_TEMPLATES #endif +#if __cplusplus < 201103L +#define BOOST_NO_CXX11_SFINAE_EXPR +#endif + #if __cplusplus < 201400 // All versions with __cplusplus above this value seem to support this: # define BOOST_NO_CXX14_DIGIT_SEPARATORS #endif - - -// Unused attribute: -#if defined(__GNUC__) && (__GNUC__ >= 4) -# define BOOST_ATTRIBUTE_UNUSED __attribute__((unused)) +// +// __builtin_unreachable: +#if defined(__has_builtin) && __has_builtin(__builtin_unreachable) +#define BOOST_UNREACHABLE_RETURN(x) __builtin_unreachable(); #endif +// Clang has supported the 'unused' attribute since the first release. +#define BOOST_ATTRIBUTE_UNUSED __attribute__((__unused__)) + #ifndef BOOST_COMPILER # define BOOST_COMPILER "Clang version " __clang_version__ #endif diff --git a/3party/boost/boost/config/compiler/codegear.hpp b/3party/boost/boost/config/compiler/codegear.hpp index 02bd792a15..3c5262fe49 100644 --- a/3party/boost/boost/config/compiler/codegear.hpp +++ b/3party/boost/boost/config/compiler/codegear.hpp @@ -112,6 +112,7 @@ #define BOOST_NO_CXX11_RAW_LITERALS #define BOOST_NO_CXX11_RVALUE_REFERENCES #define BOOST_NO_SFINAE_EXPR +#define BOOST_NO_CXX11_SFINAE_EXPR #define BOOST_NO_CXX11_TEMPLATE_ALIASES #define BOOST_NO_CXX11_UNICODE_LITERALS #define BOOST_NO_CXX11_VARIADIC_TEMPLATES @@ -122,6 +123,7 @@ #define BOOST_NO_CXX11_INLINE_NAMESPACES #define BOOST_NO_CXX11_REF_QUALIFIERS #define BOOST_NO_CXX11_FINAL +#define BOOST_NO_CXX11_THREAD_LOCAL // C++ 14: #if !defined(__cpp_aggregate_nsdmi) || (__cpp_aggregate_nsdmi < 201304) diff --git a/3party/boost/boost/config/compiler/comeau.hpp b/3party/boost/boost/config/compiler/comeau.hpp index 278222dcfd..09841604f9 100644 --- a/3party/boost/boost/config/compiler/comeau.hpp +++ b/3party/boost/boost/config/compiler/comeau.hpp @@ -12,7 +12,7 @@ // Comeau C++ compiler setup: -#include "boost/config/compiler/common_edg.hpp" +#include #if (__COMO_VERSION__ <= 4245) diff --git a/3party/boost/boost/config/compiler/common_edg.hpp b/3party/boost/boost/config/compiler/common_edg.hpp index b92e574d60..eab9378486 100644 --- a/3party/boost/boost/config/compiler/common_edg.hpp +++ b/3party/boost/boost/config/compiler/common_edg.hpp @@ -95,6 +95,7 @@ #define BOOST_NO_CXX11_RVALUE_REFERENCES #define BOOST_NO_CXX11_SCOPED_ENUMS #define BOOST_NO_SFINAE_EXPR +#define BOOST_NO_CXX11_SFINAE_EXPR #define BOOST_NO_CXX11_STATIC_ASSERT #define BOOST_NO_CXX11_TEMPLATE_ALIASES #define BOOST_NO_CXX11_UNICODE_LITERALS @@ -106,6 +107,7 @@ #define BOOST_NO_CXX11_INLINE_NAMESPACES #define BOOST_NO_CXX11_REF_QUALIFIERS #define BOOST_NO_CXX11_FINAL +#define BOOST_NO_CXX11_THREAD_LOCAL // C++ 14: #if !defined(__cpp_aggregate_nsdmi) || (__cpp_aggregate_nsdmi < 201304) diff --git a/3party/boost/boost/config/compiler/compaq_cxx.hpp b/3party/boost/boost/config/compiler/compaq_cxx.hpp index b44486c673..4d6b8ab3ac 100644 --- a/3party/boost/boost/config/compiler/compaq_cxx.hpp +++ b/3party/boost/boost/config/compiler/compaq_cxx.hpp @@ -9,7 +9,7 @@ #define BOOST_COMPILER "HP Tru64 C++ " BOOST_STRINGIZE(__DECCXX_VER) -#include "boost/config/compiler/common_edg.hpp" +#include // // versions check: diff --git a/3party/boost/boost/config/compiler/cray.hpp b/3party/boost/boost/config/compiler/cray.hpp index 3f66043357..eab5287751 100644 --- a/3party/boost/boost/config/compiler/cray.hpp +++ b/3party/boost/boost/config/compiler/cray.hpp @@ -21,7 +21,7 @@ # error "Unsupported Cray compiler, please try running the configure script." #endif -#include "boost/config/compiler/common_edg.hpp" +#include // @@ -39,6 +39,7 @@ #define BOOST_NO_CXX11_TEMPLATE_ALIASES #define BOOST_NO_CXX11_STATIC_ASSERT #define BOOST_NO_SFINAE_EXPR +#define BOOST_NO_CXX11_SFINAE_EXPR #define BOOST_NO_CXX11_SCOPED_ENUMS #define BOOST_NO_CXX11_RVALUE_REFERENCES #define BOOST_NO_CXX11_RANGE_BASED_FOR @@ -60,6 +61,7 @@ #define BOOST_NO_CXX11_CHAR16_T #define BOOST_NO_CXX11_REF_QUALIFIERS #define BOOST_NO_CXX11_FINAL +#define BOOST_NO_CXX11_THREAD_LOCAL //#define BOOST_BCB_PARTIAL_SPECIALIZATION_BUG diff --git a/3party/boost/boost/config/compiler/digitalmars.hpp b/3party/boost/boost/config/compiler/digitalmars.hpp index a3d293c7b5..e371a68e99 100644 --- a/3party/boost/boost/config/compiler/digitalmars.hpp +++ b/3party/boost/boost/config/compiler/digitalmars.hpp @@ -71,6 +71,7 @@ #define BOOST_NO_CXX11_RVALUE_REFERENCES #define BOOST_NO_CXX11_SCOPED_ENUMS #define BOOST_NO_SFINAE_EXPR +#define BOOST_NO_CXX11_SFINAE_EXPR #define BOOST_NO_CXX11_STATIC_ASSERT #define BOOST_NO_CXX11_TEMPLATE_ALIASES #define BOOST_NO_CXX11_UNICODE_LITERALS @@ -82,6 +83,7 @@ #define BOOST_NO_CXX11_INLINE_NAMESPACES #define BOOST_NO_CXX11_REF_QUALIFIERS #define BOOST_NO_CXX11_FINAL +#define BOOST_NO_CXX11_THREAD_LOCAL // C++ 14: #if !defined(__cpp_aggregate_nsdmi) || (__cpp_aggregate_nsdmi < 201304) diff --git a/3party/boost/boost/config/compiler/gcc.hpp b/3party/boost/boost/config/compiler/gcc.hpp index 41705df039..c82cbc7eda 100644 --- a/3party/boost/boost/config/compiler/gcc.hpp +++ b/3party/boost/boost/config/compiler/gcc.hpp @@ -133,16 +133,42 @@ // // Recent GCC versions have __int128 when in 64-bit mode. // -// We disable this if the compiler is really nvcc as it -// doesn't actually support __int128 as of CUDA_VERSION=5000 +// We disable this if the compiler is really nvcc with C++03 as it +// doesn't actually support __int128 as of CUDA_VERSION=7500 // even though it defines __SIZEOF_INT128__. // See https://svn.boost.org/trac/boost/ticket/8048 +// https://svn.boost.org/trac/boost/ticket/11852 // Only re-enable this for nvcc if you're absolutely sure // of the circumstances under which it's supported: // -#if defined(__SIZEOF_INT128__) && !defined(__CUDACC__) +#if defined(__CUDACC__) +# if defined(BOOST_GCC_CXX11) +# define BOOST_NVCC_CXX11 +# else +# define BOOST_NVCC_CXX03 +# endif +#endif + +#if defined(__SIZEOF_INT128__) && !defined(BOOST_NVCC_CXX03) # define BOOST_HAS_INT128 #endif +// +// Recent GCC versions have a __float128 native type, we need to +// include a std lib header to detect this - not ideal, but we'll +// be including later anyway when we select the std lib. +// +// Nevertheless, as of CUDA 7.5, using __float128 with the host +// compiler in pre-C++11 mode is still not supported. +// See https://svn.boost.org/trac/boost/ticket/11852 +// +#ifdef __cplusplus +#include +#else +#include +#endif +#if defined(_GLIBCXX_USE_FLOAT128) && !defined(__STRICT_ANSI__) && !defined(BOOST_NVCC_CXX03) +# define BOOST_HAS_FLOAT128 +#endif // C++0x features in 4.3.n and later // @@ -226,6 +252,8 @@ // #if (BOOST_GCC_VERSION < 40800) || !defined(BOOST_GCC_CXX11) # define BOOST_NO_CXX11_ALIGNAS +# define BOOST_NO_CXX11_THREAD_LOCAL +# define BOOST_NO_CXX11_SFINAE_EXPR #endif // C++0x features in 4.8.1 and later @@ -263,7 +291,12 @@ // // Unused attribute: #if __GNUC__ >= 4 -# define BOOST_ATTRIBUTE_UNUSED __attribute__((unused)) +# define BOOST_ATTRIBUTE_UNUSED __attribute__((__unused__)) +#endif +// +// __builtin_unreachable: +#if BOOST_GCC_VERSION >= 40800 +#define BOOST_UNREACHABLE_RETURN(x) __builtin_unreachable(); #endif #ifndef BOOST_COMPILER diff --git a/3party/boost/boost/config/compiler/gcc_xml.hpp b/3party/boost/boost/config/compiler/gcc_xml.hpp index c11f29dd01..63b08ac483 100644 --- a/3party/boost/boost/config/compiler/gcc_xml.hpp +++ b/3party/boost/boost/config/compiler/gcc_xml.hpp @@ -46,6 +46,7 @@ # define BOOST_NO_CXX11_HDR_INITIALIZER_LIST # define BOOST_NO_CXX11_SCOPED_ENUMS # define BOOST_NO_SFINAE_EXPR +# define BOOST_NO_CXX11_SFINAE_EXPR # define BOOST_NO_CXX11_EXPLICIT_CONVERSION_OPERATORS # define BOOST_NO_CXX11_LAMBDAS # define BOOST_NO_CXX11_LOCAL_CLASS_TEMPLATE_PARAMETERS @@ -59,7 +60,8 @@ # define BOOST_NO_CXX11_TRAILING_RESULT_TYPES # define BOOST_NO_CXX11_INLINE_NAMESPACES # define BOOST_NO_CXX11_REF_QUALIFIERS -#define BOOST_NO_CXX11_FINAL +# define BOOST_NO_CXX11_FINAL +# define BOOST_NO_CXX11_THREAD_LOCAL // C++ 14: #if !defined(__cpp_aggregate_nsdmi) || (__cpp_aggregate_nsdmi < 201304) diff --git a/3party/boost/boost/config/compiler/greenhills.hpp b/3party/boost/boost/config/compiler/greenhills.hpp index 038b6b2b52..a76a07cf4a 100644 --- a/3party/boost/boost/config/compiler/greenhills.hpp +++ b/3party/boost/boost/config/compiler/greenhills.hpp @@ -9,7 +9,7 @@ #define BOOST_COMPILER "Greenhills C++ version " BOOST_STRINGIZE(__ghs) -#include "boost/config/compiler/common_edg.hpp" +#include // // versions check: diff --git a/3party/boost/boost/config/compiler/hp_acc.hpp b/3party/boost/boost/config/compiler/hp_acc.hpp index fb63839a57..9df18eaf67 100644 --- a/3party/boost/boost/config/compiler/hp_acc.hpp +++ b/3party/boost/boost/config/compiler/hp_acc.hpp @@ -13,7 +13,7 @@ // HP aCC C++ compiler setup: #if defined(__EDG__) -#include "boost/config/compiler/common_edg.hpp" +#include #endif #if (__HP_aCC <= 33100) @@ -114,6 +114,7 @@ #define BOOST_NO_CXX11_RVALUE_REFERENCES #define BOOST_NO_CXX11_SCOPED_ENUMS #define BOOST_NO_SFINAE_EXPR +#define BOOST_NO_CXX11_SFINAE_EXPR #define BOOST_NO_CXX11_STATIC_ASSERT #define BOOST_NO_CXX11_TEMPLATE_ALIASES #define BOOST_NO_CXX11_UNICODE_LITERALS @@ -123,6 +124,7 @@ #define BOOST_NO_CXX11_TRAILING_RESULT_TYPES #define BOOST_NO_CXX11_INLINE_NAMESPACES #define BOOST_NO_CXX11_REF_QUALIFIERS +#define BOOST_NO_CXX11_THREAD_LOCAL /* See https://forums13.itrc.hp.com/service/forums/questionanswer.do?threadId=1443331 and diff --git a/3party/boost/boost/config/compiler/intel.hpp b/3party/boost/boost/config/compiler/intel.hpp index 36fb29723a..f55189a0ab 100644 --- a/3party/boost/boost/config/compiler/intel.hpp +++ b/3party/boost/boost/config/compiler/intel.hpp @@ -20,6 +20,9 @@ #include +#undef BOOST_MSVC +#undef BOOST_MSVC_FULL_VER + #if (__INTEL_COMPILER >= 1500) && (_MSC_VER >= 1900) // // These appear to be supported, even though VC++ may not support them: @@ -32,12 +35,24 @@ #endif -#else +#if (__INTEL_COMPILER <= 1600) && !defined(BOOST_NO_CXX14_VARIABLE_TEMPLATES) +# define BOOST_NO_CXX14_VARIABLE_TEMPLATES +#endif + +#else // defined(_MSC_VER) #include +#undef BOOST_GCC_VERSION +#undef BOOST_GCC_CXX11 + +// Broken in all versions up to 17 (newer versions not tested) +#if (__INTEL_COMPILER <= 1700) && !defined(BOOST_NO_CXX14_CONSTEXPR) +# define BOOST_NO_CXX14_CONSTEXPR #endif +#endif // defined(_MSC_VER) + #undef BOOST_COMPILER #if defined(__INTEL_COMPILER) @@ -82,9 +97,9 @@ # define BOOST_INTEL_LINUX BOOST_INTEL #endif -#else +#else // defined(__INTEL_COMPILER) && (__INTEL_COMPILER >= 1500) && (defined(_MSC_VER) || defined(__GNUC__)) -#include "boost/config/compiler/common_edg.hpp" +#include #if defined(__INTEL_COMPILER) #if __INTEL_COMPILER == 9999 @@ -298,7 +313,7 @@ template<> struct assert_intrinsic_wchar_t {}; #endif // // C++0x features -// For each feature we need to check both the Intel compiler version, +// For each feature we need to check both the Intel compiler version, // and the version of MSVC or GCC that we are emulating. // See http://software.intel.com/en-us/articles/c0x-features-supported-by-intel-c-compiler/ // for a list of which features were implemented in which Intel releases. @@ -400,6 +415,11 @@ template<> struct assert_intrinsic_wchar_t {}; # undef BOOST_NO_SFINAE_EXPR #endif +// BOOST_NO_CXX11_SFINAE_EXPR +#if (BOOST_INTEL_CXX_VERSION >= 1500) && (!defined(BOOST_INTEL_GCC_VERSION) || (BOOST_INTEL_GCC_VERSION >= 40800)) && !defined(_MSC_VER) +# undef BOOST_NO_CXX11_SFINAE_EXPR +#endif + // BOOST_NO_CXX11_EXPLICIT_CONVERSION_OPERATORS #if (BOOST_INTEL_CXX_VERSION >= 1500) && (!defined(BOOST_INTEL_GCC_VERSION) || (BOOST_INTEL_GCC_VERSION >= 40500)) && (!defined(_MSC_VER) || (_MSC_FULL_VER >= 180020827)) // This is available in earlier Intel releases, but breaks Multiprecision: @@ -433,7 +453,7 @@ template<> struct assert_intrinsic_wchar_t {}; // BOOST_NO_CXX11_NOEXCEPT #if (BOOST_INTEL_CXX_VERSION >= 1500) && (!defined(BOOST_INTEL_GCC_VERSION) || (BOOST_INTEL_GCC_VERSION >= 40600)) && (!defined(_MSC_VER) || (_MSC_VER >= 9999)) -// Available in earlier Intel release, but generates errors when used with +// Available in earlier Intel release, but generates errors when used with // conditional exception specifications, for example in multiprecision: # undef BOOST_NO_CXX11_NOEXCEPT #endif @@ -473,7 +493,7 @@ template<> struct assert_intrinsic_wchar_t {}; # undef BOOST_NO_CXX11_FINAL #endif -#endif +#endif // defined(BOOST_INTEL_STDCXX0X) // // Broken in all versions up to 15: @@ -508,14 +528,22 @@ template<> struct assert_intrinsic_wchar_t {}; # define BOOST_HAS_STDINT_H #endif -#if defined(__LP64__) && defined(__GNUC__) && (BOOST_INTEL_CXX_VERSION >= 1310) && !defined(__CUDACC__) +#if defined(__CUDACC__) +# if defined(BOOST_GCC_CXX11) +# define BOOST_NVCC_CXX11 +# else +# define BOOST_NVCC_CXX03 +# endif +#endif + +#if defined(__LP64__) && defined(__GNUC__) && (BOOST_INTEL_CXX_VERSION >= 1310) && !defined(BOOST_NVCC_CXX03) # define BOOST_HAS_INT128 #endif -#endif +#endif // defined(__INTEL_COMPILER) && (__INTEL_COMPILER >= 1500) && (defined(_MSC_VER) || defined(__GNUC__)) // // last known and checked version: -#if (BOOST_INTEL_CXX_VERSION > 1500) +#if (BOOST_INTEL_CXX_VERSION > 1700) # if defined(BOOST_ASSERT_CONFIG) # error "Unknown compiler version - please run the configure tests and report the results" # elif defined(_MSC_VER) diff --git a/3party/boost/boost/config/compiler/kai.hpp b/3party/boost/boost/config/compiler/kai.hpp index 2337e6a8dd..960d501c86 100644 --- a/3party/boost/boost/config/compiler/kai.hpp +++ b/3party/boost/boost/config/compiler/kai.hpp @@ -9,7 +9,7 @@ // Kai C++ compiler setup: -#include "boost/config/compiler/common_edg.hpp" +#include # if (__KCC_VERSION <= 4001) || !defined(BOOST_STRICT_CONFIG) // at least on Sun, the contents of is not in namespace std diff --git a/3party/boost/boost/config/compiler/metrowerks.hpp b/3party/boost/boost/config/compiler/metrowerks.hpp index c930143450..8d42563c34 100644 --- a/3party/boost/boost/config/compiler/metrowerks.hpp +++ b/3party/boost/boost/config/compiler/metrowerks.hpp @@ -113,6 +113,7 @@ #define BOOST_NO_CXX11_RAW_LITERALS #define BOOST_NO_CXX11_SCOPED_ENUMS #define BOOST_NO_SFINAE_EXPR +#define BOOST_NO_CXX11_SFINAE_EXPR #define BOOST_NO_CXX11_STATIC_ASSERT #define BOOST_NO_CXX11_TEMPLATE_ALIASES #define BOOST_NO_CXX11_UNICODE_LITERALS @@ -125,6 +126,7 @@ #define BOOST_NO_CXX11_INLINE_NAMESPACES #define BOOST_NO_CXX11_REF_QUALIFIERS #define BOOST_NO_CXX11_FINAL +#define BOOST_NO_CXX11_THREAD_LOCAL // C++ 14: #if !defined(__cpp_aggregate_nsdmi) || (__cpp_aggregate_nsdmi < 201304) diff --git a/3party/boost/boost/config/compiler/mpw.hpp b/3party/boost/boost/config/compiler/mpw.hpp index 76045bcd3f..1b8d39ea29 100644 --- a/3party/boost/boost/config/compiler/mpw.hpp +++ b/3party/boost/boost/config/compiler/mpw.hpp @@ -62,6 +62,7 @@ #define BOOST_NO_CXX11_RVALUE_REFERENCES #define BOOST_NO_CXX11_SCOPED_ENUMS #define BOOST_NO_SFINAE_EXPR +#define BOOST_NO_CXX11_SFINAE_EXPR #define BOOST_NO_CXX11_STATIC_ASSERT #define BOOST_NO_CXX11_TEMPLATE_ALIASES #define BOOST_NO_CXX11_UNICODE_LITERALS @@ -74,6 +75,7 @@ #define BOOST_NO_CXX11_INLINE_NAMESPACES #define BOOST_NO_CXX11_REF_QUALIFIERS #define BOOST_NO_CXX11_FINAL +#define BOOST_NO_CXX11_THREAD_LOCAL // C++ 14: #if !defined(__cpp_aggregate_nsdmi) || (__cpp_aggregate_nsdmi < 201304) diff --git a/3party/boost/boost/config/compiler/nvcc.hpp b/3party/boost/boost/config/compiler/nvcc.hpp index bbe81f6ee5..b31d4f4fa4 100644 --- a/3party/boost/boost/config/compiler/nvcc.hpp +++ b/3party/boost/boost/config/compiler/nvcc.hpp @@ -14,3 +14,19 @@ // NVIDIA Specific support // BOOST_GPU_ENABLED : Flag a function or a method as being enabled on the host and device #define BOOST_GPU_ENABLED __host__ __device__ + +// A bug in version 7.0 of CUDA prevents use of variadic templates in some occasions +// https://svn.boost.org/trac/boost/ticket/11897 +// This is fixed in 7.5. As the following version macro was introduced in 7.5 an existance +// check is enough to detect versions < 7.5 +#if !defined(__CUDACC_VER__) || (__CUDACC_VER__ < 70500) +# define BOOST_NO_CXX11_VARIADIC_TEMPLATES +#endif +// The same bug is back again in 8.0: +#if (__CUDACC_VER__ > 80000) && (__CUDACC_VER__ < 80100) +# define BOOST_NO_CXX11_VARIADIC_TEMPLATES +#endif +// Most recent CUDA (8.0) has no constexpr support in msvc mode: +#if defined(_MSC_VER) +# define BOOST_NO_CXX11_CONSTEXPR +#endif diff --git a/3party/boost/boost/config/compiler/pathscale.hpp b/3party/boost/boost/config/compiler/pathscale.hpp index 7c211c4517..016ad5a42f 100644 --- a/3party/boost/boost/config/compiler/pathscale.hpp +++ b/3party/boost/boost/config/compiler/pathscale.hpp @@ -37,6 +37,7 @@ # define BOOST_NO_CXX11_TEMPLATE_ALIASES # define BOOST_NO_CXX11_STATIC_ASSERT # define BOOST_NO_SFINAE_EXPR +# define BOOST_NO_CXX11_SFINAE_EXPR # define BOOST_NO_CXX11_SCOPED_ENUMS # define BOOST_NO_CXX11_RVALUE_REFERENCES # define BOOST_NO_CXX11_RANGE_BASED_FOR @@ -82,6 +83,7 @@ # define BOOST_NO_CXX11_INLINE_NAMESPACES # define BOOST_NO_CXX11_REF_QUALIFIERS # define BOOST_NO_CXX11_FINAL +# define BOOST_NO_CXX11_THREAD_LOCAL // C++ 14: #if !defined(__cpp_aggregate_nsdmi) || (__cpp_aggregate_nsdmi < 201304) diff --git a/3party/boost/boost/config/compiler/pgi.hpp b/3party/boost/boost/config/compiler/pgi.hpp index e5605c9ec2..af7005142f 100644 --- a/3party/boost/boost/config/compiler/pgi.hpp +++ b/3party/boost/boost/config/compiler/pgi.hpp @@ -88,6 +88,7 @@ #define BOOST_NO_CXX11_RVALUE_REFERENCES #define BOOST_NO_CXX11_SCOPED_ENUMS #define BOOST_NO_SFINAE_EXPR +#define BOOST_NO_CXX11_SFINAE_EXPR #define BOOST_NO_CXX11_STATIC_ASSERT #define BOOST_NO_SWPRINTF #define BOOST_NO_CXX11_TEMPLATE_ALIASES @@ -120,6 +121,7 @@ #define BOOST_NO_CXX11_INLINE_NAMESPACES #define BOOST_NO_CXX11_REF_QUALIFIERS #define BOOST_NO_CXX11_FINAL +#define BOOST_NO_CXX11_THREAD_LOCAL // C++ 14: #if !defined(__cpp_aggregate_nsdmi) || (__cpp_aggregate_nsdmi < 201304) diff --git a/3party/boost/boost/config/compiler/sgi_mipspro.hpp b/3party/boost/boost/config/compiler/sgi_mipspro.hpp index 90688314ad..54433c9978 100644 --- a/3party/boost/boost/config/compiler/sgi_mipspro.hpp +++ b/3party/boost/boost/config/compiler/sgi_mipspro.hpp @@ -9,7 +9,7 @@ #define BOOST_COMPILER "SGI Irix compiler version " BOOST_STRINGIZE(_COMPILER_VERSION) -#include "boost/config/compiler/common_edg.hpp" +#include // // Threading support: diff --git a/3party/boost/boost/config/compiler/sunpro_cc.hpp b/3party/boost/boost/config/compiler/sunpro_cc.hpp index 2fd6d3ece0..cdd30b14ea 100644 --- a/3party/boost/boost/config/compiler/sunpro_cc.hpp +++ b/3party/boost/boost/config/compiler/sunpro_cc.hpp @@ -125,25 +125,23 @@ #define BOOST_NO_CXX11_FINAL #endif -// -// Issues that effect all known versions: -// -// Variadic templates pass our test case, but enabling this -// causes the compiler to issue a signal 11 and bail out -// in various libraries. The others fail our test cases. -// +#if (__SUNPRO_CC < 0x5140) || (__cplusplus < 201103) #define BOOST_NO_CXX11_VARIADIC_TEMPLATES #define BOOST_NO_CXX11_UNIFIED_INITIALIZATION_SYNTAX #define BOOST_NO_CXX11_FIXED_LENGTH_VARIADIC_TEMPLATE_EXPANSION_PACKS #define BOOST_NO_CXX11_DECLTYPE_N3276 #define BOOST_NO_CXX11_USER_DEFINED_LITERALS #define BOOST_NO_CXX11_REF_QUALIFIERS +#define BOOST_NO_CXX11_THREAD_LOCAL +#endif + #define BOOST_NO_COMPLETE_VALUE_INITIALIZATION // // C++0x features // # define BOOST_HAS_LONG_LONG +#define BOOST_NO_CXX11_SFINAE_EXPR // C++ 14: #if !defined(__cpp_aggregate_nsdmi) || (__cpp_aggregate_nsdmi < 201304) @@ -155,7 +153,7 @@ #if !defined(__cpp_constexpr) || (__cpp_constexpr < 201304) # define BOOST_NO_CXX14_CONSTEXPR #endif -#if !defined(__cpp_decltype_auto) || (__cpp_decltype_auto < 201304) +#if !defined(__cpp_decltype_auto) || (__cpp_decltype_auto < 201304) || (__cplusplus < 201402L) # define BOOST_NO_CXX14_DECLTYPE_AUTO #endif #if (__cplusplus < 201304) // There's no SD6 check for this.... @@ -173,6 +171,13 @@ #if !defined(__cpp_variable_templates) || (__cpp_variable_templates < 201304) # define BOOST_NO_CXX14_VARIABLE_TEMPLATES #endif + +// Turn on threading support for Solaris 12. +// Ticket #11972 +#if (__SUNPRO_CC >= 0x5140) && defined(__SunOS_5_12) && !defined(BOOST_HAS_THREADS) +# define BOOST_HAS_THREADS +#endif + // // Version // diff --git a/3party/boost/boost/config/compiler/vacpp.hpp b/3party/boost/boost/config/compiler/vacpp.hpp index 6c228eab6e..b75a1bd144 100644 --- a/3party/boost/boost/config/compiler/vacpp.hpp +++ b/3party/boost/boost/config/compiler/vacpp.hpp @@ -114,6 +114,7 @@ # define BOOST_NO_CXX11_SCOPED_ENUMS #endif #define BOOST_NO_SFINAE_EXPR +#define BOOST_NO_CXX11_SFINAE_EXPR #define BOOST_NO_CXX11_UNIFIED_INITIALIZATION_SYNTAX #if ! __IBMCPP_STATIC_ASSERT # define BOOST_NO_CXX11_STATIC_ASSERT @@ -131,6 +132,7 @@ #define BOOST_NO_CXX11_INLINE_NAMESPACES #define BOOST_NO_CXX11_REF_QUALIFIERS #define BOOST_NO_CXX11_FINAL +#define BOOST_NO_CXX11_THREAD_LOCAL // C++ 14: #if !defined(__cpp_aggregate_nsdmi) || (__cpp_aggregate_nsdmi < 201304) diff --git a/3party/boost/boost/config/compiler/visualc.hpp b/3party/boost/boost/config/compiler/visualc.hpp index 5becb714b7..760e2833f8 100644 --- a/3party/boost/boost/config/compiler/visualc.hpp +++ b/3party/boost/boost/config/compiler/visualc.hpp @@ -55,6 +55,7 @@ # define BOOST_NO_CXX11_EXTERN_TEMPLATE // Variadic macros do not exist for VC7.1 and lower # define BOOST_NO_CXX11_VARIADIC_MACROS +# define BOOST_NO_CXX11_LOCAL_CLASS_TEMPLATE_PARAMETERS #endif #if _MSC_VER < 1500 // 140X == VC++ 8.0 @@ -157,6 +158,11 @@ # define BOOST_NO_CXX11_DECLTYPE_N3276 #endif +#if _MSC_FULL_VER >= 180020827 +#define BOOST_HAS_EXPM1 +#define BOOST_HAS_LOG1P +#endif + // C++11 features supported by VC++ 14 (aka 2015) // #if (_MSC_FULL_VER < 190023026) @@ -174,6 +180,21 @@ # define BOOST_NO_CXX14_BINARY_LITERALS # define BOOST_NO_CXX14_GENERIC_LAMBDAS # define BOOST_NO_CXX14_DIGIT_SEPARATORS +# define BOOST_NO_CXX11_THREAD_LOCAL +#endif +// C++11 features supported by VC++ 14 update 3 (aka 2015) +// +#if (_MSC_FULL_VER < 190024210) +# define BOOST_NO_CXX14_VARIABLE_TEMPLATES +# define BOOST_NO_SFINAE_EXPR +# define BOOST_NO_CXX11_CONSTEXPR +#endif + +// C++14 features supported by VC++ 14.1 (Visual Studio 2017) +// +#if (_MSC_VER < 1910) +# define BOOST_NO_CXX14_AGGREGATE_NSDMI +# define BOOST_NO_CXX14_CONSTEXPR #endif // MSVC including version 14 has not yet completely @@ -192,24 +213,30 @@ // See also: http://www.boost.org/libs/utility/value_init.htm#compiler_issues // (Niels Dekker, LKEB, May 2010) #define BOOST_NO_COMPLETE_VALUE_INITIALIZATION -// C++11 features not supported by any versions -#define BOOST_NO_SFINAE_EXPR +// +// C++ 11: +// #define BOOST_NO_TWO_PHASE_NAME_LOOKUP -// -// This is somewhat supported in VC14, but we may need to wait for -// a service release before enabling: -// -#define BOOST_NO_CXX11_CONSTEXPR +#define BOOST_NO_CXX11_SFINAE_EXPR -// C++ 14: -#if !defined(__cpp_aggregate_nsdmi) || (__cpp_aggregate_nsdmi < 201304) -# define BOOST_NO_CXX14_AGGREGATE_NSDMI +// +// Things that don't work in clr mode: +// +#ifdef _M_CEE +#ifndef BOOST_NO_CXX11_THREAD_LOCAL +# define BOOST_NO_CXX11_THREAD_LOCAL #endif -#if !defined(__cpp_constexpr) || (__cpp_constexpr < 201304) -# define BOOST_NO_CXX14_CONSTEXPR +#ifndef BOOST_NO_SFINAE_EXPR +# define BOOST_NO_SFINAE_EXPR +#endif +#ifndef BOOST_NO_CXX11_REF_QUALIFIERS +# define BOOST_NO_CXX11_REF_QUALIFIERS +#endif +#endif +#ifdef _M_CEE_PURE +#ifndef BOOST_NO_CXX11_CONSTEXPR +# define BOOST_NO_CXX11_CONSTEXPR #endif -#if !defined(__cpp_variable_templates) || (__cpp_variable_templates < 201304) -# define BOOST_NO_CXX14_VARIABLE_TEMPLATES #endif // @@ -247,7 +274,7 @@ # define BOOST_COMPILER_VERSION evc11 # elif _MSC_VER < 1900 # define BOOST_COMPILER_VERSION evc12 -# elif _MSC_VER < 2000 +# elif _MSC_VER < 2000 # define BOOST_COMPILER_VERSION evc14 # else # if defined(BOOST_ASSERT_CONFIG) @@ -276,8 +303,10 @@ # define BOOST_COMPILER_VERSION 11.0 # elif _MSC_VER < 1900 # define BOOST_COMPILER_VERSION 12.0 -# elif _MSC_VER < 2000 +# elif _MSC_VER < 1910 # define BOOST_COMPILER_VERSION 14.0 +# elif _MSC_VER < 1920 +# define BOOST_COMPILER_VERSION 14.1 # else # define BOOST_COMPILER_VERSION _MSC_VER # endif @@ -287,8 +316,8 @@ #endif // -// last known and checked version is 19.00.23026 (VC++ 2015 RTM): -#if (_MSC_VER > 1900) +// last known and checked version is 19.10.25017 (VC++ 2017): +#if (_MSC_VER > 1910) # if defined(BOOST_ASSERT_CONFIG) # error "Unknown compiler version - please run the configure tests and report the results" # else diff --git a/3party/boost/boost/config/compiler/xlcpp.hpp b/3party/boost/boost/config/compiler/xlcpp.hpp index 3592bed708..2aaafc3b66 100644 --- a/3party/boost/boost/config/compiler/xlcpp.hpp +++ b/3party/boost/boost/config/compiler/xlcpp.hpp @@ -238,6 +238,10 @@ # define BOOST_NO_CXX14_VARIABLE_TEMPLATES #endif +#if !__has_feature(cxx_thread_local) +# define BOOST_NO_CXX11_THREAD_LOCAL +#endif + #if __cplusplus < 201400 // All versions with __cplusplus above this value seem to support this: # define BOOST_NO_CXX14_DIGIT_SEPARATORS @@ -255,3 +259,4 @@ // Macro used to identify the Clang compiler. #define BOOST_CLANG 1 + diff --git a/3party/boost/boost/config/platform/cloudabi.hpp b/3party/boost/boost/config/platform/cloudabi.hpp new file mode 100644 index 0000000000..bed7b6318d --- /dev/null +++ b/3party/boost/boost/config/platform/cloudabi.hpp @@ -0,0 +1,18 @@ +// Copyright Nuxi, https://nuxi.nl/ 2015. +// 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) + +#define BOOST_PLATFORM "CloudABI" + +#define BOOST_HAS_DIRENT_H +#define BOOST_HAS_STDINT_H +#define BOOST_HAS_UNISTD_H + +#define BOOST_HAS_CLOCK_GETTIME +#define BOOST_HAS_EXPM1 +#define BOOST_HAS_GETTIMEOFDAY +#define BOOST_HAS_LOG1P +#define BOOST_HAS_NANOSLEEP +#define BOOST_HAS_PTHREADS +#define BOOST_HAS_SCHED_YIELD diff --git a/3party/boost/boost/config/platform/cygwin.hpp b/3party/boost/boost/config/platform/cygwin.hpp index b7ef572fa6..53e23f7f08 100644 --- a/3party/boost/boost/config/platform/cygwin.hpp +++ b/3party/boost/boost/config/platform/cygwin.hpp @@ -23,7 +23,7 @@ # define BOOST_HAS_SCHED_YIELD # define BOOST_HAS_GETTIMEOFDAY # define BOOST_HAS_PTHREAD_MUTEXATTR_SETTYPE -# define BOOST_HAS_SIGACTION +//# define BOOST_HAS_SIGACTION #else # if !defined(BOOST_HAS_WINTHREADS) # define BOOST_HAS_WINTHREADS @@ -51,7 +51,6 @@ #ifdef BOOST_HAS_NL_TYPES_H # undef BOOST_HAS_NL_TYPES_H #endif - diff --git a/3party/boost/boost/config/platform/linux.hpp b/3party/boost/boost/config/platform/linux.hpp index 6fa5f45be4..8c43c7b6d3 100644 --- a/3party/boost/boost/config/platform/linux.hpp +++ b/3party/boost/boost/config/platform/linux.hpp @@ -72,7 +72,7 @@ // boilerplate code: #define BOOST_HAS_UNISTD_H #include -#ifdef __USE_GNU +#if defined(__USE_GNU) && !defined(__ANDROID__) && !defined(ANDROID) #define BOOST_HAS_PTHREAD_YIELD #endif diff --git a/3party/boost/boost/config/platform/macos.hpp b/3party/boost/boost/config/platform/macos.hpp index 6d876b12db..5be4e3b3da 100644 --- a/3party/boost/boost/config/platform/macos.hpp +++ b/3party/boost/boost/config/platform/macos.hpp @@ -47,7 +47,7 @@ # define BOOST_NO_STDC_NAMESPACE # endif -# if (__GNUC__ == 4) +# if (__GNUC__ >= 4) // Both gcc and intel require these. # define BOOST_HAS_PTHREAD_MUTEXATTR_SETTYPE diff --git a/3party/boost/boost/config/platform/solaris.hpp b/3party/boost/boost/config/platform/solaris.hpp index cf364ce23d..6e4efc9e56 100644 --- a/3party/boost/boost/config/platform/solaris.hpp +++ b/3party/boost/boost/config/platform/solaris.hpp @@ -23,9 +23,9 @@ # undef BOOST_HAS_PTHREADS #endif -#define BOOST_HAS_STDINT_H -#define BOOST_HAS_PTHREAD_MUTEXATTR_SETTYPE -#define BOOST_HAS_LOG1P +#define BOOST_HAS_STDINT_H +#define BOOST_HAS_PTHREAD_MUTEXATTR_SETTYPE +#define BOOST_HAS_LOG1P #define BOOST_HAS_EXPM1 diff --git a/3party/boost/boost/config/platform/win32.hpp b/3party/boost/boost/config/platform/win32.hpp index 60a29abe83..450158fbaa 100644 --- a/3party/boost/boost/config/platform/win32.hpp +++ b/3party/boost/boost/config/platform/win32.hpp @@ -74,6 +74,14 @@ # define BOOST_HAS_GETSYSTEMTIMEASFILETIME #endif +// +// Windows Runtime +// +#if defined(WINAPI_FAMILY) && \ + (WINAPI_FAMILY == WINAPI_FAMILY_APP || WINAPI_FAMILY == WINAPI_FAMILY_PHONE_APP) +# define BOOST_NO_ANSI_APIS +#endif + #ifndef BOOST_DISABLE_WIN32 // WEK: Added #define BOOST_HAS_FTIME diff --git a/3party/boost/boost/config/select_compiler_config.hpp b/3party/boost/boost/config/select_compiler_config.hpp index 4d87093af3..7a75708428 100644 --- a/3party/boost/boost/config/select_compiler_config.hpp +++ b/3party/boost/boost/config/select_compiler_config.hpp @@ -122,27 +122,27 @@ // // This section allows dependency scanners to find all the headers we *might* include: // -#include "boost/config/compiler/gcc_xml.hpp" -#include "boost/config/compiler/cray.hpp" -#include "boost/config/compiler/comeau.hpp" -#include "boost/config/compiler/pathscale.hpp" -#include "boost/config/compiler/intel.hpp" -#include "boost/config/compiler/clang.hpp" -#include "boost/config/compiler/digitalmars.hpp" -#include "boost/config/compiler/gcc.hpp" -#include "boost/config/compiler/kai.hpp" -#include "boost/config/compiler/sgi_mipspro.hpp" -#include "boost/config/compiler/compaq_cxx.hpp" -#include "boost/config/compiler/greenhills.hpp" -#include "boost/config/compiler/codegear.hpp" -#include "boost/config/compiler/borland.hpp" -#include "boost/config/compiler/metrowerks.hpp" -#include "boost/config/compiler/sunpro_cc.hpp" -#include "boost/config/compiler/hp_acc.hpp" -#include "boost/config/compiler/mpw.hpp" -#include "boost/config/compiler/vacpp.hpp" -#include "boost/config/compiler/pgi.hpp" -#include "boost/config/compiler/visualc.hpp" +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include #endif diff --git a/3party/boost/boost/config/select_platform_config.hpp b/3party/boost/boost/config/select_platform_config.hpp index acd1409ebc..62fd818b93 100644 --- a/3party/boost/boost/config/select_platform_config.hpp +++ b/3party/boost/boost/config/select_platform_config.hpp @@ -80,6 +80,10 @@ #elif defined(__VMS) // VMS: # define BOOST_PLATFORM_CONFIG "boost/config/platform/vms.hpp" + +#elif defined(__CloudABI__) +// Nuxi CloudABI: +# define BOOST_PLATFORM_CONFIG "boost/config/platform/cloudabi.hpp" #else # if defined(unix) \ diff --git a/3party/boost/boost/config/select_stdlib_config.hpp b/3party/boost/boost/config/select_stdlib_config.hpp index 0dd7925318..e270a8813a 100644 --- a/3party/boost/boost/config/select_stdlib_config.hpp +++ b/3party/boost/boost/config/select_stdlib_config.hpp @@ -29,11 +29,11 @@ #else // If our std lib was not some version of STLport, and has not otherwise -// been detected, then include as it is about +// been detected, then include as it is about // the smallest of the std lib headers that includes real C++ stuff. -// Some std libs do not include their C++-related macros in +// Some std libs do not include their C++-related macros in // so this additional include makes sure we get those definitions. -// Note: do not rely on this header being included since users can short-circuit this +// Note: do not rely on this header being included since users can short-circuit this // #include if they know whose std lib they are using. #if !defined(__LIBCOMO__) && !defined(__STD_RWCOMPILER_H__) && !defined(_RWSTD_VER)\ && !defined(_LIBCPP_VERSION) && !defined(__GLIBCPP__) && !defined(__GLIBCXX__)\ diff --git a/3party/boost/boost/config/stdlib/dinkumware.hpp b/3party/boost/boost/config/stdlib/dinkumware.hpp index 45f9b56958..3b95dcf3b5 100644 --- a/3party/boost/boost/config/stdlib/dinkumware.hpp +++ b/3party/boost/boost/config/stdlib/dinkumware.hpp @@ -150,13 +150,24 @@ #if defined(__has_include) #if !__has_include() # define BOOST_NO_CXX14_HDR_SHARED_MUTEX -#elif __cplusplus < 201402 +#elif (__cplusplus < 201402) && !defined(_MSC_VER) # define BOOST_NO_CXX14_HDR_SHARED_MUTEX #endif #elif !defined(_CPPLIB_VER) || (_CPPLIB_VER < 650) # define BOOST_NO_CXX14_HDR_SHARED_MUTEX #endif +// C++14 features +#if !defined(_CPPLIB_VER) || (_CPPLIB_VER < 650) +# define BOOST_NO_CXX14_STD_EXCHANGE +#endif + +// C++17 features +# define BOOST_NO_CXX17_STD_APPLY +#if !defined(_CPPLIB_VER) || (_CPPLIB_VER < 650) +# define BOOST_NO_CXX17_STD_INVOKE +#endif + #if defined(BOOST_INTEL) && (BOOST_INTEL <= 1400) // Intel's compiler can't handle this header yet: # define BOOST_NO_CXX11_HDR_ATOMIC @@ -169,13 +180,52 @@ # define BOOST_NO_CXX11_ADDRESSOF #endif -// Bug specific to VC14, +// Bug specific to VC14, // See https://connect.microsoft.com/VisualStudio/feedback/details/1348277/link-error-when-using-std-codecvt-utf8-utf16-char16-t // and discussion here: http://blogs.msdn.com/b/vcblog/archive/2014/11/12/visual-studio-2015-preview-now-available.aspx?PageIndex=2 -#if _CPPLIB_VER == 650 +#if defined(_CPPLIB_VER) && (_CPPLIB_VER == 650) # define BOOST_NO_CXX11_HDR_CODECVT #endif +#if defined(_CPPLIB_VER) && (_CPPLIB_VER >= 650) +// If _HAS_AUTO_PTR_ETC is defined to 0, std::auto_ptr is not available. +// See https://www.visualstudio.com/en-us/news/vs2015-vs.aspx#C++ +// and http://blogs.msdn.com/b/vcblog/archive/2015/06/19/c-11-14-17-features-in-vs-2015-rtm.aspx +# if defined(_HAS_AUTO_PTR_ETC) && (_HAS_AUTO_PTR_ETC == 0) +# define BOOST_NO_AUTO_PTR +# endif +#endif + + +// +// Things not supported by the CLR: +#ifdef _M_CEE +#ifndef BOOST_NO_CXX11_HDR_MUTEX +# define BOOST_NO_CXX11_HDR_MUTEX +#endif +#ifndef BOOST_NO_CXX11_HDR_ATOMIC +# define BOOST_NO_CXX11_HDR_ATOMIC +#endif +#ifndef BOOST_NO_CXX11_HDR_FUTURE +# define BOOST_NO_CXX11_HDR_FUTURE +#endif +#ifndef BOOST_NO_CXX11_HDR_CONDITION_VARIABLE +# define BOOST_NO_CXX11_HDR_CONDITION_VARIABLE +#endif +#ifndef BOOST_NO_CXX11_HDR_THREAD +# define BOOST_NO_CXX11_HDR_THREAD +#endif +#ifndef BOOST_NO_CXX14_HDR_SHARED_MUTEX +# define BOOST_NO_CXX14_HDR_SHARED_MUTEX +#endif +#ifndef BOOST_NO_CXX14_STD_EXCHANGE +# define BOOST_NO_CXX14_STD_EXCHANGE +#endif +#ifndef BOOST_NO_FENV_H +# define BOOST_NO_FENV_H +#endif +#endif + #ifdef _CPPLIB_VER # define BOOST_DINKUMWARE_STDLIB _CPPLIB_VER #else diff --git a/3party/boost/boost/config/stdlib/libcomo.hpp b/3party/boost/boost/config/stdlib/libcomo.hpp index 941498d076..e3fc627f6f 100644 --- a/3party/boost/boost/config/stdlib/libcomo.hpp +++ b/3party/boost/boost/config/stdlib/libcomo.hpp @@ -72,6 +72,13 @@ # define BOOST_NO_CXX14_HDR_SHARED_MUTEX #endif +// C++14 features +# define BOOST_NO_CXX14_STD_EXCHANGE + +// C++17 features +# define BOOST_NO_CXX17_STD_APPLY +# define BOOST_NO_CXX17_STD_INVOKE + // // Intrinsic type_traits support. // The SGI STL has it's own __type_traits class, which diff --git a/3party/boost/boost/config/stdlib/libcpp.hpp b/3party/boost/boost/config/stdlib/libcpp.hpp index ab5d123544..2eea99977d 100644 --- a/3party/boost/boost/config/stdlib/libcpp.hpp +++ b/3party/boost/boost/config/stdlib/libcpp.hpp @@ -32,10 +32,14 @@ #endif #if __cplusplus < 201103 -# define BOOST_NO_CXX11_HDR_ARRAY +// +// These two appear to be somewhat useable in C++03 mode, there may be others... +// +//# define BOOST_NO_CXX11_HDR_ARRAY +//# define BOOST_NO_CXX11_HDR_FORWARD_LIST + # define BOOST_NO_CXX11_HDR_CODECVT # define BOOST_NO_CXX11_HDR_CONDITION_VARIABLE -# define BOOST_NO_CXX11_HDR_FORWARD_LIST # define BOOST_NO_CXX11_HDR_INITIALIZER_LIST # define BOOST_NO_CXX11_HDR_MUTEX # define BOOST_NO_CXX11_HDR_RANDOM @@ -53,19 +57,48 @@ # define BOOST_NO_CXX11_HDR_FUNCTIONAL # define BOOST_NO_CXX11_STD_ALIGN # define BOOST_NO_CXX11_ADDRESSOF -#endif - +# define BOOST_NO_CXX11_HDR_ATOMIC +# define BOOST_NO_CXX11_ATOMIC_SMART_PTR +# define BOOST_NO_CXX11_HDR_CHRONO +# define BOOST_NO_CXX11_HDR_TYPE_TRAITS +# define BOOST_NO_CXX11_HDR_FUTURE +#elif _LIBCPP_VERSION < 3700 // // These appear to be unusable/incomplete so far: // -# define BOOST_NO_CXX11_HDR_CHRONO -# define BOOST_NO_CXX11_HDR_FUTURE -# define BOOST_NO_CXX11_HDR_TYPE_TRAITS -# define BOOST_NO_CXX11_ATOMIC_SMART_PTR # define BOOST_NO_CXX11_HDR_ATOMIC +# define BOOST_NO_CXX11_ATOMIC_SMART_PTR +# define BOOST_NO_CXX11_HDR_CHRONO +# define BOOST_NO_CXX11_HDR_TYPE_TRAITS +# define BOOST_NO_CXX11_HDR_FUTURE +#endif + +#if _LIBCPP_VERSION < 3700 // libc++ uses a non-standard messages_base #define BOOST_NO_STD_MESSAGES +#endif + +// C++14 features +#if (_LIBCPP_VERSION < 3700) || (__cplusplus <= 201402L) +# define BOOST_NO_CXX14_STD_EXCHANGE +#endif + +// C++17 features +#if (_LIBCPP_VERSION < 3700) || (__cplusplus <= 201402L) +# define BOOST_NO_CXX17_STD_INVOKE +#endif +#if (_LIBCPP_VERSION < 4000) || (__cplusplus <= 201402L) +# define BOOST_NO_CXX17_STD_APPLY +#endif + +#if (_LIBCPP_VERSION <= 1101) && !defined(BOOST_NO_CXX11_THREAD_LOCAL) +// This is a bit of a sledgehammer, because really it's just libc++abi that has no +// support for thread_local, leading to linker errors such as +// "undefined reference to `__cxa_thread_atexit'". It is fixed in the +// most recent releases of libc++abi though... +# define BOOST_NO_CXX11_THREAD_LOCAL +#endif #if defined(__has_include) #if !__has_include() diff --git a/3party/boost/boost/config/stdlib/libstdcpp3.hpp b/3party/boost/boost/config/stdlib/libstdcpp3.hpp index 2827294a78..205489a920 100644 --- a/3party/boost/boost/config/stdlib/libstdcpp3.hpp +++ b/3party/boost/boost/config/stdlib/libstdcpp3.hpp @@ -98,10 +98,11 @@ #if defined(__GXX_EXPERIMENTAL_CXX0X__) || (__cplusplus >= 201103) # define BOOST_LIBSTDCXX11 #endif + // // Decide which version of libstdc++ we have, normally -// stdlibc++ C++0x support is detected via __GNUC__, __GNUC_MINOR__, and possibly -// __GNUC_PATCHLEVEL__ at the suggestion of Jonathan Wakely, one of the stdlibc++ +// libstdc++ C++0x support is detected via __GNUC__, __GNUC_MINOR__, and possibly +// __GNUC_PATCHLEVEL__ at the suggestion of Jonathan Wakely, one of the libstdc++ // developers. He also commented: // // "I'm not sure how useful __GLIBCXX__ is for your purposes, for instance in @@ -109,7 +110,7 @@ // Although 4.3.0 was released earlier than 4.2.4, it has better C++0x support // than any release in the 4.2 series." // -// Another resource for understanding stdlibc++ features is: +// Another resource for understanding libstdc++ features is: // http://gcc.gnu.org/onlinedocs/libstdc++/manual/status.html#manual.intro.status.standard.200x // // However, using the GCC version number fails when the compiler is clang since this @@ -122,7 +123,9 @@ // #ifdef __clang__ -#if __has_include() +#if __has_include() +# define BOOST_LIBSTDCXX_VERSION 60100 +#elif __has_include() # define BOOST_LIBSTDCXX_VERSION 50100 #elif __has_include() # define BOOST_LIBSTDCXX_VERSION 40900 @@ -139,6 +142,7 @@ #elif __has_include() # define BOOST_LIBSTDCXX_VERSION 40300 #endif + // // GCC 4.8 and 9 add working versions of and respectively. // However, we have no test for these as the headers were present but broken @@ -148,16 +152,32 @@ #if defined(__SUNPRO_CC) && (__SUNPRO_CC >= 0x5130) && (__cplusplus >= 201103L) // -// Oracle Solaris compiler uses it's own verison of libstdc++ but doesn't +// Oracle Solaris compiler uses it's own verison of libstdc++ but doesn't // set __GNUC__ // +#if __SUNPRO_CC >= 0x5140 +#define BOOST_LIBSTDCXX_VERSION 50100 +#else #define BOOST_LIBSTDCXX_VERSION 40800 #endif +#endif #if !defined(BOOST_LIBSTDCXX_VERSION) # define BOOST_LIBSTDCXX_VERSION (__GNUC__ * 10000 + __GNUC_MINOR__ * 100 + __GNUC_PATCHLEVEL__) #endif +// std::auto_ptr isn't provided with _GLIBCXX_DEPRECATED=0 (GCC 4.5 and earlier) +// or _GLIBCXX_USE_DEPRECATED=0 (GCC 4.6 and later). +#if defined(BOOST_LIBSTDCXX11) +# if BOOST_LIBSTDCXX_VERSION < 40600 +# if !_GLIBCXX_DEPRECATED +# define BOOST_NO_AUTO_PTR +# endif +# elif !_GLIBCXX_USE_DEPRECATED +# define BOOST_NO_AUTO_PTR +# endif +#endif + // C++0x headers in GCC 4.3.0 and later // #if (BOOST_LIBSTDCXX_VERSION < 40300) || !defined(BOOST_LIBSTDCXX11) @@ -202,7 +222,7 @@ // #if (BOOST_LIBSTDCXX_VERSION < 40700) || !defined(BOOST_LIBSTDCXX11) // Note that although existed prior to 4.7, "steady_clock" is spelled "monotonic_clock" -// so 4.7.0 is the first truely conforming one. +// so 4.7.0 is the first truly conforming one. # define BOOST_NO_CXX11_HDR_CHRONO # define BOOST_NO_CXX11_ALLOCATOR #endif @@ -220,6 +240,9 @@ // even for the simplest patterns such as "\d" or "[0-9]". This is the case at least in gcc up to 4.8, inclusively. # define BOOST_NO_CXX11_HDR_REGEX #endif +#if (BOOST_LIBSTDCXX_VERSION < 40900) || (__cplusplus <= 201103) +# define BOOST_NO_CXX14_STD_EXCHANGE +#endif #if defined(__clang_major__) && ((__clang_major__ < 3) || ((__clang_major__ == 3) && (__clang_minor__ < 7))) // As of clang-3.6, libstdc++ header throws up errors with clang: @@ -235,6 +258,16 @@ # define BOOST_NO_CXX11_STD_ALIGN #endif +// +// C++17 features in GCC 6.1 and later +// +#if (BOOST_LIBSTDCXX_VERSION < 60100) || (__cplusplus <= 201402L) +# define BOOST_NO_CXX17_STD_INVOKE +#endif +#if (BOOST_LIBSTDCXX_VERSION < 70100) || (__cplusplus <= 201402L) +# define BOOST_NO_CXX17_STD_APPLY +#endif + #if defined(__has_include) #if !__has_include() # define BOOST_NO_CXX14_HDR_SHARED_MUTEX @@ -247,10 +280,14 @@ // // Headers not present on Solaris with the Oracle compiler: -#if defined(__SUNPRO_CC) +#if defined(__SUNPRO_CC) && (__SUNPRO_CC < 0x5140) #define BOOST_NO_CXX11_HDR_FUTURE -#define BOOST_NO_CXX11_HDR_FORWARD_LIST +#define BOOST_NO_CXX11_HDR_FORWARD_LIST #define BOOST_NO_CXX11_HDR_ATOMIC +// shared_ptr is present, but is not convertible to bool +// which causes all kinds of problems especially in Boost.Thread +// but probably elsewhere as well. +#define BOOST_NO_CXX11_SMART_PTR #endif #if (!defined(_GLIBCXX_HAS_GTHREADS) || !defined(_GLIBCXX_USE_C99_STDINT_TR1)) diff --git a/3party/boost/boost/config/stdlib/modena.hpp b/3party/boost/boost/config/stdlib/modena.hpp index 7a85e0cd57..fa4a818715 100644 --- a/3party/boost/boost/config/stdlib/modena.hpp +++ b/3party/boost/boost/config/stdlib/modena.hpp @@ -61,6 +61,13 @@ # define BOOST_NO_CXX14_HDR_SHARED_MUTEX #endif +// C++14 features +# define BOOST_NO_CXX14_STD_EXCHANGE + +// C++17 features +# define BOOST_NO_CXX17_STD_APPLY +# define BOOST_NO_CXX17_STD_INVOKE + #define BOOST_STDLIB "Modena C++ standard library" diff --git a/3party/boost/boost/config/stdlib/msl.hpp b/3party/boost/boost/config/stdlib/msl.hpp index dd2775e10c..8f21a1388d 100644 --- a/3party/boost/boost/config/stdlib/msl.hpp +++ b/3party/boost/boost/config/stdlib/msl.hpp @@ -85,4 +85,11 @@ # define BOOST_NO_CXX14_HDR_SHARED_MUTEX #endif +// C++14 features +# define BOOST_NO_CXX14_STD_EXCHANGE + +// C++17 features +# define BOOST_NO_CXX17_STD_APPLY +# define BOOST_NO_CXX17_STD_INVOKE + #define BOOST_STDLIB "Metrowerks Standard Library version " BOOST_STRINGIZE(__MSL_CPP__) diff --git a/3party/boost/boost/config/stdlib/roguewave.hpp b/3party/boost/boost/config/stdlib/roguewave.hpp index 97a2b0b90b..437d38d97c 100644 --- a/3party/boost/boost/config/stdlib/roguewave.hpp +++ b/3party/boost/boost/config/stdlib/roguewave.hpp @@ -196,3 +196,10 @@ #else # define BOOST_NO_CXX14_HDR_SHARED_MUTEX #endif + +// C++14 features +# define BOOST_NO_CXX14_STD_EXCHANGE + +// C++17 features +# define BOOST_NO_CXX17_STD_APPLY +# define BOOST_NO_CXX17_STD_INVOKE diff --git a/3party/boost/boost/config/stdlib/sgi.hpp b/3party/boost/boost/config/stdlib/sgi.hpp index c8052717ce..8d2f849f70 100644 --- a/3party/boost/boost/config/stdlib/sgi.hpp +++ b/3party/boost/boost/config/stdlib/sgi.hpp @@ -155,4 +155,11 @@ # define BOOST_NO_CXX14_HDR_SHARED_MUTEX #endif -#define BOOST_STDLIB "SGI standard library" \ No newline at end of file +// C++14 features +# define BOOST_NO_CXX14_STD_EXCHANGE + +// C++17 features +# define BOOST_NO_CXX17_STD_APPLY +# define BOOST_NO_CXX17_STD_INVOKE + +#define BOOST_STDLIB "SGI standard library" diff --git a/3party/boost/boost/config/stdlib/stlport.hpp b/3party/boost/boost/config/stdlib/stlport.hpp index bbc4176c90..518f9efd4a 100644 --- a/3party/boost/boost/config/stdlib/stlport.hpp +++ b/3party/boost/boost/config/stdlib/stlport.hpp @@ -245,4 +245,11 @@ namespace boost { using std::min; using std::max; } # define BOOST_NO_CXX14_HDR_SHARED_MUTEX #endif +// C++14 features +# define BOOST_NO_CXX14_STD_EXCHANGE + +// C++17 features +# define BOOST_NO_CXX17_STD_APPLY +# define BOOST_NO_CXX17_STD_INVOKE + #define BOOST_STDLIB "STLPort standard library version " BOOST_STRINGIZE(__SGI_STL_PORT) diff --git a/3party/boost/boost/config/stdlib/vacpp.hpp b/3party/boost/boost/config/stdlib/vacpp.hpp index 4ccd0d2466..f9afef6387 100644 --- a/3party/boost/boost/config/stdlib/vacpp.hpp +++ b/3party/boost/boost/config/stdlib/vacpp.hpp @@ -61,4 +61,11 @@ # define BOOST_NO_CXX14_HDR_SHARED_MUTEX #endif +// C++14 features +# define BOOST_NO_CXX14_STD_EXCHANGE + +// C++17 features +# define BOOST_NO_CXX17_STD_APPLY +# define BOOST_NO_CXX17_STD_INVOKE + #define BOOST_STDLIB "Visual Age default standard library" diff --git a/3party/boost/boost/config/suffix.hpp b/3party/boost/boost/config/suffix.hpp index c0ba333918..6df9223fb2 100644 --- a/3party/boost/boost/config/suffix.hpp +++ b/3party/boost/boost/config/suffix.hpp @@ -444,10 +444,12 @@ namespace std { // is defined, in which case it evaluates to return x; Use when you have a return // statement that can never be reached. -#ifdef BOOST_NO_UNREACHABLE_RETURN_DETECTION -# define BOOST_UNREACHABLE_RETURN(x) return x; -#else -# define BOOST_UNREACHABLE_RETURN(x) +#ifndef BOOST_UNREACHABLE_RETURN +# ifdef BOOST_NO_UNREACHABLE_RETURN_DETECTION +# define BOOST_UNREACHABLE_RETURN(x) return x; +# else +# define BOOST_UNREACHABLE_RETURN(x) +# endif #endif // BOOST_DEDUCED_TYPENAME workaround ------------------------------------------// @@ -501,6 +503,16 @@ namespace boost{ # endif } #endif +// same again for __float128: +#if defined(BOOST_HAS_FLOAT128) && defined(__cplusplus) +namespace boost { +# ifdef __GNUC__ + __extension__ typedef __float128 float128_type; +# else + typedef __float128 float128_type; +# endif +} +#endif // BOOST_[APPEND_]EXPLICIT_TEMPLATE_[NON_]TYPE macros --------------------------// @@ -571,6 +583,25 @@ namespace std{ using ::type_info; } # define BOOST_GPU_ENABLED # endif +// BOOST_RESTRICT ---------------------------------------------// +// Macro to use in place of 'restrict' keyword variants +#if !defined(BOOST_RESTRICT) +# if defined(_MSC_VER) +# define BOOST_RESTRICT __restrict +# if !defined(BOOST_NO_RESTRICT_REFERENCES) && (_MSC_FULL_VER < 190023026) +# define BOOST_NO_RESTRICT_REFERENCES +# endif +# elif defined(__GNUC__) && __GNUC__ > 3 + // Clang also defines __GNUC__ (as 4) +# define BOOST_RESTRICT __restrict__ +# else +# define BOOST_RESTRICT +# if !defined(BOOST_NO_RESTRICT_REFERENCES) +# define BOOST_NO_RESTRICT_REFERENCES +# endif +# endif +#endif + // BOOST_FORCEINLINE ---------------------------------------------// // Macro to use in place of 'inline' to force a function to be inline #if !defined(BOOST_FORCEINLINE) @@ -592,7 +623,7 @@ namespace std{ using ::type_info; } # elif defined(__GNUC__) && __GNUC__ > 3 // Clang also defines __GNUC__ (as 4) # if defined(__CUDACC__) - // nvcc doesn't always parse __noinline__, + // nvcc doesn't always parse __noinline__, // see: https://svn.boost.org/trac/boost/ticket/9392 # define BOOST_NOINLINE __attribute__ ((noinline)) # else @@ -612,12 +643,22 @@ namespace std{ using ::type_info; } # define BOOST_NORETURN __declspec(noreturn) # elif defined(__GNUC__) # define BOOST_NORETURN __attribute__ ((__noreturn__)) -# else -# define BOOST_NO_NORETURN -# define BOOST_NORETURN +# elif defined(__has_attribute) && defined(__SUNPRO_CC) +# if __has_attribute(noreturn) +# define BOOST_NORETURN [[noreturn]] +# endif +# elif defined(__has_cpp_attribute) +# if __has_cpp_attribute(noreturn) +# define BOOST_NORETURN [[noreturn]] +# endif # endif #endif +#if !defined(BOOST_NORETURN) +# define BOOST_NO_NORETURN +# define BOOST_NORETURN +#endif + // Branch prediction hints // These macros are intended to wrap conditional expressions that yield true or false // diff --git a/3party/boost/boost/container/adaptive_pool.hpp b/3party/boost/boost/container/adaptive_pool.hpp index 59ba37bc93..ac14fb397e 100644 --- a/3party/boost/boost/container/adaptive_pool.hpp +++ b/3party/boost/boost/container/adaptive_pool.hpp @@ -27,7 +27,7 @@ #include #include #include -#include +#include #include #include @@ -121,8 +121,6 @@ class adaptive_pool adaptive_pool& operator= (const adaptive_pool&); - //!Not assignable from other adaptive_pool - adaptive_pool& operator=(const adaptive_pool&); #endif //#ifndef BOOST_CONTAINER_DOXYGEN_INVOKED public: @@ -164,7 +162,7 @@ class adaptive_pool return pointer(static_cast(singleton_t::instance().allocate_node())); } else{ - return static_cast(boost_cont_malloc(count*sizeof(T))); + return static_cast(dlmalloc_malloc(count*sizeof(T))); } } @@ -180,7 +178,7 @@ class adaptive_pool singleton_t::instance().deallocate_node(ptr); } else{ - boost_cont_free(ptr); + dlmalloc_free(ptr); } } @@ -198,7 +196,7 @@ class adaptive_pool //!Returns maximum the number of objects the previously allocated memory //!pointed by p can hold. size_type size(pointer p) const BOOST_NOEXCEPT_OR_NOTHROW - { return boost_cont_size(p); } + { return dlmalloc_size(p); } //!Allocates just one object. Memory allocated with this function //!must be deallocated only with deallocate_one(). @@ -251,17 +249,17 @@ class adaptive_pool void allocate_many(size_type elem_size, std::size_t n_elements, multiallocation_chain &chain) { BOOST_STATIC_ASSERT(( Version > 1 ));/* - boost_cont_memchain ch; + dlmalloc_memchain ch; BOOST_CONTAINER_MEMCHAIN_INIT(&ch); - if(BOOST_UNLIKELY(!boost_cont_multialloc_nodes(n_elements, elem_size*sizeof(T), DL_MULTIALLOC_DEFAULT_CONTIGUOUS, &ch))){ + if(BOOST_UNLIKELY(!dlmalloc_multialloc_nodes(n_elements, elem_size*sizeof(T), DL_MULTIALLOC_DEFAULT_CONTIGUOUS, &ch))){ boost::container::throw_bad_alloc(); } chain.incorporate_after(chain.before_begin() ,(T*)BOOST_CONTAINER_MEMCHAIN_FIRSTMEM(&ch) ,(T*)BOOST_CONTAINER_MEMCHAIN_LASTMEM(&ch) ,BOOST_CONTAINER_MEMCHAIN_SIZE(&ch) );*/ - if(BOOST_UNLIKELY(!boost_cont_multialloc_nodes - (n_elements, elem_size*sizeof(T), DL_MULTIALLOC_DEFAULT_CONTIGUOUS, reinterpret_cast(&chain)))){ + if(BOOST_UNLIKELY(!dlmalloc_multialloc_nodes + (n_elements, elem_size*sizeof(T), DL_MULTIALLOC_DEFAULT_CONTIGUOUS, reinterpret_cast(&chain)))){ boost::container::throw_bad_alloc(); } } @@ -271,29 +269,29 @@ class adaptive_pool void allocate_many(const size_type *elem_sizes, size_type n_elements, multiallocation_chain &chain) { BOOST_STATIC_ASSERT(( Version > 1 ));/* - boost_cont_memchain ch; + dlmalloc_memchain ch; BOOST_CONTAINER_MEMCHAIN_INIT(&ch); - if(BOOST_UNLIKELY(!boost_cont_multialloc_arrays(n_elements, elem_sizes, sizeof(T), DL_MULTIALLOC_DEFAULT_CONTIGUOUS, &ch))){ + if(BOOST_UNLIKELY(!dlmalloc_multialloc_arrays(n_elements, elem_sizes, sizeof(T), DL_MULTIALLOC_DEFAULT_CONTIGUOUS, &ch))){ boost::container::throw_bad_alloc(); } chain.incorporate_after(chain.before_begin() ,(T*)BOOST_CONTAINER_MEMCHAIN_FIRSTMEM(&ch) ,(T*)BOOST_CONTAINER_MEMCHAIN_LASTMEM(&ch) ,BOOST_CONTAINER_MEMCHAIN_SIZE(&ch) );*/ - if(BOOST_UNLIKELY(!boost_cont_multialloc_arrays - (n_elements, elem_sizes, sizeof(T), DL_MULTIALLOC_DEFAULT_CONTIGUOUS, reinterpret_cast(&chain)))){ + if(BOOST_UNLIKELY(!dlmalloc_multialloc_arrays + (n_elements, elem_sizes, sizeof(T), DL_MULTIALLOC_DEFAULT_CONTIGUOUS, reinterpret_cast(&chain)))){ boost::container::throw_bad_alloc(); } } void deallocate_many(multiallocation_chain &chain) BOOST_NOEXCEPT_OR_NOTHROW {/* - boost_cont_memchain ch; + dlmalloc_memchain ch; void *beg(&*chain.begin()), *last(&*chain.last()); size_t size(chain.size()); BOOST_CONTAINER_MEMCHAIN_INIT_FROM(&ch, beg, last, size); - boost_cont_multidealloc(&ch);*/ - boost_cont_multidealloc(reinterpret_cast(&chain)); + dlmalloc_multidealloc(&ch);*/ + dlmalloc_multidealloc(reinterpret_cast(&chain)); } //!Deallocates all free blocks of the pool @@ -326,7 +324,7 @@ class adaptive_pool ,size_type &prefer_in_recvd_out_size, pointer &reuse_ptr) { std::size_t const preferred_size = prefer_in_recvd_out_size; - boost_cont_command_ret_t ret = {0 , 0}; + dlmalloc_command_ret_t ret = {0 , 0}; if(BOOST_UNLIKELY(limit_size > this->max_size() || preferred_size > this->max_size())){ return pointer(); } @@ -335,7 +333,7 @@ class adaptive_pool std::size_t r_size; { void* reuse_ptr_void = reuse_ptr; - ret = boost_cont_allocation_command(command, sizeof(T), l_size, p_size, &r_size, reuse_ptr_void); + ret = dlmalloc_allocation_command(command, sizeof(T), l_size, p_size, &r_size, reuse_ptr_void); reuse_ptr = ret.second ? static_cast(reuse_ptr_void) : 0; } prefer_in_recvd_out_size = r_size/sizeof(T); diff --git a/3party/boost/boost/container/allocator.hpp b/3party/boost/boost/container/allocator.hpp index 9f757c73e8..9b9268f16c 100644 --- a/3party/boost/boost/container/allocator.hpp +++ b/3party/boost/boost/container/allocator.hpp @@ -24,12 +24,14 @@ #include #include #include -#include +#include #include #include #include #include +//!\file + namespace boost { namespace container { @@ -86,21 +88,18 @@ class allocator #endif //#ifndef BOOST_CONTAINER_DOXYGEN_INVOKED -//!\file //! This class is an extended STL-compatible that offers advanced allocation mechanism //!(in-place expansion, shrinking, burst-allocation...) //! //! This allocator is a wrapper around a modified DLmalloc. -#ifdef BOOST_CONTAINER_DOXYGEN_INVOKED -template -#else //! If Version is 1, the allocator is a STL conforming allocator. If Version is 2, //! the allocator offers advanced expand in place and burst allocation capabilities. -// +//! //! AllocationDisableMask works only if Version is 2 and it can be an inclusive OR //! of allocation types the user wants to disable. -template -#endif //#ifdef BOOST_CONTAINER_DOXYGEN_INVOKED +template< class T + , unsigned Version BOOST_CONTAINER_DOCONLY(=2) + , unsigned int AllocationDisableMask BOOST_CONTAINER_DOCONLY(=0)> class allocator { typedef unsigned int allocation_type; @@ -114,9 +113,6 @@ class allocator template allocator& operator=(const allocator&); - //Not assignable from other allocator - allocator& operator=(const allocator&); - static const unsigned int ForbiddenMask = BOOST_CONTAINER_ALLOCATE_NEW | BOOST_CONTAINER_EXPAND_BWD | BOOST_CONTAINER_EXPAND_FWD ; @@ -186,7 +182,7 @@ class allocator (void)hint; if(count > this->max_size()) boost::container::throw_bad_alloc(); - void *ret = boost_cont_malloc(count*sizeof(T)); + void *ret = dlmalloc_malloc(count*sizeof(T)); if(!ret) boost::container::throw_bad_alloc(); return static_cast(ret); @@ -195,7 +191,7 @@ class allocator //!Deallocates previously allocated memory. //!Never throws void deallocate(pointer ptr, size_type) BOOST_NOEXCEPT_OR_NOTHROW - { boost_cont_free(ptr); } + { dlmalloc_free(ptr); } //!Returns the maximum number of elements that could be allocated. //!Never throws @@ -243,7 +239,7 @@ class allocator size_type size(pointer p) const BOOST_NOEXCEPT_OR_NOTHROW { BOOST_STATIC_ASSERT(( Version > 1 )); - return boost_cont_size(p); + return dlmalloc_size(p); } //!Allocates just one object. Memory allocated with this function @@ -289,16 +285,16 @@ class allocator void allocate_many(size_type elem_size, std::size_t n_elements, multiallocation_chain &chain) { BOOST_STATIC_ASSERT(( Version > 1 ));/* - boost_cont_memchain ch; + dlmalloc_memchain ch; BOOST_CONTAINER_MEMCHAIN_INIT(&ch); - if(!boost_cont_multialloc_nodes(n_elements, elem_size*sizeof(T), DL_MULTIALLOC_DEFAULT_CONTIGUOUS, &ch)){ + if(!dlmalloc_multialloc_nodes(n_elements, elem_size*sizeof(T), DL_MULTIALLOC_DEFAULT_CONTIGUOUS, &ch)){ boost::container::throw_bad_alloc(); } chain.incorporate_after(chain.before_begin() ,(T*)BOOST_CONTAINER_MEMCHAIN_FIRSTMEM(&ch) ,(T*)BOOST_CONTAINER_MEMCHAIN_LASTMEM(&ch) ,BOOST_CONTAINER_MEMCHAIN_SIZE(&ch) );*/ - if(!boost_cont_multialloc_nodes(n_elements, elem_size*sizeof(T), DL_MULTIALLOC_DEFAULT_CONTIGUOUS, reinterpret_cast(&chain))){ + if(!dlmalloc_multialloc_nodes(n_elements, elem_size*sizeof(T), DL_MULTIALLOC_DEFAULT_CONTIGUOUS, reinterpret_cast(&chain))){ boost::container::throw_bad_alloc(); } } @@ -309,9 +305,9 @@ class allocator void allocate_many(const size_type *elem_sizes, size_type n_elements, multiallocation_chain &chain) { BOOST_STATIC_ASSERT(( Version > 1 )); - boost_cont_memchain ch; + dlmalloc_memchain ch; BOOST_CONTAINER_MEMCHAIN_INIT(&ch); - if(!boost_cont_multialloc_arrays(n_elements, elem_sizes, sizeof(T), DL_MULTIALLOC_DEFAULT_CONTIGUOUS, &ch)){ + if(!dlmalloc_multialloc_arrays(n_elements, elem_sizes, sizeof(T), DL_MULTIALLOC_DEFAULT_CONTIGUOUS, &ch)){ boost::container::throw_bad_alloc(); } chain.incorporate_after(chain.before_begin() @@ -319,7 +315,7 @@ class allocator ,(T*)BOOST_CONTAINER_MEMCHAIN_LASTMEM(&ch) ,BOOST_CONTAINER_MEMCHAIN_SIZE(&ch) ); /* - if(!boost_cont_multialloc_arrays(n_elements, elem_sizes, sizeof(T), DL_MULTIALLOC_DEFAULT_CONTIGUOUS, reinterpret_cast(&chain))){ + if(!dlmalloc_multialloc_arrays(n_elements, elem_sizes, sizeof(T), DL_MULTIALLOC_DEFAULT_CONTIGUOUS, reinterpret_cast(&chain))){ boost::container::throw_bad_alloc(); }*/ } @@ -330,12 +326,12 @@ class allocator void deallocate_many(multiallocation_chain &chain) BOOST_NOEXCEPT_OR_NOTHROW { BOOST_STATIC_ASSERT(( Version > 1 )); - boost_cont_memchain ch; + dlmalloc_memchain ch; void *beg(&*chain.begin()), *last(&*chain.last()); size_t size(chain.size()); BOOST_CONTAINER_MEMCHAIN_INIT_FROM(&ch, beg, last, size); - boost_cont_multidealloc(&ch); - //boost_cont_multidealloc(reinterpret_cast(&chain)); + dlmalloc_multidealloc(&ch); + //dlmalloc_multidealloc(reinterpret_cast(&chain)); } private: @@ -346,7 +342,7 @@ class allocator ,pointer &reuse_ptr) { std::size_t const preferred_size = prefer_in_recvd_out_size; - boost_cont_command_ret_t ret = {0 , 0}; + dlmalloc_command_ret_t ret = {0 , 0}; if((limit_size > this->max_size()) | (preferred_size > this->max_size())){ return pointer(); } @@ -355,7 +351,7 @@ class allocator std::size_t r_size; { void* reuse_ptr_void = reuse_ptr; - ret = boost_cont_allocation_command(command, sizeof(T), l_size, p_size, &r_size, reuse_ptr_void); + ret = dlmalloc_allocation_command(command, sizeof(T), l_size, p_size, &r_size, reuse_ptr_void); reuse_ptr = ret.second ? static_cast(reuse_ptr_void) : 0; } prefer_in_recvd_out_size = r_size/sizeof(T); diff --git a/3party/boost/boost/container/allocator_traits.hpp b/3party/boost/boost/container/allocator_traits.hpp index 2c7900ea72..d6621f614a 100644 --- a/3party/boost/boost/container/allocator_traits.hpp +++ b/3party/boost/boost/container/allocator_traits.hpp @@ -77,6 +77,9 @@ namespace container { #ifndef BOOST_CONTAINER_DOXYGEN_INVOKED +template +class small_vector_allocator; + namespace allocator_traits_detail { BOOST_INTRUSIVE_HAS_STATIC_MEMBER_FUNC_SIGNATURE(has_max_size, max_size) @@ -96,6 +99,10 @@ template struct is_std_allocator< std::allocator > { static const bool value = true; }; +template +struct is_std_allocator< small_vector_allocator< std::allocator > > +{ static const bool value = true; }; + template struct is_not_std_allocator { static const bool value = !is_std_allocator::value; }; @@ -282,18 +289,18 @@ struct allocator_traits //! Returns: a.allocate(n) //! - static pointer allocate(Allocator &a, size_type n) + BOOST_CONTAINER_FORCEINLINE static pointer allocate(Allocator &a, size_type n) { return a.allocate(n); } //! Returns: a.deallocate(p, n) //! //! Throws: Nothing - static void deallocate(Allocator &a, pointer p, size_type n) + BOOST_CONTAINER_FORCEINLINE static void deallocate(Allocator &a, pointer p, size_type n) { a.deallocate(p, n); } //! Effects: calls a.allocate(n, p) if that call is well-formed; //! otherwise, invokes a.allocate(n) - static pointer allocate(Allocator &a, size_type n, const_void_pointer p) + BOOST_CONTAINER_FORCEINLINE static pointer allocate(Allocator &a, size_type n, const_void_pointer p) { const bool value = boost::container::container_detail:: has_member_function_callable_with_allocate @@ -305,7 +312,7 @@ struct allocator_traits //! Effects: calls a.destroy(p) if that call is well-formed; //! otherwise, invokes p->~T(). template - static void destroy(Allocator &a, T*p) BOOST_NOEXCEPT_OR_NOTHROW + BOOST_CONTAINER_FORCEINLINE static void destroy(Allocator &a, T*p) BOOST_NOEXCEPT_OR_NOTHROW { typedef T* destroy_pointer; const bool value = boost::container::container_detail:: @@ -317,7 +324,7 @@ struct allocator_traits //! Returns: a.max_size() if that expression is well-formed; otherwise, //! numeric_limits::max(). - static size_type max_size(const Allocator &a) BOOST_NOEXCEPT_OR_NOTHROW + BOOST_CONTAINER_FORCEINLINE static size_type max_size(const Allocator &a) BOOST_NOEXCEPT_OR_NOTHROW { const bool value = allocator_traits_detail::has_max_size::value; container_detail::bool_ flag; @@ -326,7 +333,7 @@ struct allocator_traits //! Returns: a.select_on_container_copy_construction() if that expression is well-formed; //! otherwise, a. - static BOOST_CONTAINER_DOC1ST(Allocator, + BOOST_CONTAINER_FORCEINLINE static BOOST_CONTAINER_DOC1ST(Allocator, typename container_detail::if_c < allocator_traits_detail::has_select_on_container_copy_construction::value BOOST_MOVE_I Allocator BOOST_MOVE_I const Allocator & >::type) @@ -342,7 +349,7 @@ struct allocator_traits //! Effects: calls a.construct(p, std::forward(args)...) if that call is well-formed; //! otherwise, invokes ::new (static_cast(p)) T(std::forward(args)...) template - static void construct(Allocator & a, T* p, BOOST_FWD_REF(Args)... args) + BOOST_CONTAINER_FORCEINLINE static void construct(Allocator & a, T* p, BOOST_FWD_REF(Args)... args) { static const bool value = ::boost::move_detail::and_ < container_detail::is_not_std_allocator @@ -356,7 +363,7 @@ struct allocator_traits //! Returns: a.storage_is_unpropagable(p) if is_partially_propagable::value is true; otherwise, //! false. - static bool storage_is_unpropagable(const Allocator &a, pointer p) BOOST_NOEXCEPT_OR_NOTHROW + BOOST_CONTAINER_FORCEINLINE static bool storage_is_unpropagable(const Allocator &a, pointer p) BOOST_NOEXCEPT_OR_NOTHROW { container_detail::bool_ flag; return allocator_traits::priv_storage_is_unpropagable(flag, a, p); @@ -364,7 +371,7 @@ struct allocator_traits //! Returns: true if is_always_equal::value == true, otherwise, //! a == b. - static bool equal(const Allocator &a, const Allocator &b) BOOST_NOEXCEPT_OR_NOTHROW + BOOST_CONTAINER_FORCEINLINE static bool equal(const Allocator &a, const Allocator &b) BOOST_NOEXCEPT_OR_NOTHROW { container_detail::bool_ flag; return allocator_traits::priv_equal(flag, a, b); @@ -372,46 +379,46 @@ struct allocator_traits #if !defined(BOOST_CONTAINER_DOXYGEN_INVOKED) private: - static pointer priv_allocate(container_detail::true_type, Allocator &a, size_type n, const_void_pointer p) + BOOST_CONTAINER_FORCEINLINE static pointer priv_allocate(container_detail::true_type, Allocator &a, size_type n, const_void_pointer p) { return a.allocate(n, p); } - static pointer priv_allocate(container_detail::false_type, Allocator &a, size_type n, const_void_pointer) + BOOST_CONTAINER_FORCEINLINE static pointer priv_allocate(container_detail::false_type, Allocator &a, size_type n, const_void_pointer) { return a.allocate(n); } template - static void priv_destroy(container_detail::true_type, Allocator &a, T* p) BOOST_NOEXCEPT_OR_NOTHROW + BOOST_CONTAINER_FORCEINLINE static void priv_destroy(container_detail::true_type, Allocator &a, T* p) BOOST_NOEXCEPT_OR_NOTHROW { a.destroy(p); } template - static void priv_destroy(container_detail::false_type, Allocator &, T* p) BOOST_NOEXCEPT_OR_NOTHROW + BOOST_CONTAINER_FORCEINLINE static void priv_destroy(container_detail::false_type, Allocator &, T* p) BOOST_NOEXCEPT_OR_NOTHROW { p->~T(); (void)p; } - static size_type priv_max_size(container_detail::true_type, const Allocator &a) BOOST_NOEXCEPT_OR_NOTHROW + BOOST_CONTAINER_FORCEINLINE static size_type priv_max_size(container_detail::true_type, const Allocator &a) BOOST_NOEXCEPT_OR_NOTHROW { return a.max_size(); } - static size_type priv_max_size(container_detail::false_type, const Allocator &) BOOST_NOEXCEPT_OR_NOTHROW + BOOST_CONTAINER_FORCEINLINE static size_type priv_max_size(container_detail::false_type, const Allocator &) BOOST_NOEXCEPT_OR_NOTHROW { return size_type(-1)/sizeof(value_type); } - static Allocator priv_select_on_container_copy_construction(container_detail::true_type, const Allocator &a) + BOOST_CONTAINER_FORCEINLINE static Allocator priv_select_on_container_copy_construction(container_detail::true_type, const Allocator &a) { return a.select_on_container_copy_construction(); } - static const Allocator &priv_select_on_container_copy_construction(container_detail::false_type, const Allocator &a) BOOST_NOEXCEPT_OR_NOTHROW + BOOST_CONTAINER_FORCEINLINE static const Allocator &priv_select_on_container_copy_construction(container_detail::false_type, const Allocator &a) BOOST_NOEXCEPT_OR_NOTHROW { return a; } #if !defined(BOOST_NO_CXX11_VARIADIC_TEMPLATES) template - static void priv_construct(container_detail::true_type, Allocator &a, T *p, BOOST_FWD_REF(Args) ...args) + BOOST_CONTAINER_FORCEINLINE static void priv_construct(container_detail::true_type, Allocator &a, T *p, BOOST_FWD_REF(Args) ...args) { a.construct( p, ::boost::forward(args)...); } template - static void priv_construct(container_detail::false_type, Allocator &, T *p, BOOST_FWD_REF(Args) ...args) + BOOST_CONTAINER_FORCEINLINE static void priv_construct(container_detail::false_type, Allocator &, T *p, BOOST_FWD_REF(Args) ...args) { ::new((void*)p, boost_container_new_t()) T(::boost::forward(args)...); } #else // #if !defined(BOOST_NO_CXX11_VARIADIC_TEMPLATES) public: #define BOOST_CONTAINER_ALLOCATOR_TRAITS_CONSTRUCT_IMPL(N) \ template\ - static void construct(Allocator &a, T *p BOOST_MOVE_I##N BOOST_MOVE_UREF##N)\ + BOOST_CONTAINER_FORCEINLINE static void construct(Allocator &a, T *p BOOST_MOVE_I##N BOOST_MOVE_UREF##N)\ {\ static const bool value = ::boost::move_detail::and_ \ < container_detail::is_not_std_allocator \ @@ -431,11 +438,11 @@ struct allocator_traits ///////////////////////////////// #define BOOST_CONTAINER_ALLOCATOR_TRAITS_PRIV_CONSTRUCT_IMPL(N) \ template\ - static void priv_construct(container_detail::true_type, Allocator &a, T *p BOOST_MOVE_I##N BOOST_MOVE_UREF##N)\ + BOOST_CONTAINER_FORCEINLINE static void priv_construct(container_detail::true_type, Allocator &a, T *p BOOST_MOVE_I##N BOOST_MOVE_UREF##N)\ { a.construct( p BOOST_MOVE_I##N BOOST_MOVE_FWD##N ); }\ \ template\ - static void priv_construct(container_detail::false_type, Allocator &, T *p BOOST_MOVE_I##N BOOST_MOVE_UREF##N)\ + BOOST_CONTAINER_FORCEINLINE static void priv_construct(container_detail::false_type, Allocator &, T *p BOOST_MOVE_I##N BOOST_MOVE_UREF##N)\ { ::new((void*)p, boost_container_new_t()) T(BOOST_MOVE_FWD##N); }\ // BOOST_MOVE_ITERATE_0TO8(BOOST_CONTAINER_ALLOCATOR_TRAITS_PRIV_CONSTRUCT_IMPL) @@ -444,19 +451,19 @@ struct allocator_traits #endif // #if !defined(BOOST_NO_CXX11_VARIADIC_TEMPLATES) template - static void priv_construct(container_detail::false_type, Allocator &, T *p, const ::boost::container::default_init_t&) - { ::new((void*)p) T; } + BOOST_CONTAINER_FORCEINLINE static void priv_construct(container_detail::false_type, Allocator &, T *p, const ::boost::container::default_init_t&) + { ::new((void*)p, boost_container_new_t()) T; } - static bool priv_storage_is_unpropagable(container_detail::true_type, const Allocator &a, pointer p) + BOOST_CONTAINER_FORCEINLINE static bool priv_storage_is_unpropagable(container_detail::true_type, const Allocator &a, pointer p) { return a.storage_is_unpropagable(p); } - static bool priv_storage_is_unpropagable(container_detail::false_type, const Allocator &, pointer) + BOOST_CONTAINER_FORCEINLINE static bool priv_storage_is_unpropagable(container_detail::false_type, const Allocator &, pointer) { return false; } - static bool priv_equal(container_detail::true_type, const Allocator &, const Allocator &) + BOOST_CONTAINER_FORCEINLINE static bool priv_equal(container_detail::true_type, const Allocator &, const Allocator &) { return true; } - static bool priv_equal(container_detail::false_type, const Allocator &a, const Allocator &b) + BOOST_CONTAINER_FORCEINLINE static bool priv_equal(container_detail::false_type, const Allocator &a, const Allocator &b) { return a == b; } #endif //#if defined(BOOST_CONTAINER_DOXYGEN_INVOKED) diff --git a/3party/boost/boost/container/container_fwd.hpp b/3party/boost/boost/container/container_fwd.hpp index a9b421c2b2..e85a6ce952 100644 --- a/3party/boost/boost/container/container_fwd.hpp +++ b/3party/boost/boost/container/container_fwd.hpp @@ -24,6 +24,7 @@ //! - boost::container::vector //! - boost::container::stable_vector //! - boost::container::static_vector +//! - boost::container::small_vector //! - boost::container::slist //! - boost::container::list //! - boost::container::set @@ -38,11 +39,19 @@ //! - boost::container::string //! - boost::container::wstring //! -//! It forward declares the following allocators: +//! Forward declares the following allocators: //! - boost::container::allocator //! - boost::container::node_allocator //! - boost::container::adaptive_pool //! +//! Forward declares the following polymorphic resource classes: +//! - boost::container::pmr::memory_resource +//! - boost::container::pmr::polymorphic_allocator +//! - boost::container::pmr::monotonic_buffer_resource +//! - boost::container::pmr::pool_options +//! - boost::container::pmr::unsynchronized_pool_resource +//! - boost::container::pmr::synchronized_pool_resource +//! //! And finally it defines the following types #ifndef BOOST_CONTAINER_DOXYGEN_INVOKED @@ -54,11 +63,18 @@ namespace boost{ namespace intrusive{ +namespace detail{ //Create namespace to avoid compilation errors -}} +}}} namespace boost{ namespace container{ namespace container_detail{ namespace bi = boost::intrusive; + namespace bid = boost::intrusive::detail; +}}} + +namespace boost{ namespace container{ namespace pmr{ + namespace bi = boost::intrusive; + namespace bid = boost::intrusive::detail; }}} #include @@ -210,6 +226,26 @@ template , std::size_t Version = 2> class node_allocator; +namespace pmr { + +class memory_resource; + +template +class polymorphic_allocator; + +class monotonic_buffer_resource; + +struct pool_options; + +template +class resource_adaptor_imp; + +class unsynchronized_pool_resource; + +class synchronized_pool_resource; + +} //namespace pmr { + #else //! Default options for tree-based associative containers diff --git a/3party/boost/boost/container/deque.hpp b/3party/boost/boost/container/deque.hpp index bdfecc1212..255cd9399d 100644 --- a/3party/boost/boost/container/deque.hpp +++ b/3party/boost/boost/container/deque.hpp @@ -1,6 +1,6 @@ ////////////////////////////////////////////////////////////////////////////// // -// (C) Copyright Ion Gaztanaga 2005-2013. Distributed under the Boost +// (C) Copyright Ion Gaztanaga 2005-2015. 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) // @@ -535,7 +535,7 @@ class deque : protected deque_base //! Throws: If allocator_type's default constructor throws. //! //! Complexity: Constant. - deque() + deque() BOOST_NOEXCEPT_IF(container_detail::is_nothrow_default_constructible::value) : Base() {} @@ -619,8 +619,18 @@ class deque : protected deque_base //! throws or T's copy constructor throws. //! //! Complexity: Linear to n. - deque(size_type n, const value_type& value, - const allocator_type& a = allocator_type()) + deque(size_type n, const value_type& value) + : Base(n, allocator_type()) + { this->priv_fill_initialize(value); } + + //! Effects: Constructs a deque that will use a copy of allocator a + //! and inserts n copies of value. + //! + //! Throws: If allocator_type's default constructor + //! throws or T's copy constructor throws. + //! + //! Complexity: Linear to n. + deque(size_type n, const value_type& value, const allocator_type& a) : Base(n, a) { this->priv_fill_initialize(value); } @@ -632,11 +642,29 @@ class deque : protected deque_base //! //! Complexity: Linear to the range [first, last). template - deque(InIt first, InIt last, const allocator_type& a = allocator_type() + deque(InIt first, InIt last #if !defined(BOOST_CONTAINER_DOXYGEN_INVOKED) - , typename container_detail::enable_if_c - < !container_detail::is_convertible::value - >::type * = 0 + , typename container_detail::disable_if_convertible + ::type * = 0 + #endif + ) + : Base(allocator_type()) + { + this->priv_range_initialize(first, last); + } + + //! Effects: Constructs a deque that will use a copy of allocator a + //! and inserts a copy of the range [first, last) in the deque. + //! + //! Throws: If allocator_type's default constructor + //! throws or T's constructor taking a dereferenced InIt throws. + //! + //! Complexity: Linear to the range [first, last). + template + deque(InIt first, InIt last, const allocator_type& a + #if !defined(BOOST_CONTAINER_DOXYGEN_INVOKED) + , typename container_detail::disable_if_convertible + ::type * = 0 #endif ) : Base(a) @@ -679,7 +707,7 @@ class deque : protected deque_base //! Throws: If allocator_type's copy constructor throws. //! //! Complexity: Constant. - deque(BOOST_RV_REF(deque) x) + deque(BOOST_RV_REF(deque) x) BOOST_NOEXCEPT_OR_NOTHROW : Base(BOOST_MOVE_BASE(Base, x)) { this->swap_members(x); } @@ -1140,7 +1168,10 @@ class deque : protected deque_base //! //! Complexity: Constant. reference front() BOOST_NOEXCEPT_OR_NOTHROW - { return *this->members_.m_start; } + { + BOOST_ASSERT(!this->empty()); + return *this->members_.m_start; + } //! Requires: !empty() //! @@ -1151,7 +1182,10 @@ class deque : protected deque_base //! //! Complexity: Constant. const_reference front() const BOOST_NOEXCEPT_OR_NOTHROW - { return *this->members_.m_start; } + { + BOOST_ASSERT(!this->empty()); + return *this->members_.m_start; + } //! Requires: !empty() //! @@ -1162,7 +1196,10 @@ class deque : protected deque_base //! //! Complexity: Constant. reference back() BOOST_NOEXCEPT_OR_NOTHROW - { return *(end()-1); } + { + BOOST_ASSERT(!this->empty()); + return *(end()-1); + } //! Requires: !empty() //! @@ -1173,7 +1210,10 @@ class deque : protected deque_base //! //! Complexity: Constant. const_reference back() const BOOST_NOEXCEPT_OR_NOTHROW - { return *(cend()-1); } + { + BOOST_ASSERT(!this->empty()); + return *(cend()-1); + } //! Requires: size() > n. //! @@ -1184,7 +1224,10 @@ class deque : protected deque_base //! //! Complexity: Constant. reference operator[](size_type n) BOOST_NOEXCEPT_OR_NOTHROW - { return this->members_.m_start[difference_type(n)]; } + { + BOOST_ASSERT(this->size() > n); + return this->members_.m_start[difference_type(n)]; + } //! Requires: size() > n. //! @@ -1195,7 +1238,10 @@ class deque : protected deque_base //! //! Complexity: Constant. const_reference operator[](size_type n) const BOOST_NOEXCEPT_OR_NOTHROW - { return this->members_.m_start[difference_type(n)]; } + { + BOOST_ASSERT(this->size() > n); + return this->members_.m_start[difference_type(n)]; + } //! Requires: size() >= n. //! @@ -1231,11 +1277,10 @@ class deque : protected deque_base return const_iterator(this->cbegin()+n); } - //! Requires: size() >= n. + //! Requires: begin() <= p <= end(). //! - //! Effects: Returns an iterator to the nth element - //! from the beginning of the container. Returns end() - //! if n == size(). + //! Effects: Returns the index of the element pointed by p + //! and size() if p == end(). //! //! Throws: Nothing. //! @@ -1243,7 +1288,10 @@ class deque : protected deque_base //! //! Note: Non-standard extension size_type index_of(iterator p) BOOST_NOEXCEPT_OR_NOTHROW - { return this->priv_index_of(p); } + { + //Range checked priv_index_of + return this->priv_index_of(p); + } //! Requires: begin() <= p <= end(). //! @@ -1256,7 +1304,10 @@ class deque : protected deque_base //! //! Note: Non-standard extension size_type index_of(const_iterator p) const BOOST_NOEXCEPT_OR_NOTHROW - { return this->priv_index_of(p); } + { + //Range checked priv_index_of + return this->priv_index_of(p); + } //! Requires: size() > n. //! @@ -1267,7 +1318,10 @@ class deque : protected deque_base //! //! Complexity: Constant. reference at(size_type n) - { this->priv_range_check(n); return (*this)[n]; } + { + this->priv_throw_if_out_of_range(n); + return (*this)[n]; + } //! Requires: size() > n. //! @@ -1278,7 +1332,10 @@ class deque : protected deque_base //! //! Complexity: Constant. const_reference at(size_type n) const - { this->priv_range_check(n); return (*this)[n]; } + { + this->priv_throw_if_out_of_range(n); + return (*this)[n]; + } ////////////////////////////////////////////// // @@ -1291,44 +1348,52 @@ class deque : protected deque_base //! Effects: Inserts an object of type T constructed with //! std::forward(args)... in the beginning of the deque. //! + //! Returns: A reference to the created object. + //! //! Throws: If memory allocation throws or the in-place constructor throws. //! //! Complexity: Amortized constant time template - void emplace_front(BOOST_FWD_REF(Args)... args) + reference emplace_front(BOOST_FWD_REF(Args)... args) { if(this->priv_push_front_simple_available()){ + reference r = *this->priv_push_front_simple_pos(); allocator_traits_type::construct ( this->alloc() , this->priv_push_front_simple_pos() , boost::forward(args)...); this->priv_push_front_simple_commit(); + return r; } else{ typedef container_detail::insert_nonmovable_emplace_proxy type; - this->priv_insert_front_aux_impl(1, type(boost::forward(args)...)); + return *this->priv_insert_front_aux_impl(1, type(boost::forward(args)...)); } } //! Effects: Inserts an object of type T constructed with //! std::forward(args)... in the end of the deque. //! + //! Returns: A reference to the created object. + //! //! Throws: If memory allocation throws or the in-place constructor throws. //! //! Complexity: Amortized constant time template - void emplace_back(BOOST_FWD_REF(Args)... args) + reference emplace_back(BOOST_FWD_REF(Args)... args) { if(this->priv_push_back_simple_available()){ + reference r = *this->priv_push_back_simple_pos(); allocator_traits_type::construct ( this->alloc() , this->priv_push_back_simple_pos() , boost::forward(args)...); this->priv_push_back_simple_commit(); + return r; } else{ typedef container_detail::insert_nonmovable_emplace_proxy type; - this->priv_insert_back_aux_impl(1, type(boost::forward(args)...)); + return *this->priv_insert_back_aux_impl(1, type(boost::forward(args)...)); } } @@ -1344,6 +1409,7 @@ class deque : protected deque_base template iterator emplace(const_iterator p, BOOST_FWD_REF(Args)... args) { + BOOST_ASSERT(this->priv_in_range_or_end(p)); if(p == this->cbegin()){ this->emplace_front(boost::forward(args)...); return this->begin(); @@ -1362,38 +1428,43 @@ class deque : protected deque_base #define BOOST_CONTAINER_DEQUE_EMPLACE_CODE(N) \ BOOST_MOVE_TMPL_LT##N BOOST_MOVE_CLASS##N BOOST_MOVE_GT##N\ - void emplace_front(BOOST_MOVE_UREF##N)\ + reference emplace_front(BOOST_MOVE_UREF##N)\ {\ if(priv_push_front_simple_available()){\ + reference r = *this->priv_push_front_simple_pos();\ allocator_traits_type::construct\ ( this->alloc(), this->priv_push_front_simple_pos() BOOST_MOVE_I##N BOOST_MOVE_FWD##N);\ priv_push_front_simple_commit();\ + return r;\ }\ else{\ typedef container_detail::insert_nonmovable_emplace_proxy##N\ type;\ - priv_insert_front_aux_impl(1, type(BOOST_MOVE_FWD##N));\ + return *priv_insert_front_aux_impl(1, type(BOOST_MOVE_FWD##N));\ }\ }\ \ BOOST_MOVE_TMPL_LT##N BOOST_MOVE_CLASS##N BOOST_MOVE_GT##N\ - void emplace_back(BOOST_MOVE_UREF##N)\ + reference emplace_back(BOOST_MOVE_UREF##N)\ {\ if(priv_push_back_simple_available()){\ + reference r = *this->priv_push_back_simple_pos();\ allocator_traits_type::construct\ ( this->alloc(), this->priv_push_back_simple_pos() BOOST_MOVE_I##N BOOST_MOVE_FWD##N);\ priv_push_back_simple_commit();\ + return r;\ }\ else{\ typedef container_detail::insert_nonmovable_emplace_proxy##N\ type;\ - priv_insert_back_aux_impl(1, type(BOOST_MOVE_FWD##N));\ + return *priv_insert_back_aux_impl(1, type(BOOST_MOVE_FWD##N));\ }\ }\ \ BOOST_MOVE_TMPL_LT##N BOOST_MOVE_CLASS##N BOOST_MOVE_GT##N\ iterator emplace(const_iterator p BOOST_MOVE_I##N BOOST_MOVE_UREF##N)\ {\ + BOOST_ASSERT(this->priv_in_range_or_end(p));\ if(p == this->cbegin()){\ this->emplace_front(BOOST_MOVE_FWD##N);\ return this->begin();\ @@ -1494,6 +1565,7 @@ class deque : protected deque_base //! Complexity: Linear to n. iterator insert(const_iterator pos, size_type n, const value_type& x) { + //Range check of p is done by insert() typedef constant_iterator c_it; return this->insert(pos, c_it(x, n), c_it()); } @@ -1519,6 +1591,7 @@ class deque : protected deque_base #endif ) { + BOOST_ASSERT(this->priv_in_range_or_end(pos)); size_type n = 0; iterator it(pos.unconst()); for(;first != last; ++first, ++n){ @@ -1541,7 +1614,10 @@ class deque : protected deque_base //! //! Complexity: Linear to distance [il.begin(), il.end()). iterator insert(const_iterator pos, std::initializer_list il) - { return insert(pos, il.begin(), il.end()); } + { + //Range check os pos is done in insert() + return insert(pos, il.begin(), il.end()); + } #endif #if !defined(BOOST_CONTAINER_DOXYGEN_INVOKED) @@ -1556,6 +1632,7 @@ class deque : protected deque_base #endif ) { + BOOST_ASSERT(this->priv_in_range_or_end(p)); container_detail::insert_range_proxy proxy(first); return priv_insert_aux_impl(p, boost::container::iterator_distance(first, last), proxy); } @@ -1568,6 +1645,7 @@ class deque : protected deque_base //! Complexity: Constant time. void pop_front() BOOST_NOEXCEPT_OR_NOTHROW { + BOOST_ASSERT(!this->empty()); if (this->members_.m_start.m_cur != this->members_.m_start.m_last - 1) { allocator_traits_type::destroy ( this->alloc() @@ -1586,6 +1664,7 @@ class deque : protected deque_base //! Complexity: Constant time. void pop_back() BOOST_NOEXCEPT_OR_NOTHROW { + BOOST_ASSERT(!this->empty()); if (this->members_.m_finish.m_cur != this->members_.m_finish.m_first) { --this->members_.m_finish.m_cur; allocator_traits_type::destroy @@ -1607,6 +1686,7 @@ class deque : protected deque_base //! Constant if pos is the first or the last element. iterator erase(const_iterator pos) BOOST_NOEXCEPT_OR_NOTHROW { + BOOST_ASSERT(this->priv_in_range(pos)); iterator next = pos.unconst(); ++next; size_type index = pos - this->members_.m_start; @@ -1631,6 +1711,8 @@ class deque : protected deque_base //! if(pos is near the beginning). iterator erase(const_iterator first, const_iterator last) BOOST_NOEXCEPT_OR_NOTHROW { + BOOST_ASSERT(first == last || + (first < last && this->priv_in_range(first) && this->priv_in_range_or_end(last))); if (first == this->members_.m_start && last == this->members_.m_finish) { this->clear(); return this->members_.m_finish; @@ -1641,16 +1723,14 @@ class deque : protected deque_base if (elems_before < (this->size() - n) - elems_before) { boost::container::move_backward(begin(), first.unconst(), last.unconst()); iterator new_start = this->members_.m_start + n; - if(!Base::traits_t::trivial_dctr_after_move) - this->priv_destroy_range(this->members_.m_start, new_start); + this->priv_destroy_range(this->members_.m_start, new_start); this->priv_destroy_nodes(this->members_.m_start.m_node, new_start.m_node); this->members_.m_start = new_start; } else { boost::container::move(last.unconst(), end(), first.unconst()); iterator new_finish = this->members_.m_finish - n; - if(!Base::traits_t::trivial_dctr_after_move) - this->priv_destroy_range(new_finish, this->members_.m_finish); + this->priv_destroy_range(new_finish, this->members_.m_finish); this->priv_destroy_nodes(new_finish.m_node + 1, this->members_.m_finish.m_node + 1); this->members_.m_finish = new_finish; } @@ -1757,19 +1837,32 @@ class deque : protected deque_base } else { iterator new_finish = this->members_.m_finish - n; - if(!Base::traits_t::trivial_dctr_after_move) - this->priv_destroy_range(new_finish, this->members_.m_finish); + this->priv_destroy_range(new_finish, this->members_.m_finish); this->priv_destroy_nodes(new_finish.m_node + 1, this->members_.m_finish.m_node + 1); this->members_.m_finish = new_finish; } } - void priv_range_check(size_type n) const - { if (n >= this->size()) throw_out_of_range("deque::at out of range"); } + void priv_throw_if_out_of_range(size_type n) const + { + if (n >= this->size()) + throw_out_of_range("deque::at out of range"); + } + + bool priv_in_range(const_iterator pos) const + { + return (this->begin() <= pos) && (pos < this->end()); + } + + bool priv_in_range_or_end(const_iterator pos) const + { + return (this->begin() <= pos) && (pos <= this->end()); + } template iterator priv_insert(const_iterator p, BOOST_FWD_REF(U) x) { + BOOST_ASSERT(this->priv_in_range_or_end(p)); if (p == cbegin()){ this->push_front(::boost::forward(x)); return begin(); @@ -1994,8 +2087,7 @@ class deque : protected deque_base } template - typename iterator_enable_if_tag::type - priv_range_initialize(InIt first, InIt last) + void priv_range_initialize(InIt first, InIt last, typename iterator_enable_if_tag::type* =0) { this->priv_initialize_map(0); BOOST_TRY { @@ -2010,8 +2102,7 @@ class deque : protected deque_base } template - typename iterator_disable_if_tag::type - priv_range_initialize(FwdIt first, FwdIt last) + void priv_range_initialize(FwdIt first, FwdIt last, typename iterator_disable_if_tag::type* =0) { size_type n = 0; n = boost::container::iterator_distance(first, last); diff --git a/3party/boost/boost/container/detail/adaptive_node_pool.hpp b/3party/boost/boost/container/detail/adaptive_node_pool.hpp index 4a1f07c4a8..20696100f5 100644 --- a/3party/boost/boost/container/detail/adaptive_node_pool.hpp +++ b/3party/boost/boost/container/detail/adaptive_node_pool.hpp @@ -23,7 +23,6 @@ #include #include -#include #include #include #include diff --git a/3party/boost/boost/container/detail/addressof.hpp b/3party/boost/boost/container/detail/addressof.hpp index cc582c439d..fedbdb91d1 100644 --- a/3party/boost/boost/container/detail/addressof.hpp +++ b/3party/boost/boost/container/detail/addressof.hpp @@ -25,12 +25,12 @@ namespace container { namespace container_detail { template -inline T* addressof(T& obj) +BOOST_CONTAINER_FORCEINLINE T* addressof(T& obj) { return static_cast( static_cast( const_cast( - &reinterpret_cast(obj) + &reinterpret_cast(obj) ))); } diff --git a/3party/boost/boost/container/detail/advanced_insert_int.hpp b/3party/boost/boost/container/detail/advanced_insert_int.hpp index 56df588706..1050857c46 100644 --- a/3party/boost/boost/container/detail/advanced_insert_int.hpp +++ b/3party/boost/boost/container/detail/advanced_insert_int.hpp @@ -107,8 +107,8 @@ struct insert_n_copies_proxy void copy_n_and_update(Allocator &, Iterator p, size_type n) const { - for (; 0 < n; --n, ++p){ - *p = v_; + for (; 0 < n; --n, ++p){ + *p = v_; } } @@ -236,7 +236,7 @@ struct insert_nonmovable_emplace_proxy { this->priv_uninitialized_copy_some_and_update(a, index_tuple_t(), p, n); } private: - template + template void priv_uninitialized_copy_some_and_update(Allocator &a, const index_tuple&, Iterator p, size_type n) { BOOST_ASSERT(n == 1); (void)n; @@ -266,7 +266,7 @@ struct insert_emplace_proxy private: - template + template void priv_copy_some_and_update(Allocator &a, const index_tuple&, Iterator p, size_type n) { BOOST_ASSERT(n ==1); (void)n; diff --git a/3party/boost/boost/container/detail/alloc_lib.h b/3party/boost/boost/container/detail/alloc_lib.h index 4802d9d814..950ff722a5 100644 --- a/3party/boost/boost/container/detail/alloc_lib.h +++ b/3party/boost/boost/container/detail/alloc_lib.h @@ -15,27 +15,6 @@ #ifdef _MSC_VER #pragma warning (push) #pragma warning (disable : 4127) - -/* - we need to import/export our code only if the user has specifically - asked for it by defining either BOOST_ALL_DYN_LINK if they want all boost - libraries to be dynamically linked, or BOOST_CONTAINER_DYN_LINK - if they want just this one to be dynamically liked: -*/ -#if defined(BOOST_ALL_DYN_LINK) || defined(BOOST_CONTAINER_DYN_LINK) - -/* export if this is our own source, otherwise import: */ -#ifdef BOOST_CONTAINER_SOURCE -# define BOOST_CONTAINER_DECL __declspec(dllexport) -#else -# define BOOST_CONTAINER_DECL __declspec(dllimport) -#endif /* BOOST_CONTAINER_SOURCE */ -#endif /* DYN_LINK */ -#endif /* _MSC_VER */ - -/* if BOOST_CONTAINER_DECL isn't defined yet define it now: */ -#ifndef BOOST_CONTAINER_DECL -#define BOOST_CONTAINER_DECL #endif #ifdef __cplusplus @@ -215,14 +194,6 @@ typedef struct boost_cont_memchain_impl }while(0)\ /**/ -BOOST_CONTAINER_DECL size_t boost_cont_size(const void *p); - -BOOST_CONTAINER_DECL void* boost_cont_malloc(size_t bytes); - -BOOST_CONTAINER_DECL void boost_cont_free(void* mem); - -BOOST_CONTAINER_DECL void* boost_cont_memalign(size_t bytes, size_t alignment); - /*!Indicates the all elements allocated by boost_cont_multialloc_nodes or boost_cont_multialloc_arrays must be contiguous.*/ #define DL_MULTIALLOC_ALL_CONTIGUOUS ((size_t)(-1)) @@ -231,22 +202,6 @@ BOOST_CONTAINER_DECL void* boost_cont_memalign(size_t bytes, size_t alignment); should be selected by those functions.*/ #define DL_MULTIALLOC_DEFAULT_CONTIGUOUS ((size_t)(0)) -BOOST_CONTAINER_DECL int boost_cont_multialloc_nodes - (size_t n_elements, size_t elem_size, size_t contiguous_elements, boost_cont_memchain *pchain); - -BOOST_CONTAINER_DECL int boost_cont_multialloc_arrays - (size_t n_elements, const size_t *sizes, size_t sizeof_element, size_t contiguous_elements, boost_cont_memchain *pchain); - -BOOST_CONTAINER_DECL void boost_cont_multidealloc(boost_cont_memchain *pchain); - -BOOST_CONTAINER_DECL size_t boost_cont_footprint(); - -BOOST_CONTAINER_DECL size_t boost_cont_allocated_memory(); - -BOOST_CONTAINER_DECL size_t boost_cont_chunksize(const void *p); - -BOOST_CONTAINER_DECL int boost_cont_all_deallocated(); - typedef struct boost_cont_malloc_stats_impl { size_t max_system_bytes; @@ -254,26 +209,6 @@ typedef struct boost_cont_malloc_stats_impl size_t in_use_bytes; } boost_cont_malloc_stats_t; -BOOST_CONTAINER_DECL boost_cont_malloc_stats_t boost_cont_malloc_stats(); - -BOOST_CONTAINER_DECL size_t boost_cont_in_use_memory(); - -BOOST_CONTAINER_DECL int boost_cont_trim(size_t pad); - -BOOST_CONTAINER_DECL int boost_cont_mallopt - (int parameter_number, int parameter_value); - -BOOST_CONTAINER_DECL int boost_cont_grow - (void* oldmem, size_t minbytes, size_t maxbytes, size_t *received); - -BOOST_CONTAINER_DECL int boost_cont_shrink - (void* oldmem, size_t minbytes, size_t maxbytes, size_t *received, int do_commit); - -BOOST_CONTAINER_DECL void* boost_cont_alloc - (size_t minbytes, size_t preferred_bytes, size_t *received_bytes); - -BOOST_CONTAINER_DECL int boost_cont_malloc_check(); - typedef unsigned int allocation_type; enum @@ -303,7 +238,50 @@ typedef struct boost_cont_command_ret_impl int second; }boost_cont_command_ret_t; -BOOST_CONTAINER_DECL boost_cont_command_ret_t boost_cont_allocation_command +size_t boost_cont_size(const void *p); + +void* boost_cont_malloc(size_t bytes); + +void boost_cont_free(void* mem); + +void* boost_cont_memalign(size_t bytes, size_t alignment); + +int boost_cont_multialloc_nodes + (size_t n_elements, size_t elem_size, size_t contiguous_elements, boost_cont_memchain *pchain); + +int boost_cont_multialloc_arrays + (size_t n_elements, const size_t *sizes, size_t sizeof_element, size_t contiguous_elements, boost_cont_memchain *pchain); + +void boost_cont_multidealloc(boost_cont_memchain *pchain); + +size_t boost_cont_footprint(); + +size_t boost_cont_allocated_memory(); + +size_t boost_cont_chunksize(const void *p); + +int boost_cont_all_deallocated(); + +boost_cont_malloc_stats_t boost_cont_malloc_stats(); + +size_t boost_cont_in_use_memory(); + +int boost_cont_trim(size_t pad); + +int boost_cont_mallopt(int parameter_number, int parameter_value); + +int boost_cont_grow + (void* oldmem, size_t minbytes, size_t maxbytes, size_t *received); + +int boost_cont_shrink + (void* oldmem, size_t minbytes, size_t maxbytes, size_t *received, int do_commit); + +void* boost_cont_alloc + (size_t minbytes, size_t preferred_bytes, size_t *received_bytes); + +int boost_cont_malloc_check(); + +boost_cont_command_ret_t boost_cont_allocation_command ( allocation_type command , size_t sizeof_object , size_t limit_objects @@ -312,7 +290,17 @@ BOOST_CONTAINER_DECL boost_cont_command_ret_t boost_cont_allocation_command , void *reuse_ptr ); -BOOST_CONTAINER_DECL int boost_cont_mallopt(int param_number, int value); +void *boost_cont_sync_create(); + +void boost_cont_sync_destroy(void *sync); + +int boost_cont_sync_lock(void *sync); + +void boost_cont_sync_unlock(void *sync); + +int boost_cont_global_sync_lock(); + +void boost_cont_global_sync_unlock(); #ifdef __cplusplus } //extern "C" { diff --git a/3party/boost/boost/container/detail/auto_link.hpp b/3party/boost/boost/container/detail/auto_link.hpp index da078e8342..264b1ba112 100644 --- a/3party/boost/boost/container/detail/auto_link.hpp +++ b/3party/boost/boost/container/detail/auto_link.hpp @@ -18,6 +18,13 @@ # pragma once #endif +//Define BOOST_CONTAINER_DYNAMIC_LINKING which is independent from BOOST_*_NO_LIB +//and is needed is some tests that need to disable some checks (like operator new replacements) +//that don't work across DLL boundaries +#if defined(BOOST_ALL_DYN_LINK) || defined(BOOST_CONTAINER_DYN_LINK) +# define BOOST_CONTAINER_DYNAMIC_LINKING +#endif + // // Automatically link to the correct build variant where possible. // @@ -27,12 +34,14 @@ // once it's done with it: // #define BOOST_LIB_NAME boost_container + // // If we're importing code from a dll, then tell auto_link.hpp about it: // -#if defined(BOOST_ALL_DYN_LINK) || defined(BOOST_CONTAINER_DYN_LINK) +#if defined(BOOST_CONTAINER_DYNAMIC_LINKING) # define BOOST_DYN_LINK #endif + // // And include the header that does the work: // diff --git a/3party/boost/boost/container/detail/block_list.hpp b/3party/boost/boost/container/detail/block_list.hpp new file mode 100644 index 0000000000..1a6057cb4a --- /dev/null +++ b/3party/boost/boost/container/detail/block_list.hpp @@ -0,0 +1,139 @@ +////////////////////////////////////////////////////////////////////////////// +// +// (C) Copyright Ion Gaztanaga 2015-2015. 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) +// +// See http://www.boost.org/libs/container for documentation. +// +////////////////////////////////////////////////////////////////////////////// + +#ifndef BOOST_CONTAINER_DETAIL_BLOCK_LIST_HEADER +#define BOOST_CONTAINER_DETAIL_BLOCK_LIST_HEADER + +#ifndef BOOST_CONFIG_HPP +# include +#endif + +#if defined(BOOST_HAS_PRAGMA_ONCE) +# pragma once +#endif + +#include +#include +#include +#include +#include +#include +#include +#include + +#include + +namespace boost { +namespace container { +namespace pmr { + +struct list_node +{ + list_node *next; + list_node *previous; +}; + +struct list_node_traits +{ + typedef list_node node; + typedef list_node* node_ptr; + typedef const list_node* const_node_ptr; + + static node_ptr get_next(const_node_ptr n) + { return n->next; } + + static node_ptr get_previous(const_node_ptr n) + { return n->previous; } + + static void set_next(const node_ptr & n, const node_ptr & next) + { n->next = next; } + + static void set_previous(const node_ptr & n, const node_ptr & previous) + { n->previous = previous; } +}; + +struct block_list_header + : public list_node +{ + std::size_t size; +}; + +typedef bi::circular_list_algorithms list_algo; + + +template +class block_list_base +{ + list_node m_list; + + static const std::size_t MaxAlignMinus1 = memory_resource::max_align-1u; + + public: + + static const std::size_t header_size = std::size_t(sizeof(DerivedFromBlockListHeader) + MaxAlignMinus1) & std::size_t(~MaxAlignMinus1); + + explicit block_list_base() + { list_algo::init_header(&m_list); } + + #if !defined(BOOST_NO_CXX11_DELETED_FUNCTIONS) || defined(BOOST_CONTAINER_DOXYGEN_INVOKED) + block_list_base(const block_list_base&) = delete; + block_list_base operator=(const block_list_base&) = delete; + #else + private: + block_list_base (const block_list_base&); + block_list_base operator=(const block_list_base&); + public: + #endif + + ~block_list_base() + {} + + void *allocate(std::size_t size, memory_resource &mr) + { + if((size_t(-1) - header_size) < size) + throw_bad_alloc(); + void *p = mr.allocate(size+header_size); + block_list_header &mb = *::new((void*)p) DerivedFromBlockListHeader; + mb.size = size+header_size; + list_algo::link_after(&m_list, &mb); + return (char *)p + header_size; + } + + void deallocate(void *p, memory_resource &mr) BOOST_NOEXCEPT + { + DerivedFromBlockListHeader *pheader = static_cast + (static_cast((char*)p - header_size)); + list_algo::unlink(pheader); + const std::size_t size = pheader->size; + static_cast(pheader)->~DerivedFromBlockListHeader(); + mr.deallocate(pheader, size, memory_resource::max_align); + } + + void release(memory_resource &mr) BOOST_NOEXCEPT + { + list_node *n = list_algo::node_traits::get_next(&m_list); + while(n != &m_list){ + DerivedFromBlockListHeader &d = static_cast(*n); + n = list_algo::node_traits::get_next(n); + std::size_t size = d.size; + d.~DerivedFromBlockListHeader(); + mr.deallocate(reinterpret_cast(&d), size, memory_resource::max_align); + } + list_algo::init_header(&m_list); + } +}; + +} //namespace pmr { +} //namespace container { +} //namespace boost { + +#include + +#endif //BOOST_CONTAINER_DETAIL_BLOCK_LIST_HEADER diff --git a/3party/boost/boost/container/detail/block_slist.hpp b/3party/boost/boost/container/detail/block_slist.hpp new file mode 100644 index 0000000000..278e6414a7 --- /dev/null +++ b/3party/boost/boost/container/detail/block_slist.hpp @@ -0,0 +1,157 @@ +////////////////////////////////////////////////////////////////////////////// +// +// (C) Copyright Ion Gaztanaga 2015-2015. 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) +// +// See http://www.boost.org/libs/container for documentation. +// +////////////////////////////////////////////////////////////////////////////// + +#ifndef BOOST_CONTAINER_DETAIL_BLOCK_SLIST_HEADER +#define BOOST_CONTAINER_DETAIL_BLOCK_SLIST_HEADER + +#ifndef BOOST_CONFIG_HPP +# include +#endif + +#if defined(BOOST_HAS_PRAGMA_ONCE) +# pragma once +#endif + + +#include +#include +#include +#include +#include + +#include +#include +#include + +#include + +namespace boost { +namespace container { +namespace pmr { + +struct slist_node +{ + slist_node *next; +}; + +struct slist_node_traits +{ + typedef slist_node node; + typedef slist_node* node_ptr; + typedef const slist_node* const_node_ptr; + + static node_ptr get_next(const_node_ptr n) + { return n->next; } + + static void set_next(const node_ptr & n, const node_ptr & next) + { n->next = next; } +}; + +struct block_slist_header + : public slist_node +{ + std::size_t size; +}; + +typedef bi::linear_slist_algorithms slist_algo; + +template +class block_slist_base +{ + slist_node m_slist; + + static const std::size_t MaxAlignMinus1 = memory_resource::max_align-1u; + + public: + + static const std::size_t header_size = std::size_t(sizeof(DerivedFromBlockSlistHeader) + MaxAlignMinus1) & std::size_t(~MaxAlignMinus1); + + explicit block_slist_base() + { slist_algo::init_header(&m_slist); } + + #if !defined(BOOST_NO_CXX11_DELETED_FUNCTIONS) || defined(BOOST_CONTAINER_DOXYGEN_INVOKED) + block_slist_base(const block_slist_base&) = delete; + block_slist_base operator=(const block_slist_base&) = delete; + #else + private: + block_slist_base (const block_slist_base&); + block_slist_base operator=(const block_slist_base&); + public: + #endif + + ~block_slist_base() + {} + + void *allocate(std::size_t size, memory_resource &mr) + { + if((size_t(-1) - header_size) < size) + throw_bad_alloc(); + void *p = mr.allocate(size+header_size); + block_slist_header &mb = *::new((void*)p) DerivedFromBlockSlistHeader; + mb.size = size+header_size; + slist_algo::link_after(&m_slist, &mb); + return (char *)p + header_size; + } + + void release(memory_resource &mr) BOOST_NOEXCEPT + { + slist_node *n = slist_algo::node_traits::get_next(&m_slist); + while(n){ + DerivedFromBlockSlistHeader &d = static_cast(*n); + n = slist_algo::node_traits::get_next(n); + std::size_t size = d.block_slist_header::size; + d.~DerivedFromBlockSlistHeader(); + mr.deallocate(reinterpret_cast(&d), size, memory_resource::max_align); + } + slist_algo::init_header(&m_slist); + } +}; + +class block_slist + : public block_slist_base<> +{ + memory_resource &m_upstream_rsrc; + + public: + + explicit block_slist(memory_resource &upstream_rsrc) + : block_slist_base<>(), m_upstream_rsrc(upstream_rsrc) + {} + + #if !defined(BOOST_NO_CXX11_DELETED_FUNCTIONS) || defined(BOOST_CONTAINER_DOXYGEN_INVOKED) + block_slist(const block_slist&) = delete; + block_slist operator=(const block_slist&) = delete; + #else + private: + block_slist (const block_slist&); + block_slist operator=(const block_slist&); + public: + #endif + + ~block_slist() + { this->release(); } + + void *allocate(std::size_t size) + { return this->block_slist_base<>::allocate(size, m_upstream_rsrc); } + + void release() BOOST_NOEXCEPT + { return this->block_slist_base<>::release(m_upstream_rsrc); } + + memory_resource& upstream_resource() const BOOST_NOEXCEPT + { return m_upstream_rsrc; } +}; + +} //namespace pmr { +} //namespace container { +} //namespace boost { + +#include + +#endif //BOOST_CONTAINER_DETAIL_BLOCK_SLIST_HEADER diff --git a/3party/boost/boost/container/detail/compare_functors.hpp b/3party/boost/boost/container/detail/compare_functors.hpp index 4220d50996..28f9093b9a 100644 --- a/3party/boost/boost/container/detail/compare_functors.hpp +++ b/3party/boost/boost/container/detail/compare_functors.hpp @@ -53,16 +53,16 @@ struct value_to_node_compare {} bool operator()(const Node &a, const Node &b) const - { return static_cast(*this)(a.m_data, b.m_data); } + { return static_cast(*this)(a.get_data(), b.get_data()); } bool operator()(const Node &a) const - { return static_cast(*this)(a.m_data); } + { return static_cast(*this)(a.get_data()); } bool operator()(const Node &a, const Node &b) - { return static_cast(*this)(a.m_data, b.m_data); } + { return static_cast(*this)(a.get_data(), b.get_data()); } bool operator()(const Node &a) - { return static_cast(*this)(a.m_data); } + { return static_cast(*this)(a.get_data()); } predicate_type & predicate() { return static_cast(*this); } const predicate_type & predicate() const { return static_cast(*this); } diff --git a/3party/boost/boost/container/detail/config_begin.hpp b/3party/boost/boost/container/detail/config_begin.hpp index 3f509e320b..4df9e35d8b 100644 --- a/3party/boost/boost/container/detail/config_begin.hpp +++ b/3party/boost/boost/container/detail/config_begin.hpp @@ -25,6 +25,7 @@ #pragma warning (disable : 4267) // conversion from "X" to "Y", possible loss of data #pragma warning (disable : 4275) // non DLL-interface classkey "identifier" used as base for DLL-interface classkey "identifier" #pragma warning (disable : 4284) // odd return type for operator-> + #pragma warning (disable : 4290) // C++ exception specification ignored except to indicate a function is not __declspec(nothrow) #pragma warning (disable : 4324) // structure was padded due to __declspec(align( #pragma warning (disable : 4345) // behavior change: an object of POD type constructed with an initializer of the form () will be default-initialized #pragma warning (disable : 4355) // "this" : used in base member initializer list @@ -44,7 +45,9 @@ #pragma warning (disable : 4702) // unreachable code #pragma warning (disable : 4706) // assignment within conditional expression #pragma warning (disable : 4710) // function not inlined + #pragma warning (disable : 4714) // "function": marked as __forceinline not inlined #pragma warning (disable : 4711) // function selected for automatic inline expansion #pragma warning (disable : 4786) // identifier truncated in debug info #pragma warning (disable : 4996) // "function": was declared deprecated + #endif //BOOST_MSVC diff --git a/3party/boost/boost/container/detail/construct_in_place.hpp b/3party/boost/boost/container/detail/construct_in_place.hpp index f1931e7d44..9fecd24a8f 100644 --- a/3party/boost/boost/container/detail/construct_in_place.hpp +++ b/3party/boost/boost/container/detail/construct_in_place.hpp @@ -23,16 +23,19 @@ #include #include +#include namespace boost { namespace container { +//In place construction + template -inline void construct_in_place(Allocator &a, T* dest, InpIt source) +BOOST_CONTAINER_FORCEINLINE void construct_in_place(Allocator &a, T* dest, InpIt source) { boost::container::allocator_traits::construct(a, dest, *source); } template -inline void construct_in_place(Allocator &a, T *dest, value_init_construct_iterator) +BOOST_CONTAINER_FORCEINLINE void construct_in_place(Allocator &a, T *dest, value_init_construct_iterator) { boost::container::allocator_traits::construct(a, dest); } @@ -41,7 +44,7 @@ template class default_init_construct_iterator; template -inline void construct_in_place(Allocator &a, T *dest, default_init_construct_iterator) +BOOST_CONTAINER_FORCEINLINE void construct_in_place(Allocator &a, T *dest, default_init_construct_iterator) { boost::container::allocator_traits::construct(a, dest, default_init); } @@ -50,11 +53,43 @@ template class emplace_iterator; template -inline void construct_in_place(Allocator &a, T *dest, emplace_iterator ei) +BOOST_CONTAINER_FORCEINLINE void construct_in_place(Allocator &a, T *dest, emplace_iterator ei) { ei.construct_in_place(a, dest); } +//Assignment + +template +BOOST_CONTAINER_FORCEINLINE void assign_in_place(DstIt dest, InpIt source) +{ *dest = *source; } + +template +BOOST_CONTAINER_FORCEINLINE void assign_in_place(DstIt dest, value_init_construct_iterator) +{ + container_detail::value_init val; + *dest = boost::move(val.get()); +} + +template +class default_init_construct_iterator; + +template +BOOST_CONTAINER_FORCEINLINE void assign_in_place(DstIt dest, default_init_construct_iterator) +{ + U u; + *dest = boost::move(u); +} + +template +class emplace_iterator; + +template +BOOST_CONTAINER_FORCEINLINE void assign_in_place(DstIt dest, emplace_iterator ei) +{ + ei.assign_in_place(dest); +} + } //namespace container { } //namespace boost { diff --git a/3party/boost/boost/container/detail/copy_move_algo.hpp b/3party/boost/boost/container/detail/copy_move_algo.hpp index 23fa730838..dda311aa33 100644 --- a/3party/boost/boost/container/detail/copy_move_algo.hpp +++ b/3party/boost/boost/container/detail/copy_move_algo.hpp @@ -7,8 +7,8 @@ // See http://www.boost.org/libs/container for documentation. // ////////////////////////////////////////////////////////////////////////////// -#ifndef BOOST_CONTAINER_DETAIL_UTILITIES_HPP -#define BOOST_CONTAINER_DETAIL_UTILITIES_HPP +#ifndef BOOST_CONTAINER_DETAIL_COPY_MOVE_ALGO_HPP +#define BOOST_CONTAINER_DETAIL_COPY_MOVE_ALGO_HPP #ifndef BOOST_CONFIG_HPP # include @@ -25,6 +25,8 @@ #include #include #include +#include + // move #include #include @@ -184,8 +186,9 @@ inline F memmove(I f, I l, F r) BOOST_NOEXCEPT_OR_NOTHROW template // F models ForwardIterator -F memmove_n(I f, typename boost::container::iterator_traits::difference_type n, F r) BOOST_NOEXCEPT_OR_NOTHROW +F memmove_n(I f, U n, F r) BOOST_NOEXCEPT_OR_NOTHROW { typedef typename boost::container::iterator_traits::value_type value_type; if(n){ @@ -197,8 +200,9 @@ F memmove_n(I f, typename boost::container::iterator_traits::difference_type template // F models ForwardIterator -I memmove_n_source(I f, typename boost::container::iterator_traits::difference_type n, F r) BOOST_NOEXCEPT_OR_NOTHROW +I memmove_n_source(I f, U n, F r) BOOST_NOEXCEPT_OR_NOTHROW { if(n){ typedef typename boost::container::iterator_traits::value_type value_type; @@ -210,8 +214,9 @@ I memmove_n_source(I f, typename boost::container::iterator_traits::differenc template // F models ForwardIterator -I memmove_n_source_dest(I f, typename boost::container::iterator_traits::difference_type n, F &r) BOOST_NOEXCEPT_OR_NOTHROW +I memmove_n_source_dest(I f, U n, F &r) BOOST_NOEXCEPT_OR_NOTHROW { typedef typename boost::container::iterator_traits::value_type value_type; if(n){ @@ -252,15 +257,15 @@ struct disable_if_memzero_initializable template struct enable_if_trivially_destructible - : enable_if_c < false/*container_detail::is_trivially_destructible - ::value_type>::value*/ + : enable_if_c < container_detail::is_trivially_destructible + ::value_type>::value , R> {}; template struct disable_if_trivially_destructible - : enable_if_c ::value_type>::value*/ + : enable_if_c ::value_type>::value , R> {}; @@ -330,7 +335,7 @@ template typename I, // I models InputIterator typename F> // F models ForwardIterator inline typename container_detail::disable_if_memtransfer_copy_constructible::type - uninitialized_move_alloc_n(Allocator &a, I f, typename boost::container::iterator_traits::difference_type n, F r) + uninitialized_move_alloc_n(Allocator &a, I f, typename boost::container::allocator_traits::size_type n, F r) { F back = r; BOOST_TRY{ @@ -354,7 +359,7 @@ template typename I, // I models InputIterator typename F> // F models ForwardIterator inline typename container_detail::enable_if_memtransfer_copy_constructible::type - uninitialized_move_alloc_n(Allocator &, I f, typename boost::container::iterator_traits::difference_type n, F r) BOOST_NOEXCEPT_OR_NOTHROW + uninitialized_move_alloc_n(Allocator &, I f, typename boost::container::allocator_traits::size_type n, F r) BOOST_NOEXCEPT_OR_NOTHROW { return container_detail::memmove_n(f, n, r); } ////////////////////////////////////////////////////////////////////////////// @@ -375,7 +380,7 @@ template typename I, // I models InputIterator typename F> // F models ForwardIterator inline typename container_detail::disable_if_memtransfer_copy_constructible::type - uninitialized_move_alloc_n_source(Allocator &a, I f, typename boost::container::iterator_traits::difference_type n, F r) + uninitialized_move_alloc_n_source(Allocator &a, I f, typename boost::container::allocator_traits::size_type n, F r) { F back = r; BOOST_TRY{ @@ -399,7 +404,7 @@ template typename I, // I models InputIterator typename F> // F models ForwardIterator inline typename container_detail::enable_if_memtransfer_copy_constructible::type - uninitialized_move_alloc_n_source(Allocator &, I f, typename boost::container::iterator_traits::difference_type n, F r) BOOST_NOEXCEPT_OR_NOTHROW + uninitialized_move_alloc_n_source(Allocator &, I f, typename boost::container::allocator_traits::size_type n, F r) BOOST_NOEXCEPT_OR_NOTHROW { return container_detail::memmove_n_source(f, n, r); } ////////////////////////////////////////////////////////////////////////////// @@ -465,7 +470,7 @@ template typename I, // I models InputIterator typename F> // F models ForwardIterator inline typename container_detail::disable_if_memtransfer_copy_constructible::type - uninitialized_copy_alloc_n(Allocator &a, I f, typename boost::container::iterator_traits::difference_type n, F r) + uninitialized_copy_alloc_n(Allocator &a, I f, typename boost::container::allocator_traits::size_type n, F r) { F back = r; BOOST_TRY{ @@ -489,7 +494,7 @@ template typename I, // I models InputIterator typename F> // F models ForwardIterator inline typename container_detail::enable_if_memtransfer_copy_constructible::type - uninitialized_copy_alloc_n(Allocator &, I f, typename boost::container::iterator_traits::difference_type n, F r) BOOST_NOEXCEPT_OR_NOTHROW + uninitialized_copy_alloc_n(Allocator &, I f, typename boost::container::allocator_traits::size_type n, F r) BOOST_NOEXCEPT_OR_NOTHROW { return container_detail::memmove_n(f, n, r); } ////////////////////////////////////////////////////////////////////////////// @@ -510,12 +515,12 @@ template typename I, // I models InputIterator typename F> // F models ForwardIterator inline typename container_detail::disable_if_memtransfer_copy_constructible::type - uninitialized_copy_alloc_n_source(Allocator &a, I f, typename boost::container::iterator_traits::difference_type n, F r) + uninitialized_copy_alloc_n_source(Allocator &a, I f, typename boost::container::allocator_traits::size_type n, F r) { F back = r; BOOST_TRY{ while (n--) { - allocator_traits::construct(a, container_detail::iterator_to_raw_pointer(r), *f); + boost::container::construct_in_place(a, container_detail::iterator_to_raw_pointer(r), f); ++f; ++r; } } @@ -534,7 +539,7 @@ template typename I, // I models InputIterator typename F> // F models ForwardIterator inline typename container_detail::enable_if_memtransfer_copy_constructible::type - uninitialized_copy_alloc_n_source(Allocator &, I f, typename boost::container::iterator_traits::difference_type n, F r) BOOST_NOEXCEPT_OR_NOTHROW + uninitialized_copy_alloc_n_source(Allocator &, I f, typename boost::container::allocator_traits::size_type n, F r) BOOST_NOEXCEPT_OR_NOTHROW { return container_detail::memmove_n_source(f, n, r); } ////////////////////////////////////////////////////////////////////////////// @@ -554,7 +559,7 @@ template // F models ForwardIterator inline typename container_detail::disable_if_memzero_initializable::type - uninitialized_value_init_alloc_n(Allocator &a, typename allocator_traits::difference_type n, F r) + uninitialized_value_init_alloc_n(Allocator &a, typename boost::container::allocator_traits::size_type n, F r) { F back = r; BOOST_TRY{ @@ -577,7 +582,7 @@ template // F models ForwardIterator inline typename container_detail::enable_if_memzero_initializable::type - uninitialized_value_init_alloc_n(Allocator &, typename allocator_traits::difference_type n, F r) + uninitialized_value_init_alloc_n(Allocator &, typename boost::container::allocator_traits::size_type n, F r) { typedef typename boost::container::iterator_traits::value_type value_type; std::memset((void*)container_detail::iterator_to_raw_pointer(r), 0, sizeof(value_type)*n); @@ -601,7 +606,7 @@ inline typename container_detail::enable_if_memzero_initializable::type template // F models ForwardIterator -inline F uninitialized_default_init_alloc_n(Allocator &a, typename allocator_traits::difference_type n, F r) +inline F uninitialized_default_init_alloc_n(Allocator &a, typename boost::container::allocator_traits::size_type n, F r) { F back = r; BOOST_TRY{ @@ -673,7 +678,7 @@ template // F models ForwardIterator -inline F uninitialized_fill_alloc_n(Allocator &a, const T &v, typename allocator_traits::difference_type n, F r) +inline F uninitialized_fill_alloc_n(Allocator &a, const T &v, typename boost::container::allocator_traits::size_type n, F r) { F back = r; BOOST_TRY{ @@ -726,9 +731,10 @@ inline typename container_detail::enable_if_memtransfer_copy_assignable template // F models ForwardIterator inline typename container_detail::disable_if_memtransfer_copy_assignable::type - copy_n(I f, typename boost::container::iterator_traits::difference_type n, F r) + copy_n(I f, U n, F r) { while (n--) { *r = *f; @@ -739,9 +745,10 @@ inline typename container_detail::disable_if_memtransfer_copy_assignable // F models ForwardIterator inline typename container_detail::enable_if_memtransfer_copy_assignable::type - copy_n(I f, typename boost::container::iterator_traits::difference_type n, F r) BOOST_NOEXCEPT_OR_NOTHROW + copy_n(I f, U n, F r) BOOST_NOEXCEPT_OR_NOTHROW { return container_detail::memmove_n(f, n, r); } ////////////////////////////////////////////////////////////////////////////// @@ -752,12 +759,13 @@ inline typename container_detail::enable_if_memtransfer_copy_assignable template // F models ForwardIterator inline typename container_detail::disable_if_memtransfer_copy_assignable::type - copy_n_source(I f, typename boost::container::iterator_traits::difference_type n, F r) + copy_n_source(I f, U n, F r) { while (n--) { - *r = *f; + boost::container::assign_in_place(r, f); ++f; ++r; } return f; @@ -765,9 +773,10 @@ inline typename container_detail::disable_if_memtransfer_copy_assignable // F models ForwardIterator inline typename container_detail::enable_if_memtransfer_copy_assignable::type - copy_n_source(I f, typename boost::container::iterator_traits::difference_type n, F r) BOOST_NOEXCEPT_OR_NOTHROW + copy_n_source(I f, U n, F r) BOOST_NOEXCEPT_OR_NOTHROW { return container_detail::memmove_n_source(f, n, r); } ////////////////////////////////////////////////////////////////////////////// @@ -778,9 +787,10 @@ inline typename container_detail::enable_if_memtransfer_copy_assignable template // F models ForwardIterator inline typename container_detail::disable_if_memtransfer_copy_assignable::type - copy_n_source_dest(I f, typename boost::container::iterator_traits::difference_type n, F &r) + copy_n_source_dest(I f, U n, F &r) { while (n--) { *r = *f; @@ -791,9 +801,10 @@ inline typename container_detail::disable_if_memtransfer_copy_assignable // F models ForwardIterator inline typename container_detail::enable_if_memtransfer_copy_assignable::type - copy_n_source_dest(I f, typename boost::container::iterator_traits::difference_type n, F &r) BOOST_NOEXCEPT_OR_NOTHROW + copy_n_source_dest(I f, U n, F &r) BOOST_NOEXCEPT_OR_NOTHROW { return container_detail::memmove_n_source_dest(f, n, r); } ////////////////////////////////////////////////////////////////////////////// @@ -830,9 +841,10 @@ inline typename container_detail::enable_if_memtransfer_copy_assignable template // F models ForwardIterator inline typename container_detail::disable_if_memtransfer_copy_assignable::type - move_n(I f, typename boost::container::iterator_traits::difference_type n, F r) + move_n(I f, U n, F r) { while (n--) { *r = ::boost::move(*f); @@ -843,9 +855,10 @@ inline typename container_detail::disable_if_memtransfer_copy_assignable // F models ForwardIterator inline typename container_detail::enable_if_memtransfer_copy_assignable::type - move_n(I f, typename boost::container::iterator_traits::difference_type n, F r) BOOST_NOEXCEPT_OR_NOTHROW + move_n(I f, U n, F r) BOOST_NOEXCEPT_OR_NOTHROW { return container_detail::memmove_n(f, n, r); } @@ -889,9 +902,10 @@ inline typename container_detail::enable_if_memtransfer_copy_assignable template // F models ForwardIterator inline typename container_detail::disable_if_memtransfer_copy_assignable::type - move_n_source_dest(I f, typename boost::container::iterator_traits::difference_type n, F &r) + move_n_source_dest(I f, U n, F &r) { while (n--) { *r = ::boost::move(*f); @@ -902,9 +916,10 @@ inline typename container_detail::disable_if_memtransfer_copy_assignable // F models ForwardIterator inline typename container_detail::enable_if_memtransfer_copy_assignable::type - move_n_source_dest(I f, typename boost::container::iterator_traits::difference_type n, F &r) BOOST_NOEXCEPT_OR_NOTHROW + move_n_source_dest(I f, U n, F &r) BOOST_NOEXCEPT_OR_NOTHROW { return container_detail::memmove_n_source_dest(f, n, r); } ////////////////////////////////////////////////////////////////////////////// @@ -915,9 +930,10 @@ inline typename container_detail::enable_if_memtransfer_copy_assignable template // F models ForwardIterator inline typename container_detail::disable_if_memtransfer_copy_assignable::type - move_n_source(I f, typename boost::container::iterator_traits::difference_type n, F r) + move_n_source(I f, U n, F r) { while (n--) { *r = ::boost::move(*f); @@ -928,9 +944,10 @@ inline typename container_detail::disable_if_memtransfer_copy_assignable // F models ForwardIterator inline typename container_detail::enable_if_memtransfer_copy_assignable::type - move_n_source(I f, typename boost::container::iterator_traits::difference_type n, F r) BOOST_NOEXCEPT_OR_NOTHROW + move_n_source(I f, U n, F r) BOOST_NOEXCEPT_OR_NOTHROW { return container_detail::memmove_n_source(f, n, r); } ////////////////////////////////////////////////////////////////////////////// @@ -1139,4 +1156,4 @@ void move_assign_range_alloc_n( Allocator &a, I inp_start, typename allocator_tr } //namespace container { } //namespace boost { -#endif //#ifndef BOOST_CONTAINER_DETAIL_UTILITIES_HPP +#endif //#ifndef BOOST_CONTAINER_DETAIL_COPY_MOVE_ALGO_HPP diff --git a/3party/boost/boost/container/detail/dispatch_uses_allocator.hpp b/3party/boost/boost/container/detail/dispatch_uses_allocator.hpp new file mode 100644 index 0000000000..946fdf615b --- /dev/null +++ b/3party/boost/boost/container/detail/dispatch_uses_allocator.hpp @@ -0,0 +1,461 @@ +////////////////////////////////////////////////////////////////////////////// +// +// (C) Copyright Ion Gaztanaga 2015-2015. 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) +// +// See http://www.boost.org/libs/container for documentation. +// +////////////////////////////////////////////////////////////////////////////// + +#ifndef BOOST_CONTAINER_DISPATCH_USES_ALLOCATOR_HPP +#define BOOST_CONTAINER_DISPATCH_USES_ALLOCATOR_HPP + +#if defined (_MSC_VER) +# pragma once +#endif + +#include +#include + +#include +#include + +#include +#include +#include +#include + +#if defined(BOOST_NO_CXX11_VARIADIC_TEMPLATES) +#include +#endif +#include + +#include + +namespace boost { namespace container { + +namespace container_detail { + + +// Check if we can detect is_convertible using advanced SFINAE expressions +#if !defined(BOOST_NO_CXX11_DECLTYPE) && !defined(BOOST_NO_CXX11_VARIADIC_TEMPLATES) + + //! Code inspired by Mathias Gaunard's is_convertible.cpp found in the Boost mailing list + //! http://boost.2283326.n4.nabble.com/type-traits-is-constructible-when-decltype-is-supported-td3575452.html + //! Thanks Mathias! + + //With variadic templates, we need a single class to implement the trait + template + struct is_constructible + { + typedef char yes_type; + struct no_type + { char padding[2]; }; + + template + struct dummy; + + template + static decltype(X(boost::move_detail::declval()...), true_type()) test(int); + + template + static no_type test(...); + + static const bool value = sizeof(test(0)) == sizeof(yes_type); + }; + + template + struct is_constructible_with_allocator_prefix + : is_constructible + {}; + +#else // #if !defined(BOOST_NO_SFINAE_EXPR) && !defined(BOOST_NO_CXX11_VARIADIC_TEMPLATES) + + //Without advanced SFINAE expressions, we can't use is_constructible + //so backup to constructible_with_allocator_xxx + + #if !defined(BOOST_NO_CXX11_VARIADIC_TEMPLATES) + + template + struct is_constructible_with_allocator_prefix + : constructible_with_allocator_prefix + {}; + + template + struct is_constructible_with_allocator_suffix + : constructible_with_allocator_suffix + {}; + + #else // #if !defined(BOOST_NO_CXX11_VARIADIC_TEMPLATES) + + template + struct is_constructible_with_allocator_prefix + : constructible_with_allocator_prefix + {}; + + template + struct is_constructible_with_allocator_suffix + : constructible_with_allocator_suffix + {}; + + #endif // #if !defined(BOOST_NO_CXX11_VARIADIC_TEMPLATES) + +#endif // #if !defined(BOOST_NO_SFINAE_EXPR) + +#if !defined(BOOST_NO_CXX11_VARIADIC_TEMPLATES) + +template < typename ConstructAlloc + , typename ArgAlloc + , typename T + , class ...Args + > +inline typename container_detail::enable_if_and + < void + , container_detail::is_not_pair + , container_detail::not_< uses_allocator > + >::type dispatch_uses_allocator + ( ConstructAlloc & construct_alloc, BOOST_FWD_REF(ArgAlloc) arg_alloc, T* p, BOOST_FWD_REF(Args)...args) +{ + (void)arg_alloc; + allocator_traits::construct(construct_alloc, p, ::boost::forward(args)...); +} + +// allocator_arg_t +template < typename ConstructAlloc + , typename ArgAlloc + , typename T + , class ...Args + > +inline typename container_detail::enable_if_and + < void + , container_detail::is_not_pair + , uses_allocator + , is_constructible_with_allocator_prefix + >::type dispatch_uses_allocator + ( ConstructAlloc& construct_alloc, BOOST_FWD_REF(ArgAlloc) arg_alloc, T* p, BOOST_FWD_REF(Args) ...args) +{ + allocator_traits::construct + ( construct_alloc, p, allocator_arg + , ::boost::forward(arg_alloc), ::boost::forward(args)...); +} + +// allocator suffix +template < typename ConstructAlloc + , typename ArgAlloc + , typename T + , class ...Args + > +inline typename container_detail::enable_if_and + < void + , container_detail::is_not_pair + , uses_allocator + , container_detail::not_ > + >::type dispatch_uses_allocator + ( ConstructAlloc& construct_alloc, BOOST_FWD_REF(ArgAlloc) arg_alloc, T* p, BOOST_FWD_REF(Args)...args) +{ + allocator_traits::construct + (construct_alloc, p, ::boost::forward(args)..., ::boost::forward(arg_alloc)); +} + +#else //#if !defined(BOOST_NO_CXX11_VARIADIC_TEMPLATES) + +#define BOOST_CONTAINER_SCOPED_ALLOCATOR_DISPATCH_USES_ALLOCATOR_CODE(N) \ + template \ + inline typename container_detail::enable_if_and\ + < void\ + , container_detail::is_not_pair\ + , container_detail::not_ >\ + >::type\ + dispatch_uses_allocator\ + (ConstructAlloc &construct_alloc, BOOST_FWD_REF(ArgAlloc) arg_alloc, T* p BOOST_MOVE_I##N BOOST_MOVE_UREF##N)\ + {\ + (void)arg_alloc;\ + allocator_traits::construct(construct_alloc, p BOOST_MOVE_I##N BOOST_MOVE_FWD##N);\ + }\ +// +BOOST_MOVE_ITERATE_0TO9(BOOST_CONTAINER_SCOPED_ALLOCATOR_DISPATCH_USES_ALLOCATOR_CODE) +#undef BOOST_CONTAINER_SCOPED_ALLOCATOR_DISPATCH_USES_ALLOCATOR_CODE + +#define BOOST_CONTAINER_SCOPED_ALLOCATOR_DISPATCH_USES_ALLOCATOR_CODE(N) \ + template < typename ConstructAlloc, typename ArgAlloc, typename T BOOST_MOVE_I##N BOOST_MOVE_CLASS##N >\ + inline typename container_detail::enable_if_and\ + < void\ + , container_detail::is_not_pair\ + , uses_allocator\ + , is_constructible_with_allocator_prefix\ + >::type\ + dispatch_uses_allocator\ + (ConstructAlloc& construct_alloc, BOOST_FWD_REF(ArgAlloc) arg_alloc, T* p BOOST_MOVE_I##N BOOST_MOVE_UREF##N)\ + {\ + allocator_traits::construct\ + (construct_alloc, p, allocator_arg, ::boost::forward(arg_alloc) BOOST_MOVE_I##N BOOST_MOVE_FWD##N);\ + }\ +// +BOOST_MOVE_ITERATE_0TO9(BOOST_CONTAINER_SCOPED_ALLOCATOR_DISPATCH_USES_ALLOCATOR_CODE) +#undef BOOST_CONTAINER_SCOPED_ALLOCATOR_DISPATCH_USES_ALLOCATOR_CODE + +#define BOOST_CONTAINER_SCOPED_ALLOCATOR_DISPATCH_USES_ALLOCATOR_CODE(N) \ + template < typename ConstructAlloc, typename ArgAlloc, typename T BOOST_MOVE_I##N BOOST_MOVE_CLASS##N >\ + inline typename container_detail::enable_if_and\ + < void\ + , container_detail::is_not_pair\ + , uses_allocator\ + , container_detail::not_ >\ + >::type\ + dispatch_uses_allocator\ + (ConstructAlloc& construct_alloc, BOOST_FWD_REF(ArgAlloc) arg_alloc, T* p BOOST_MOVE_I##N BOOST_MOVE_UREF##N)\ + {\ + allocator_traits::construct\ + (construct_alloc, p BOOST_MOVE_I##N BOOST_MOVE_FWD##N, ::boost::forward(arg_alloc));\ + }\ +// +BOOST_MOVE_ITERATE_0TO9(BOOST_CONTAINER_SCOPED_ALLOCATOR_DISPATCH_USES_ALLOCATOR_CODE) +#undef BOOST_CONTAINER_SCOPED_ALLOCATOR_DISPATCH_USES_ALLOCATOR_CODE + +#endif //#if !defined(BOOST_NO_CXX11_VARIADIC_TEMPLATES) + +template < typename ConstructAlloc + , typename ArgAlloc + , typename Pair + > inline +BOOST_CONTAINER_DOC1ST(void, typename container_detail::enable_if >::type) + dispatch_uses_allocator + ( ConstructAlloc & construct_alloc + , BOOST_FWD_REF(ArgAlloc) arg_alloc + , Pair* p) +{ + (dispatch_uses_allocator)(construct_alloc, arg_alloc, container_detail::addressof(p->first)); + BOOST_TRY{ + (dispatch_uses_allocator)(construct_alloc, arg_alloc, container_detail::addressof(p->second)); + } + BOOST_CATCH(...) { + allocator_traits::destroy(construct_alloc, container_detail::addressof(p->first)); + BOOST_RETHROW + } + BOOST_CATCH_END +} + + +template < typename ConstructAlloc + , typename ArgAlloc + , class Pair, class U, class V> +BOOST_CONTAINER_DOC1ST(void, typename container_detail::enable_if >::type) + dispatch_uses_allocator + ( ConstructAlloc & construct_alloc + , BOOST_FWD_REF(ArgAlloc) arg_alloc + , Pair* p, BOOST_FWD_REF(U) x, BOOST_FWD_REF(V) y) +{ + (dispatch_uses_allocator)(construct_alloc, arg_alloc, container_detail::addressof(p->first), ::boost::forward(x)); + BOOST_TRY{ + (dispatch_uses_allocator)(construct_alloc, arg_alloc, container_detail::addressof(p->second), ::boost::forward(y)); + } + BOOST_CATCH(...){ + allocator_traits::destroy(construct_alloc, container_detail::addressof(p->first)); + BOOST_RETHROW + } + BOOST_CATCH_END +} + +template < typename ConstructAlloc + , typename ArgAlloc + , class Pair, class Pair2> +BOOST_CONTAINER_DOC1ST(void, typename container_detail::enable_if< container_detail::is_pair >::type) + dispatch_uses_allocator + (ConstructAlloc & construct_alloc + , BOOST_FWD_REF(ArgAlloc) arg_alloc + , Pair* p, Pair2& x) +{ (dispatch_uses_allocator)(construct_alloc, arg_alloc, p, x.first, x.second); } + +template < typename ConstructAlloc + , typename ArgAlloc + , class Pair, class Pair2> +typename container_detail::enable_if_and + < void + , container_detail::is_pair + , container_detail::not_ > >::type //This is needed for MSVC10 and ambiguous overloads + dispatch_uses_allocator + (ConstructAlloc & construct_alloc + , BOOST_FWD_REF(ArgAlloc) arg_alloc + , Pair* p, BOOST_RV_REF_BEG Pair2 BOOST_RV_REF_END x) +{ (dispatch_uses_allocator)(construct_alloc, arg_alloc, p, ::boost::move(x.first), ::boost::move(x.second)); } + + +//piecewise construction from boost::tuple +#define BOOST_DISPATCH_USES_ALLOCATOR_PIECEWISE_CONSTRUCT_BOOST_TUPLE_CODE(N,M)\ +template< typename ConstructAlloc, typename ArgAlloc, class Pair \ + , template class BoostTuple \ + BOOST_MOVE_I_IF(BOOST_MOVE_OR(N,M)) BOOST_MOVE_CLASS##N BOOST_MOVE_I_IF(BOOST_MOVE_AND(N,M)) BOOST_MOVE_CLASSQ##M > \ +typename container_detail::enable_if< container_detail::is_pair >::type\ + dispatch_uses_allocator( ConstructAlloc & construct_alloc, BOOST_FWD_REF(ArgAlloc) arg_alloc, Pair* pair, piecewise_construct_t\ + , BoostTuple p\ + , BoostTuple q)\ +{\ + (void)p; (void)q;\ + (dispatch_uses_allocator)\ + (construct_alloc, arg_alloc, container_detail::addressof(pair->first) BOOST_MOVE_I_IF(N) BOOST_MOVE_TMPL_GET##N);\ + BOOST_TRY{\ + (dispatch_uses_allocator)\ + (construct_alloc, arg_alloc, container_detail::addressof(pair->second) BOOST_MOVE_I_IF(M) BOOST_MOVE_TMPL_GETQ##M);\ + }\ + BOOST_CATCH(...) {\ + allocator_traits::destroy(construct_alloc, container_detail::addressof(pair->first));\ + BOOST_RETHROW\ + }\ + BOOST_CATCH_END\ +}\ +// +BOOST_MOVE_ITER2D_0TOMAX(9, BOOST_DISPATCH_USES_ALLOCATOR_PIECEWISE_CONSTRUCT_BOOST_TUPLE_CODE) +#undef BOOST_DISPATCH_USES_ALLOCATOR_PIECEWISE_CONSTRUCT_BOOST_TUPLE_CODE + +//piecewise construction from Std Tuple +#if !defined(BOOST_NO_CXX11_VARIADIC_TEMPLATES) + + template< typename ConstructAlloc, typename ArgAlloc, class Pair + , template class Tuple, class... Args1, class... Args2, size_t... Indexes1, size_t... Indexes2> + void dispatch_uses_allocator_index( ConstructAlloc & construct_alloc, BOOST_FWD_REF(ArgAlloc) arg_alloc, Pair* pair + , Tuple& t1, Tuple& t2, index_tuple, index_tuple) + { + (void)t1; (void)t2; + (dispatch_uses_allocator)(construct_alloc, arg_alloc, container_detail::addressof(pair->first), ::boost::forward(get(t1))...); + BOOST_TRY{ + (dispatch_uses_allocator)(construct_alloc, arg_alloc, container_detail::addressof(pair->second), ::boost::forward(get(t2))...); + } + BOOST_CATCH(...){ + allocator_traits::destroy(construct_alloc, container_detail::addressof(pair->first)); + BOOST_RETHROW + } + BOOST_CATCH_END + } + + template< typename ConstructAlloc, typename ArgAlloc, class Pair + , template class Tuple, class... Args1, class... Args2> + typename container_detail::enable_if< container_detail::is_pair >::type + dispatch_uses_allocator( ConstructAlloc & construct_alloc, BOOST_FWD_REF(ArgAlloc) arg_alloc, Pair* pair, piecewise_construct_t + , Tuple t1, Tuple t2) + { + (dispatch_uses_allocator_index)( construct_alloc, arg_alloc, pair, t1, t2 + , typename build_number_seq::type() + , typename build_number_seq::type()); + } + +#elif defined(BOOST_MSVC) && (_CPPLIB_VER == 520) + + //MSVC 2010 tuple implementation + #define BOOST_DISPATCH_USES_ALLOCATOR_PIECEWISE_CONSTRUCT_MSVC2010_TUPLE_CODE(N,M)\ + template< typename ConstructAlloc, typename ArgAlloc, class Pair\ + , template class StdTuple\ + BOOST_MOVE_I_IF(BOOST_MOVE_OR(N,M)) BOOST_MOVE_CLASS##N BOOST_MOVE_I_IF(BOOST_MOVE_AND(N,M)) BOOST_MOVE_CLASSQ##M > \ + typename container_detail::enable_if< container_detail::is_pair >::type\ + dispatch_uses_allocator(ConstructAlloc & construct_alloc, BOOST_FWD_REF(ArgAlloc) arg_alloc, Pair* pair, piecewise_construct_t\ + , StdTuple p\ + , StdTuple q)\ + {\ + (void)p; (void)q;\ + (dispatch_uses_allocator)\ + (construct_alloc, arg_alloc, container_detail::addressof(pair->first) BOOST_MOVE_I_IF(N) BOOST_MOVE_GET_IDX##N);\ + BOOST_TRY{\ + (dispatch_uses_allocator)\ + (construct_alloc, arg_alloc, container_detail::addressof(pair->second) BOOST_MOVE_I_IF(M) BOOST_MOVE_GET_IDXQ##M);\ + }\ + BOOST_CATCH(...) {\ + allocator_traits::destroy(construct_alloc, container_detail::addressof(pair->first));\ + BOOST_RETHROW\ + }\ + BOOST_CATCH_END\ + }\ + // + BOOST_MOVE_ITER2D_0TOMAX(9, BOOST_DISPATCH_USES_ALLOCATOR_PIECEWISE_CONSTRUCT_MSVC2010_TUPLE_CODE) + #undef BOOST_DISPATCH_USES_ALLOCATOR_PIECEWISE_CONSTRUCT_MSVC2010_TUPLE_CODE + +#elif defined(BOOST_MSVC) && (_CPPLIB_VER == 540) + #if _VARIADIC_MAX >= 9 + #define BOOST_DISPATCH_USES_ALLOCATOR_PIECEWISE_CONSTRUCT_MSVC2012_TUPLE_MAX_IT 9 + #else + #define BOOST_DISPATCH_USES_ALLOCATOR_PIECEWISE_CONSTRUCT_MSVC2012_TUPLE_MAX_IT BOOST_MOVE_ADD(_VARIADIC_MAX, 1) + #endif + + //MSVC 2012 tuple implementation + #define BOOST_DISPATCH_USES_ALLOCATOR_PIECEWISE_CONSTRUCT_MSVC2012_TUPLE_CODE(N,M)\ + template< typename ConstructAlloc, typename ArgAlloc, class Pair\ + , template class StdTuple \ + BOOST_MOVE_I_IF(BOOST_MOVE_OR(N,M)) BOOST_MOVE_CLASS##N BOOST_MOVE_I_IF(BOOST_MOVE_AND(N,M)) BOOST_MOVE_CLASSQ##M > \ + typename container_detail::enable_if< container_detail::is_pair >::type\ + dispatch_uses_allocator\ + ( ConstructAlloc & construct_alloc, BOOST_FWD_REF(ArgAlloc) arg_alloc, Pair* pair, piecewise_construct_t\ + , StdTuple p\ + , StdTuple q)\ + {\ + (void)p; (void)q;\ + (dispatch_uses_allocator)\ + (construct_alloc, arg_alloc, container_detail::addressof(pair->first) BOOST_MOVE_I_IF(N) BOOST_MOVE_GET_IDX##N);\ + BOOST_TRY{\ + (dispatch_uses_allocator)\ + (construct_alloc, arg_alloc, container_detail::addressof(pair->second) BOOST_MOVE_I_IF(M) BOOST_MOVE_GET_IDXQ##M);\ + }\ + BOOST_CATCH(...) {\ + allocator_traits::destroy(construct_alloc, container_detail::addressof(pair->first));\ + BOOST_RETHROW\ + }\ + BOOST_CATCH_END\ + }\ + // + BOOST_MOVE_ITER2D_0TOMAX(BOOST_DISPATCH_USES_ALLOCATOR_PIECEWISE_CONSTRUCT_MSVC2012_TUPLE_MAX_IT, BOOST_DISPATCH_USES_ALLOCATOR_PIECEWISE_CONSTRUCT_MSVC2012_TUPLE_CODE) + #undef BOOST_DISPATCH_USES_ALLOCATOR_PIECEWISE_CONSTRUCT_MSVC2010_TUPLE_CODE + #undef BOOST_DISPATCH_USES_ALLOCATOR_PIECEWISE_CONSTRUCT_MSVC2012_TUPLE_MAX_IT + +#endif //!defined(BOOST_NO_CXX11_VARIADIC_TEMPLATES) + +#if !defined(BOOST_NO_CXX11_VARIADIC_TEMPLATES) + +template < typename ConstructAlloc + , typename ArgAlloc + , class Pair, class KeyType, class ... Args> +typename container_detail::enable_if< container_detail::is_pair, void >::type + dispatch_uses_allocator + (ConstructAlloc & construct_alloc, BOOST_FWD_REF(ArgAlloc) arg_alloc, Pair* p, try_emplace_t, BOOST_FWD_REF(KeyType) k, BOOST_FWD_REF(Args) ...args) +{ + (dispatch_uses_allocator)(construct_alloc, arg_alloc, container_detail::addressof(p->first), ::boost::forward(k)); + BOOST_TRY{ + (dispatch_uses_allocator)(construct_alloc, arg_alloc, container_detail::addressof(p->second), ::boost::forward(args)...); + } + BOOST_CATCH(...) { + allocator_traits::destroy(construct_alloc, container_detail::addressof(p->first)); + BOOST_RETHROW + } + BOOST_CATCH_END +} + +#else + +#define BOOST_CONTAINER_DISPATCH_USES_ALLOCATOR_PAIR_TRY_EMPLACE_CODE(N) \ + template \ + inline typename container_detail::enable_if\ + < container_detail::is_pair, void >::type\ + dispatch_uses_allocator\ + (ConstructAlloc &construct_alloc, BOOST_FWD_REF(ArgAlloc) arg_alloc, Pair* p, try_emplace_t, \ + BOOST_FWD_REF(KeyType) k BOOST_MOVE_I##N BOOST_MOVE_UREF##N)\ + {\ + (dispatch_uses_allocator)(construct_alloc, arg_alloc, container_detail::addressof(p->first), ::boost::forward(k));\ + BOOST_TRY{\ + (dispatch_uses_allocator)(construct_alloc, arg_alloc, container_detail::addressof(p->second) BOOST_MOVE_I##N BOOST_MOVE_FWD##N);\ + }\ + BOOST_CATCH(...) {\ + allocator_traits::destroy(construct_alloc, container_detail::addressof(p->first));\ + BOOST_RETHROW\ + }\ + BOOST_CATCH_END\ + }\ +// +BOOST_MOVE_ITERATE_0TO9(BOOST_CONTAINER_DISPATCH_USES_ALLOCATOR_PAIR_TRY_EMPLACE_CODE) +#undef BOOST_CONTAINER_DISPATCH_USES_ALLOCATOR_PAIR_TRY_EMPLACE_CODE + +#endif //!defined(BOOST_NO_CXX11_VARIADIC_TEMPLATES) + +} //namespace container_detail + +}} // namespace boost { namespace container { + +#include + +#endif // BOOST_CONTAINER_DISPATCH_USES_ALLOCATOR_HPP diff --git a/3party/boost/boost/container/detail/dlmalloc.hpp b/3party/boost/boost/container/detail/dlmalloc.hpp new file mode 100644 index 0000000000..15086c399f --- /dev/null +++ b/3party/boost/boost/container/detail/dlmalloc.hpp @@ -0,0 +1,103 @@ +////////////////////////////////////////////////////////////////////////////// +// +// (C) Copyright Ion Gaztanaga 2015-2015. 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) +// +// See http://www.boost.org/libs/container for documentation. +// +////////////////////////////////////////////////////////////////////////////// +#ifndef BOOST_CONTAINER_DETAIL_ALLOC_LIB_HPP +#define BOOST_CONTAINER_DETAIL_ALLOC_LIB_HPP + +#ifndef BOOST_CONFIG_HPP +# include +#endif + +#if defined(BOOST_HAS_PRAGMA_ONCE) +# pragma once +#endif + +#include +#include +#include + +#include + +namespace boost{ +namespace container{ + +typedef boost_cont_command_ret_t dlmalloc_command_ret_t; +typedef boost_cont_memchain dlmalloc_memchain; +typedef boost_cont_memchain_it dlmalloc_memchain_it; +typedef boost_cont_malloc_stats_t dlmalloc_malloc_stats_t; + +BOOST_CONTAINER_DECL size_t dlmalloc_size(const void *p); + +BOOST_CONTAINER_DECL void* dlmalloc_malloc(size_t bytes); + +BOOST_CONTAINER_DECL void dlmalloc_free(void* mem); + +BOOST_CONTAINER_DECL void* dlmalloc_memalign(size_t bytes, size_t alignment); + +BOOST_CONTAINER_DECL int dlmalloc_multialloc_nodes + (size_t n_elements, size_t elem_size, size_t contiguous_elements, boost_cont_memchain *pchain); + +BOOST_CONTAINER_DECL int dlmalloc_multialloc_arrays + (size_t n_elements, const size_t *sizes, size_t sizeof_element, size_t contiguous_elements, boost_cont_memchain *pchain); + +BOOST_CONTAINER_DECL void dlmalloc_multidealloc(boost_cont_memchain *pchain); + +BOOST_CONTAINER_DECL size_t dlmalloc_footprint(); + +BOOST_CONTAINER_DECL size_t dlmalloc_allocated_memory(); + +BOOST_CONTAINER_DECL size_t dlmalloc_chunksize(const void *p); + +BOOST_CONTAINER_DECL int dlmalloc_all_deallocated(); + +BOOST_CONTAINER_DECL boost_cont_malloc_stats_t dlmalloc_malloc_stats(); + +BOOST_CONTAINER_DECL size_t dlmalloc_in_use_memory(); + +BOOST_CONTAINER_DECL int dlmalloc_trim(size_t pad); + +BOOST_CONTAINER_DECL int dlmalloc_mallopt(int parameter_number, int parameter_value); + +BOOST_CONTAINER_DECL int dlmalloc_grow(void* oldmem, size_t minbytes, size_t maxbytes, size_t *received); + +BOOST_CONTAINER_DECL int dlmalloc_shrink(void* oldmem, size_t minbytes, size_t maxbytes, size_t *received, int do_commit); + +BOOST_CONTAINER_DECL void* dlmalloc_alloc(size_t minbytes, size_t preferred_bytes, size_t *received_bytes); + +BOOST_CONTAINER_DECL int dlmalloc_malloc_check(); + +BOOST_CONTAINER_DECL boost_cont_command_ret_t dlmalloc_allocation_command + ( allocation_type command + , size_t sizeof_object + , size_t limit_objects + , size_t preferred_objects + , size_t *received_objects + , void *reuse_ptr + ); + +BOOST_CONTAINER_DECL int dlmalloc_mallopt(int param_number, int value); + +BOOST_CONTAINER_DECL void *dlmalloc_sync_create(); + +BOOST_CONTAINER_DECL void dlmalloc_sync_destroy(void *sync); + +BOOST_CONTAINER_DECL bool dlmalloc_sync_lock(void *sync); + +BOOST_CONTAINER_DECL void dlmalloc_sync_unlock(void *sync); + +BOOST_CONTAINER_DECL bool dlmalloc_global_sync_lock(); + +BOOST_CONTAINER_DECL void dlmalloc_global_sync_unlock(); + +} //namespace container{ +} //namespace boost{ + +#include + +#endif //BOOST_CONTAINER_DETAIL_ALLOC_LIB_HPP diff --git a/3party/boost/boost/container/detail/flat_tree.hpp b/3party/boost/boost/container/detail/flat_tree.hpp index f27421125f..93984d18e5 100644 --- a/3party/boost/boost/container/detail/flat_tree.hpp +++ b/3party/boost/boost/container/detail/flat_tree.hpp @@ -1,6 +1,6 @@ //////////////////////////////////////////////////////////////////////////////// // -// (C) Copyright Ion Gaztanaga 2005-2013. Distributed under the Boost +// (C) Copyright Ion Gaztanaga 2005-2015. 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) // @@ -32,11 +32,13 @@ #include #include //algo_equal(), algo_lexicographical_compare #include +#include #include #ifdef BOOST_CONTAINER_VECTOR_ITERATOR_IS_POINTER #include #endif #include +#include #include #include #if defined(BOOST_NO_CXX11_VARIADIC_TEMPLATES) @@ -44,6 +46,7 @@ #endif #include //pair +#include namespace boost { namespace container { @@ -98,7 +101,7 @@ struct get_flat_tree_iterators typedef boost::container::reverse_iterator const_reverse_iterator; }; -template class flat_tree { @@ -183,7 +186,7 @@ class flat_tree typedef typename vector_t::const_pointer const_pointer; typedef typename vector_t::reference reference; typedef typename vector_t::const_reference const_reference; - typedef Key key_type; + typedef typename KeyOfValue::type key_type; typedef Compare key_compare; typedef typename vector_t::allocator_type allocator_type; typedef typename vector_t::size_type size_type; @@ -200,35 +203,36 @@ class flat_tree typedef allocator_traits stored_allocator_traits; public: - flat_tree() + BOOST_CONTAINER_FORCEINLINE flat_tree() : m_data() { } - explicit flat_tree(const Compare& comp) + BOOST_CONTAINER_FORCEINLINE explicit flat_tree(const Compare& comp) : m_data(comp) { } - flat_tree(const Compare& comp, const allocator_type& a) + BOOST_CONTAINER_FORCEINLINE flat_tree(const Compare& comp, const allocator_type& a) : m_data(comp, a) { } - explicit flat_tree(const allocator_type& a) + BOOST_CONTAINER_FORCEINLINE explicit flat_tree(const allocator_type& a) : m_data(a) { } - flat_tree(const flat_tree& x) + BOOST_CONTAINER_FORCEINLINE flat_tree(const flat_tree& x) : m_data(x.m_data) { } - flat_tree(BOOST_RV_REF(flat_tree) x) + BOOST_CONTAINER_FORCEINLINE flat_tree(BOOST_RV_REF(flat_tree) x) + BOOST_NOEXCEPT_IF(boost::container::container_detail::is_nothrow_move_constructible::value) : m_data(boost::move(x.m_data)) { } - flat_tree(const flat_tree& x, const allocator_type &a) + BOOST_CONTAINER_FORCEINLINE flat_tree(const flat_tree& x, const allocator_type &a) : m_data(x.m_data, a) { } - flat_tree(BOOST_RV_REF(flat_tree) x, const allocator_type &a) + BOOST_CONTAINER_FORCEINLINE flat_tree(BOOST_RV_REF(flat_tree) x, const allocator_type &a) : m_data(boost::move(x.m_data), a) { } @@ -237,7 +241,20 @@ class flat_tree , const Compare& comp = Compare() , const allocator_type& a = allocator_type()) : m_data(comp, a) - { this->m_data.m_vect.insert(this->m_data.m_vect.end(), first, last); } + { + this->m_data.m_vect.insert(this->m_data.m_vect.end(), first, last); + BOOST_ASSERT((is_sorted)(this->m_data.m_vect.cbegin(), this->m_data.m_vect.cend(), this->priv_value_comp())); + } + + template + flat_tree( ordered_unique_range_t, InputIterator first, InputIterator last + , const Compare& comp = Compare() + , const allocator_type& a = allocator_type()) + : m_data(comp, a) + { + this->m_data.m_vect.insert(this->m_data.m_vect.end(), first, last); + BOOST_ASSERT((is_sorted_and_unique)(this->m_data.m_vect.cbegin(), this->m_data.m_vect.cend(), this->priv_value_comp())); + } template flat_tree( bool unique_insertion @@ -262,80 +279,93 @@ class flat_tree } } - ~flat_tree() + BOOST_CONTAINER_FORCEINLINE ~flat_tree() {} - flat_tree& operator=(BOOST_COPY_ASSIGN_REF(flat_tree) x) + BOOST_CONTAINER_FORCEINLINE flat_tree& operator=(BOOST_COPY_ASSIGN_REF(flat_tree) x) { m_data = x.m_data; return *this; } - flat_tree& operator=(BOOST_RV_REF(flat_tree) x) - BOOST_NOEXCEPT_IF( allocator_traits_type::is_always_equal::value - && boost::container::container_detail::is_nothrow_move_assignable::value ) + BOOST_CONTAINER_FORCEINLINE flat_tree& operator=(BOOST_RV_REF(flat_tree) x) + BOOST_NOEXCEPT_IF( (allocator_traits_type::propagate_on_container_move_assignment::value || + allocator_traits_type::is_always_equal::value) && + boost::container::container_detail::is_nothrow_move_assignable::value) { m_data = boost::move(x.m_data); return *this; } + BOOST_CONTAINER_FORCEINLINE const value_compare &priv_value_comp() const + { return static_cast(this->m_data); } + + BOOST_CONTAINER_FORCEINLINE value_compare &priv_value_comp() + { return static_cast(this->m_data); } + + BOOST_CONTAINER_FORCEINLINE const key_compare &priv_key_comp() const + { return this->priv_value_comp().get_comp(); } + + BOOST_CONTAINER_FORCEINLINE key_compare &priv_key_comp() + { return this->priv_value_comp().get_comp(); } + public: // accessors: - Compare key_comp() const + BOOST_CONTAINER_FORCEINLINE Compare key_comp() const { return this->m_data.get_comp(); } - value_compare value_comp() const + BOOST_CONTAINER_FORCEINLINE value_compare value_comp() const { return this->m_data; } - allocator_type get_allocator() const + BOOST_CONTAINER_FORCEINLINE allocator_type get_allocator() const { return this->m_data.m_vect.get_allocator(); } - const stored_allocator_type &get_stored_allocator() const + BOOST_CONTAINER_FORCEINLINE const stored_allocator_type &get_stored_allocator() const { return this->m_data.m_vect.get_stored_allocator(); } - stored_allocator_type &get_stored_allocator() + BOOST_CONTAINER_FORCEINLINE stored_allocator_type &get_stored_allocator() { return this->m_data.m_vect.get_stored_allocator(); } - iterator begin() + BOOST_CONTAINER_FORCEINLINE iterator begin() { return this->m_data.m_vect.begin(); } - const_iterator begin() const + BOOST_CONTAINER_FORCEINLINE const_iterator begin() const { return this->cbegin(); } - const_iterator cbegin() const + BOOST_CONTAINER_FORCEINLINE const_iterator cbegin() const { return this->m_data.m_vect.begin(); } - iterator end() + BOOST_CONTAINER_FORCEINLINE iterator end() { return this->m_data.m_vect.end(); } - const_iterator end() const + BOOST_CONTAINER_FORCEINLINE const_iterator end() const { return this->cend(); } - const_iterator cend() const + BOOST_CONTAINER_FORCEINLINE const_iterator cend() const { return this->m_data.m_vect.end(); } - reverse_iterator rbegin() + BOOST_CONTAINER_FORCEINLINE reverse_iterator rbegin() { return reverse_iterator(this->end()); } - const_reverse_iterator rbegin() const + BOOST_CONTAINER_FORCEINLINE const_reverse_iterator rbegin() const { return this->crbegin(); } - const_reverse_iterator crbegin() const + BOOST_CONTAINER_FORCEINLINE const_reverse_iterator crbegin() const { return const_reverse_iterator(this->cend()); } - reverse_iterator rend() + BOOST_CONTAINER_FORCEINLINE reverse_iterator rend() { return reverse_iterator(this->begin()); } - const_reverse_iterator rend() const + BOOST_CONTAINER_FORCEINLINE const_reverse_iterator rend() const { return this->crend(); } - const_reverse_iterator crend() const + BOOST_CONTAINER_FORCEINLINE const_reverse_iterator crend() const { return const_reverse_iterator(this->cbegin()); } - bool empty() const + BOOST_CONTAINER_FORCEINLINE bool empty() const { return this->m_data.m_vect.empty(); } - size_type size() const + BOOST_CONTAINER_FORCEINLINE size_type size() const { return this->m_data.m_vect.size(); } - size_type max_size() const + BOOST_CONTAINER_FORCEINLINE size_type max_size() const { return this->m_data.m_vect.max_size(); } - void swap(flat_tree& other) + BOOST_CONTAINER_FORCEINLINE void swap(flat_tree& other) BOOST_NOEXCEPT_IF( allocator_traits_type::is_always_equal::value && boost::container::container_detail::is_nothrow_swappable::value ) { this->m_data.swap(other.m_data); } @@ -346,7 +376,7 @@ class flat_tree { std::pair ret; insert_commit_data data; - ret.second = this->priv_insert_unique_prepare(val, data); + ret.second = this->priv_insert_unique_prepare(KeyOfValue()(val), data); ret.first = ret.second ? this->priv_insert_commit(data, val) : iterator(vector_iterator_get_ptr(data.position)); return ret; @@ -356,7 +386,7 @@ class flat_tree { std::pair ret; insert_commit_data data; - ret.second = this->priv_insert_unique_prepare(val, data); + ret.second = this->priv_insert_unique_prepare(KeyOfValue()(val), data); ret.first = ret.second ? this->priv_insert_commit(data, boost::move(val)) : iterator(vector_iterator_get_ptr(data.position)); return ret; @@ -376,35 +406,37 @@ class flat_tree return i; } - iterator insert_unique(const_iterator pos, const value_type& val) + iterator insert_unique(const_iterator hint, const value_type& val) { - std::pair ret; + BOOST_ASSERT(this->priv_in_range_or_end(hint)); insert_commit_data data; - return this->priv_insert_unique_prepare(pos, val, data) + return this->priv_insert_unique_prepare(hint, KeyOfValue()(val), data) ? this->priv_insert_commit(data, val) : iterator(vector_iterator_get_ptr(data.position)); } - iterator insert_unique(const_iterator pos, BOOST_RV_REF(value_type) val) + iterator insert_unique(const_iterator hint, BOOST_RV_REF(value_type) val) { - std::pair ret; + BOOST_ASSERT(this->priv_in_range_or_end(hint)); insert_commit_data data; - return this->priv_insert_unique_prepare(pos, val, data) + return this->priv_insert_unique_prepare(hint, KeyOfValue()(val), data) ? this->priv_insert_commit(data, boost::move(val)) : iterator(vector_iterator_get_ptr(data.position)); } - iterator insert_equal(const_iterator pos, const value_type& val) + iterator insert_equal(const_iterator hint, const value_type& val) { + BOOST_ASSERT(this->priv_in_range_or_end(hint)); insert_commit_data data; - this->priv_insert_equal_prepare(pos, val, data); + this->priv_insert_equal_prepare(hint, val, data); return this->priv_insert_commit(data, val); } - iterator insert_equal(const_iterator pos, BOOST_RV_REF(value_type) mval) + iterator insert_equal(const_iterator hint, BOOST_RV_REF(value_type) mval) { + BOOST_ASSERT(this->priv_in_range_or_end(hint)); insert_commit_data data; - this->priv_insert_equal_prepare(pos, mval, data); + this->priv_insert_equal_prepare(hint, mval, data); return this->priv_insert_commit(data, boost::move(mval)); } @@ -477,7 +509,7 @@ class flat_tree >::type * = 0 #endif ) - { this->m_data.m_vect.merge(first, last); } + { this->m_data.m_vect.merge(first, last, static_cast(this->m_data)); } template void insert_unique(ordered_unique_range_t, InIt first, InIt last @@ -506,7 +538,7 @@ class flat_tree >::type * = 0 #endif ) - { this->m_data.m_vect.merge_unique(first, last, value_compare()); } + { this->m_data.m_vect.merge_unique(first, last, static_cast(this->m_data)); } #if !defined(BOOST_NO_CXX11_VARIADIC_TEMPLATES) @@ -524,6 +556,7 @@ class flat_tree template iterator emplace_hint_unique(const_iterator hint, BOOST_FWD_REF(Args)... args) { + //hint checked in insert_unique typename aligned_storage::value>::type v; value_type &val = *static_cast(static_cast(&v)); stored_allocator_type &a = this->get_stored_allocator(); @@ -546,6 +579,7 @@ class flat_tree template iterator emplace_hint_equal(const_iterator hint, BOOST_FWD_REF(Args)... args) { + //hint checked in insert_equal typename aligned_storage::value>::type v; value_type &val = *static_cast(static_cast(&v)); stored_allocator_type &a = this->get_stored_allocator(); @@ -554,6 +588,29 @@ class flat_tree return this->insert_equal(hint, ::boost::move(val)); } + template + BOOST_CONTAINER_FORCEINLINE std::pair try_emplace + (const_iterator hint, BOOST_FWD_REF(KeyType) key, BOOST_FWD_REF(Args)... args) + { + std::pair ret; + insert_commit_data data; + const key_type & k = key; + ret.second = hint == const_iterator() + ? this->priv_insert_unique_prepare(k, data) + : this->priv_insert_unique_prepare(hint, k, data); + + if(!ret.second){ + ret.first = this->nth(data.position - this->cbegin()); + } + else{ + typedef typename emplace_functor_type::type func_t; + typedef emplace_iterator it_t; + func_t func(try_emplace_t(), ::boost::forward(key), ::boost::forward(args)...); + ret.first = this->m_data.m_vect.insert(data.position, it_t(func), it_t()); + } + return ret; + } + #else // !defined(BOOST_NO_CXX11_VARIADIC_TEMPLATES) #define BOOST_CONTAINER_FLAT_TREE_EMPLACE_CODE(N) \ @@ -600,13 +657,57 @@ class flat_tree value_destructor d(a, val);\ return this->insert_equal(hint, ::boost::move(val));\ }\ + template \ + BOOST_CONTAINER_FORCEINLINE std::pair\ + try_emplace(const_iterator hint, BOOST_FWD_REF(KeyType) key BOOST_MOVE_I##N BOOST_MOVE_UREF##N)\ + {\ + std::pair ret;\ + insert_commit_data data;\ + const key_type & k = key;\ + ret.second = hint == const_iterator()\ + ? this->priv_insert_unique_prepare(k, data)\ + : this->priv_insert_unique_prepare(hint, k, data);\ + \ + if(!ret.second){\ + ret.first = this->nth(data.position - this->cbegin());\ + }\ + else{\ + typedef typename emplace_functor_type::type func_t;\ + typedef emplace_iterator it_t;\ + func_t func(try_emplace_t(), ::boost::forward(key) BOOST_MOVE_I##N BOOST_MOVE_FWD##N);\ + ret.first = this->m_data.m_vect.insert(data.position, it_t(func), it_t());\ + }\ + return ret;\ + }\ // - BOOST_MOVE_ITERATE_0TO9(BOOST_CONTAINER_FLAT_TREE_EMPLACE_CODE) + BOOST_MOVE_ITERATE_0TO7(BOOST_CONTAINER_FLAT_TREE_EMPLACE_CODE) #undef BOOST_CONTAINER_FLAT_TREE_EMPLACE_CODE #endif // !defined(BOOST_NO_CXX11_VARIADIC_TEMPLATES) - iterator erase(const_iterator position) + template + std::pair insert_or_assign(const_iterator hint, BOOST_FWD_REF(KeyType) key, BOOST_FWD_REF(M) obj) + { + const key_type& k = key; + std::pair ret; + insert_commit_data data; + ret.second = hint == const_iterator() + ? this->priv_insert_unique_prepare(k, data) + : this->priv_insert_unique_prepare(hint, k, data); + if(!ret.second){ + ret.first = this->nth(data.position - this->cbegin()); + ret.first->second = boost::forward(obj); + } + else{ + typedef typename emplace_functor_type::type func_t; + typedef emplace_iterator it_t; + func_t func(boost::forward(key), boost::forward(obj)); + ret.first = this->m_data.m_vect.insert(data.position, it_t(func), it_t()); + } + return ret; + } + + BOOST_CONTAINER_FORCEINLINE iterator erase(const_iterator position) { return this->m_data.m_vect.erase(position); } size_type erase(const key_type& k) @@ -619,10 +720,10 @@ class flat_tree return ret; } - iterator erase(const_iterator first, const_iterator last) + BOOST_CONTAINER_FORCEINLINE iterator erase(const_iterator first, const_iterator last) { return this->m_data.m_vect.erase(first, last); } - void clear() + BOOST_CONTAINER_FORCEINLINE void clear() { this->m_data.m_vect.clear(); } //! Effects: Tries to deallocate the excess of memory created @@ -631,19 +732,19 @@ class flat_tree //! Throws: If memory allocation throws, or T's copy constructor throws. //! //! Complexity: Linear to size(). - void shrink_to_fit() + BOOST_CONTAINER_FORCEINLINE void shrink_to_fit() { this->m_data.m_vect.shrink_to_fit(); } - iterator nth(size_type n) BOOST_NOEXCEPT_OR_NOTHROW + BOOST_CONTAINER_FORCEINLINE iterator nth(size_type n) BOOST_NOEXCEPT_OR_NOTHROW { return this->m_data.m_vect.nth(n); } - const_iterator nth(size_type n) const BOOST_NOEXCEPT_OR_NOTHROW + BOOST_CONTAINER_FORCEINLINE const_iterator nth(size_type n) const BOOST_NOEXCEPT_OR_NOTHROW { return this->m_data.m_vect.nth(n); } - size_type index_of(iterator p) BOOST_NOEXCEPT_OR_NOTHROW + BOOST_CONTAINER_FORCEINLINE size_type index_of(iterator p) BOOST_NOEXCEPT_OR_NOTHROW { return this->m_data.m_vect.index_of(p); } - size_type index_of(const_iterator p) const BOOST_NOEXCEPT_OR_NOTHROW + BOOST_CONTAINER_FORCEINLINE size_type index_of(const_iterator p) const BOOST_NOEXCEPT_OR_NOTHROW { return this->m_data.m_vect.index_of(p); } // set operations: @@ -676,62 +777,98 @@ class flat_tree return n; } - iterator lower_bound(const key_type& k) + template + void merge_unique(flat_tree& source) + { + this->insert( boost::make_move_iterator(source.begin()) + , boost::make_move_iterator(source.end())); + } + + template + void merge_equal(flat_tree& source) + { + this->insert( boost::make_move_iterator(source.begin()) + , boost::make_move_iterator(source.end())); + } + + void merge_unique(flat_tree& source) + { + this->m_data.m_vect.merge_unique + ( boost::make_move_iterator(source.begin()) + , boost::make_move_iterator(source.end()) + , static_cast(this->m_data)); + } + + void merge_equal(flat_tree& source) + { + this->m_data.m_vect.merge + ( boost::make_move_iterator(source.begin()) + , boost::make_move_iterator(source.end()) + , static_cast(this->m_data)); + } + + BOOST_CONTAINER_FORCEINLINE iterator lower_bound(const key_type& k) { return this->priv_lower_bound(this->begin(), this->end(), k); } - const_iterator lower_bound(const key_type& k) const + BOOST_CONTAINER_FORCEINLINE const_iterator lower_bound(const key_type& k) const { return this->priv_lower_bound(this->cbegin(), this->cend(), k); } - iterator upper_bound(const key_type& k) + BOOST_CONTAINER_FORCEINLINE iterator upper_bound(const key_type& k) { return this->priv_upper_bound(this->begin(), this->end(), k); } - const_iterator upper_bound(const key_type& k) const + BOOST_CONTAINER_FORCEINLINE const_iterator upper_bound(const key_type& k) const { return this->priv_upper_bound(this->cbegin(), this->cend(), k); } - std::pair equal_range(const key_type& k) + BOOST_CONTAINER_FORCEINLINE std::pair equal_range(const key_type& k) { return this->priv_equal_range(this->begin(), this->end(), k); } - std::pair equal_range(const key_type& k) const + BOOST_CONTAINER_FORCEINLINE std::pair equal_range(const key_type& k) const { return this->priv_equal_range(this->cbegin(), this->cend(), k); } - std::pair lower_bound_range(const key_type& k) + BOOST_CONTAINER_FORCEINLINE std::pair lower_bound_range(const key_type& k) { return this->priv_lower_bound_range(this->begin(), this->end(), k); } - std::pair lower_bound_range(const key_type& k) const + BOOST_CONTAINER_FORCEINLINE std::pair lower_bound_range(const key_type& k) const { return this->priv_lower_bound_range(this->cbegin(), this->cend(), k); } - size_type capacity() const + BOOST_CONTAINER_FORCEINLINE size_type capacity() const { return this->m_data.m_vect.capacity(); } - void reserve(size_type cnt) + BOOST_CONTAINER_FORCEINLINE void reserve(size_type cnt) { this->m_data.m_vect.reserve(cnt); } - friend bool operator==(const flat_tree& x, const flat_tree& y) + BOOST_CONTAINER_FORCEINLINE friend bool operator==(const flat_tree& x, const flat_tree& y) { return x.size() == y.size() && ::boost::container::algo_equal(x.begin(), x.end(), y.begin()); } - friend bool operator<(const flat_tree& x, const flat_tree& y) + BOOST_CONTAINER_FORCEINLINE friend bool operator<(const flat_tree& x, const flat_tree& y) { return ::boost::container::algo_lexicographical_compare(x.begin(), x.end(), y.begin(), y.end()); } - friend bool operator!=(const flat_tree& x, const flat_tree& y) + BOOST_CONTAINER_FORCEINLINE friend bool operator!=(const flat_tree& x, const flat_tree& y) { return !(x == y); } - friend bool operator>(const flat_tree& x, const flat_tree& y) + BOOST_CONTAINER_FORCEINLINE friend bool operator>(const flat_tree& x, const flat_tree& y) { return y < x; } - friend bool operator<=(const flat_tree& x, const flat_tree& y) + BOOST_CONTAINER_FORCEINLINE friend bool operator<=(const flat_tree& x, const flat_tree& y) { return !(y < x); } - friend bool operator>=(const flat_tree& x, const flat_tree& y) + BOOST_CONTAINER_FORCEINLINE friend bool operator>=(const flat_tree& x, const flat_tree& y) { return !(x < y); } - friend void swap(flat_tree& x, flat_tree& y) + BOOST_CONTAINER_FORCEINLINE friend void swap(flat_tree& x, flat_tree& y) { x.swap(y); } private: + + BOOST_CONTAINER_FORCEINLINE bool priv_in_range_or_end(const_iterator pos) const + { + return (this->begin() <= pos) && (pos <= this->end()); + } + struct insert_commit_data { const_iterator position; @@ -768,34 +905,34 @@ class flat_tree } bool priv_insert_unique_prepare - (const_iterator b, const_iterator e, const value_type& val, insert_commit_data &commit_data) + (const_iterator b, const_iterator e, const key_type& k, insert_commit_data &commit_data) { - const value_compare &val_cmp = this->m_data; - commit_data.position = this->priv_lower_bound(b, e, KeyOfValue()(val)); - return commit_data.position == e || val_cmp(val, *commit_data.position); + const key_compare &key_cmp = this->priv_key_comp(); + commit_data.position = this->priv_lower_bound(b, e, k); + return commit_data.position == e || key_cmp(k, KeyOfValue()(*commit_data.position)); } - bool priv_insert_unique_prepare - (const value_type& val, insert_commit_data &commit_data) - { return this->priv_insert_unique_prepare(this->cbegin(), this->cend(), val, commit_data); } + BOOST_CONTAINER_FORCEINLINE bool priv_insert_unique_prepare + (const key_type& k, insert_commit_data &commit_data) + { return this->priv_insert_unique_prepare(this->cbegin(), this->cend(), k, commit_data); } bool priv_insert_unique_prepare - (const_iterator pos, const value_type& val, insert_commit_data &commit_data) + (const_iterator pos, const key_type& k, insert_commit_data &commit_data) { //N1780. Props to Howard Hinnant! - //To insert val at pos: - //if pos == end || val <= *pos - // if pos == begin || val >= *(pos-1) - // insert val before pos + //To insert k at pos: + //if pos == end || k <= *pos + // if pos == begin || k >= *(pos-1) + // insert k before pos // else - // insert val before upper_bound(val) - //else if pos+1 == end || val <= *(pos+1) - // insert val after pos + // insert k before upper_bound(k) + //else if pos+1 == end || k <= *(pos+1) + // insert k after pos //else - // insert val before lower_bound(val) - const value_compare &val_cmp = this->m_data; + // insert k before lower_bound(k) + const key_compare &key_cmp = this->priv_key_comp(); const const_iterator cend_it = this->cend(); - if(pos == cend_it || val_cmp(val, *pos)){ //Check if val should go before end + if(pos == cend_it || key_cmp(k, KeyOfValue()(*pos))){ //Check if k should go before end const const_iterator cbeg = this->cbegin(); commit_data.position = pos; if(pos == cbeg){ //If container is empty then insert it in the beginning @@ -803,27 +940,27 @@ class flat_tree } const_iterator prev(pos); --prev; - if(val_cmp(*prev, val)){ //If previous element was less, then it should go between prev and pos + if(key_cmp(KeyOfValue()(*prev), k)){ //If previous element was less, then it should go between prev and pos return true; } - else if(!val_cmp(val, *prev)){ //If previous was equal then insertion should fail + else if(!key_cmp(k, KeyOfValue()(*prev))){ //If previous was equal then insertion should fail commit_data.position = prev; return false; } else{ //Previous was bigger so insertion hint was pointless, dispatch to hintless insertion - //but reduce the search between beg and prev as prev is bigger than val - return this->priv_insert_unique_prepare(cbeg, prev, val, commit_data); + //but reduce the search between beg and prev as prev is bigger than k + return this->priv_insert_unique_prepare(cbeg, prev, k, commit_data); } } else{ //The hint is before the insertion position, so insert it //in the remaining range [pos, end) - return this->priv_insert_unique_prepare(pos, cend_it, val, commit_data); + return this->priv_insert_unique_prepare(pos, cend_it, k, commit_data); } } template - iterator priv_insert_commit + BOOST_CONTAINER_FORCEINLINE iterator priv_insert_commit (insert_commit_data &commit_data, BOOST_FWD_REF(Convertible) convertible) { return this->m_data.m_vect.insert @@ -954,9 +1091,9 @@ class flat_tree //!has_trivial_destructor_after_move<> == true_type //!specialization for optimizations -template -struct has_trivial_destructor_after_move > +struct has_trivial_destructor_after_move > { typedef typename ::boost::container::allocator_traits::pointer pointer; static const bool value = ::boost::has_trivial_destructor_after_move::value && diff --git a/3party/boost/boost/container/detail/hash_table.hpp b/3party/boost/boost/container/detail/hash_table.hpp deleted file mode 100644 index 4bc5c901de..0000000000 --- a/3party/boost/boost/container/detail/hash_table.hpp +++ /dev/null @@ -1,383 +0,0 @@ -/* -template , class Pred = equal_to, - class Allocator = allocator > -class hash_set -{ -public: - // types - typedef Value key_type; - typedef key_type value_type; - typedef Hash hasher; - typedef Pred key_equal; - typedef Allocator allocator_type; - typedef value_type& reference; - typedef const value_type& const_reference; - typedef typename allocator_traits::pointer pointer; - typedef typename allocator_traits::const_pointer const_pointer; - typedef typename allocator_traits::size_type size_type; - typedef typename allocator_traits::difference_type difference_type; - - typedef /unspecified/ iterator; - typedef /unspecified/ const_iterator; - typedef /unspecified/ local_iterator; - typedef /unspecified/ const_local_iterator; - - hash_set() - noexcept( - is_nothrow_default_constructible::value && - is_nothrow_default_constructible::value && - is_nothrow_default_constructible::value); - explicit hash_set(size_type n, const hasher& hf = hasher(), - const key_equal& eql = key_equal(), - const allocator_type& a = allocator_type()); - template - hash_set(InputIterator f, InputIterator l, - size_type n = 0, const hasher& hf = hasher(), - const key_equal& eql = key_equal(), - const allocator_type& a = allocator_type()); - explicit hash_set(const allocator_type&); - hash_set(const hash_set&); - hash_set(const hash_set&, const Allocator&); - hash_set(hash_set&&) - noexcept( - is_nothrow_move_constructible::value && - is_nothrow_move_constructible::value && - is_nothrow_move_constructible::value); - hash_set(hash_set&&, const Allocator&); - hash_set(initializer_list, size_type n = 0, - const hasher& hf = hasher(), const key_equal& eql = key_equal(), - const allocator_type& a = allocator_type()); - ~hash_set(); - hash_set& operator=(const hash_set&); - hash_set& operator=(hash_set&&) - noexcept( - allocator_type::propagate_on_container_move_assignment::value && - is_nothrow_move_assignable::value && - is_nothrow_move_assignable::value && - is_nothrow_move_assignable::value); - hash_set& operator=(initializer_list); - - allocator_type get_allocator() const noexcept; - - bool empty() const noexcept; - size_type size() const noexcept; - size_type max_size() const noexcept; - - iterator begin() noexcept; - iterator end() noexcept; - const_iterator begin() const noexcept; - const_iterator end() const noexcept; - const_iterator cbegin() const noexcept; - const_iterator cend() const noexcept; - - template - pair emplace(BOOST_FWD_REF(Args)... args); - template - iterator emplace_hint(const_iterator position, BOOST_FWD_REF(Args)... args); - pair insert(const value_type& obj); - pair insert(value_type&& obj); - iterator insert(const_iterator hint, const value_type& obj); - iterator insert(const_iterator hint, value_type&& obj); - template - void insert(InputIterator first, InputIterator last); - void insert(initializer_list); - - iterator erase(const_iterator position); - size_type erase(const key_type& k); - iterator erase(const_iterator first, const_iterator last); - void clear() noexcept; - - void swap(hash_set&) - noexcept( - (!allocator_type::propagate_on_container_swap::value || - __is_nothrow_swappable::value) && - __is_nothrow_swappable::value && - __is_nothrow_swappable::value); - - hasher hash_function() const; - key_equal key_eq() const; - - iterator find(const key_type& k); - const_iterator find(const key_type& k) const; - size_type count(const key_type& k) const; - pair equal_range(const key_type& k); - pair equal_range(const key_type& k) const; - - size_type bucket_count() const noexcept; - size_type max_bucket_count() const noexcept; - - size_type bucket_size(size_type n) const; - size_type bucket(const key_type& k) const; - - local_iterator begin(size_type n); - local_iterator end(size_type n); - const_local_iterator begin(size_type n) const; - const_local_iterator end(size_type n) const; - const_local_iterator cbegin(size_type n) const; - const_local_iterator cend(size_type n) const; - - float load_factor() const noexcept; - float max_load_factor() const noexcept; - void max_load_factor(float z); - void rehash(size_type n); - void reserve(size_type n); -}; - -template , class Pred = equal_to, - class Allocator = allocator > > -class hash_map -{ -public: - // types - typedef Key key_type; - typedef T mapped_type; - typedef Hash hasher; - typedef Pred key_equal; - typedef Allocator allocator_type; - typedef pair value_type; - typedef value_type& reference; - typedef const value_type& const_reference; - typedef typename allocator_traits::pointer pointer; - typedef typename allocator_traits::const_pointer const_pointer; - typedef typename allocator_traits::size_type size_type; - typedef typename allocator_traits::difference_type difference_type; - - typedef /unspecified/ iterator; - typedef /unspecified/ const_iterator; - typedef /unspecified/ local_iterator; - typedef /unspecified/ const_local_iterator; - - hash_map() - noexcept( - is_nothrow_default_constructible::value && - is_nothrow_default_constructible::value && - is_nothrow_default_constructible::value); - explicit hash_map(size_type n, const hasher& hf = hasher(), - const key_equal& eql = key_equal(), - const allocator_type& a = allocator_type()); - template - hash_map(InputIterator f, InputIterator l, - size_type n = 0, const hasher& hf = hasher(), - const key_equal& eql = key_equal(), - const allocator_type& a = allocator_type()); - explicit hash_map(const allocator_type&); - hash_map(const hash_map&); - hash_map(const hash_map&, const Allocator&); - hash_map(hash_map&&) - noexcept( - is_nothrow_move_constructible::value && - is_nothrow_move_constructible::value && - is_nothrow_move_constructible::value); - hash_map(hash_map&&, const Allocator&); - hash_map(initializer_list, size_type n = 0, - const hasher& hf = hasher(), const key_equal& eql = key_equal(), - const allocator_type& a = allocator_type()); - ~hash_map(); - hash_map& operator=(const hash_map&); - hash_map& operator=(hash_map&&) - noexcept( - allocator_type::propagate_on_container_move_assignment::value && - is_nothrow_move_assignable::value && - is_nothrow_move_assignable::value && - is_nothrow_move_assignable::value); - hash_map& operator=(initializer_list); - - allocator_type get_allocator() const noexcept; - - bool empty() const noexcept; - size_type size() const noexcept; - size_type max_size() const noexcept; - - iterator begin() noexcept; - iterator end() noexcept; - const_iterator begin() const noexcept; - const_iterator end() const noexcept; - const_iterator cbegin() const noexcept; - const_iterator cend() const noexcept; - - template - pair emplace(BOOST_FWD_REF(Args)... args); - template - iterator emplace_hint(const_iterator position, BOOST_FWD_REF(Args)... args); - pair insert(const value_type& obj); - template - pair insert(P&& obj); - iterator insert(const_iterator hint, const value_type& obj); - template - iterator insert(const_iterator hint, P&& obj); - template - void insert(InputIterator first, InputIterator last); - void insert(initializer_list); - - iterator erase(const_iterator position); - size_type erase(const key_type& k); - iterator erase(const_iterator first, const_iterator last); - void clear() noexcept; - - void swap(hash_map&) - noexcept( - (!allocator_type::propagate_on_container_swap::value || - __is_nothrow_swappable::value) && - __is_nothrow_swappable::value && - __is_nothrow_swappable::value); - - hasher hash_function() const; - key_equal key_eq() const; - - iterator find(const key_type& k); - const_iterator find(const key_type& k) const; - size_type count(const key_type& k) const; - pair equal_range(const key_type& k); - pair equal_range(const key_type& k) const; - - mapped_type& operator[](const key_type& k); - mapped_type& operator[](key_type&& k); - - mapped_type& at(const key_type& k); - const mapped_type& at(const key_type& k) const; - - size_type bucket_count() const noexcept; - size_type max_bucket_count() const noexcept; - - size_type bucket_size(size_type n) const; - size_type bucket(const key_type& k) const; - - local_iterator begin(size_type n); - local_iterator end(size_type n); - const_local_iterator begin(size_type n) const; - const_local_iterator end(size_type n) const; - const_local_iterator cbegin(size_type n) const; - const_local_iterator cend(size_type n) const; - - float load_factor() const noexcept; - float max_load_factor() const noexcept; - void max_load_factor(float z); - void rehash(size_type n); - void reserve(size_type n); -}; - -*/ - -template , class Pred = equal_to, - class Allocator = allocator > -class hash_table -{ -public: - // types - typedef Value key_type; - typedef key_type value_type; - typedef Hash hasher; - typedef Pred key_equal; - typedef Allocator allocator_type; - typedef value_type& reference; - typedef const value_type& const_reference; - typedef typename allocator_traits::pointer pointer; - typedef typename allocator_traits::const_pointer const_pointer; - typedef typename allocator_traits::size_type size_type; - typedef typename allocator_traits::difference_type difference_type; - - typedef /unspecified/ iterator; - typedef /unspecified/ const_iterator; - typedef /unspecified/ local_iterator; - typedef /unspecified/ const_local_iterator; - - hash_set() - noexcept( - is_nothrow_default_constructible::value && - is_nothrow_default_constructible::value && - is_nothrow_default_constructible::value); - explicit hash_set(size_type n, const hasher& hf = hasher(), - const key_equal& eql = key_equal(), - const allocator_type& a = allocator_type()); - template - hash_set(InputIterator f, InputIterator l, - size_type n = 0, const hasher& hf = hasher(), - const key_equal& eql = key_equal(), - const allocator_type& a = allocator_type()); - explicit hash_set(const allocator_type&); - hash_set(const hash_set&); - hash_set(const hash_set&, const Allocator&); - hash_set(hash_set&&) - noexcept( - is_nothrow_move_constructible::value && - is_nothrow_move_constructible::value && - is_nothrow_move_constructible::value); - hash_set(hash_set&&, const Allocator&); - hash_set(initializer_list, size_type n = 0, - const hasher& hf = hasher(), const key_equal& eql = key_equal(), - const allocator_type& a = allocator_type()); - ~hash_set(); - hash_set& operator=(const hash_set&); - hash_set& operator=(hash_set&&) - noexcept( - allocator_type::propagate_on_container_move_assignment::value && - is_nothrow_move_assignable::value && - is_nothrow_move_assignable::value && - is_nothrow_move_assignable::value); - hash_set& operator=(initializer_list); - - allocator_type get_allocator() const noexcept; - - bool empty() const noexcept; - size_type size() const noexcept; - size_type max_size() const noexcept; - - iterator begin() noexcept; - iterator end() noexcept; - const_iterator begin() const noexcept; - const_iterator end() const noexcept; - const_iterator cbegin() const noexcept; - const_iterator cend() const noexcept; - - template - pair emplace(BOOST_FWD_REF(Args)... args); - template - iterator emplace_hint(const_iterator position, BOOST_FWD_REF(Args)... args); - pair insert(const value_type& obj); - pair insert(value_type&& obj); - iterator insert(const_iterator hint, const value_type& obj); - iterator insert(const_iterator hint, value_type&& obj); - template - void insert(InputIterator first, InputIterator last); - void insert(initializer_list); - - iterator erase(const_iterator position); - size_type erase(const key_type& k); - iterator erase(const_iterator first, const_iterator last); - void clear() noexcept; - - void swap(hash_set&) - noexcept( - (!allocator_type::propagate_on_container_swap::value || - __is_nothrow_swappable::value) && - __is_nothrow_swappable::value && - __is_nothrow_swappable::value); - - hasher hash_function() const; - key_equal key_eq() const; - - iterator find(const key_type& k); - const_iterator find(const key_type& k) const; - size_type count(const key_type& k) const; - pair equal_range(const key_type& k); - pair equal_range(const key_type& k) const; - - size_type bucket_count() const noexcept; - size_type max_bucket_count() const noexcept; - - size_type bucket_size(size_type n) const; - size_type bucket(const key_type& k) const; - - local_iterator begin(size_type n); - local_iterator end(size_type n); - const_local_iterator begin(size_type n) const; - const_local_iterator end(size_type n) const; - const_local_iterator cbegin(size_type n) const; - const_local_iterator cend(size_type n) const; - - float load_factor() const noexcept; - float max_load_factor() const noexcept; - void max_load_factor(float z); - void rehash(size_type n); - void reserve(size_type n); -}; diff --git a/3party/boost/boost/container/detail/is_sorted.hpp b/3party/boost/boost/container/detail/is_sorted.hpp new file mode 100644 index 0000000000..b8c223bb7b --- /dev/null +++ b/3party/boost/boost/container/detail/is_sorted.hpp @@ -0,0 +1,57 @@ +////////////////////////////////////////////////////////////////////////////// +// +// (C) Copyright Ion Gaztanaga 2016-2016. 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) +// +// See http://www.boost.org/libs/container for documentation. +// +////////////////////////////////////////////////////////////////////////////// +#ifndef BOOST_CONTAINER_DETAIL_IS_SORTED_HPP +#define BOOST_CONTAINER_DETAIL_IS_SORTED_HPP + +#ifndef BOOST_CONFIG_HPP +# include +#endif + +#if defined(BOOST_HAS_PRAGMA_ONCE) +# pragma once +#endif + +namespace boost { +namespace container { +namespace container_detail { + +template +bool is_sorted (ForwardIterator first, ForwardIterator last, Pred pred) +{ + if(first != last){ + ForwardIterator next = first; + while (++next != last){ + if(pred(*next, *first)) + return false; + ++first; + } + } + return true; +} + +template +bool is_sorted_and_unique (ForwardIterator first, ForwardIterator last, Pred pred) +{ + if(first != last){ + ForwardIterator next = first; + while (++next != last){ + if(!pred(*first, *next)) + return false; + ++first; + } + } + return true; +} + +} //namespace container_detail { +} //namespace container { +} //namespace boost { + +#endif //#ifndef BOOST_CONTAINER_DETAIL_IS_SORTED_HPP diff --git a/3party/boost/boost/container/detail/iterators.hpp b/3party/boost/boost/container/detail/iterators.hpp index e8cfcf97a4..11ffaae65e 100644 --- a/3party/boost/boost/container/detail/iterators.hpp +++ b/3party/boost/boost/container/detail/iterators.hpp @@ -26,6 +26,7 @@ #include #include #include +#include #include #include #include @@ -377,7 +378,7 @@ class default_init_construct_iterator template class repeat_iterator : public ::boost::container::iterator - + { typedef repeat_iterator this_type; public: @@ -493,13 +494,13 @@ class emplace_iterator public: typedef Difference difference_type; - explicit emplace_iterator(EmplaceFunctor&e) + BOOST_CONTAINER_FORCEINLINE explicit emplace_iterator(EmplaceFunctor&e) : m_num(1), m_pe(&e){} - emplace_iterator() + BOOST_CONTAINER_FORCEINLINE emplace_iterator() : m_num(0), m_pe(0){} - this_type& operator++() + BOOST_CONTAINER_FORCEINLINE this_type& operator++() { increment(); return *this; } this_type operator++(int) @@ -509,7 +510,7 @@ class emplace_iterator return result; } - this_type& operator--() + BOOST_CONTAINER_FORCEINLINE this_type& operator--() { decrement(); return *this; } this_type operator--(int) @@ -519,29 +520,29 @@ class emplace_iterator return result; } - friend bool operator== (const this_type& i, const this_type& i2) + BOOST_CONTAINER_FORCEINLINE friend bool operator== (const this_type& i, const this_type& i2) { return i.equal(i2); } - friend bool operator!= (const this_type& i, const this_type& i2) + BOOST_CONTAINER_FORCEINLINE friend bool operator!= (const this_type& i, const this_type& i2) { return !(i == i2); } - friend bool operator< (const this_type& i, const this_type& i2) + BOOST_CONTAINER_FORCEINLINE friend bool operator< (const this_type& i, const this_type& i2) { return i.less(i2); } - friend bool operator> (const this_type& i, const this_type& i2) + BOOST_CONTAINER_FORCEINLINE friend bool operator> (const this_type& i, const this_type& i2) { return i2 < i; } - friend bool operator<= (const this_type& i, const this_type& i2) + BOOST_CONTAINER_FORCEINLINE friend bool operator<= (const this_type& i, const this_type& i2) { return !(i > i2); } - friend bool operator>= (const this_type& i, const this_type& i2) + BOOST_CONTAINER_FORCEINLINE friend bool operator>= (const this_type& i, const this_type& i2) { return !(i < i2); } - friend difference_type operator- (const this_type& i, const this_type& i2) + BOOST_CONTAINER_FORCEINLINE friend difference_type operator- (const this_type& i, const this_type& i2) { return i2.distance_to(i); } //Arithmetic - this_type& operator+=(difference_type off) + BOOST_CONTAINER_FORCEINLINE this_type& operator+=(difference_type off) { this->advance(off); return *this; } this_type operator+(difference_type off) const @@ -551,52 +552,58 @@ class emplace_iterator return other; } - friend this_type operator+(difference_type off, const this_type& right) + BOOST_CONTAINER_FORCEINLINE friend this_type operator+(difference_type off, const this_type& right) { return right + off; } - this_type& operator-=(difference_type off) + BOOST_CONTAINER_FORCEINLINE this_type& operator-=(difference_type off) { this->advance(-off); return *this; } - this_type operator-(difference_type off) const + BOOST_CONTAINER_FORCEINLINE this_type operator-(difference_type off) const { return *this + (-off); } + private: //This pseudo-iterator's dereference operations have no sense since value is not //constructed until ::boost::container::construct_in_place is called. //So comment them to catch bad uses - //const T& operator*() const; - //const T& operator[](difference_type) const; - //const T* operator->() const; + const T& operator*() const; + const T& operator[](difference_type) const; + const T* operator->() const; + public: template void construct_in_place(Allocator &a, T* ptr) { (*m_pe)(a, ptr); } + template + void assign_in_place(DestIt dest) + { (*m_pe)(dest); } + private: difference_type m_num; EmplaceFunctor * m_pe; - void increment() + BOOST_CONTAINER_FORCEINLINE void increment() { --m_num; } - void decrement() + BOOST_CONTAINER_FORCEINLINE void decrement() { ++m_num; } - bool equal(const this_type &other) const + BOOST_CONTAINER_FORCEINLINE bool equal(const this_type &other) const { return m_num == other.m_num; } - bool less(const this_type &other) const + BOOST_CONTAINER_FORCEINLINE bool less(const this_type &other) const { return other.m_num < m_num; } - const T & dereference() const + BOOST_CONTAINER_FORCEINLINE const T & dereference() const { static T dummy; return dummy; } - void advance(difference_type n) + BOOST_CONTAINER_FORCEINLINE void advance(difference_type n) { m_num -= n; } - difference_type distance_to(const this_type &other)const + BOOST_CONTAINER_FORCEINLINE difference_type distance_to(const this_type &other)const { return difference_type(m_num - other.m_num); } }; @@ -612,21 +619,44 @@ struct emplace_functor {} template - void operator()(Allocator &a, T *ptr) + BOOST_CONTAINER_FORCEINLINE void operator()(Allocator &a, T *ptr) { emplace_functor::inplace_impl(a, ptr, index_tuple_t()); } - template - void inplace_impl(Allocator &a, T* ptr, const container_detail::index_tuple&) + template + BOOST_CONTAINER_FORCEINLINE void operator()(DestIt dest) + { emplace_functor::inplace_impl(dest, index_tuple_t()); } + + private: + template + BOOST_CONTAINER_FORCEINLINE void inplace_impl(Allocator &a, T* ptr, const container_detail::index_tuple&) { allocator_traits::construct (a, ptr, ::boost::forward(container_detail::get(args_))...); } + template + BOOST_CONTAINER_FORCEINLINE void inplace_impl(DestIt dest, const container_detail::index_tuple&) + { + typedef typename boost::container::iterator_traits::value_type value_type; + value_type && tmp= value_type(::boost::forward(container_detail::get(args_))...); + *dest = ::boost::move(tmp); + } + container_detail::tuple args_; }; +template +struct emplace_functor_type +{ + typedef emplace_functor type; +}; + #else // !defined(BOOST_NO_CXX11_VARIADIC_TEMPLATES) +//Partial specializations cannot match argument list for primary template, so add an extra argument +template +struct emplace_functor_type; + #define BOOST_MOVE_ITERATOR_EMPLACE_FUNCTOR_CODE(N) \ BOOST_MOVE_TMPL_LT##N BOOST_MOVE_CLASS##N BOOST_MOVE_GT##N \ struct emplace_functor##N\ @@ -638,10 +668,26 @@ struct emplace_functor##N\ void operator()(Allocator &a, T *ptr)\ { allocator_traits::construct(a, ptr BOOST_MOVE_I##N BOOST_MOVE_MFWD##N); }\ \ + template\ + void operator()(DestIt dest)\ + {\ + typedef typename boost::container::iterator_traits::value_type value_type;\ + BOOST_MOVE_IF(N, value_type tmp(BOOST_MOVE_MFWD##N), container_detail::value_init tmp) ;\ + *dest = ::boost::move(const_cast(BOOST_MOVE_IF(N, tmp, tmp.get())));\ + }\ + \ BOOST_MOVE_MREF##N\ };\ +\ +template \ +struct emplace_functor_type\ +{\ + typedef emplace_functor##N BOOST_MOVE_LT##N BOOST_MOVE_TARG##N BOOST_MOVE_GT##N type;\ +};\ // + BOOST_MOVE_ITERATE_0TO9(BOOST_MOVE_ITERATOR_EMPLACE_FUNCTOR_CODE) + #undef BOOST_MOVE_ITERATOR_EMPLACE_FUNCTOR_CODE #endif @@ -762,54 +808,55 @@ class iterator_from_iiterator typedef typename types_t::iterator_category iterator_category; typedef typename types_t::value_type value_type; - iterator_from_iiterator() + BOOST_CONTAINER_FORCEINLINE iterator_from_iiterator() + : m_iit() {} - explicit iterator_from_iiterator(IIterator iit) BOOST_NOEXCEPT_OR_NOTHROW + BOOST_CONTAINER_FORCEINLINE explicit iterator_from_iiterator(IIterator iit) BOOST_NOEXCEPT_OR_NOTHROW : m_iit(iit) {} - iterator_from_iiterator(iterator_from_iiterator const& other) BOOST_NOEXCEPT_OR_NOTHROW + BOOST_CONTAINER_FORCEINLINE iterator_from_iiterator(iterator_from_iiterator const& other) BOOST_NOEXCEPT_OR_NOTHROW : m_iit(other.get()) {} - iterator_from_iiterator& operator++() BOOST_NOEXCEPT_OR_NOTHROW + BOOST_CONTAINER_FORCEINLINE iterator_from_iiterator& operator++() BOOST_NOEXCEPT_OR_NOTHROW { ++this->m_iit; return *this; } - iterator_from_iiterator operator++(int) BOOST_NOEXCEPT_OR_NOTHROW + BOOST_CONTAINER_FORCEINLINE iterator_from_iiterator operator++(int) BOOST_NOEXCEPT_OR_NOTHROW { iterator_from_iiterator result (*this); ++this->m_iit; return result; } - iterator_from_iiterator& operator--() BOOST_NOEXCEPT_OR_NOTHROW + BOOST_CONTAINER_FORCEINLINE iterator_from_iiterator& operator--() BOOST_NOEXCEPT_OR_NOTHROW { //If the iterator_from_iiterator is not a bidirectional iterator, operator-- should not exist BOOST_STATIC_ASSERT((is_bidirectional_iterator::value)); --this->m_iit; return *this; } - iterator_from_iiterator operator--(int) BOOST_NOEXCEPT_OR_NOTHROW + BOOST_CONTAINER_FORCEINLINE iterator_from_iiterator operator--(int) BOOST_NOEXCEPT_OR_NOTHROW { iterator_from_iiterator result (*this); --this->m_iit; return result; } - friend bool operator== (const iterator_from_iiterator& l, const iterator_from_iiterator& r) BOOST_NOEXCEPT_OR_NOTHROW + BOOST_CONTAINER_FORCEINLINE friend bool operator== (const iterator_from_iiterator& l, const iterator_from_iiterator& r) BOOST_NOEXCEPT_OR_NOTHROW { return l.m_iit == r.m_iit; } - friend bool operator!= (const iterator_from_iiterator& l, const iterator_from_iiterator& r) BOOST_NOEXCEPT_OR_NOTHROW + BOOST_CONTAINER_FORCEINLINE friend bool operator!= (const iterator_from_iiterator& l, const iterator_from_iiterator& r) BOOST_NOEXCEPT_OR_NOTHROW { return !(l == r); } - reference operator*() const BOOST_NOEXCEPT_OR_NOTHROW + BOOST_CONTAINER_FORCEINLINE reference operator*() const BOOST_NOEXCEPT_OR_NOTHROW { return this->m_iit->get_data(); } - pointer operator->() const BOOST_NOEXCEPT_OR_NOTHROW + BOOST_CONTAINER_FORCEINLINE pointer operator->() const BOOST_NOEXCEPT_OR_NOTHROW { return ::boost::intrusive::pointer_traits::pointer_to(this->operator*()); } - const IIterator &get() const BOOST_NOEXCEPT_OR_NOTHROW + BOOST_CONTAINER_FORCEINLINE const IIterator &get() const BOOST_NOEXCEPT_OR_NOTHROW { return this->m_iit; } private: diff --git a/3party/boost/boost/container/detail/mpl.hpp b/3party/boost/boost/container/detail/mpl.hpp index e1684ea0b1..82fcc7036d 100644 --- a/3party/boost/boost/container/detail/mpl.hpp +++ b/3party/boost/boost/container/detail/mpl.hpp @@ -62,19 +62,18 @@ using boost::move_detail::disable_if_and; using boost::move_detail::enable_if_or; using boost::move_detail::disable_if_or; - -template +template struct select1st { - typedef Pair argument_type; - typedef typename Pair::first_type result_type; + typedef FirstType type; - template - const typename Pair::first_type& operator()(const OtherPair& x) const + template + const type& operator()(const T& x) const { return x.first; } - const typename Pair::first_type& operator()(const typename Pair::first_type& x) const - { return x; } + template + type& operator()(T& x) + { return const_cast(x.first); } }; } //namespace container_detail { diff --git a/3party/boost/boost/container/detail/mutex.hpp b/3party/boost/boost/container/detail/mutex.hpp index f8efa7fe6b..9743614c23 100644 --- a/3party/boost/boost/container/detail/mutex.hpp +++ b/3party/boost/boost/container/detail/mutex.hpp @@ -1,14 +1,9 @@ -// Copyright (C) 2000 Stephen Cleary -// -// 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) -// -// See http://www.boost.org for updates, documentation, and revision history. - ////////////////////////////////////////////////////////////////////////////// // -// (C) Copyright Ion Gaztanaga 2007-2013. Distributed under the Boost +// (C) Copyright Stephen Cleary 2000 +// (C) Copyright Ion Gaztanaga 2015-2017. +// +// 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) // @@ -107,7 +102,7 @@ #elif (defined(__GNUC__) && (defined(__i386__) || defined(__x86_64__))) /* Custom spin locks for older gcc on x86 */ - static FORCEINLINE int boost_container_x86_cas_lock(int *sl) { + static inline int boost_container_x86_cas_lock(int *sl) { int ret; int val = 1; int cmp = 0; @@ -118,7 +113,7 @@ return ret; } - static FORCEINLINE void boost_container_x86_clear_lock(int* sl) { + static inline void boost_container_x86_clear_lock(int* sl) { assert(*sl != 0); int prev = 0; int ret; diff --git a/3party/boost/boost/container/detail/node_alloc_holder.hpp b/3party/boost/boost/container/detail/node_alloc_holder.hpp index 3b632a677d..7ef5d2883e 100644 --- a/3party/boost/boost/container/detail/node_alloc_holder.hpp +++ b/3party/boost/boost/container/detail/node_alloc_holder.hpp @@ -60,14 +60,17 @@ struct node_alloc_holder { //If the intrusive container is an associative container, obtain the predicate, which will //be of type node_compare<>. If not an associative container value_compare will be a "nat" type. - typedef BOOST_INTRUSIVE_OBTAIN_TYPE_WITH_DEFAULT(boost::container::container_detail::, ICont, - value_compare, container_detail::nat) intrusive_value_compare; + typedef BOOST_INTRUSIVE_OBTAIN_TYPE_WITH_DEFAULT + ( boost::container::container_detail:: + , ICont, value_compare, container_detail::nat) intrusive_value_compare; //In that case obtain the value predicate from the node predicate via predicate_type //if intrusive_value_compare is node_compare<>, nat otherwise - typedef BOOST_INTRUSIVE_OBTAIN_TYPE_WITH_DEFAULT(boost::container::container_detail::, intrusive_value_compare, - predicate_type, container_detail::nat) value_compare; + typedef BOOST_INTRUSIVE_OBTAIN_TYPE_WITH_DEFAULT + ( boost::container::container_detail:: + , intrusive_value_compare + , predicate_type, container_detail::nat) value_compare; - typedef allocator_traits allocator_traits_type; + typedef allocator_traits allocator_traits_type; typedef typename allocator_traits_type::value_type value_type; typedef ICont intrusive_container; typedef typename ICont::value_type Node; @@ -75,19 +78,19 @@ struct node_alloc_holder portable_rebind_alloc::type NodeAlloc; typedef allocator_traits node_allocator_traits_type; typedef container_detail::allocator_version_traits node_allocator_version_traits_type; - typedef Allocator ValAlloc; + typedef Allocator ValAlloc; typedef typename node_allocator_traits_type::pointer NodePtr; typedef container_detail::scoped_deallocator Deallocator; typedef typename node_allocator_traits_type::size_type size_type; typedef typename node_allocator_traits_type::difference_type difference_type; typedef container_detail::integral_constant::value> alloc_version; - typedef typename ICont::iterator icont_iterator; - typedef typename ICont::const_iterator icont_citerator; - typedef allocator_destroyer Destroyer; - typedef allocator_traits NodeAllocTraits; - typedef allocator_version_traits AllocVersionTraits; + version::value> alloc_version; + typedef typename ICont::iterator icont_iterator; + typedef typename ICont::const_iterator icont_citerator; + typedef allocator_destroyer Destroyer; + typedef allocator_traits NodeAllocTraits; + typedef allocator_version_traits AllocVersionTraits; private: BOOST_COPYABLE_AND_MOVABLE(node_alloc_holder) @@ -208,6 +211,29 @@ struct node_alloc_holder return (p); } + template + NodePtr create_node_from_key(BOOST_FWD_REF(KeyConvertible) key) + { + NodePtr p = this->allocate_one(); + NodeAlloc &na = this->node_alloc(); + Deallocator node_deallocator(p, this->node_alloc()); + node_allocator_traits_type::construct + (na, container_detail::addressof(p->m_data.first), boost::forward(key)); + BOOST_TRY{ + node_allocator_traits_type::construct(na, container_detail::addressof(p->m_data.second)); + } + BOOST_CATCH(...){ + node_allocator_traits_type::destroy(na, container_detail::addressof(p->m_data.first)); + BOOST_RETHROW; + } + BOOST_CATCH_END + node_deallocator.release(); + //This does not throw + typedef typename Node::hook_type hook_type; + ::new(static_cast(container_detail::to_raw_pointer(p)), boost_container_new_t()) hook_type; + return (p); + } + void destroy_node(const NodePtr &nodep) { allocator_traits::destroy(this->node_alloc(), container_detail::to_raw_pointer(nodep)); @@ -368,12 +394,6 @@ struct node_alloc_holder ICont &non_const_icont() const { return const_cast(this->members_.m_icont); } - ICont &icont() - { return this->members_.m_icont; } - - const ICont &icont() const - { return this->members_.m_icont; } - NodeAlloc &node_alloc() { return static_cast(this->members_); } @@ -381,6 +401,13 @@ struct node_alloc_holder { return static_cast(this->members_); } members_holder members_; + + public: + ICont &icont() + { return this->members_.m_icont; } + + const ICont &icont() const + { return this->members_.m_icont; } }; } //namespace container_detail { diff --git a/3party/boost/boost/container/detail/pair.hpp b/3party/boost/boost/container/detail/pair.hpp index 35e8846caa..4abff4b4d8 100644 --- a/3party/boost/boost/container/detail/pair.hpp +++ b/3party/boost/boost/container/detail/pair.hpp @@ -27,56 +27,75 @@ #include #include #include -#include +#include +#if !defined(BOOST_NO_CXX11_VARIADIC_TEMPLATES) +# include +#endif #include //swap #include //pair #include +#include -/* -namespace boost{ +namespace boost { +namespace tuples { -template -inline rv< std::pair > &move(std::pair &r) -{ - return reinterpret_cast< rv< std::pair > &>(r); -} - -template -inline rv< std::pair > &move(rv< std::pair > &r) -{ - return r; -} - -template -inline typename ::boost::move_detail::enable_if_and - < T & - , boost::container::container_detail::is_std_pair - , ::boost::move_detail::is_rv - >::type - forward(const typename ::boost::move_detail::identity::type &x) BOOST_NOEXCEPT -{ - return const_cast(x); -} - -template -inline typename ::boost::move_detail::enable_if_and - < const T & - , boost::container::container_detail::is_std_pair - , ::boost::move_detail::is_not_rv - >::type - forward(const typename ::boost::move_detail::identity::type &x) BOOST_NOEXCEPT -{ - return x; -} +struct null_type; +} //namespace tuples { } //namespace boost { -*/ + +#if defined(BOOST_MSVC) && (_CPPLIB_VER == 520) +//MSVC 2010 tuple marker +namespace std { namespace tr1 { struct _Nil; }} +#elif defined(BOOST_MSVC) && (_CPPLIB_VER == 540) +//MSVC 2012 tuple marker +namespace std { struct _Nil; } +#endif + namespace boost { namespace container { + +#ifndef BOOST_CONTAINER_DOXYGEN_INVOKED + + template + struct std_piecewise_construct_holder + { + static ::std::piecewise_construct_t *dummy; + }; + + template + ::std::piecewise_construct_t *std_piecewise_construct_holder::dummy = + reinterpret_cast< ::std::piecewise_construct_t *>(0x01234); //Avoid sanitizer errors on references to null pointers + +typedef const std::piecewise_construct_t & piecewise_construct_t; + +struct try_emplace_t{}; + +#else + +//! The piecewise_construct_t struct is an empty structure type used as a unique type to +//! disambiguate used to disambiguate between different functions that take two tuple arguments. +typedef unspecified piecewise_construct_t; + +#endif //#ifndef BOOST_CONTAINER_DOXYGEN_INVOKED + +//! A instance of type +//! piecewise_construct_t +static piecewise_construct_t piecewise_construct = BOOST_CONTAINER_DOC1ST(unspecified, *std_piecewise_construct_holder<>::dummy); + +///@cond + namespace container_detail { +struct piecewise_construct_use +{ + //Avoid warnings of unused "piecewise_construct" + piecewise_construct_use() + { (void)&::boost::container::piecewise_construct; } +}; + template struct pair; @@ -118,35 +137,10 @@ struct is_std_pair< std::pair > struct pair_nat; -struct piecewise_construct_t { }; -static const piecewise_construct_t piecewise_construct = piecewise_construct_t(); - -/* -template -struct pair -{ - template pair(pair&& p); - template - pair(piecewise_construct_t, tuple first_args, - tuple second_args); - - template pair& operator=(const pair& p); - pair& operator=(pair&& p) noexcept(is_nothrow_move_assignable::value && - is_nothrow_move_assignable::value); - template pair& operator=(pair&& p); - - void swap(pair& p) noexcept(noexcept(swap(first, p.first)) && - noexcept(swap(second, p.second))); -}; - -template bool operator==(const pair&, const pair&); -template bool operator!=(const pair&, const pair&); -template bool operator< (const pair&, const pair&); -template bool operator> (const pair&, const pair&); -template bool operator>=(const pair&, const pair&); -template bool operator<=(const pair&, const pair&); -*/ +template +void get(T); //to enable ADL +///@endcond template struct pair @@ -217,11 +211,105 @@ struct pair : first(::boost::move(p.first)), second(::boost::move(p.second)) {} - //piecewise_construct missing - //template pair(pair&& p); - //template - // pair(piecewise_construct_t, tuple first_args, - // tuple second_args); + #if !defined(BOOST_NO_CXX11_VARIADIC_TEMPLATES) + template< class KeyType, class ...Args> + pair(try_emplace_t, BOOST_FWD_REF(KeyType) k, Args && ...args) + : first(boost::forward(k)), second(::boost::forward(args)...)\ + {} + #else + + //piecewise construction from boost::tuple + #define BOOST_PAIR_TRY_EMPLACE_CONSTRUCT_CODE(N)\ + template< class KeyType BOOST_MOVE_I##N BOOST_MOVE_CLASS##N > \ + pair( try_emplace_t, BOOST_FWD_REF(KeyType) k BOOST_MOVE_I##N BOOST_MOVE_UREF##N )\ + : first(boost::forward(k)), second(BOOST_MOVE_FWD##N)\ + {}\ + // + BOOST_MOVE_ITERATE_0TO9(BOOST_PAIR_TRY_EMPLACE_CONSTRUCT_CODE) + #undef BOOST_PAIR_TRY_EMPLACE_CONSTRUCT_CODE + + #endif //BOOST_NO_CXX11_VARIADIC_TEMPLATES + + //piecewise construction from boost::tuple + #define BOOST_PAIR_PIECEWISE_CONSTRUCT_BOOST_TUPLE_CODE(N,M)\ + template< template class BoostTuple \ + BOOST_MOVE_I_IF(BOOST_MOVE_OR(N,M)) BOOST_MOVE_CLASS##N BOOST_MOVE_I_IF(BOOST_MOVE_AND(N,M)) BOOST_MOVE_CLASSQ##M > \ + pair( piecewise_construct_t\ + , BoostTuple p\ + , BoostTuple q)\ + : first(BOOST_MOVE_TMPL_GET##N), second(BOOST_MOVE_TMPL_GETQ##M)\ + { (void)p; (void)q; }\ + // + BOOST_MOVE_ITER2D_0TOMAX(9, BOOST_PAIR_PIECEWISE_CONSTRUCT_BOOST_TUPLE_CODE) + #undef BOOST_PAIR_PIECEWISE_CONSTRUCT_BOOST_TUPLE_CODE + + //piecewise construction from variadic tuple (with delegating constructors) + #if !defined(BOOST_NO_CXX11_VARIADIC_TEMPLATES) + # if !defined(BOOST_CONTAINER_NO_CXX11_DELEGATING_CONSTRUCTORS) + private: + template class Tuple, class... Args1, class... Args2, size_t... Indexes1, size_t... Indexes2> + pair(Tuple& t1, Tuple& t2, index_tuple, index_tuple) + : first (::boost::forward(get(t1))...) + , second(::boost::forward(get(t2))...) + { (void) t1; (void)t2; } + + public: + template class Tuple, class... Args1, class... Args2> + pair(piecewise_construct_t, Tuple t1, Tuple t2) + : pair(t1, t2, typename build_number_seq::type(), typename build_number_seq::type()) + {} + # else + //piecewise construction from variadic tuple (suboptimal, without delegating constructors) + private: + template class Tuple, typename... Args> + static T build_from_args(Tuple&& t) + { return do_build_from_args(::boost::move(t), typename build_number_seq::type()); } + + template class Tuple, typename... Args, std::size_t... Indexes> + static T do_build_from_args(Tuple && t, const index_tuple&) + { (void)t; return T(::boost::forward(get(t))...); } + + public: + template class Tuple, class... Args1, class... Args2> + pair(piecewise_construct_t, Tuple t1, Tuple t2) + : first (build_from_args (::boost::move(t1))) + , second (build_from_args(::boost::move(t2))) + {} + # endif //BOOST_NO_CXX11_VARIADIC_TEMPLATES + #elif defined(BOOST_MSVC) && (_CPPLIB_VER == 520) + //MSVC 2010 tuple implementation + #define BOOST_PAIR_PIECEWISE_CONSTRUCT_MSVC2010_TUPLE_CODE(N,M)\ + template< template class StdTuple \ + BOOST_MOVE_I_IF(BOOST_MOVE_OR(N,M)) BOOST_MOVE_CLASS##N BOOST_MOVE_I_IF(BOOST_MOVE_AND(N,M)) BOOST_MOVE_CLASSQ##M > \ + pair( piecewise_construct_t\ + , StdTuple p\ + , StdTuple q)\ + : first(BOOST_MOVE_GET_IDX##N), second(BOOST_MOVE_GET_IDXQ##M)\ + { (void)p; (void)q; }\ + // + BOOST_MOVE_ITER2D_0TOMAX(9, BOOST_PAIR_PIECEWISE_CONSTRUCT_MSVC2010_TUPLE_CODE) + #undef BOOST_PAIR_PIECEWISE_CONSTRUCT_MSVC2010_TUPLE_CODE + #elif defined(BOOST_MSVC) && (_CPPLIB_VER == 540) + #if _VARIADIC_MAX >= 9 + #define BOOST_PAIR_PIECEWISE_CONSTRUCT_MSVC2012_TUPLE_MAX_IT 9 + #else + #define BOOST_PAIR_PIECEWISE_CONSTRUCT_MSVC2012_TUPLE_MAX_IT BOOST_MOVE_ADD(_VARIADIC_MAX, 1) + #endif + + //MSVC 2012 tuple implementation + #define BOOST_PAIR_PIECEWISE_CONSTRUCT_MSVC2012_TUPLE_CODE(N,M)\ + template< template class StdTuple \ + BOOST_MOVE_I_IF(BOOST_MOVE_OR(N,M)) BOOST_MOVE_CLASS##N BOOST_MOVE_I_IF(BOOST_MOVE_AND(N,M)) BOOST_MOVE_CLASSQ##M > \ + pair( piecewise_construct_t\ + , StdTuple p\ + , StdTuple q)\ + : first(BOOST_MOVE_GET_IDX##N), second(BOOST_MOVE_GET_IDXQ##M)\ + { (void)p; (void)q; }\ + // + BOOST_MOVE_ITER2D_0TOMAX(BOOST_PAIR_PIECEWISE_CONSTRUCT_MSVC2012_TUPLE_MAX_IT, BOOST_PAIR_PIECEWISE_CONSTRUCT_MSVC2012_TUPLE_CODE) + #undef BOOST_PAIR_PIECEWISE_CONSTRUCT_MSVC2010_TUPLE_CODE + #undef BOOST_PAIR_PIECEWISE_CONSTRUCT_MSVC2012_TUPLE_MAX_IT + #endif //pair copy assignment pair& operator=(BOOST_COPY_ASSIGN_REF(pair) p) @@ -340,30 +428,6 @@ inline void swap(pair& x, pair& y) } //namespace container_detail { } //namespace container { - -//Without this specialization recursive flat_(multi)map instantiation fails -//because is_enum needs to instantiate the recursive pair, leading to a compilation error). -//This breaks the cycle clearly stating that pair is not an enum avoiding any instantiation. -template -struct is_enum; - -template -struct is_enum< ::boost::container::container_detail::pair > -{ - static const bool value = false; -}; - -template -struct is_class; - -//This specialization is needed to avoid instantiation of pair in -//is_class, and allow recursive maps. -template -struct is_class< ::boost::container::container_detail::pair > -{ - static const bool value = true; -}; - #ifdef BOOST_NO_CXX11_RVALUE_REFERENCES template @@ -387,6 +451,51 @@ struct is_class_or_union< ::boost::container::container_detail::pair > static const bool value = true; }; +template +struct is_class_or_union< std::pair > +//This specialization is needed to avoid instantiation of pair in +//is_class, and allow recursive maps. +{ + static const bool value = true; +}; + +template +struct is_union; + +template +struct is_union< ::boost::container::container_detail::pair > +//This specialization is needed to avoid instantiation of pair in +//is_class, and allow recursive maps. +{ + static const bool value = false; +}; + +template +struct is_union< std::pair > +//This specialization is needed to avoid instantiation of pair in +//is_class, and allow recursive maps. +{ + static const bool value = false; +}; + +template +struct is_class; + +template +struct is_class< ::boost::container::container_detail::pair > +//This specialization is needed to avoid instantiation of pair in +//is_class, and allow recursive maps. +{ + static const bool value = true; +}; + +template +struct is_class< std::pair > +//This specialization is needed to avoid instantiation of pair in +//is_class, and allow recursive maps. +{ + static const bool value = true; +}; } //namespace move_detail{ diff --git a/3party/boost/boost/container/detail/pool_common_alloc.hpp b/3party/boost/boost/container/detail/pool_common_alloc.hpp index 72e9c8d278..3a3c80a78f 100644 --- a/3party/boost/boost/container/detail/pool_common_alloc.hpp +++ b/3party/boost/boost/container/detail/pool_common_alloc.hpp @@ -25,7 +25,7 @@ #include #include -#include +#include #include namespace boost{ @@ -44,15 +44,15 @@ struct fake_segment_manager typedef boost::container::container_detail:: basic_multiallocation_chain multiallocation_chain; static void deallocate(void_pointer p) - { boost_cont_free(p); } + { dlmalloc_free(p); } static void deallocate_many(multiallocation_chain &chain) { std::size_t size = chain.size(); std::pair ptrs = chain.extract_data(); - boost_cont_memchain dlchain; + dlmalloc_memchain dlchain; BOOST_CONTAINER_MEMCHAIN_INIT_FROM(&dlchain, ptrs.first, ptrs.second, size); - boost_cont_multidealloc(&dlchain); + dlmalloc_multidealloc(&dlchain); } typedef std::ptrdiff_t difference_type; @@ -60,7 +60,7 @@ struct fake_segment_manager static void *allocate_aligned(std::size_t nbytes, std::size_t alignment) { - void *ret = boost_cont_memalign(nbytes, alignment); + void *ret = dlmalloc_memalign(nbytes, alignment); if(!ret) boost::container::throw_bad_alloc(); return ret; @@ -68,7 +68,7 @@ struct fake_segment_manager static void *allocate(std::size_t nbytes) { - void *ret = boost_cont_malloc(nbytes); + void *ret = dlmalloc_malloc(nbytes); if(!ret) boost::container::throw_bad_alloc(); return ret; diff --git a/3party/boost/boost/container/detail/pool_resource.hpp b/3party/boost/boost/container/detail/pool_resource.hpp new file mode 100644 index 0000000000..e5f59f5186 --- /dev/null +++ b/3party/boost/boost/container/detail/pool_resource.hpp @@ -0,0 +1,191 @@ +////////////////////////////////////////////////////////////////////////////// +// +// (C) Copyright Ion Gaztanaga 2015-2015. 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) +// +// See http://www.boost.org/libs/container for documentation. +// +////////////////////////////////////////////////////////////////////////////// + +#ifndef BOOST_CONTAINER_POOL_RESOURCE_HPP +#define BOOST_CONTAINER_POOL_RESOURCE_HPP + +#if defined (_MSC_VER) +# pragma once +#endif + +#include +#include +#include +#include +#include + +#include + +namespace boost { +namespace container { +namespace pmr { + +#if !defined(BOOST_CONTAINER_DOXYGEN_INVOKED) + +class pool_data_t; + +static const std::size_t pool_options_minimum_max_blocks_per_chunk = 1u; +static const std::size_t pool_options_default_max_blocks_per_chunk = 32u; +static const std::size_t pool_options_minimum_largest_required_pool_block = + memory_resource::max_align > 2*sizeof(void*) ? memory_resource::max_align : 2*sizeof(void*); +static const std::size_t pool_options_default_largest_required_pool_block = + pool_options_minimum_largest_required_pool_block > 4096u + ? pool_options_minimum_largest_required_pool_block : 4096u; + +#endif //BOOST_CONTAINER_DOXYGEN_INVOKED + +class pool_resource +{ + typedef block_list_base<> block_list_base_t; + + pool_options m_options; + memory_resource& m_upstream; + block_list_base_t m_oversized_list; + pool_data_t *m_pool_data; + std::size_t m_pool_count; + + static void priv_limit_option(std::size_t &val, std::size_t min, std::size_t max); + static std::size_t priv_pool_index(std::size_t block_size); + static std::size_t priv_pool_block(std::size_t index); + + void priv_fix_options(); + void priv_init_pools(); + void priv_constructor_body(); + + public: + + //! Requires: `upstream` is the address of a valid memory resource. + //! + //! Effects: Constructs a pool resource object that will obtain memory + //! from upstream whenever the pool resource is unable to satisfy a memory + //! request from its own internal data structures. The resulting object will hold + //! a copy of upstream, but will not own the resource to which upstream points. + //! [ Note: The intention is that calls to upstream->allocate() will be + //! substantially fewer than calls to this->allocate() in most cases. - end note + //! The behavior of the pooling mechanism is tuned according to the value of + //! the opts argument. + //! + //! Throws: Nothing unless upstream->allocate() throws. It is unspecified if + //! or under what conditions this constructor calls upstream->allocate(). + pool_resource(const pool_options& opts, memory_resource* upstream) BOOST_NOEXCEPT; + + //! Effects: Same as + //! `pool_resource(pool_options(), get_default_resource())`. + pool_resource() BOOST_NOEXCEPT; + + //! Effects: Same as + //! `pool_resource(pool_options(), upstream)`. + explicit pool_resource(memory_resource* upstream) BOOST_NOEXCEPT; + + //! Effects: Same as + //! `pool_resource(opts, get_default_resource())`. + explicit pool_resource(const pool_options& opts) BOOST_NOEXCEPT; + + #if !defined(BOOST_NO_CXX11_DELETED_FUNCTIONS) || defined(BOOST_CONTAINER_DOXYGEN_INVOKED) + pool_resource(const pool_resource&) = delete; + pool_resource operator=(const pool_resource&) = delete; + #else + private: + pool_resource (const pool_resource&); + pool_resource operator=(const pool_resource&); + public: + #endif + + //! Effects: Calls + //! `this->release()`. + virtual ~pool_resource(); + + //! Effects: Calls Calls `upstream_resource()->deallocate()` as necessary + //! to release all allocated memory. [ Note: memory is released back to + //! `upstream_resource()` even if deallocate has not been called for some + //! of the allocated blocks. - end note ] + void release(); + + //! Returns: The value of the upstream argument provided to the + //! constructor of this object. + memory_resource* upstream_resource() const; + + //! Returns: The options that control the pooling behavior of this resource. + //! The values in the returned struct may differ from those supplied to the pool + //! resource constructor in that values of zero will be replaced with + //! implementation-defined defaults and sizes may be rounded to unspecified granularity. + pool_options options() const; + + public: //public so that [un]synchronized_pool_resource can use them + + //! Returns: A pointer to allocated storage with a size of at least `bytes`. + //! The size and alignment of the allocated memory shall meet the requirements for + //! a class derived from `memory_resource`. + //! + //! Effects: If the pool selected for a block of size bytes is unable to + //! satisfy the memory request from its own internal data structures, it will call + //! `upstream_resource()->allocate()` to obtain more memory. If `bytes` is larger + //! than that which the largest pool can handle, then memory will be allocated + //! using `upstream_resource()->allocate()`. + //! + //! Throws: Nothing unless `upstream_resource()->allocate()` throws. + virtual void* do_allocate(std::size_t bytes, std::size_t alignment); + + //! Effects: Return the memory at p to the pool. It is unspecified if or under + //! what circumstances this operation will result in a call to + //! `upstream_resource()->deallocate()`. + //! + //! Throws: Nothing. + virtual void do_deallocate(void* p, std::size_t bytes, std::size_t alignment); + + //! Returns: + //! `this == dynamic_cast(&other)`. + virtual bool do_is_equal(const memory_resource& other) const BOOST_NOEXCEPT; + + //Non-standard observers + public: + //! Returns: The number of pools that will be used in the pool resource. + //! + //! Note: Non-standard extension. + std::size_t pool_count() const; + + //! Returns: The index of the pool that will be used to serve the allocation of `bytes`. + //! from the pool specified by `pool_index`. Returns `pool_count()` if `bytes` is bigger + //! than `options().largest_required_pool_block` (no pool will be used to serve this). + //! + //! Note: Non-standard extension. + std::size_t pool_index(std::size_t bytes) const; + + //! Requires: `pool_idx < pool_index()` + //! + //! Returns: The number blocks that will be allocated in the next chunk + //! from the pool specified by `pool_idx`. + //! + //! Note: Non-standard extension. + std::size_t pool_next_blocks_per_chunk(std::size_t pool_idx) const; + + //! Requires: `pool_idx < pool_index()` + //! + //! Returns: The number of bytes of the block that the specified `pool_idx` pool manages. + //! + //! Note: Non-standard extension. + std::size_t pool_block(std::size_t pool_idx) const; + + //! Requires: `pool_idx < pool_index()` + //! + //! Returns: The number of blocks that the specified `pool_idx` pool has cached + //! and will be served without calling the upstream_allocator. + //! + //! Note: Non-standard extension. + std::size_t pool_cached_blocks(std::size_t pool_idx) const; +}; + +} //namespace pmr { +} //namespace container { +} //namespace boost { + +#include + +#endif //BOOST_CONTAINER_POOL_RESOURCE_HPP diff --git a/3party/boost/boost/container/detail/std_fwd.hpp b/3party/boost/boost/container/detail/std_fwd.hpp index 1277df071f..09678123ff 100644 --- a/3party/boost/boost/container/detail/std_fwd.hpp +++ b/3party/boost/boost/container/detail/std_fwd.hpp @@ -23,26 +23,8 @@ // Standard predeclarations ////////////////////////////////////////////////////////////////////////////// -#if defined(_LIBCPP_VERSION) - #define BOOST_CONTAINER_CLANG_INLINE_STD_NS - #pragma GCC diagnostic push - #if defined(__clang__) - #pragma GCC diagnostic ignored "-Wc++11-extensions" - #endif - #define BOOST_CONTAINER_STD_NS_BEG _LIBCPP_BEGIN_NAMESPACE_STD - #define BOOST_CONTAINER_STD_NS_END _LIBCPP_END_NAMESPACE_STD -#elif defined(BOOST_GNU_STDLIB) && defined(_GLIBCXX_BEGIN_NAMESPACE_VERSION) //GCC >= 4.6 - #define BOOST_CONTAINER_STD_NS_BEG namespace std _GLIBCXX_VISIBILITY(default) { _GLIBCXX_BEGIN_NAMESPACE_VERSION - #define BOOST_CONTAINER_STD_NS_END _GLIBCXX_END_NAMESPACE_VERSION } // namespace -#elif defined(BOOST_GNU_STDLIB) && defined(_GLIBCXX_BEGIN_NAMESPACE) //GCC >= 4.2 - #define BOOST_CONTAINER_STD_NS_BEG _GLIBCXX_BEGIN_NAMESPACE(std) - #define BOOST_CONTAINER_STD_NS_END _GLIBCXX_END_NAMESPACE -#else - #define BOOST_CONTAINER_STD_NS_BEG namespace std{ - #define BOOST_CONTAINER_STD_NS_END } -#endif - -BOOST_CONTAINER_STD_NS_BEG +#include +BOOST_MOVE_STD_NS_BEG template class allocator; @@ -66,11 +48,9 @@ class insert_iterator; struct allocator_arg_t; -BOOST_CONTAINER_STD_NS_END +struct piecewise_construct_t; -#ifdef BOOST_CONTAINER_CLANG_INLINE_STD_NS - #pragma GCC diagnostic pop - #undef BOOST_CONTAINER_CLANG_INLINE_STD_NS -#endif //BOOST_CONTAINER_CLANG_INLINE_STD_NS +BOOST_MOVE_STD_NS_END +#include #endif //#ifndef BOOST_CONTAINER_DETAIL_STD_FWD_HPP diff --git a/3party/boost/boost/container/detail/tree.hpp b/3party/boost/boost/container/detail/tree.hpp index ce34ffb136..853d0ad843 100644 --- a/3party/boost/boost/container/detail/tree.hpp +++ b/3party/boost/boost/container/detail/tree.hpp @@ -1,6 +1,6 @@ ////////////////////////////////////////////////////////////////////////////// // -// (C) Copyright Ion Gaztanaga 2005-2013. Distributed under the Boost +// (C) Copyright Ion Gaztanaga 2005-2015. 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) // @@ -25,6 +25,7 @@ #include #include #include +#include // container/detail #include //algo_equal(), algo_lexicographical_compare @@ -50,6 +51,7 @@ #if !defined(BOOST_NO_CXX11_VARIADIC_TEMPLATES) #include #endif +#include // other #include @@ -134,15 +136,15 @@ struct tree_node typedef typename tree_internal_data_type::type internal_type; typedef tree_node< T, VoidPointer - , tree_type_value, OptimizeSize> node_type; + , tree_type_value, OptimizeSize> node_t; - T &get_data() + BOOST_CONTAINER_FORCEINLINE T &get_data() { T* ptr = reinterpret_cast(&this->m_data); return *ptr; } - const T &get_data() const + BOOST_CONTAINER_FORCEINLINE const T &get_data() const { const T* ptr = reinterpret_cast(&this->m_data); return *ptr; @@ -151,39 +153,39 @@ struct tree_node internal_type m_data; template - void do_assign(const std::pair &p) + BOOST_CONTAINER_FORCEINLINE void do_assign(const std::pair &p) { const_cast(m_data.first) = p.first; m_data.second = p.second; } template - void do_assign(const pair &p) + BOOST_CONTAINER_FORCEINLINE void do_assign(const pair &p) { const_cast(m_data.first) = p.first; m_data.second = p.second; } template - void do_assign(const V &v) + BOOST_CONTAINER_FORCEINLINE void do_assign(const V &v) { m_data = v; } template - void do_move_assign(std::pair &p) + BOOST_CONTAINER_FORCEINLINE void do_move_assign(std::pair &p) { const_cast(m_data.first) = ::boost::move(p.first); m_data.second = ::boost::move(p.second); } template - void do_move_assign(pair &p) + BOOST_CONTAINER_FORCEINLINE void do_move_assign(pair &p) { const_cast(m_data.first) = ::boost::move(p.first); m_data.second = ::boost::move(p.second); } template - void do_move_assign(V &v) + BOOST_CONTAINER_FORCEINLINE void do_move_assign(V &v) { m_data = ::boost::move(v); } }; @@ -198,11 +200,11 @@ class insert_equal_end_hint_functor Icont &icont_; public: - insert_equal_end_hint_functor(Icont &icont) + BOOST_CONTAINER_FORCEINLINE insert_equal_end_hint_functor(Icont &icont) : icont_(icont) {} - void operator()(Node &n) + BOOST_CONTAINER_FORCEINLINE void operator()(Node &n) { this->icont_.insert_equal(this->icont_.cend(), n); } }; @@ -212,11 +214,11 @@ class push_back_functor Icont &icont_; public: - push_back_functor(Icont &icont) + BOOST_CONTAINER_FORCEINLINE push_back_functor(Icont &icont) : icont_(icont) {} - void operator()(Node &n) + BOOST_CONTAINER_FORCEINLINE void operator()(Node &n) { this->icont_.push_back(n); } }; @@ -293,18 +295,18 @@ struct intrusive_tree_type allocator_traits::size_type size_type; typedef typename container_detail::tree_node < value_type, void_pointer - , tree_type_value, OptimizeSize> node_type; + , tree_type_value, OptimizeSize> node_t; typedef value_to_node_compare - node_compare_type; - //Deducing the hook type from node_type (e.g. node_type::hook_type) would - //provoke an early instantiation of node_type that could ruin recursive + node_compare_type; + //Deducing the hook type from node_t (e.g. node_t::hook_type) would + //provoke an early instantiation of node_t that could ruin recursive //tree definitions, so retype the complete type to avoid any problem. typedef typename intrusive_tree_hook ::type hook_type; public: typedef typename intrusive_tree_dispatch - < node_type, node_compare_type + < node_t, node_compare_type , size_type, hook_type , tree_type_value>::type type; }; @@ -327,14 +329,14 @@ template< boost::container::tree_type_enum tree_type_value struct intrusive_tree_proxy { template - static void rebalance(Icont &) {} + BOOST_CONTAINER_FORCEINLINE static void rebalance(Icont &) {} }; template struct intrusive_tree_proxy { template - static void rebalance(Icont &c) + BOOST_CONTAINER_FORCEINLINE static void rebalance(Icont &c) { c.rebalance(); } }; @@ -350,7 +352,7 @@ template class RecyclingCloner { typedef typename AllocHolder::intrusive_container intrusive_container; - typedef typename AllocHolder::Node node_type; + typedef typename AllocHolder::Node node_t; typedef typename AllocHolder::NodePtr node_ptr_type; public: @@ -358,13 +360,13 @@ class RecyclingCloner : m_holder(holder), m_icont(itree) {} - static void do_assign(node_ptr_type &p, const node_type &other, bool_) - { p->do_move_assign(const_cast(other).m_data); } + BOOST_CONTAINER_FORCEINLINE static void do_assign(node_ptr_type &p, const node_t &other, bool_) + { p->do_move_assign(const_cast(other).m_data); } - static void do_assign(node_ptr_type &p, const node_type &other, bool_) + BOOST_CONTAINER_FORCEINLINE static void do_assign(node_ptr_type &p, const node_t &other, bool_) { p->do_assign(other.m_data); } - node_ptr_type operator()(const node_type &other) const + node_ptr_type operator()(const node_t &other) const { if(node_ptr_type p = m_icont.unlink_leftmost_without_rebalance()){ //First recycle a node (this can't throw) @@ -392,56 +394,63 @@ class RecyclingCloner intrusive_container &m_icont; }; -template -//where KeyValueCompare is tree_value_compare +template struct key_node_compare - : private KeyValueCompare + : public boost::intrusive::detail::ebo_functor_holder { - explicit key_node_compare(const KeyValueCompare &comp) - : KeyValueCompare(comp) + BOOST_CONTAINER_FORCEINLINE explicit key_node_compare(const KeyCompare &comp) + : base_t(comp) {} - template - struct is_node - { - static const bool value = is_same::value; - }; + typedef boost::intrusive::detail::ebo_functor_holder base_t; + typedef KeyCompare key_compare; + typedef KeyOfValue key_of_value; + typedef typename KeyOfValue::type key_type; - template - typename enable_if_c::value, const typename KeyValueCompare::value_type &>::type - key_forward(const T &node) const - { return node.get_data(); } + BOOST_CONTAINER_FORCEINLINE const key_compare &key_comp() const + { return static_cast(*this); } - template - typename enable_if_c::value, const T &>::type - key_forward(const T &key) const - { return key; } + BOOST_CONTAINER_FORCEINLINE key_compare &key_comp() + { return static_cast(*this); } - template - bool operator()(const KeyType &key1, const KeyType2 &key2) const - { return KeyValueCompare::operator()(this->key_forward(key1), this->key_forward(key2)); } + BOOST_CONTAINER_FORCEINLINE bool operator()(const key_type &key1, const key_type &key2) const + { return this->key_comp()(key1, key2); } + + template + BOOST_CONTAINER_FORCEINLINE bool operator()(const key_type &key1, const U &nonkey2) const + { return this->key_comp()(key1, key_of_value()(nonkey2.get_data())); } + + template + BOOST_CONTAINER_FORCEINLINE bool operator()(const U &nonkey1, const key_type &key2) const + { return this->key_comp()(key_of_value()(nonkey1.get_data()), key2); } + + template + BOOST_CONTAINER_FORCEINLINE bool operator()(const U &nonkey1, const V &nonkey2) const + { return this->key_comp()(key_of_value()(nonkey1.get_data()), key_of_value()(nonkey2.get_data())); } }; -template class tree - : protected container_detail::node_alloc_holder + : public container_detail::node_alloc_holder < Allocator , typename container_detail::intrusive_tree_type - < Allocator, tree_value_compare //ValComp + < Allocator, tree_value_compare + ::pointer, Compare, KeyOfValue> , Options::tree_type, Options::optimize_size>::type > { typedef tree_value_compare - ValComp; + < typename allocator_traits::pointer + , Compare, KeyOfValue> ValComp; typedef typename container_detail::intrusive_tree_type < Allocator, ValComp, Options::tree_type , Options::optimize_size>::type Icont; typedef container_detail::node_alloc_holder AllocHolder; typedef typename AllocHolder::NodePtr NodePtr; - typedef tree < Key, T, KeyOfValue + typedef tree < T, KeyOfValue , Compare, Allocator, Options> ThisType; typedef typename AllocHolder::NodeAlloc NodeAlloc; typedef boost::container:: @@ -458,7 +467,7 @@ class tree public: - typedef Key key_type; + typedef typename KeyOfValue::type key_type; typedef T value_type; typedef Allocator allocator_type; typedef Compare key_compare; @@ -475,32 +484,36 @@ class tree allocator_traits::size_type size_type; typedef typename boost::container:: allocator_traits::difference_type difference_type; - typedef difference_type tree_difference_type; - typedef pointer tree_pointer; - typedef const_pointer tree_const_pointer; - typedef reference tree_reference; - typedef const_reference tree_const_reference; + typedef container_detail::iterator_from_iiterator + iterator; + typedef container_detail::iterator_from_iiterator + const_iterator; + typedef boost::container::reverse_iterator + reverse_iterator; + typedef boost::container::reverse_iterator + const_reverse_iterator; + typedef node_handle + < Node, value_type, allocator_type, void> node_type; + typedef insert_return_type_base + insert_return_type; + typedef NodeAlloc stored_allocator_type; private: - typedef key_node_compare KeyNodeCompare; + typedef key_node_compare KeyNodeCompare; public: - typedef container_detail::iterator_from_iiterator iterator; - typedef container_detail::iterator_from_iiterator const_iterator; - typedef boost::container::reverse_iterator reverse_iterator; - typedef boost::container::reverse_iterator const_reverse_iterator; - tree() + BOOST_CONTAINER_FORCEINLINE tree() : AllocHolder() {} - explicit tree(const key_compare& comp, const allocator_type& a = allocator_type()) + BOOST_CONTAINER_FORCEINLINE explicit tree(const key_compare& comp, const allocator_type& a = allocator_type()) : AllocHolder(ValComp(comp), a) {} - explicit tree(const allocator_type& a) + BOOST_CONTAINER_FORCEINLINE explicit tree(const allocator_type& a) : AllocHolder(a) {} @@ -523,12 +536,12 @@ class tree const const_iterator end_it(this->cend()); if(unique_insertion){ for ( ; first != last; ++first){ - this->insert_unique(end_it, *first); + this->insert_unique_convertible(end_it, *first); } } else{ for ( ; first != last; ++first){ - this->insert_equal(end_it, *first); + this->insert_equal_convertible(end_it, *first); } } } @@ -552,7 +565,7 @@ class tree //for the constructor const const_iterator end_it(this->cend()); for ( ; first != last; ++first){ - this->insert_unique(end_it, *first); + this->insert_unique_convertible(end_it, *first); } } else{ @@ -600,18 +613,19 @@ class tree , container_detail::push_back_functor(this->icont())); } - tree(const tree& x) + BOOST_CONTAINER_FORCEINLINE tree(const tree& x) : AllocHolder(x.value_comp(), x) { this->icont().clone_from (x.icont(), typename AllocHolder::cloner(*this), Destroyer(this->node_alloc())); } - tree(BOOST_RV_REF(tree) x) + BOOST_CONTAINER_FORCEINLINE tree(BOOST_RV_REF(tree) x) + BOOST_NOEXCEPT_IF(boost::container::container_detail::is_nothrow_move_constructible::value) : AllocHolder(BOOST_MOVE_BASE(AllocHolder, x), x.value_comp()) {} - tree(const tree& x, const allocator_type &a) + BOOST_CONTAINER_FORCEINLINE tree(const tree& x, const allocator_type &a) : AllocHolder(x.value_comp(), a) { this->icont().clone_from @@ -630,7 +644,7 @@ class tree } } - ~tree() + BOOST_CONTAINER_FORCEINLINE ~tree() {} //AllocHolder clears the tree tree& operator=(BOOST_COPY_ASSIGN_REF(tree) x) @@ -665,8 +679,9 @@ class tree } tree& operator=(BOOST_RV_REF(tree) x) - BOOST_NOEXCEPT_IF( allocator_traits_type::is_always_equal::value - && boost::container::container_detail::is_nothrow_move_assignable::value ) + BOOST_NOEXCEPT_IF( (allocator_traits_type::propagate_on_container_move_assignment::value || + allocator_traits_type::is_always_equal::value) && + boost::container::container_detail::is_nothrow_move_assignable::value) { BOOST_ASSERT(this != &x); NodeAlloc &this_alloc = this->node_alloc(); @@ -708,43 +723,43 @@ class tree public: // accessors: - value_compare value_comp() const + BOOST_CONTAINER_FORCEINLINE value_compare value_comp() const { return this->icont().value_comp().predicate(); } - key_compare key_comp() const + BOOST_CONTAINER_FORCEINLINE key_compare key_comp() const { return this->icont().value_comp().predicate().key_comp(); } - allocator_type get_allocator() const + BOOST_CONTAINER_FORCEINLINE allocator_type get_allocator() const { return allocator_type(this->node_alloc()); } - const stored_allocator_type &get_stored_allocator() const + BOOST_CONTAINER_FORCEINLINE const stored_allocator_type &get_stored_allocator() const { return this->node_alloc(); } - stored_allocator_type &get_stored_allocator() + BOOST_CONTAINER_FORCEINLINE stored_allocator_type &get_stored_allocator() { return this->node_alloc(); } - iterator begin() + BOOST_CONTAINER_FORCEINLINE iterator begin() { return iterator(this->icont().begin()); } - const_iterator begin() const + BOOST_CONTAINER_FORCEINLINE const_iterator begin() const { return this->cbegin(); } - iterator end() + BOOST_CONTAINER_FORCEINLINE iterator end() { return iterator(this->icont().end()); } - const_iterator end() const + BOOST_CONTAINER_FORCEINLINE const_iterator end() const { return this->cend(); } - reverse_iterator rbegin() + BOOST_CONTAINER_FORCEINLINE reverse_iterator rbegin() { return reverse_iterator(end()); } - const_reverse_iterator rbegin() const + BOOST_CONTAINER_FORCEINLINE const_reverse_iterator rbegin() const { return this->crbegin(); } - reverse_iterator rend() + BOOST_CONTAINER_FORCEINLINE reverse_iterator rend() { return reverse_iterator(begin()); } - const_reverse_iterator rend() const + BOOST_CONTAINER_FORCEINLINE const_reverse_iterator rend() const { return this->crend(); } //! Effects: Returns a const_iterator to the first element contained in the container. @@ -752,7 +767,7 @@ class tree //! Throws: Nothing. //! //! Complexity: Constant. - const_iterator cbegin() const + BOOST_CONTAINER_FORCEINLINE const_iterator cbegin() const { return const_iterator(this->non_const_icont().begin()); } //! Effects: Returns a const_iterator to the end of the container. @@ -760,7 +775,7 @@ class tree //! Throws: Nothing. //! //! Complexity: Constant. - const_iterator cend() const + BOOST_CONTAINER_FORCEINLINE const_iterator cend() const { return const_iterator(this->non_const_icont().end()); } //! Effects: Returns a const_reverse_iterator pointing to the beginning @@ -769,7 +784,7 @@ class tree //! Throws: Nothing. //! //! Complexity: Constant. - const_reverse_iterator crbegin() const + BOOST_CONTAINER_FORCEINLINE const_reverse_iterator crbegin() const { return const_reverse_iterator(cend()); } //! Effects: Returns a const_reverse_iterator pointing to the end @@ -778,19 +793,19 @@ class tree //! Throws: Nothing. //! //! Complexity: Constant. - const_reverse_iterator crend() const + BOOST_CONTAINER_FORCEINLINE const_reverse_iterator crend() const { return const_reverse_iterator(cbegin()); } - bool empty() const + BOOST_CONTAINER_FORCEINLINE bool empty() const { return !this->size(); } - size_type size() const + BOOST_CONTAINER_FORCEINLINE size_type size() const { return this->icont().size(); } - size_type max_size() const + BOOST_CONTAINER_FORCEINLINE size_type max_size() const { return AllocHolder::max_size(); } - void swap(ThisType& x) + BOOST_CONTAINER_FORCEINLINE void swap(ThisType& x) BOOST_NOEXCEPT_IF( allocator_traits_type::is_always_equal::value && boost::container::container_detail::is_nothrow_swappable::value ) { AllocHolder::swap(x); } @@ -804,27 +819,19 @@ class tree (const key_type& key, insert_commit_data &data) { std::pair ret = - this->icont().insert_unique_check(key, KeyNodeCompare(value_comp()), data); + this->icont().insert_unique_check(key, KeyNodeCompare(key_comp()), data); return std::pair(iterator(ret.first), ret.second); } std::pair insert_unique_check (const_iterator hint, const key_type& key, insert_commit_data &data) { + BOOST_ASSERT((priv_is_linked)(hint)); std::pair ret = - this->icont().insert_unique_check(hint.get(), key, KeyNodeCompare(value_comp()), data); + this->icont().insert_unique_check(hint.get(), key, KeyNodeCompare(key_comp()), data); return std::pair(iterator(ret.first), ret.second); } - iterator insert_unique_commit(const value_type& v, insert_commit_data &data) - { - NodePtr tmp = AllocHolder::create_node(v); - scoped_destroy_deallocator destroy_deallocator(tmp, this->node_alloc()); - iterator ret(this->icont().insert_unique_commit(*tmp, data)); - destroy_deallocator.release(); - return ret; - } - template iterator insert_unique_commit (BOOST_FWD_REF(MovableConvertible) v, insert_commit_data &data) @@ -836,17 +843,6 @@ class tree return ret; } - std::pair insert_unique(const value_type& v) - { - insert_commit_data data; - std::pair ret = - this->insert_unique_check(KeyOfValue()(v), data); - if(ret.second){ - ret.first = this->insert_unique_commit(v, data); - } - return ret; - } - template std::pair insert_unique(BOOST_FWD_REF(MovableConvertible) v) { @@ -861,6 +857,26 @@ class tree private: + template + iiterator priv_insert_or_assign_commit + (BOOST_FWD_REF(KeyConvertible) key, BOOST_FWD_REF(M) obj, insert_commit_data &data) + { + NodePtr tmp = AllocHolder::create_node(boost::forward(key), boost::forward(obj)); + scoped_destroy_deallocator destroy_deallocator(tmp, this->node_alloc()); + iiterator ret(this->icont().insert_unique_commit(*tmp, data)); + destroy_deallocator.release(); + return ret; + } + + bool priv_is_linked(const_iterator const position) const + { + iiterator const cur(position.get()); + return cur == this->icont().end() || + cur == this->icont().root() || + iiterator(cur).go_parent().go_left() == cur || + iiterator(cur).go_parent().go_right() == cur; + } + template void push_back_impl(BOOST_FWD_REF(MovableConvertible) v) { @@ -882,12 +898,13 @@ class tree //No throw insertion part, release rollback destroy_deallocator.release(); return std::pair - ( iterator(iiterator(this->icont().insert_unique_commit(*p, data))) + ( iterator(this->icont().insert_unique_commit(*p, data)) , true ); } iterator emplace_unique_hint_impl(const_iterator hint, NodePtr p) { + BOOST_ASSERT((priv_is_linked)(hint)); value_type &v = p->get_data(); insert_commit_data data; std::pair ret = @@ -896,7 +913,7 @@ class tree Destroyer(this->node_alloc())(p); return ret.first; } - return iterator(iiterator(this->icont().insert_unique_commit(*p, data))); + return iterator(this->icont().insert_unique_commit(*p, data)); } public: @@ -904,11 +921,11 @@ class tree #if !defined(BOOST_NO_CXX11_VARIADIC_TEMPLATES) template - std::pair emplace_unique(BOOST_FWD_REF(Args)... args) + BOOST_CONTAINER_FORCEINLINE std::pair emplace_unique(BOOST_FWD_REF(Args)... args) { return this->emplace_unique_impl(AllocHolder::create_node(boost::forward(args)...)); } template - iterator emplace_hint_unique(const_iterator hint, BOOST_FWD_REF(Args)... args) + BOOST_CONTAINER_FORCEINLINE iterator emplace_hint_unique(const_iterator hint, BOOST_FWD_REF(Args)... args) { return this->emplace_unique_hint_impl(hint, AllocHolder::create_node(boost::forward(args)...)); } template @@ -924,6 +941,7 @@ class tree template iterator emplace_hint_equal(const_iterator hint, BOOST_FWD_REF(Args)... args) { + BOOST_ASSERT((priv_is_linked)(hint)); NodePtr tmp(AllocHolder::create_node(boost::forward(args)...)); scoped_destroy_deallocator destroy_deallocator(tmp, this->node_alloc()); iterator ret(this->icont().insert_equal(hint.get(), *tmp)); @@ -931,6 +949,22 @@ class tree return ret; } + template + BOOST_CONTAINER_FORCEINLINE std::pair try_emplace + (const_iterator hint, BOOST_FWD_REF(KeyType) key, BOOST_FWD_REF(Args)... args) + { + insert_commit_data data; + const key_type & k = key; //Support emulated rvalue references + std::pair ret = + hint == const_iterator() ? this->icont().insert_unique_check( k, KeyNodeCompare(key_comp()), data) + : this->icont().insert_unique_check(hint.get(), k, KeyNodeCompare(key_comp()), data); + if(ret.second){ + ret.first = this->icont().insert_unique_commit + (*AllocHolder::create_node(try_emplace_t(), boost::forward(key), boost::forward(args)...), data); + } + return std::pair(iterator(ret.first), ret.second); + } + #else // !defined(BOOST_NO_CXX11_VARIADIC_TEMPLATES) #define BOOST_CONTAINER_TREE_EMPLACE_CODE(N) \ @@ -955,31 +989,39 @@ class tree BOOST_MOVE_TMPL_LT##N BOOST_MOVE_CLASS##N BOOST_MOVE_GT##N \ iterator emplace_hint_equal(const_iterator hint BOOST_MOVE_I##N BOOST_MOVE_UREF##N)\ {\ + BOOST_ASSERT((priv_is_linked)(hint));\ NodePtr tmp(AllocHolder::create_node(BOOST_MOVE_FWD##N));\ scoped_destroy_deallocator destroy_deallocator(tmp, this->node_alloc());\ iterator ret(this->icont().insert_equal(hint.get(), *tmp));\ destroy_deallocator.release();\ return ret;\ }\ + \ + template \ + BOOST_CONTAINER_FORCEINLINE std::pair\ + try_emplace(const_iterator hint, BOOST_FWD_REF(KeyType) key BOOST_MOVE_I##N BOOST_MOVE_UREF##N)\ + {\ + insert_commit_data data;\ + const key_type & k = key;\ + std::pair ret =\ + hint == const_iterator() ? this->icont().insert_unique_check( k, KeyNodeCompare(key_comp()), data)\ + : this->icont().insert_unique_check(hint.get(), k, KeyNodeCompare(key_comp()), data);\ + if(ret.second){\ + ret.first = this->icont().insert_unique_commit\ + (*AllocHolder::create_node(try_emplace_t(), boost::forward(key) BOOST_MOVE_I##N BOOST_MOVE_FWD##N), data);\ + }\ + return std::pair(iterator(ret.first), ret.second);\ + }\ // BOOST_MOVE_ITERATE_0TO9(BOOST_CONTAINER_TREE_EMPLACE_CODE) #undef BOOST_CONTAINER_TREE_EMPLACE_CODE #endif // !defined(BOOST_NO_CXX11_VARIADIC_TEMPLATES) - iterator insert_unique(const_iterator hint, const value_type& v) - { - insert_commit_data data; - std::pair ret = - this->insert_unique_check(hint, KeyOfValue()(v), data); - if(!ret.second) - return ret.first; - return this->insert_unique_commit(v, data); - } - template - iterator insert_unique(const_iterator hint, BOOST_FWD_REF(MovableConvertible) v) + iterator insert_unique_convertible(const_iterator hint, BOOST_FWD_REF(MovableConvertible) v) { + BOOST_ASSERT((priv_is_linked)(hint)); insert_commit_data data; std::pair ret = this->insert_unique_check(hint, KeyOfValue()(v), data); @@ -988,6 +1030,8 @@ class tree return this->insert_unique_commit(boost::forward(v), data); } + BOOST_MOVE_CONVERSION_AWARE_CATCH_1ARG(insert_unique, value_type, iterator, this->insert_unique_convertible, const_iterator, const_iterator) + template void insert_unique(InputIterator first, InputIterator last) { @@ -1014,18 +1058,10 @@ class tree return ret; } - iterator insert_equal(const_iterator hint, const value_type& v) - { - NodePtr tmp(AllocHolder::create_node(v)); - scoped_destroy_deallocator destroy_deallocator(tmp, this->node_alloc()); - iterator ret(this->icont().insert_equal(hint.get(), *tmp)); - destroy_deallocator.release(); - return ret; - } - template - iterator insert_equal(const_iterator hint, BOOST_FWD_REF(MovableConvertible) v) + iterator insert_equal_convertible(const_iterator hint, BOOST_FWD_REF(MovableConvertible) v) { + BOOST_ASSERT((priv_is_linked)(hint)); NodePtr tmp(AllocHolder::create_node(boost::forward(v))); scoped_destroy_deallocator destroy_deallocator(tmp, this->node_alloc()); iterator ret(this->icont().insert_equal(hint.get(), *tmp)); @@ -1033,6 +1069,8 @@ class tree return ret; } + BOOST_MOVE_CONVERSION_AWARE_CATCH_1ARG(insert_equal, value_type, iterator, this->insert_equal_convertible, const_iterator, const_iterator) + template void insert_equal(InputIterator first, InputIterator last) { @@ -1040,52 +1078,150 @@ class tree this->insert_equal(*first); } - iterator erase(const_iterator position) - { return iterator(this->icont().erase_and_dispose(position.get(), Destroyer(this->node_alloc()))); } + template + std::pair insert_or_assign(const_iterator hint, BOOST_FWD_REF(KeyType) key, BOOST_FWD_REF(M) obj) + { + insert_commit_data data; + const key_type & k = key; //Support emulated rvalue references + std::pair ret = + hint == const_iterator() ? this->icont().insert_unique_check(k, KeyNodeCompare(key_comp()), data) + : this->icont().insert_unique_check(hint.get(), k, KeyNodeCompare(key_comp()), data); + if(ret.second){ + ret.first = this->priv_insert_or_assign_commit(boost::forward(key), boost::forward(obj), data); + } + else{ + ret.first->get_data().second = boost::forward(obj); + } + return std::pair(iterator(ret.first), ret.second); + } - size_type erase(const key_type& k) - { return AllocHolder::erase_key(k, KeyNodeCompare(value_comp()), alloc_version()); } + iterator erase(const_iterator position) + { + BOOST_ASSERT(position != this->cend() && (priv_is_linked)(position)); + return iterator(this->icont().erase_and_dispose(position.get(), Destroyer(this->node_alloc()))); + } + + BOOST_CONTAINER_FORCEINLINE size_type erase(const key_type& k) + { return AllocHolder::erase_key(k, KeyNodeCompare(key_comp()), alloc_version()); } iterator erase(const_iterator first, const_iterator last) - { return iterator(AllocHolder::erase_range(first.get(), last.get(), alloc_version())); } + { + BOOST_ASSERT(first == last || (first != this->cend() && (priv_is_linked)(first))); + BOOST_ASSERT(first == last || (priv_is_linked)(last)); + return iterator(AllocHolder::erase_range(first.get(), last.get(), alloc_version())); + } - void clear() + node_type extract(const key_type& k) + { + iterator const it = this->find(k); + if(this->end() != it){ + return this->extract(it); + } + return node_type(); + } + + node_type extract(const_iterator position) + { + BOOST_ASSERT(position != this->cend() && (priv_is_linked)(position)); + iiterator const iit(position.get()); + this->icont().erase(iit); + return node_type(iit.operator->(), this->node_alloc()); + } + + insert_return_type insert_unique_node(BOOST_RV_REF_BEG_IF_CXX11 node_type BOOST_RV_REF_END_IF_CXX11 nh) + { + return this->insert_unique_node(this->end(), boost::move(nh)); + } + + insert_return_type insert_unique_node(const_iterator hint, BOOST_RV_REF_BEG_IF_CXX11 node_type BOOST_RV_REF_END_IF_CXX11 nh) + { + insert_return_type irt; //inserted == false, node.empty() + if(!nh.empty()){ + insert_commit_data data; + std::pair ret = + this->insert_unique_check(hint, KeyOfValue()(nh.value()), data); + if(ret.second){ + irt.inserted = true; + irt.position = iterator(this->icont().insert_unique_commit(*nh.get_node_pointer(), data)); + nh.release(); + } + else{ + irt.position = ret.first; + irt.node = boost::move(nh); + } + } + else{ + irt.position = this->end(); + } + return BOOST_MOVE_RET(insert_return_type, irt); + } + + iterator insert_equal_node(BOOST_RV_REF_BEG_IF_CXX11 node_type BOOST_RV_REF_END_IF_CXX11 nh) + { + if(nh.empty()){ + return this->end(); + } + else{ + NodePtr const p(nh.release()); + return iterator(this->icont().insert_equal(*p)); + } + } + + iterator insert_equal_node(const_iterator hint, BOOST_RV_REF_BEG_IF_CXX11 node_type BOOST_RV_REF_END_IF_CXX11 nh) + { + if(nh.empty()){ + return this->end(); + } + else{ + NodePtr const p(nh.release()); + return iterator(this->icont().insert_equal(hint.get(), *p)); + } + } + + template + BOOST_CONTAINER_FORCEINLINE void merge_unique(tree& source) + { return this->icont().merge_unique(source.icont()); } + + template + BOOST_CONTAINER_FORCEINLINE void merge_equal(tree& source) + { return this->icont().merge_equal(source.icont()); } + BOOST_CONTAINER_FORCEINLINE void clear() { AllocHolder::clear(alloc_version()); } // search operations. Const and non-const overloads even if no iterator is returned // so splay implementations can to their rebalancing when searching in non-const versions - iterator find(const key_type& k) - { return iterator(this->icont().find(k, KeyNodeCompare(value_comp()))); } + BOOST_CONTAINER_FORCEINLINE iterator find(const key_type& k) + { return iterator(this->icont().find(k, KeyNodeCompare(key_comp()))); } - const_iterator find(const key_type& k) const - { return const_iterator(this->non_const_icont().find(k, KeyNodeCompare(value_comp()))); } + BOOST_CONTAINER_FORCEINLINE const_iterator find(const key_type& k) const + { return const_iterator(this->non_const_icont().find(k, KeyNodeCompare(key_comp()))); } - size_type count(const key_type& k) const - { return size_type(this->icont().count(k, KeyNodeCompare(value_comp()))); } + BOOST_CONTAINER_FORCEINLINE size_type count(const key_type& k) const + { return size_type(this->icont().count(k, KeyNodeCompare(key_comp()))); } - iterator lower_bound(const key_type& k) - { return iterator(this->icont().lower_bound(k, KeyNodeCompare(value_comp()))); } + BOOST_CONTAINER_FORCEINLINE iterator lower_bound(const key_type& k) + { return iterator(this->icont().lower_bound(k, KeyNodeCompare(key_comp()))); } - const_iterator lower_bound(const key_type& k) const - { return const_iterator(this->non_const_icont().lower_bound(k, KeyNodeCompare(value_comp()))); } + BOOST_CONTAINER_FORCEINLINE const_iterator lower_bound(const key_type& k) const + { return const_iterator(this->non_const_icont().lower_bound(k, KeyNodeCompare(key_comp()))); } - iterator upper_bound(const key_type& k) - { return iterator(this->icont().upper_bound(k, KeyNodeCompare(value_comp()))); } + BOOST_CONTAINER_FORCEINLINE iterator upper_bound(const key_type& k) + { return iterator(this->icont().upper_bound(k, KeyNodeCompare(key_comp()))); } - const_iterator upper_bound(const key_type& k) const - { return const_iterator(this->non_const_icont().upper_bound(k, KeyNodeCompare(value_comp()))); } + BOOST_CONTAINER_FORCEINLINE const_iterator upper_bound(const key_type& k) const + { return const_iterator(this->non_const_icont().upper_bound(k, KeyNodeCompare(key_comp()))); } std::pair equal_range(const key_type& k) { std::pair ret = - this->icont().equal_range(k, KeyNodeCompare(value_comp())); + this->icont().equal_range(k, KeyNodeCompare(key_comp())); return std::pair(iterator(ret.first), iterator(ret.second)); } std::pair equal_range(const key_type& k) const { std::pair ret = - this->non_const_icont().equal_range(k, KeyNodeCompare(value_comp())); + this->non_const_icont().equal_range(k, KeyNodeCompare(key_comp())); return std::pair (const_iterator(ret.first), const_iterator(ret.second)); } @@ -1093,40 +1229,40 @@ class tree std::pair lower_bound_range(const key_type& k) { std::pair ret = - this->icont().lower_bound_range(k, KeyNodeCompare(value_comp())); + this->icont().lower_bound_range(k, KeyNodeCompare(key_comp())); return std::pair(iterator(ret.first), iterator(ret.second)); } std::pair lower_bound_range(const key_type& k) const { std::pair ret = - this->non_const_icont().lower_bound_range(k, KeyNodeCompare(value_comp())); + this->non_const_icont().lower_bound_range(k, KeyNodeCompare(key_comp())); return std::pair (const_iterator(ret.first), const_iterator(ret.second)); } - void rebalance() + BOOST_CONTAINER_FORCEINLINE void rebalance() { intrusive_tree_proxy_t::rebalance(this->icont()); } - friend bool operator==(const tree& x, const tree& y) + BOOST_CONTAINER_FORCEINLINE friend bool operator==(const tree& x, const tree& y) { return x.size() == y.size() && ::boost::container::algo_equal(x.begin(), x.end(), y.begin()); } - friend bool operator<(const tree& x, const tree& y) + BOOST_CONTAINER_FORCEINLINE friend bool operator<(const tree& x, const tree& y) { return ::boost::container::algo_lexicographical_compare(x.begin(), x.end(), y.begin(), y.end()); } - friend bool operator!=(const tree& x, const tree& y) + BOOST_CONTAINER_FORCEINLINE friend bool operator!=(const tree& x, const tree& y) { return !(x == y); } - friend bool operator>(const tree& x, const tree& y) + BOOST_CONTAINER_FORCEINLINE friend bool operator>(const tree& x, const tree& y) { return y < x; } - friend bool operator<=(const tree& x, const tree& y) + BOOST_CONTAINER_FORCEINLINE friend bool operator<=(const tree& x, const tree& y) { return !(y < x); } - friend bool operator>=(const tree& x, const tree& y) + BOOST_CONTAINER_FORCEINLINE friend bool operator>=(const tree& x, const tree& y) { return !(x < y); } - friend void swap(tree& x, tree& y) + BOOST_CONTAINER_FORCEINLINE friend void swap(tree& x, tree& y) { x.swap(y); } }; @@ -1138,11 +1274,11 @@ struct has_trivial_destructor_after_move; //!has_trivial_destructor_after_move<> == true_type //!specialization for optimizations -template +template struct has_trivial_destructor_after_move - < + < ::boost::container::container_detail::tree - + > { typedef typename ::boost::container::allocator_traits::pointer pointer; diff --git a/3party/boost/boost/container/detail/type_traits.hpp b/3party/boost/boost/container/detail/type_traits.hpp index e02709ac6e..e1453a6594 100644 --- a/3party/boost/boost/container/detail/type_traits.hpp +++ b/3party/boost/boost/container/detail/type_traits.hpp @@ -30,6 +30,8 @@ namespace boost { namespace container { namespace container_detail { +using ::boost::move_detail::enable_if; +using ::boost::move_detail::enable_if_and; using ::boost::move_detail::is_same; using ::boost::move_detail::is_different; using ::boost::move_detail::is_pointer; diff --git a/3party/boost/boost/container/detail/value_init.hpp b/3party/boost/boost/container/detail/value_init.hpp index eb4c976d92..faba70ee14 100644 --- a/3party/boost/boost/container/detail/value_init.hpp +++ b/3party/boost/boost/container/detail/value_init.hpp @@ -37,6 +37,8 @@ struct value_init operator T &() { return m_t; } + T &get() { return m_t; } + T m_t; }; diff --git a/3party/boost/boost/container/detail/variadic_templates_tools.hpp b/3party/boost/boost/container/detail/variadic_templates_tools.hpp index ec8b8ceef0..e9fa9cd15a 100644 --- a/3party/boost/boost/container/detail/variadic_templates_tools.hpp +++ b/3party/boost/boost/container/detail/variadic_templates_tools.hpp @@ -21,6 +21,7 @@ #include #include +#include #include #include //std::size_t @@ -42,19 +43,19 @@ class tuple typedef tuple inherited; public: - tuple() { } + tuple() + : inherited(), m_head() + {} - // implicit copy-constructor is okay - // Construct tuple from separate arguments. - tuple(typename add_const_reference::type v, - typename add_const_reference::type... vtail) - : inherited(vtail...), m_head(v) + template + tuple(U &&u, Args && ...args) + : inherited(::boost::forward(args)...), m_head(::boost::forward(u)) {} // Construct tuple from another tuple. template tuple(const tuple& other) - : m_head(other.head()), inherited(other.tail()) + : inherited(other.tail()), m_head(other.head()) {} template @@ -77,8 +78,8 @@ class tuple template -tuple tie_forward(Values&&... values) -{ return tuple(values...); } +tuple forward_as_tuple(Values&&... values) +{ return tuple(::boost::forward(values)...); } template struct tuple_element; @@ -135,21 +136,25 @@ typename get_impl >::const_type get(const tuple& // in a function call. //////////////////////////////////////////////////// -template -struct index_tuple{}; +template struct index_tuple{ typedef index_tuple type; }; -template > -struct build_number_seq; +template struct concat_index_tuple; -template -struct build_number_seq > - : build_number_seq > +template +struct concat_index_tuple, index_tuple> + : index_tuple{}; + +template struct build_number_seq; + +template +struct build_number_seq + : concat_index_tuple::type + ,typename build_number_seq::type + >::type {}; -template -struct build_number_seq<0, index_tuple > -{ typedef index_tuple type; }; - +template<> struct build_number_seq<0> : index_tuple<>{}; +template<> struct build_number_seq<1> : index_tuple<0>{}; }}} //namespace boost { namespace container { namespace container_detail { diff --git a/3party/boost/boost/container/detail/workaround.hpp b/3party/boost/boost/container/detail/workaround.hpp index 026e65d6bb..816d3cc84d 100644 --- a/3party/boost/boost/container/detail/workaround.hpp +++ b/3party/boost/boost/container/detail/workaround.hpp @@ -19,8 +19,6 @@ # pragma once #endif -#include - #if !defined(BOOST_NO_CXX11_RVALUE_REFERENCES) && !defined(BOOST_NO_CXX11_VARIADIC_TEMPLATES)\ && !defined(BOOST_INTERPROCESS_DISABLE_VARIADIC_TMPL) #define BOOST_CONTAINER_PERFECT_FORWARDING @@ -31,12 +29,34 @@ #define BOOST_CONTAINER_UNIMPLEMENTED_PACK_EXPANSION_TO_FIXED_LIST #endif +#if defined(BOOST_GCC_VERSION) +# if (BOOST_GCC_VERSION < 40700) || !defined(BOOST_GCC_CXX11) +# define BOOST_CONTAINER_NO_CXX11_DELEGATING_CONSTRUCTORS +# endif +#elif defined(BOOST_MSVC) +# if _MSC_FULL_VER < 180020827 +# define BOOST_CONTAINER_NO_CXX11_DELEGATING_CONSTRUCTORS +# endif +#elif defined(BOOST_CLANG) +# if !__has_feature(cxx_delegating_constructors) +# define BOOST_CONTAINER_NO_CXX11_DELEGATING_CONSTRUCTORS +# endif +#endif + #if !defined(BOOST_FALLTHOUGH) #define BOOST_CONTAINER_FALLTHOUGH #else #define BOOST_CONTAINER_FALLTHOUGH BOOST_FALLTHOUGH; #endif +#if defined(BOOST_MSVC) && (_MSC_VER < 1400) + #define BOOST_CONTAINER_TEMPLATED_CONVERSION_OPERATOR_BROKEN +#endif + +#if !defined(BOOST_NO_CXX11_HDR_TUPLE) || (defined(BOOST_MSVC) && (BOOST_MSVC == 1700 || BOOST_MSVC == 1600)) +#define BOOST_CONTAINER_PAIR_TEST_HAS_HEADER_TUPLE +#endif + //Macros for documentation purposes. For code, expands to the argument #define BOOST_CONTAINER_IMPDEF(TYPE) TYPE #define BOOST_CONTAINER_SEEDOC(TYPE) TYPE @@ -59,6 +79,39 @@ #define BOOST_CONTAINER_DOCIGN(T) T #define BOOST_CONTAINER_DOCONLY(T) -#include +/* + we need to import/export our code only if the user has specifically + asked for it by defining either BOOST_ALL_DYN_LINK if they want all boost + libraries to be dynamically linked, or BOOST_CONTAINER_DYN_LINK + if they want just this one to be dynamically liked: +*/ +#if defined(BOOST_ALL_DYN_LINK) || defined(BOOST_CONTAINER_DYN_LINK) + + /* export if this is our own source, otherwise import: */ + #ifdef BOOST_CONTAINER_SOURCE + # define BOOST_CONTAINER_DECL BOOST_SYMBOL_EXPORT + #else + # define BOOST_CONTAINER_DECL BOOST_SYMBOL_IMPORT + + #endif /* BOOST_CONTAINER_SOURCE */ +#else + #define BOOST_CONTAINER_DECL +#endif /* DYN_LINK */ + +//#define BOOST_CONTAINER_DISABLE_FORCEINLINE + +#if defined(BOOST_CONTAINER_DISABLE_FORCEINLINE) + #define BOOST_CONTAINER_FORCEINLINE inline +#elif defined(BOOST_CONTAINER_FORCEINLINE_IS_BOOST_FORCELINE) + #define BOOST_CONTAINER_FORCEINLINE BOOST_FORCEINLINE +#elif defined(BOOST_MSVC) && defined(_DEBUG) + //"__forceinline" and MSVC seems to have some bugs in debug mode + #define BOOST_CONTAINER_FORCEINLINE inline +#elif defined(__GNUC__) && ((__GNUC__ < 4) || (__GNUC__ == 4 && (__GNUC_MINOR__ < 5))) + //Older GCCs have problems with forceinline + #define BOOST_CONTAINER_FORCEINLINE inline +#else + #define BOOST_CONTAINER_FORCEINLINE BOOST_FORCEINLINE +#endif #endif //#ifndef BOOST_CONTAINER_DETAIL_WORKAROUND_HPP diff --git a/3party/boost/boost/container/flat_map.hpp b/3party/boost/boost/container/flat_map.hpp index ef0e1cb252..b842101feb 100644 --- a/3party/boost/boost/container/flat_map.hpp +++ b/3party/boost/boost/container/flat_map.hpp @@ -53,14 +53,17 @@ namespace container { #ifndef BOOST_CONTAINER_DOXYGEN_INVOKED +template +class flat_multimap; + namespace container_detail{ template -static D &force(const S &s) +BOOST_CONTAINER_FORCEINLINE static D &force(const S &s) { return *const_cast((reinterpret_cast(&s))); } template -static D force_copy(S s) +BOOST_CONTAINER_FORCEINLINE static D force_copy(S s) { D *vp = reinterpret_cast(&s); return D(*vp); @@ -110,16 +113,16 @@ class flat_map private: BOOST_COPYABLE_AND_MOVABLE(flat_map) //This is the tree that we should store if pair was movable - typedef container_detail::flat_tree, - container_detail::select1st< std::pair >, + container_detail::select1st, Compare, Allocator> tree_t; //This is the real tree stored here. It's based on a movable pair - typedef container_detail::flat_tree, - container_detail::select1st >, + container_detail::select1st, Compare, typename allocator_traits::template portable_rebind_alloc >::type> impl_tree_t; @@ -131,7 +134,7 @@ class flat_map typedef typename impl_tree_t::allocator_type impl_allocator_type; typedef container_detail::flat_tree_value_compare < Compare - , container_detail::select1st< std::pair > + , container_detail::select1st , std::pair > value_compare_impl; typedef typename container_detail::get_flat_tree_iterators ::pointer>::iterator iterator_impl; @@ -143,6 +146,13 @@ class flat_map ::pointer>::const_reverse_iterator const_reverse_iterator_impl; public: typedef typename impl_tree_t::stored_allocator_type impl_stored_allocator_type; + + impl_tree_t &tree() + { return m_flat_tree; } + + const impl_tree_t &tree() const + { return m_flat_tree; } + private: #endif //#ifndef BOOST_CONTAINER_DOXYGEN_INVOKED @@ -183,10 +193,11 @@ class flat_map //! Effects: Default constructs an empty flat_map. //! //! Complexity: Constant. - flat_map() + flat_map() BOOST_NOEXCEPT_IF(container_detail::is_nothrow_default_constructible::value && + container_detail::is_nothrow_default_constructible::value) : m_flat_tree() { - //A type must be std::pair + //value_type must be std::pair BOOST_STATIC_ASSERT((container_detail::is_same, typename Allocator::value_type>::value)); } @@ -197,7 +208,7 @@ class flat_map explicit flat_map(const Compare& comp, const allocator_type& a = allocator_type()) : m_flat_tree(comp, container_detail::force(a)) { - //A type must be std::pair + //value_type must be std::pair BOOST_STATIC_ASSERT((container_detail::is_same, typename Allocator::value_type>::value)); } @@ -207,7 +218,7 @@ class flat_map explicit flat_map(const allocator_type& a) : m_flat_tree(container_detail::force(a)) { - //A type must be std::pair + //value_type must be std::pair BOOST_STATIC_ASSERT((container_detail::is_same, typename Allocator::value_type>::value)); } @@ -221,7 +232,7 @@ class flat_map const allocator_type& a = allocator_type()) : m_flat_tree(true, first, last, comp, container_detail::force(a)) { - //A type must be std::pair + //value_type must be std::pair BOOST_STATIC_ASSERT((container_detail::is_same, typename Allocator::value_type>::value)); } @@ -234,7 +245,7 @@ class flat_map flat_map(InputIterator first, InputIterator last, const allocator_type& a) : m_flat_tree(true, first, last, Compare(), container_detail::force(a)) { - //A type must be std::pair + //value_type must be std::pair BOOST_STATIC_ASSERT((container_detail::is_same, typename Allocator::value_type>::value)); } @@ -251,9 +262,9 @@ class flat_map template flat_map( ordered_unique_range_t, InputIterator first, InputIterator last , const Compare& comp = Compare(), const allocator_type& a = allocator_type()) - : m_flat_tree(ordered_range, first, last, comp, a) + : m_flat_tree(ordered_unique_range, first, last, comp, a) { - //A type must be std::pair + //value_type must be std::pair BOOST_STATIC_ASSERT((container_detail::is_same, typename Allocator::value_type>::value)); } @@ -267,7 +278,7 @@ class flat_map const allocator_type& a = allocator_type()) : m_flat_tree(true, il.begin(), il.end(), comp, container_detail::force(a)) { - //A type must be std::pair + //value_type must be std::pair BOOST_STATIC_ASSERT((container_detail::is_same, typename Allocator::value_type>::value)); } @@ -279,7 +290,7 @@ class flat_map flat_map(std::initializer_list il, const allocator_type& a) : m_flat_tree(true, il.begin(), il.end(), Compare(), container_detail::force(a)) { - //A type must be std::pair + //value_type must be std::pair BOOST_STATIC_ASSERT((container_detail::is_same, typename Allocator::value_type>::value)); } @@ -295,9 +306,9 @@ class flat_map //! Note: Non-standard extension. flat_map(ordered_unique_range_t, std::initializer_list il, const Compare& comp = Compare(), const allocator_type& a = allocator_type()) - : m_flat_tree(ordered_range, il.begin(), il.end(), comp, a) + : m_flat_tree(ordered_unique_range, il.begin(), il.end(), comp, a) { - //A type must be std::pair + //value_type must be std::pair BOOST_STATIC_ASSERT((container_detail::is_same, typename Allocator::value_type>::value)); } #endif @@ -308,7 +319,7 @@ class flat_map flat_map(const flat_map& x) : m_flat_tree(x.m_flat_tree) { - //A type must be std::pair + //value_type must be std::pair BOOST_STATIC_ASSERT((container_detail::is_same, typename Allocator::value_type>::value)); } @@ -319,9 +330,10 @@ class flat_map //! //! Postcondition: x is emptied. flat_map(BOOST_RV_REF(flat_map) x) + BOOST_NOEXCEPT_IF(boost::container::container_detail::is_nothrow_move_constructible::value) : m_flat_tree(boost::move(x.m_flat_tree)) { - //A type must be std::pair + //value_type must be std::pair BOOST_STATIC_ASSERT((container_detail::is_same, typename Allocator::value_type>::value)); } @@ -331,7 +343,7 @@ class flat_map flat_map(const flat_map& x, const allocator_type &a) : m_flat_tree(x.m_flat_tree, a) { - //A type must be std::pair + //value_type must be std::pair BOOST_STATIC_ASSERT((container_detail::is_same, typename Allocator::value_type>::value)); } @@ -342,7 +354,7 @@ class flat_map flat_map(BOOST_RV_REF(flat_map) x, const allocator_type &a) : m_flat_tree(boost::move(x.m_flat_tree), a) { - //A type must be std::pair + //value_type must be std::pair BOOST_STATIC_ASSERT((container_detail::is_same, typename Allocator::value_type>::value)); } @@ -362,8 +374,9 @@ class flat_map //! propagate_on_container_move_assignment is true or //! this->get>allocator() == x.get_allocator(). Linear otherwise. flat_map& operator=(BOOST_RV_REF(flat_map) x) - BOOST_NOEXCEPT_IF( allocator_traits_type::is_always_equal::value - && boost::container::container_detail::is_nothrow_move_assignable::value ) + BOOST_NOEXCEPT_IF( (allocator_traits_type::propagate_on_container_move_assignment::value || + allocator_traits_type::is_always_equal::value) && + boost::container::container_detail::is_nothrow_move_assignable::value) { m_flat_tree = boost::move(x.m_flat_tree); return *this; } #if !defined(BOOST_NO_CXX11_HDR_INITIALIZER_LIST) @@ -593,11 +606,104 @@ class flat_map //! //! Complexity: Logarithmic. mapped_type &operator[](key_type &&k) ; - + #elif defined(BOOST_MOVE_HELPERS_RETURN_SFINAE_BROKEN) + //in compilers like GCC 3.4, we can't catch temporaries + mapped_type& operator[](const key_type &k) { return this->priv_subscript(k); } + mapped_type& operator[](BOOST_RV_REF(key_type) k) { return this->priv_subscript(::boost::move(k)); } #else - BOOST_MOVE_CONVERSION_AWARE_CATCH( operator[] , key_type, mapped_type&, this->priv_subscript) + BOOST_MOVE_CONVERSION_AWARE_CATCH( operator[] , key_type, mapped_type&, this->priv_subscript) #endif + //! Effects: If a key equivalent to k already exists in the container, assigns forward(obj) + //! to the mapped_type corresponding to the key k. If the key does not exist, inserts the new value + //! as if by insert, constructing it from value_type(k, forward(obj)). + //! + //! No iterators or references are invalidated. If the insertion is successful, pointers and references + //! to the element obtained while it is held in the node handle are invalidated, and pointers and + //! references obtained to that element before it was extracted become valid. + //! + //! Returns: The bool component is true if the insertion took place and false if the assignment + //! took place. The iterator component is pointing at the element that was inserted or updated. + //! + //! Complexity: Logarithmic in the size of the container. + template + BOOST_CONTAINER_FORCEINLINE std::pair insert_or_assign(const key_type& k, BOOST_FWD_REF(M) obj) + { + return container_detail::force_copy< std::pair > + (this->m_flat_tree.insert_or_assign + ( impl_const_iterator(), k, ::boost::forward(obj)) + ); + } + + //! Effects: If a key equivalent to k already exists in the container, assigns forward(obj) + //! to the mapped_type corresponding to the key k. If the key does not exist, inserts the new value + //! as if by insert, constructing it from value_type(k, move(obj)). + //! + //! No iterators or references are invalidated. If the insertion is successful, pointers and references + //! to the element obtained while it is held in the node handle are invalidated, and pointers and + //! references obtained to that element before it was extracted become valid. + //! + //! Returns: The bool component is true if the insertion took place and false if the assignment + //! took place. The iterator component is pointing at the element that was inserted or updated. + //! + //! Complexity: Logarithmic in the size of the container. + template + BOOST_CONTAINER_FORCEINLINE std::pair insert_or_assign(BOOST_RV_REF(key_type) k, BOOST_FWD_REF(M) obj) + { + return container_detail::force_copy< std::pair > + (this->m_flat_tree.insert_or_assign + ( impl_const_iterator(), ::boost::move(k), ::boost::forward(obj)) + ); + } + + //! Effects: If a key equivalent to k already exists in the container, assigns forward(obj) + //! to the mapped_type corresponding to the key k. If the key does not exist, inserts the new value + //! as if by insert, constructing it from value_type(k, forward(obj)) and the new element + //! to the container as close as possible to the position just before hint. + //! + //! No iterators or references are invalidated. If the insertion is successful, pointers and references + //! to the element obtained while it is held in the node handle are invalidated, and pointers and + //! references obtained to that element before it was extracted become valid. + //! + //! Returns: The bool component is true if the insertion took place and false if the assignment + //! took place. The iterator component is pointing at the element that was inserted or updated. + //! + //! Complexity: Logarithmic in the size of the container in general, but amortized constant if + //! the new element is inserted just before hint. + template + BOOST_CONTAINER_FORCEINLINE iterator insert_or_assign(const_iterator hint, const key_type& k, BOOST_FWD_REF(M) obj) + { + return container_detail::force_copy< std::pair > + (this->m_flat_tree.insert_or_assign + ( container_detail::force_copy(hint) + , k, ::boost::forward(obj)) + ); + } + + //! Effects: If a key equivalent to k already exists in the container, assigns forward(obj) + //! to the mapped_type corresponding to the key k. If the key does not exist, inserts the new value + //! as if by insert, constructing it from value_type(k, move(obj)) and the new element + //! to the container as close as possible to the position just before hint. + //! + //! No iterators or references are invalidated. If the insertion is successful, pointers and references + //! to the element obtained while it is held in the node handle are invalidated, and pointers and + //! references obtained to that element before it was extracted become valid. + //! + //! Returns: The bool component is true if the insertion took place and false if the assignment + //! took place. The iterator component is pointing at the element that was inserted or updated. + //! + //! Complexity: Logarithmic in the size of the container in general, but amortized constant if + //! the new element is inserted just before hint. + template + BOOST_CONTAINER_FORCEINLINE iterator insert_or_assign(const_iterator hint, BOOST_RV_REF(key_type) k, BOOST_FWD_REF(M) obj) + { + return container_detail::force_copy< std::pair > + (this->m_flat_tree.insert_or_assign + ( container_detail::force_copy(hint) + , ::boost::move(k), ::boost::forward(obj)) + ); + } + //! @copydoc ::boost::container::flat_set::nth(size_type) iterator nth(size_type n) BOOST_NOEXCEPT_OR_NOTHROW { return container_detail::force_copy(m_flat_tree.nth(n)); } @@ -686,6 +792,79 @@ class flat_map , boost::forward(args)...)); } + //! Requires: value_type shall be EmplaceConstructible into map from piecewise_construct, + //! forward_as_tuple(k), forward_as_tuple(forward(args)...). + //! + //! Effects: If the map already contains an element whose key is equivalent to k, there is no effect. Otherwise + //! inserts an object of type value_type constructed with piecewise_construct, forward_as_tuple(k), + //! forward_as_tuple(forward(args)...). + //! + //! Returns: The bool component of the returned pair is true if and only if the + //! insertion took place. The returned iterator points to the map element whose key is equivalent to k. + //! + //! Complexity: Logarithmic. + template + BOOST_CONTAINER_FORCEINLINE std::pair try_emplace(const key_type& k, BOOST_FWD_REF(Args)... args) + { + return container_detail::force_copy< std::pair >( + m_flat_tree.try_emplace(impl_const_iterator(), k, boost::forward(args)...)); + } + + //! Requires: value_type shall be EmplaceConstructible into map from piecewise_construct, + //! forward_as_tuple(k), forward_as_tuple(forward(args)...). + //! + //! Effects: If the map already contains an element whose key is equivalent to k, there is no effect. Otherwise + //! inserts an object of type value_type constructed with piecewise_construct, forward_as_tuple(k), + //! forward_as_tuple(forward(args)...). + //! + //! Returns: The returned iterator points to the map element whose key is equivalent to k. + //! + //! Complexity: Logarithmic in general, but amortized constant if value + //! is inserted right before p. + template + BOOST_CONTAINER_FORCEINLINE iterator try_emplace(const_iterator hint, const key_type &k, BOOST_FWD_REF(Args)... args) + { + return container_detail::force_copy(m_flat_tree.try_emplace + (container_detail::force_copy(hint), k, boost::forward(args)...).first); + } + + //! Requires: value_type shall be EmplaceConstructible into map from piecewise_construct, + //! forward_as_tuple(move(k)), forward_as_tuple(forward(args)...). + //! + //! Effects: If the map already contains an element whose key is equivalent to k, there is no effect. Otherwise + //! inserts an object of type value_type constructed with piecewise_construct, forward_as_tuple(move(k)), + //! forward_as_tuple(forward(args)...). + //! + //! Returns: The bool component of the returned pair is true if and only if the + //! insertion took place. The returned iterator points to the map element whose key is equivalent to k. + //! + //! Complexity: Logarithmic. + template + BOOST_CONTAINER_FORCEINLINE std::pair try_emplace(BOOST_RV_REF(key_type) k, BOOST_FWD_REF(Args)... args) + { + return container_detail::force_copy< std::pair > + (m_flat_tree.try_emplace(impl_const_iterator(), boost::move(k), boost::forward(args)...)); + } + + //! Requires: value_type shall be EmplaceConstructible into map from piecewise_construct, + //! forward_as_tuple(move(k)), forward_as_tuple(forward(args)...). + //! + //! Effects: If the map already contains an element whose key is equivalent to k, there is no effect. Otherwise + //! inserts an object of type value_type constructed with piecewise_construct, forward_as_tuple(move(k)), + //! forward_as_tuple(forward(args)...). + //! + //! Returns: The returned iterator points to the map element whose key is equivalent to k. + //! + //! Complexity: Logarithmic in general, but amortized constant if value + //! is inserted right before p. + template + BOOST_CONTAINER_FORCEINLINE iterator try_emplace(const_iterator hint, BOOST_RV_REF(key_type) k, BOOST_FWD_REF(Args)... args) + { + return container_detail::force_copy + (m_flat_tree.try_emplace(container_detail::force_copy + (hint), boost::move(k), boost::forward(args)...).first); + } + #else // !defined(BOOST_NO_CXX11_VARIADIC_TEMPLATES) #define BOOST_CONTAINER_FLAT_MAP_EMPLACE_CODE(N) \ @@ -702,6 +881,29 @@ class flat_map return container_detail::force_copy(m_flat_tree.emplace_hint_unique\ (container_detail::force_copy(hint) BOOST_MOVE_I##N BOOST_MOVE_FWD##N));\ }\ + BOOST_MOVE_TMPL_LT##N BOOST_MOVE_CLASS##N BOOST_MOVE_GT##N \ + BOOST_CONTAINER_FORCEINLINE std::pair try_emplace(const key_type& k BOOST_MOVE_I##N BOOST_MOVE_UREF##N)\ + {\ + return container_detail::force_copy< std::pair >\ + (m_flat_tree.try_emplace(impl_const_iterator(), k BOOST_MOVE_I##N BOOST_MOVE_FWD##N));\ + }\ + \ + BOOST_MOVE_TMPL_LT##N BOOST_MOVE_CLASS##N BOOST_MOVE_GT##N \ + BOOST_CONTAINER_FORCEINLINE iterator try_emplace(const_iterator hint, const key_type &k BOOST_MOVE_I##N BOOST_MOVE_UREF##N)\ + { return container_detail::force_copy(m_flat_tree.try_emplace\ + (container_detail::force_copy(hint), k BOOST_MOVE_I##N BOOST_MOVE_FWD##N).first); }\ + \ + BOOST_MOVE_TMPL_LT##N BOOST_MOVE_CLASS##N BOOST_MOVE_GT##N \ + BOOST_CONTAINER_FORCEINLINE std::pair try_emplace(BOOST_RV_REF(key_type) k BOOST_MOVE_I##N BOOST_MOVE_UREF##N)\ + {\ + return container_detail::force_copy< std::pair >\ + (m_flat_tree.try_emplace(impl_const_iterator(), boost::move(k) BOOST_MOVE_I##N BOOST_MOVE_FWD##N));\ + }\ + \ + BOOST_MOVE_TMPL_LT##N BOOST_MOVE_CLASS##N BOOST_MOVE_GT##N \ + BOOST_CONTAINER_FORCEINLINE iterator try_emplace(const_iterator hint, BOOST_RV_REF(key_type) k BOOST_MOVE_I##N BOOST_MOVE_UREF##N)\ + { return container_detail::force_copy(m_flat_tree.try_emplace\ + (container_detail::force_copy(hint), boost::move(k) BOOST_MOVE_I##N BOOST_MOVE_FWD##N).first); }\ // BOOST_MOVE_ITERATE_0TO9(BOOST_CONTAINER_FLAT_MAP_EMPLACE_CODE) #undef BOOST_CONTAINER_FLAT_MAP_EMPLACE_CODE @@ -864,6 +1066,39 @@ class flat_map { m_flat_tree.insert_unique(ordered_unique_range, il.begin(), il.end()); } #endif + //! Requires: this->get_allocator() == source.get_allocator(). + //! + //! Effects: Attempts to extract each element in source and insert it into a using + //! the comparison object of *this. If there is an element in a with key equivalent to the + //! key of an element from source, then that element is not extracted from source. + //! + //! Postcondition: Pointers and references to the transferred elements of source refer + //! to those same elements but as members of *this. Iterators referring to the transferred + //! elements will continue to refer to their elements, but they now behave as iterators into *this, + //! not into source. + //! + //! Throws: Nothing unless the comparison object throws. + //! + //! Complexity: N log(a.size() + N) (N has the value source.size()) + template + BOOST_CONTAINER_FORCEINLINE void merge(flat_map& source) + { m_flat_tree.merge_unique(source.tree()); } + + //! @copydoc ::boost::container::flat_map::merge(flat_map&) + template + BOOST_CONTAINER_FORCEINLINE void merge(BOOST_RV_REF_BEG flat_map BOOST_RV_REF_END source) + { return this->merge(static_cast&>(source)); } + + //! @copydoc ::boost::container::flat_map::merge(flat_map&) + template + BOOST_CONTAINER_FORCEINLINE void merge(flat_multimap& source) + { m_flat_tree.merge_unique(source.tree()); } + + //! @copydoc ::boost::container::flat_map::merge(flat_map&) + template + BOOST_CONTAINER_FORCEINLINE void merge(BOOST_RV_REF_BEG flat_multimap BOOST_RV_REF_END source) + { return this->merge(static_cast&>(source)); } + //! Effects: Erases the element pointed to by p. //! //! Returns: Returns an iterator pointing to the element immediately @@ -958,7 +1193,7 @@ class flat_map //! Returns: A const_iterator pointing to an element with the key //! equivalent to x, or end() if such an element is not found. //! - //! Complexity: Logarithmic.s + //! Complexity: Logarithmic. const_iterator find(const key_type& x) const { return container_detail::force_copy(m_flat_tree.find(x)); } @@ -971,40 +1206,40 @@ class flat_map //! Returns: An iterator pointing to the first element with key not less //! than k, or a.end() if such an element is not found. //! - //! Complexity: Logarithmic + //! Complexity: Logarithmic. iterator lower_bound(const key_type& x) { return container_detail::force_copy(m_flat_tree.lower_bound(x)); } //! Returns: A const iterator pointing to the first element with key not //! less than k, or a.end() if such an element is not found. //! - //! Complexity: Logarithmic + //! Complexity: Logarithmic. const_iterator lower_bound(const key_type& x) const { return container_detail::force_copy(m_flat_tree.lower_bound(x)); } //! Returns: An iterator pointing to the first element with key not less //! than x, or end() if such an element is not found. //! - //! Complexity: Logarithmic + //! Complexity: Logarithmic. iterator upper_bound(const key_type& x) { return container_detail::force_copy(m_flat_tree.upper_bound(x)); } //! Returns: A const iterator pointing to the first element with key not //! less than x, or end() if such an element is not found. //! - //! Complexity: Logarithmic + //! Complexity: Logarithmic. const_iterator upper_bound(const key_type& x) const { return container_detail::force_copy(m_flat_tree.upper_bound(x)); } //! Effects: Equivalent to std::make_pair(this->lower_bound(k), this->upper_bound(k)). //! - //! Complexity: Logarithmic + //! Complexity: Logarithmic. std::pair equal_range(const key_type& x) { return container_detail::force_copy >(m_flat_tree.lower_bound_range(x)); } //! Effects: Equivalent to std::make_pair(this->lower_bound(k), this->upper_bound(k)). //! - //! Complexity: Logarithmic + //! Complexity: Logarithmic. std::pair equal_range(const key_type& x) const { return container_detail::force_copy >(m_flat_tree.lower_bound_range(x)); } @@ -1134,15 +1369,15 @@ class flat_multimap #ifndef BOOST_CONTAINER_DOXYGEN_INVOKED private: BOOST_COPYABLE_AND_MOVABLE(flat_multimap) - typedef container_detail::flat_tree, - container_detail::select1st< std::pair >, + container_detail::select1st, Compare, Allocator> tree_t; //This is the real tree stored here. It's based on a movable pair - typedef container_detail::flat_tree, - container_detail::select1st >, + container_detail::select1st, Compare, typename allocator_traits::template portable_rebind_alloc >::type> impl_tree_t; @@ -1154,7 +1389,7 @@ class flat_multimap typedef typename impl_tree_t::allocator_type impl_allocator_type; typedef container_detail::flat_tree_value_compare < Compare - , container_detail::select1st< std::pair > + , container_detail::select1st , std::pair > value_compare_impl; typedef typename container_detail::get_flat_tree_iterators ::pointer>::iterator iterator_impl; @@ -1166,6 +1401,13 @@ class flat_multimap ::pointer>::const_reverse_iterator const_reverse_iterator_impl; public: typedef typename impl_tree_t::stored_allocator_type impl_stored_allocator_type; + + impl_tree_t &tree() + { return m_flat_tree; } + + const impl_tree_t &tree() const + { return m_flat_tree; } + private: #endif //#ifndef BOOST_CONTAINER_DOXYGEN_INVOKED @@ -1205,10 +1447,11 @@ class flat_multimap //! Effects: Default constructs an empty flat_map. //! //! Complexity: Constant. - flat_multimap() + flat_multimap() BOOST_NOEXCEPT_IF(container_detail::is_nothrow_default_constructible::value && + container_detail::is_nothrow_default_constructible::value) : m_flat_tree() { - //A type must be std::pair + //value_type must be std::pair BOOST_STATIC_ASSERT((container_detail::is_same, typename Allocator::value_type>::value)); } @@ -1220,7 +1463,7 @@ class flat_multimap const allocator_type& a = allocator_type()) : m_flat_tree(comp, container_detail::force(a)) { - //A type must be std::pair + //value_type must be std::pair BOOST_STATIC_ASSERT((container_detail::is_same, typename Allocator::value_type>::value)); } @@ -1230,7 +1473,7 @@ class flat_multimap explicit flat_multimap(const allocator_type& a) : m_flat_tree(container_detail::force(a)) { - //A type must be std::pair + //value_type must be std::pair BOOST_STATIC_ASSERT((container_detail::is_same, typename Allocator::value_type>::value)); } @@ -1245,7 +1488,7 @@ class flat_multimap const allocator_type& a = allocator_type()) : m_flat_tree(false, first, last, comp, container_detail::force(a)) { - //A type must be std::pair + //value_type must be std::pair BOOST_STATIC_ASSERT((container_detail::is_same, typename Allocator::value_type>::value)); } @@ -1258,7 +1501,7 @@ class flat_multimap flat_multimap(InputIterator first, InputIterator last, const allocator_type& a) : m_flat_tree(false, first, last, Compare(), container_detail::force(a)) { - //A type must be std::pair + //value_type must be std::pair BOOST_STATIC_ASSERT((container_detail::is_same, typename Allocator::value_type>::value)); } @@ -1277,7 +1520,7 @@ class flat_multimap const allocator_type& a = allocator_type()) : m_flat_tree(ordered_range, first, last, comp, a) { - //A type must be std::pair + //value_type must be std::pair BOOST_STATIC_ASSERT((container_detail::is_same, typename Allocator::value_type>::value)); } @@ -1290,7 +1533,7 @@ class flat_multimap flat_multimap(std::initializer_list il, const Compare& comp = Compare(), const allocator_type& a = allocator_type()) : m_flat_tree(false, il.begin(), il.end(), comp, container_detail::force(a)) { - //A type must be std::pair + //value_type must be std::pair BOOST_STATIC_ASSERT((container_detail::is_same, typename Allocator::value_type>::value)); } @@ -1302,7 +1545,7 @@ class flat_multimap flat_multimap(std::initializer_list il, const allocator_type& a) : m_flat_tree(false, il.begin(), il.end(), Compare(), container_detail::force(a)) { - //A type must be std::pair + //value_type must be std::pair BOOST_STATIC_ASSERT((container_detail::is_same, typename Allocator::value_type>::value)); } @@ -1319,7 +1562,7 @@ class flat_multimap const allocator_type& a = allocator_type()) : m_flat_tree(ordered_range, il.begin(), il.end(), comp, a) { - //A type must be std::pair + //value_type must be std::pair BOOST_STATIC_ASSERT((container_detail::is_same, typename Allocator::value_type>::value)); } #endif @@ -1330,7 +1573,7 @@ class flat_multimap flat_multimap(const flat_multimap& x) : m_flat_tree(x.m_flat_tree) { - //A type must be std::pair + //value_type must be std::pair BOOST_STATIC_ASSERT((container_detail::is_same, typename Allocator::value_type>::value)); } @@ -1340,9 +1583,10 @@ class flat_multimap //! //! Postcondition: x is emptied. flat_multimap(BOOST_RV_REF(flat_multimap) x) + BOOST_NOEXCEPT_IF(boost::container::container_detail::is_nothrow_move_constructible::value) : m_flat_tree(boost::move(x.m_flat_tree)) { - //A type must be std::pair + //value_type must be std::pair BOOST_STATIC_ASSERT((container_detail::is_same, typename Allocator::value_type>::value)); } @@ -1352,7 +1596,7 @@ class flat_multimap flat_multimap(const flat_multimap& x, const allocator_type &a) : m_flat_tree(x.m_flat_tree, a) { - //A type must be std::pair + //value_type must be std::pair BOOST_STATIC_ASSERT((container_detail::is_same, typename Allocator::value_type>::value)); } @@ -1363,7 +1607,7 @@ class flat_multimap flat_multimap(BOOST_RV_REF(flat_multimap) x, const allocator_type &a) : m_flat_tree(boost::move(x.m_flat_tree), a) { - //A type must be std::pair + //value_type must be std::pair BOOST_STATIC_ASSERT((container_detail::is_same, typename Allocator::value_type>::value)); } @@ -1377,8 +1621,9 @@ class flat_multimap //! //! Complexity: Constant. flat_multimap& operator=(BOOST_RV_REF(flat_multimap) x) - BOOST_NOEXCEPT_IF( allocator_traits_type::is_always_equal::value - && boost::container::container_detail::is_nothrow_move_assignable::value ) + BOOST_NOEXCEPT_IF( (allocator_traits_type::propagate_on_container_move_assignment::value || + allocator_traits_type::is_always_equal::value) && + boost::container::container_detail::is_nothrow_move_assignable::value) { m_flat_tree = boost::move(x.m_flat_tree); return *this; } #if !defined(BOOST_NO_CXX11_HDR_INITIALIZER_LIST) @@ -1798,6 +2043,38 @@ class flat_multimap { m_flat_tree.insert_equal(ordered_range, il.begin(), il.end()); } #endif + //! Requires: this->get_allocator() == source.get_allocator(). + //! + //! Effects: Extracts each element in source and insert it into a using + //! the comparison object of *this. + //! + //! Postcondition: Pointers and references to the transferred elements of source refer + //! to those same elements but as members of *this. Iterators referring to the transferred + //! elements will continue to refer to their elements, but they now behave as iterators into *this, + //! not into source. + //! + //! Throws: Nothing unless the comparison object throws. + //! + //! Complexity: N log(a.size() + N) (N has the value source.size()) + template + void merge(flat_multimap& source) + { m_flat_tree.merge_equal(source.tree()); } + + //! @copydoc ::boost::container::flat_multimap::merge(flat_multimap&) + template + void merge(BOOST_RV_REF_BEG flat_multimap BOOST_RV_REF_END source) + { return this->merge(static_cast&>(source)); } + + //! @copydoc ::boost::container::flat_multimap::merge(flat_multimap&) + template + void merge(flat_map& source) + { m_flat_tree.merge_equal(source.tree()); } + + //! @copydoc ::boost::container::flat_multimap::merge(flat_multimap&) + template + void merge(BOOST_RV_REF_BEG flat_map BOOST_RV_REF_END source) + { return this->merge(static_cast&>(source)); } + //! Effects: Erases the element pointed to by p. //! //! Returns: Returns an iterator pointing to the element immediately diff --git a/3party/boost/boost/container/flat_set.hpp b/3party/boost/boost/container/flat_set.hpp index 8f592798d2..fa27006177 100644 --- a/3party/boost/boost/container/flat_set.hpp +++ b/3party/boost/boost/container/flat_set.hpp @@ -47,6 +47,11 @@ namespace boost { namespace container { +#if !defined(BOOST_CONTAINER_DOXYGEN_INVOKED) +template +class flat_multimap; +#endif + //! flat_set is a Sorted Associative Container that stores objects of type Key. //! It is also a Unique Associative Container, meaning that no two elements are the same. //! @@ -69,13 +74,21 @@ template #endif class flat_set ///@cond - : public container_detail::flat_tree, Compare, Allocator> + : public container_detail::flat_tree, Compare, Allocator> ///@endcond { #ifndef BOOST_CONTAINER_DOXYGEN_INVOKED private: BOOST_COPYABLE_AND_MOVABLE(flat_set) - typedef container_detail::flat_tree, Compare, Allocator> base_t; + typedef container_detail::flat_tree, Compare, Allocator> base_t; + + public: + base_t &tree() + { return *this; } + + const base_t &tree() const + { return *this; } + #endif //#ifndef BOOST_CONTAINER_DOXYGEN_INVOKED public: @@ -112,7 +125,8 @@ class flat_set //! Effects: Default constructs an empty container. //! //! Complexity: Constant. - explicit flat_set() + explicit flat_set() BOOST_NOEXCEPT_IF(container_detail::is_nothrow_default_constructible::value && + container_detail::is_nothrow_default_constructible::value) : base_t() {} @@ -168,7 +182,7 @@ class flat_set flat_set(ordered_unique_range_t, InputIterator first, InputIterator last, const Compare& comp = Compare(), const allocator_type& a = allocator_type()) - : base_t(ordered_range, first, last, comp, a) + : base_t(ordered_unique_range, first, last, comp, a) {} #if !defined(BOOST_NO_CXX11_HDR_INITIALIZER_LIST) @@ -203,7 +217,7 @@ class flat_set //! Note: Non-standard extension. flat_set(ordered_unique_range_t, std::initializer_list il, const Compare& comp = Compare(), const allocator_type& a = allocator_type()) - : base_t(ordered_range, il.begin(), il.end(), comp, a) + : base_t(ordered_unique_range, il.begin(), il.end(), comp, a) {} #endif @@ -220,6 +234,7 @@ class flat_set //! //! Postcondition: x is emptied. flat_set(BOOST_RV_REF(flat_set) x) + BOOST_NOEXCEPT_IF(boost::container::container_detail::is_nothrow_move_constructible::value) : base_t(BOOST_MOVE_BASE(base_t, x)) {} @@ -251,8 +266,9 @@ class flat_set //! propagate_on_container_move_assignment is true or //! this->get>allocator() == x.get_allocator(). Linear otherwise. flat_set& operator=(BOOST_RV_REF(flat_set) x) - BOOST_NOEXCEPT_IF( allocator_traits_type::is_always_equal::value - && boost::container::container_detail::is_nothrow_move_assignable::value ) + BOOST_NOEXCEPT_IF( (allocator_traits_type::propagate_on_container_move_assignment::value || + allocator_traits_type::is_always_equal::value) && + boost::container::container_detail::is_nothrow_move_assignable::value) { return static_cast(this->base_t::operator=(BOOST_MOVE_BASE(base_t, x))); } #if !defined(BOOST_NO_CXX11_HDR_INITIALIZER_LIST) @@ -602,6 +618,26 @@ class flat_set { this->base_t::insert_unique(ordered_unique_range, il.begin(), il.end()); } #endif + //! @copydoc ::boost::container::flat_map::merge(flat_map&) + template + BOOST_CONTAINER_FORCEINLINE void merge(flat_set& source) + { this->base_t::merge_unique(source.tree()); } + + //! @copydoc ::boost::container::flat_map::merge(flat_set&) + template + BOOST_CONTAINER_FORCEINLINE void merge(BOOST_RV_REF_BEG flat_set BOOST_RV_REF_END source) + { return this->merge(static_cast&>(source)); } + + //! @copydoc ::boost::container::flat_map::merge(flat_multimap&) + template + BOOST_CONTAINER_FORCEINLINE void merge(flat_multiset& source) + { this->base_t::merge_unique(source.tree()); } + + //! @copydoc ::boost::container::flat_map::merge(flat_multiset&) + template + BOOST_CONTAINER_FORCEINLINE void merge(BOOST_RV_REF_BEG flat_multiset BOOST_RV_REF_END source) + { return this->merge(static_cast&>(source)); } + #if defined(BOOST_CONTAINER_DOXYGEN_INVOKED) //! Effects: Erases the element pointed to by p. @@ -700,11 +736,10 @@ class flat_set //! Note: Non-standard extension const_iterator nth(size_type n) const BOOST_NOEXCEPT_OR_NOTHROW; - //! Requires: size() >= n. + //! Requires: begin() <= p <= end(). //! - //! Effects: Returns an iterator to the nth element - //! from the beginning of the container. Returns end() - //! if n == size(). + //! Effects: Returns the index of the element pointed by p + //! and size() if p == end(). //! //! Throws: Nothing. //! @@ -865,13 +900,20 @@ template #endif class flat_multiset ///@cond - : public container_detail::flat_tree, Compare, Allocator> + : public container_detail::flat_tree, Compare, Allocator> ///@endcond { #ifndef BOOST_CONTAINER_DOXYGEN_INVOKED private: BOOST_COPYABLE_AND_MOVABLE(flat_multiset) - typedef container_detail::flat_tree, Compare, Allocator> base_t; + typedef container_detail::flat_tree, Compare, Allocator> base_t; + + public: + base_t &tree() + { return *this; } + + const base_t &tree() const + { return *this; } #endif //#ifndef BOOST_CONTAINER_DOXYGEN_INVOKED public: @@ -899,7 +941,8 @@ class flat_multiset typedef typename BOOST_CONTAINER_IMPDEF(base_t::const_reverse_iterator) const_reverse_iterator; //! @copydoc ::boost::container::flat_set::flat_set() - explicit flat_multiset() + explicit flat_multiset() BOOST_NOEXCEPT_IF(container_detail::is_nothrow_default_constructible::value && + container_detail::is_nothrow_default_constructible::value) : base_t() {} @@ -956,8 +999,16 @@ class flat_multiset : base_t(false, il.begin(), il.end(), Compare(), a) {} - //! @copydoc ::boost::container::flat_set::flat_set(ordered_unique_range_t, std::initializer_list, const Compare& comp, const allocator_type&) - flat_multiset(ordered_unique_range_t, std::initializer_list il, + //! Effects: Constructs an empty container using the specified comparison object and + //! allocator, and inserts elements from the ordered unique range [il.begin(), il.end()). This function + //! is more efficient than the normal range creation for ordered ranges. + //! + //! Requires: [il.begin(), il.end()) must be ordered according to the predicate. + //! + //! Complexity: Linear in N. + //! + //! Note: Non-standard extension. + flat_multiset(ordered_range_t, std::initializer_list il, const Compare& comp = Compare(), const allocator_type& a = allocator_type()) : base_t(ordered_range, il.begin(), il.end(), comp, a) {} @@ -968,17 +1019,18 @@ class flat_multiset : base_t(static_cast(x)) {} - //! @copydoc ::boost::container::flat_set(flat_set &&) + //! @copydoc ::boost::container::flat_set::flat_set(flat_set &&) flat_multiset(BOOST_RV_REF(flat_multiset) x) + BOOST_NOEXCEPT_IF(boost::container::container_detail::is_nothrow_move_constructible::value) : base_t(boost::move(static_cast(x))) {} - //! @copydoc ::boost::container::flat_set(const flat_set &, const allocator_type &) + //! @copydoc ::boost::container::flat_set::flat_set(const flat_set &, const allocator_type &) flat_multiset(const flat_multiset& x, const allocator_type &a) : base_t(static_cast(x), a) {} - //! @copydoc ::boost::container::flat_set(flat_set &&, const allocator_type &) + //! @copydoc ::boost::container::flat_set::flat_set(flat_set &&, const allocator_type &) flat_multiset(BOOST_RV_REF(flat_multiset) x, const allocator_type &a) : base_t(BOOST_MOVE_BASE(base_t, x), a) {} @@ -989,8 +1041,9 @@ class flat_multiset //! @copydoc ::boost::container::flat_set::operator=(flat_set &&) flat_multiset& operator=(BOOST_RV_REF(flat_multiset) x) - BOOST_NOEXCEPT_IF( allocator_traits_type::is_always_equal::value - && boost::container::container_detail::is_nothrow_move_assignable::value ) + BOOST_NOEXCEPT_IF( (allocator_traits_type::propagate_on_container_move_assignment::value || + allocator_traits_type::is_always_equal::value) && + boost::container::container_detail::is_nothrow_move_assignable::value) { return static_cast(this->base_t::operator=(BOOST_MOVE_BASE(base_t, x))); } #if !defined(BOOST_NO_CXX11_HDR_INITIALIZER_LIST) @@ -1220,6 +1273,26 @@ class flat_multiset { this->base_t::insert_equal(ordered_range, il.begin(), il.end()); } #endif + //! @copydoc ::boost::container::flat_multimap::merge(flat_multimap&) + template + BOOST_CONTAINER_FORCEINLINE void merge(flat_multiset& source) + { this->base_t::merge_equal(source.tree()); } + + //! @copydoc ::boost::container::flat_multiset::merge(flat_multiset&) + template + BOOST_CONTAINER_FORCEINLINE void merge(BOOST_RV_REF_BEG flat_multiset BOOST_RV_REF_END source) + { return this->merge(static_cast&>(source)); } + + //! @copydoc ::boost::container::flat_multimap::merge(flat_map&) + template + BOOST_CONTAINER_FORCEINLINE void merge(flat_set& source) + { this->base_t::merge_equal(source.tree()); } + + //! @copydoc ::boost::container::flat_multiset::merge(flat_set&) + template + BOOST_CONTAINER_FORCEINLINE void merge(BOOST_RV_REF_BEG flat_set BOOST_RV_REF_END source) + { return this->merge(static_cast&>(source)); } + #if defined(BOOST_CONTAINER_DOXYGEN_INVOKED) //! @copydoc ::boost::container::flat_set::erase(const_iterator) diff --git a/3party/boost/boost/container/list.hpp b/3party/boost/boost/container/list.hpp index 5135eaecee..f779cc4553 100644 --- a/3party/boost/boost/container/list.hpp +++ b/3party/boost/boost/container/list.hpp @@ -1,6 +1,6 @@ ////////////////////////////////////////////////////////////////////////////// // -// (C) Copyright Ion Gaztanaga 2005-2013. Distributed under the Boost +// (C) Copyright Ion Gaztanaga 2005-2015. 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) // @@ -188,7 +188,7 @@ class list //! Throws: If allocator_type's default constructor throws. //! //! Complexity: Constant. - list() + list() BOOST_NOEXCEPT_IF(container_detail::is_nothrow_default_constructible::value) : AllocHolder() {} @@ -250,7 +250,7 @@ class list //! Throws: If allocator_type's copy constructor throws. //! //! Complexity: Constant. - list(BOOST_RV_REF(list) x) + list(BOOST_RV_REF(list) x) BOOST_NOEXCEPT_OR_NOTHROW : AllocHolder(BOOST_MOVE_BASE(AllocHolder, x)) {} @@ -408,7 +408,7 @@ class list return this->assign(cvalue_iterator(val, n), cvalue_iterator()); } - //! Effects: Assigns the the range [first, last) to *this. + //! Effects: Assigns the range [first, last) to *this. //! //! Throws: If memory allocation throws or //! T's constructor from dereferencing InpIt throws. @@ -433,7 +433,7 @@ class list } #if !defined(BOOST_NO_CXX11_HDR_INITIALIZER_LIST) - //! Effects: Assigns the the range [il.begin(), il.end()) to *this. + //! Effects: Assigns the range [il.begin(), il.end()) to *this. //! //! Throws: If memory allocation throws or //! T's constructor from dereferencing std::initializer_list iterator throws. @@ -651,7 +651,10 @@ class list //! //! Complexity: Constant. reference front() BOOST_NOEXCEPT_OR_NOTHROW - { return *this->begin(); } + { + BOOST_ASSERT(!this->empty()); + return *this->begin(); + } //! Requires: !empty() //! @@ -662,7 +665,10 @@ class list //! //! Complexity: Constant. const_reference front() const BOOST_NOEXCEPT_OR_NOTHROW - { return *this->begin(); } + { + BOOST_ASSERT(!this->empty()); + return *this->begin(); + } //! Requires: !empty() //! @@ -673,7 +679,10 @@ class list //! //! Complexity: Constant. reference back() BOOST_NOEXCEPT_OR_NOTHROW - { return *(--this->end()); } + { + BOOST_ASSERT(!this->empty()); + return *(--this->end()); + } //! Requires: !empty() //! @@ -684,7 +693,10 @@ class list //! //! Complexity: Constant. const_reference back() const BOOST_NOEXCEPT_OR_NOTHROW - { return *(--this->end()); } + { + BOOST_ASSERT(!this->empty()); + return *(--this->end()); + } ////////////////////////////////////////////// // @@ -697,24 +709,28 @@ class list //! Effects: Inserts an object of type T constructed with //! std::forward(args)... in the end of the list. //! + //! Returns: A reference to the created object. + //! //! Throws: If memory allocation throws or //! T's in-place constructor throws. //! //! Complexity: Constant template - void emplace_back(BOOST_FWD_REF(Args)... args) - { this->emplace(this->cend(), boost::forward(args)...); } + reference emplace_back(BOOST_FWD_REF(Args)... args) + { return *this->emplace(this->cend(), boost::forward(args)...); } //! Effects: Inserts an object of type T constructed with //! std::forward(args)... in the beginning of the list. //! + //! Returns: A reference to the created object. + //! //! Throws: If memory allocation throws or //! T's in-place constructor throws. //! //! Complexity: Constant template - void emplace_front(BOOST_FWD_REF(Args)... args) - { this->emplace(this->cbegin(), boost::forward(args)...); } + reference emplace_front(BOOST_FWD_REF(Args)... args) + { return *this->emplace(this->cbegin(), boost::forward(args)...); } //! Effects: Inserts an object of type T constructed with //! std::forward(args)... before p. @@ -724,28 +740,30 @@ class list //! //! Complexity: Constant template - iterator emplace(const_iterator p, BOOST_FWD_REF(Args)... args) + iterator emplace(const_iterator position, BOOST_FWD_REF(Args)... args) { + BOOST_ASSERT((priv_is_linked)(position)); NodePtr pnode(AllocHolder::create_node(boost::forward(args)...)); - return iterator(this->icont().insert(p.get(), *pnode)); + return iterator(this->icont().insert(position.get(), *pnode)); } #else // !defined(BOOST_NO_CXX11_VARIADIC_TEMPLATES) #define BOOST_CONTAINER_LIST_EMPLACE_CODE(N) \ BOOST_MOVE_TMPL_LT##N BOOST_MOVE_CLASS##N BOOST_MOVE_GT##N \ - void emplace_back(BOOST_MOVE_UREF##N)\ - { this->emplace(this->cend() BOOST_MOVE_I##N BOOST_MOVE_FWD##N); }\ + reference emplace_back(BOOST_MOVE_UREF##N)\ + { return *this->emplace(this->cend() BOOST_MOVE_I##N BOOST_MOVE_FWD##N); }\ \ BOOST_MOVE_TMPL_LT##N BOOST_MOVE_CLASS##N BOOST_MOVE_GT##N \ - void emplace_front(BOOST_MOVE_UREF##N)\ - { this->emplace(this->cbegin() BOOST_MOVE_I##N BOOST_MOVE_FWD##N);}\ + reference emplace_front(BOOST_MOVE_UREF##N)\ + { return *this->emplace(this->cbegin() BOOST_MOVE_I##N BOOST_MOVE_FWD##N);}\ \ BOOST_MOVE_TMPL_LT##N BOOST_MOVE_CLASS##N BOOST_MOVE_GT##N \ - iterator emplace(const_iterator p BOOST_MOVE_I##N BOOST_MOVE_UREF##N)\ + iterator emplace(const_iterator position BOOST_MOVE_I##N BOOST_MOVE_UREF##N)\ {\ + BOOST_ASSERT(position == this->cend() || (--(++position) == position) );\ NodePtr pnode (AllocHolder::create_node(BOOST_MOVE_FWD##N));\ - return iterator(this->icont().insert(p.get(), *pnode));\ + return iterator(this->icont().insert(position.get(), *pnode));\ }\ // BOOST_MOVE_ITERATE_0TO9(BOOST_CONTAINER_LIST_EMPLACE_CODE) @@ -828,10 +846,11 @@ class list //! Throws: If memory allocation throws or T's copy constructor throws. //! //! Complexity: Linear to n. - iterator insert(const_iterator p, size_type n, const T& x) + iterator insert(const_iterator position, size_type n, const T& x) { + //range check is done by insert typedef constant_iterator cvalue_iterator; - return this->insert(p, cvalue_iterator(x, n), cvalue_iterator()); + return this->insert(position, cvalue_iterator(x, n), cvalue_iterator()); } //! Requires: p must be a valid iterator of *this. @@ -856,6 +875,7 @@ class list #endif ) { + BOOST_ASSERT((priv_is_linked)(p)); const typename Icont::iterator ipos(p.get()); iterator ret_it(ipos); if(first != last){ @@ -870,7 +890,7 @@ class list #if !defined(BOOST_CONTAINER_DOXYGEN_INVOKED) template - iterator insert(const_iterator p, FwdIt first, FwdIt last + iterator insert(const_iterator position, FwdIt first, FwdIt last , typename container_detail::enable_if_c < !container_detail::is_convertible::value && !(container_detail::is_input_iterator::value @@ -879,9 +899,10 @@ class list >::type * = 0 ) { + BOOST_ASSERT((priv_is_linked)(position)); //Optimized allocation and construction - insertion_functor func(this->icont(), p.get()); - iterator before_p(p.get()); + insertion_functor func(this->icont(), position.get()); + iterator before_p(position.get()); --before_p; this->allocate_many_and_construct(first, boost::container::iterator_distance(first, last), func); return ++before_p; @@ -900,7 +921,10 @@ class list //! //! Complexity: Linear to distance [il.begin(), il.end()). iterator insert(const_iterator p, std::initializer_list il) - { return insert(p, il.begin(), il.end()); } + { + //position range check is done by insert() + return insert(p, il.begin(), il.end()); + } #endif //! Effects: Removes the first element from the list. @@ -909,7 +933,10 @@ class list //! //! Complexity: Amortized constant time. void pop_front() BOOST_NOEXCEPT_OR_NOTHROW - { this->erase(this->cbegin()); } + { + BOOST_ASSERT(!this->empty()); + this->erase(this->cbegin()); + } //! Effects: Removes the last element from the list. //! @@ -917,17 +944,24 @@ class list //! //! Complexity: Amortized constant time. void pop_back() BOOST_NOEXCEPT_OR_NOTHROW - { const_iterator tmp = this->cend(); this->erase(--tmp); } + { + BOOST_ASSERT(!this->empty()); + const_iterator tmp = this->cend(); + this->erase(--tmp); + } //! Requires: p must be a valid iterator of *this. //! - //! Effects: Erases the element at p p. + //! Effects: Erases the element at p. //! //! Throws: Nothing. //! //! Complexity: Amortized constant time. iterator erase(const_iterator p) BOOST_NOEXCEPT_OR_NOTHROW - { return iterator(this->icont().erase_and_dispose(p.get(), Destroyer(this->node_alloc()))); } + { + BOOST_ASSERT(p != this->cend() && (priv_is_linked)(p)); + return iterator(this->icont().erase_and_dispose(p.get(), Destroyer(this->node_alloc()))); + } //! Requires: first and last must be valid iterator to elements in *this. //! @@ -937,7 +971,11 @@ class list //! //! Complexity: Linear to the distance between first and last. iterator erase(const_iterator first, const_iterator last) BOOST_NOEXCEPT_OR_NOTHROW - { return iterator(AllocHolder::erase_range(first.get(), last.get(), alloc_version())); } + { + BOOST_ASSERT(first == last || (first != this->cend() && (priv_is_linked)(first))); + BOOST_ASSERT(first == last || (priv_is_linked)(last)); + return iterator(AllocHolder::erase_range(first.get(), last.get(), alloc_version())); + } //! Effects: Swaps the contents of *this and x. //! @@ -947,7 +985,12 @@ class list void swap(list& x) BOOST_NOEXCEPT_IF(allocator_traits_type::propagate_on_container_swap::value || allocator_traits_type::is_always_equal::value) - { AllocHolder::swap(x); } + { + BOOST_ASSERT(allocator_traits_type::propagate_on_container_swap::value || + allocator_traits_type::is_always_equal::value || + this->get_stored_allocator() == x.get_stored_allocator()); + AllocHolder::swap(x); + } //! Effects: Erases all the elements of the list. //! @@ -977,6 +1020,7 @@ class list //! this list. Iterators of this list and all the references are not invalidated. void splice(const_iterator p, list& x) BOOST_NOEXCEPT_OR_NOTHROW { + BOOST_ASSERT((priv_is_linked)(p)); BOOST_ASSERT(this != &x); BOOST_ASSERT(this->node_alloc() == x.node_alloc()); this->icont().splice(p.get(), x.icont()); @@ -995,14 +1039,17 @@ class list //! Note: Iterators of values obtained from list x now point to elements of //! this list. Iterators of this list and all the references are not invalidated. void splice(const_iterator p, BOOST_RV_REF(list) x) BOOST_NOEXCEPT_OR_NOTHROW - { this->splice(p, static_cast(x)); } + { + //Checks done in splice + this->splice(p, static_cast(x)); + } //! Requires: p must point to an element contained //! by this list. i must point to an element contained in list x. //! this' allocator and x's allocator shall compare equal //! //! Effects: Transfers the value pointed by i, from list x to this list, - //! before the the element pointed by p. No destructors or copy constructors are called. + //! before the element pointed by p. No destructors or copy constructors are called. //! If p == i or p == ++i, this function is a null operation. //! //! Throws: Nothing @@ -1013,7 +1060,7 @@ class list //! list. Iterators of this list and all the references are not invalidated. void splice(const_iterator p, list &x, const_iterator i) BOOST_NOEXCEPT_OR_NOTHROW { - //BOOST_ASSERT(this != &x); + BOOST_ASSERT((priv_is_linked)(p)); BOOST_ASSERT(this->node_alloc() == x.node_alloc()); this->icont().splice(p.get(), x.icont(), i.get()); } @@ -1023,7 +1070,7 @@ class list //! this' allocator and x's allocator shall compare equal. //! //! Effects: Transfers the value pointed by i, from list x to this list, - //! before the the element pointed by p. No destructors or copy constructors are called. + //! before the element pointed by p. No destructors or copy constructors are called. //! If p == i or p == ++i, this function is a null operation. //! //! Throws: Nothing @@ -1033,14 +1080,18 @@ class list //! Note: Iterators of values obtained from list x now point to elements of this //! list. Iterators of this list and all the references are not invalidated. void splice(const_iterator p, BOOST_RV_REF(list) x, const_iterator i) BOOST_NOEXCEPT_OR_NOTHROW - { this->splice(p, static_cast(x), i); } + { + BOOST_ASSERT(this != &x); + //Additional checks done in splice() + this->splice(p, static_cast(x), i); + } //! Requires: p must point to an element contained //! by this list. first and last must point to elements contained in list x. //! this' allocator and x's allocator shall compare equal //! //! Effects: Transfers the range pointed by first and last from list x to this list, - //! before the the element pointed by p. No destructors or copy constructors are called. + //! before the element pointed by p. No destructors or copy constructors are called. //! //! Throws: Nothing //! @@ -1050,6 +1101,9 @@ class list //! list. Iterators of this list and all the references are not invalidated. void splice(const_iterator p, list &x, const_iterator first, const_iterator last) BOOST_NOEXCEPT_OR_NOTHROW { + BOOST_ASSERT((priv_is_linked)(p)); + BOOST_ASSERT(first == last || (first != x.cend() && x.priv_is_linked(first))); + BOOST_ASSERT(first == last || x.priv_is_linked(last)); BOOST_ASSERT(this->node_alloc() == x.node_alloc()); this->icont().splice(p.get(), x.icont(), first.get(), last.get()); } @@ -1059,7 +1113,7 @@ class list //! this' allocator and x's allocator shall compare equal. //! //! Effects: Transfers the range pointed by first and last from list x to this list, - //! before the the element pointed by p. No destructors or copy constructors are called. + //! before the element pointed by p. No destructors or copy constructors are called. //! //! Throws: Nothing //! @@ -1068,14 +1122,18 @@ class list //! Note: Iterators of values obtained from list x now point to elements of this //! list. Iterators of this list and all the references are not invalidated. void splice(const_iterator p, BOOST_RV_REF(list) x, const_iterator first, const_iterator last) BOOST_NOEXCEPT_OR_NOTHROW - { this->splice(p, static_cast(x), first, last); } + { + BOOST_ASSERT(this != &x); + //Additional checks done in splice() + this->splice(p, static_cast(x), first, last); + } //! Requires: p must point to an element contained //! by this list. first and last must point to elements contained in list x. //! n == distance(first, last). this' allocator and x's allocator shall compare equal //! //! Effects: Transfers the range pointed by first and last from list x to this list, - //! before the the element pointed by p. No destructors or copy constructors are called. + //! before the element pointed by p. No destructors or copy constructors are called. //! //! Throws: Nothing //! @@ -1096,7 +1154,7 @@ class list //! n == distance(first, last). this' allocator and x's allocator shall compare equal //! //! Effects: Transfers the range pointed by first and last from list x to this list, - //! before the the element pointed by p. No destructors or copy constructors are called. + //! before the element pointed by p. No destructors or copy constructors are called. //! //! Throws: Nothing //! @@ -1318,6 +1376,13 @@ class list #ifndef BOOST_CONTAINER_DOXYGEN_INVOKED private: + static bool priv_is_linked(const_iterator const position) + { + const_iterator cur(position); + //This list is circular including end nodes + return (--(++cur)) == position && (++(--cur)) == position; + } + bool priv_try_shrink(size_type new_size) { const size_type len = this->size(); @@ -1348,12 +1413,14 @@ class list iterator priv_insert(const_iterator p, const T &x) { + BOOST_ASSERT((priv_is_linked)(p)); NodePtr tmp = AllocHolder::create_node(x); return iterator(this->icont().insert(p.get(), *tmp)); } iterator priv_insert(const_iterator p, BOOST_RV_REF(T) x) { + BOOST_ASSERT((priv_is_linked)(p)); NodePtr tmp = AllocHolder::create_node(boost::move(x)); return iterator(this->icont().insert(p.get(), *tmp)); } diff --git a/3party/boost/boost/container/map.hpp b/3party/boost/boost/container/map.hpp index 170f7ae404..5520fb45ba 100644 --- a/3party/boost/boost/container/map.hpp +++ b/3party/boost/boost/container/map.hpp @@ -53,6 +53,34 @@ namespace boost { namespace container { +///@cond + +template +struct pair_key_mapped_of_value +{ + typedef Key key_type; + typedef Mapped mapped_type; + + template + const key_type & key_of_value(const Pair &p) const + { return p.first; } + + template + const mapped_type & mapped_of_value(const Pair &p) const + { return p.second; } + + template + key_type & key_of_value(Pair &p) const + { return const_cast(p.first); } + + template + mapped_type & mapped_of_value(Pair &p) const + { return p.second; } + +}; + +///@endcond + #ifdef BOOST_CONTAINER_DOXYGEN_INVOKED //! A map is a kind of associative container that supports unique keys (contains at @@ -68,31 +96,30 @@ namespace container { //! \tparam Compare is the ordering function for Keys (e.g. std::less). //! \tparam Allocator is the allocator to allocate the value_types //! (e.g. allocator< std::pair > ). -//! \tparam MapOptions is an packed option type generated using using boost::container::tree_assoc_options. +//! \tparam Options is an packed option type generated using using boost::container::tree_assoc_options. template < class Key, class T, class Compare = std::less - , class Allocator = new_allocator< std::pair< const Key, T> >, class MapOptions = tree_assoc_defaults > + , class Allocator = new_allocator< std::pair< const Key, T> >, class Options = tree_assoc_defaults > #else -template +template #endif class map ///@cond : public container_detail::tree - < Key, std::pair - , container_detail::select1st< std::pair > - , Compare, Allocator, MapOptions> + < std::pair + , container_detail::select1st + , Compare, Allocator, Options> ///@endcond { #ifndef BOOST_CONTAINER_DOXYGEN_INVOKED private: BOOST_COPYABLE_AND_MOVABLE(map) - typedef std::pair value_type_impl; + typedef container_detail::select1st select_1st_t; + typedef std::pair value_type_impl; typedef container_detail::tree - , Compare, Allocator, MapOptions> base_t; - typedef container_detail::pair movable_value_type_impl; - typedef container_detail::tree_value_compare - < Key, value_type_impl, Compare, container_detail::select1st - > value_compare_impl; + base_t; + typedef container_detail::pair movable_value_type_impl; + typedef typename base_t::value_compare value_compare_impl; #endif //#ifndef BOOST_CONTAINER_DOXYGEN_INVOKED public: @@ -102,10 +129,10 @@ class map // ////////////////////////////////////////////// - typedef Key key_type; - typedef ::boost::container::allocator_traits allocator_traits_type; - typedef T mapped_type; - typedef std::pair value_type; + typedef Key key_type; + typedef ::boost::container::allocator_traits allocator_traits_type; + typedef T mapped_type; + typedef std::pair value_type; typedef typename boost::container::allocator_traits::pointer pointer; typedef typename boost::container::allocator_traits::const_pointer const_pointer; typedef typename boost::container::allocator_traits::reference reference; @@ -122,6 +149,14 @@ class map typedef typename BOOST_CONTAINER_IMPDEF(base_t::const_reverse_iterator) const_reverse_iterator; typedef std::pair nonconst_value_type; typedef BOOST_CONTAINER_IMPDEF(movable_value_type_impl) movable_value_type; + typedef BOOST_CONTAINER_IMPDEF(node_handle< + typename base_t::node_type::container_node_type + BOOST_MOVE_I value_type + BOOST_MOVE_I allocator_type + BOOST_MOVE_I pair_key_mapped_of_value + >) node_type; + typedef BOOST_CONTAINER_IMPDEF + (insert_return_type_base) insert_return_type; ////////////////////////////////////////////// // @@ -132,7 +167,9 @@ class map //! Effects: Default constructs an empty map. //! //! Complexity: Constant. - map() + BOOST_CONTAINER_FORCEINLINE + map() BOOST_NOEXCEPT_IF(container_detail::is_nothrow_default_constructible::value && + container_detail::is_nothrow_default_constructible::value) : base_t() { //A type must be std::pair @@ -143,6 +180,7 @@ class map //! and allocator. //! //! Complexity: Constant. + BOOST_CONTAINER_FORCEINLINE explicit map(const Compare& comp, const allocator_type& a = allocator_type()) : base_t(comp, a) { @@ -153,6 +191,7 @@ class map //! Effects: Constructs an empty map using the specified allocator. //! //! Complexity: Constant. + BOOST_CONTAINER_FORCEINLINE explicit map(const allocator_type& a) : base_t(a) { @@ -166,6 +205,7 @@ class map //! Complexity: Linear in N if the range [first ,last ) is already sorted using //! comp and otherwise N logN, where N is last - first. template + BOOST_CONTAINER_FORCEINLINE map(InputIterator first, InputIterator last, const Compare& comp = Compare(), const allocator_type& a = allocator_type()) : base_t(true, first, last, comp, a) @@ -174,12 +214,13 @@ class map BOOST_STATIC_ASSERT((container_detail::is_same, typename Allocator::value_type>::value)); } - //! Effects: Constructs an empty map using the specified + //! Effects: Constructs an empty map using the specified //! allocator, and inserts elements from the range [first ,last ). //! //! Complexity: Linear in N if the range [first ,last ) is already sorted using //! comp and otherwise N logN, where N is last - first. template + BOOST_CONTAINER_FORCEINLINE map(InputIterator first, InputIterator last, const allocator_type& a) : base_t(true, first, last, Compare(), a) { @@ -198,6 +239,7 @@ class map //! //! Note: Non-standard extension. template + BOOST_CONTAINER_FORCEINLINE map( ordered_unique_range_t, InputIterator first, InputIterator last , const Compare& comp = Compare(), const allocator_type& a = allocator_type()) : base_t(ordered_range, first, last, comp, a) @@ -212,6 +254,7 @@ class map //! //! Complexity: Linear in N if the range [first ,last ) is already sorted using //! comp and otherwise N logN, where N is il.first() - il.end(). + BOOST_CONTAINER_FORCEINLINE map(std::initializer_list il, const Compare& comp = Compare(), const allocator_type& a = allocator_type()) : base_t(true, il.begin(), il.end(), comp, a) { @@ -224,6 +267,7 @@ class map //! //! Complexity: Linear in N if the range [first ,last ) is already sorted using //! comp and otherwise N logN, where N is il.first() - il.end(). + BOOST_CONTAINER_FORCEINLINE map(std::initializer_list il, const allocator_type& a) : base_t(true, il.begin(), il.end(), Compare(), a) { @@ -241,6 +285,7 @@ class map //! Complexity: Linear in N. //! //! Note: Non-standard extension. + BOOST_CONTAINER_FORCEINLINE map(ordered_unique_range_t, std::initializer_list il, const Compare& comp = Compare(), const allocator_type& a = allocator_type()) : base_t(ordered_range, il.begin(), il.end(), comp, a) @@ -253,6 +298,7 @@ class map //! Effects: Copy constructs a map. //! //! Complexity: Linear in x.size(). + BOOST_CONTAINER_FORCEINLINE map(const map& x) : base_t(static_cast(x)) { @@ -265,7 +311,9 @@ class map //! Complexity: Constant. //! //! Postcondition: x is emptied. + BOOST_CONTAINER_FORCEINLINE map(BOOST_RV_REF(map) x) + BOOST_NOEXCEPT_IF(boost::container::container_detail::is_nothrow_move_constructible::value) : base_t(BOOST_MOVE_BASE(base_t, x)) { //A type must be std::pair @@ -275,6 +323,7 @@ class map //! Effects: Copy constructs a map using the specified allocator. //! //! Complexity: Linear in x.size(). + BOOST_CONTAINER_FORCEINLINE map(const map& x, const allocator_type &a) : base_t(static_cast(x), a) { @@ -288,6 +337,7 @@ class map //! Complexity: Constant if x == x.get_allocator(), linear otherwise. //! //! Postcondition: x is emptied. + BOOST_CONTAINER_FORCEINLINE map(BOOST_RV_REF(map) x, const allocator_type &a) : base_t(BOOST_MOVE_BASE(base_t, x), a) { @@ -298,6 +348,7 @@ class map //! Effects: Makes *this a copy of x. //! //! Complexity: Linear in x.size(). + BOOST_CONTAINER_FORCEINLINE map& operator=(BOOST_COPY_ASSIGN_REF(map) x) { return static_cast(this->base_t::operator=(static_cast(x))); } @@ -309,15 +360,17 @@ class map //! Complexity: Constant if allocator_traits_type:: //! propagate_on_container_move_assignment is true or //! this->get>allocator() == x.get_allocator(). Linear otherwise. + BOOST_CONTAINER_FORCEINLINE map& operator=(BOOST_RV_REF(map) x) - BOOST_NOEXCEPT_IF( allocator_traits_type::is_always_equal::value - && boost::container::container_detail::is_nothrow_move_assignable::value ) - + BOOST_NOEXCEPT_IF( (allocator_traits_type::propagate_on_container_move_assignment::value || + allocator_traits_type::is_always_equal::value) && + boost::container::container_detail::is_nothrow_move_assignable::value) { return static_cast(this->base_t::operator=(BOOST_MOVE_BASE(base_t, x))); } #if !defined(BOOST_NO_CXX11_HDR_INITIALIZER_LIST) //! Effects: Assign content of il to *this. //! + BOOST_CONTAINER_FORCEINLINE map& operator=(std::initializer_list il) { this->clear(); @@ -466,28 +519,100 @@ class map #endif //#if defined(BOOST_CONTAINER_DOXYGEN_INVOKED) #if defined(BOOST_CONTAINER_DOXYGEN_INVOKED) - //! Effects: If there is no key equivalent to x in the map, inserts + //! Effects: If there is no key equivalent to x in the map, inserts //! value_type(x, T()) into the map. //! - //! Returns: A reference to the mapped_type corresponding to x in *this. + //! Returns: A reference to the mapped_type corresponding to x in *this. //! - //! Complexity: Logarithmic. + //! Complexity: Logarithmic. mapped_type& operator[](const key_type &k); - //! Effects: If there is no key equivalent to x in the map, inserts + //! Effects: If there is no key equivalent to x in the map, inserts //! value_type(boost::move(x), T()) into the map (the key is move-constructed) //! - //! Returns: A reference to the mapped_type corresponding to x in *this. + //! Returns: A reference to the mapped_type corresponding to x in *this. //! - //! Complexity: Logarithmic. + //! Complexity: Logarithmic. mapped_type& operator[](key_type &&k); + #elif defined(BOOST_MOVE_HELPERS_RETURN_SFINAE_BROKEN) + //in compilers like GCC 3.4, we can't catch temporaries + BOOST_CONTAINER_FORCEINLINE mapped_type& operator[](const key_type &k) { return this->priv_subscript(k); } + BOOST_CONTAINER_FORCEINLINE mapped_type& operator[](BOOST_RV_REF(key_type) k) { return this->priv_subscript(::boost::move(k)); } #else - BOOST_MOVE_CONVERSION_AWARE_CATCH( operator[] , key_type, mapped_type&, this->priv_subscript) + BOOST_MOVE_CONVERSION_AWARE_CATCH( operator[] , key_type, mapped_type&, this->priv_subscript) #endif - //! Returns: A reference to the element whose key is equivalent to x. + //! Effects: If a key equivalent to k already exists in the container, assigns forward(obj) + //! to the mapped_type corresponding to the key k. If the key does not exist, inserts the new value + //! as if by insert, constructing it from value_type(k, forward(obj)). + //! + //! No iterators or references are invalidated. If the insertion is successful, pointers and references + //! to the element obtained while it is held in the node handle are invalidated, and pointers and + //! references obtained to that element before it was extracted become valid. + //! + //! Returns: The bool component is true if the insertion took place and false if the assignment + //! took place. The iterator component is pointing at the element that was inserted or updated. + //! + //! Complexity: Logarithmic in the size of the container. + template + BOOST_CONTAINER_FORCEINLINE std::pair insert_or_assign(const key_type& k, BOOST_FWD_REF(M) obj) + { return this->base_t::insert_or_assign(const_iterator(), k, ::boost::forward(obj)); } + + //! Effects: If a key equivalent to k already exists in the container, assigns forward(obj) + //! to the mapped_type corresponding to the key k. If the key does not exist, inserts the new value + //! as if by insert, constructing it from value_type(k, move(obj)). + //! + //! No iterators or references are invalidated. If the insertion is successful, pointers and references + //! to the element obtained while it is held in the node handle are invalidated, and pointers and + //! references obtained to that element before it was extracted become valid. + //! + //! Returns: The bool component is true if the insertion took place and false if the assignment + //! took place. The iterator component is pointing at the element that was inserted or updated. + //! + //! Complexity: Logarithmic in the size of the container. + template + BOOST_CONTAINER_FORCEINLINE std::pair insert_or_assign(BOOST_RV_REF(key_type) k, BOOST_FWD_REF(M) obj) + { return this->base_t::insert_or_assign(const_iterator(), ::boost::move(k), ::boost::forward(obj)); } + + //! Effects: If a key equivalent to k already exists in the container, assigns forward(obj) + //! to the mapped_type corresponding to the key k. If the key does not exist, inserts the new value + //! as if by insert, constructing it from value_type(k, forward(obj)) and the new element + //! to the container as close as possible to the position just before hint. + //! + //! No iterators or references are invalidated. If the insertion is successful, pointers and references + //! to the element obtained while it is held in the node handle are invalidated, and pointers and + //! references obtained to that element before it was extracted become valid. + //! + //! Returns: The bool component is true if the insertion took place and false if the assignment + //! took place. The iterator component is pointing at the element that was inserted or updated. + //! + //! Complexity: Logarithmic in the size of the container in general, but amortized constant if + //! the new element is inserted just before hint. + template + BOOST_CONTAINER_FORCEINLINE iterator insert_or_assign(const_iterator hint, const key_type& k, BOOST_FWD_REF(M) obj) + { return this->base_t::insert_or_assign(hint, k, ::boost::forward(obj)); } + + //! Effects: If a key equivalent to k already exists in the container, assigns forward(obj) + //! to the mapped_type corresponding to the key k. If the key does not exist, inserts the new value + //! as if by insert, constructing it from value_type(k, move(obj)) and the new element + //! to the container as close as possible to the position just before hint. + //! + //! No iterators or references are invalidated. If the insertion is successful, pointers and references + //! to the element obtained while it is held in the node handle are invalidated, and pointers and + //! references obtained to that element before it was extracted become valid. + //! + //! Returns: The bool component is true if the insertion took place and false if the assignment + //! took place. The iterator component is pointing at the element that was inserted or updated. + //! + //! Complexity: Logarithmic in the size of the container in general, but amortized constant if + //! the new element is inserted just before hint. + template + BOOST_CONTAINER_FORCEINLINE iterator insert_or_assign(const_iterator hint, BOOST_RV_REF(key_type) k, BOOST_FWD_REF(M) obj) + { return this->base_t::insert_or_assign(hint, ::boost::move(k), ::boost::forward(obj)); } + + //! Returns: A reference to the element whose key is equivalent to x. //! Throws: An exception object of type out_of_range if no such element is present. - //! Complexity: logarithmic. + //! Complexity: logarithmic. T& at(const key_type& k) { iterator i = this->find(k); @@ -497,9 +622,9 @@ class map return i->second; } - //! Returns: A reference to the element whose key is equivalent to x. + //! Returns: A reference to the element whose key is equivalent to x. //! Throws: An exception object of type out_of_range if no such element is present. - //! Complexity: logarithmic. + //! Complexity: logarithmic. const T& at(const key_type& k) const { const_iterator i = this->find(k); @@ -523,7 +648,7 @@ class map //! points to the element with key equivalent to the key of x. //! //! Complexity: Logarithmic. - std::pair insert(const value_type& x) + BOOST_CONTAINER_FORCEINLINE std::pair insert(const value_type& x) { return this->base_t::insert_unique(x); } //! Effects: Inserts a new value_type created from the pair if and only if @@ -534,8 +659,8 @@ class map //! points to the element with key equivalent to the key of x. //! //! Complexity: Logarithmic. - std::pair insert(const nonconst_value_type& x) - { return this->base_t::insert_unique(x); } + BOOST_CONTAINER_FORCEINLINE std::pair insert(const nonconst_value_type& x) + { return this->try_emplace(x.first, x.second); } //! Effects: Inserts a new value_type move constructed from the pair if and //! only if there is no element in the container with key equivalent to the key of x. @@ -545,8 +670,8 @@ class map //! points to the element with key equivalent to the key of x. //! //! Complexity: Logarithmic. - std::pair insert(BOOST_RV_REF(nonconst_value_type) x) - { return this->base_t::insert_unique(boost::move(x)); } + BOOST_CONTAINER_FORCEINLINE std::pair insert(BOOST_RV_REF(nonconst_value_type) x) + { return this->try_emplace(boost::move(x.first), boost::move(x.second)); } //! Effects: Inserts a new value_type move constructed from the pair if and //! only if there is no element in the container with key equivalent to the key of x. @@ -556,8 +681,8 @@ class map //! points to the element with key equivalent to the key of x. //! //! Complexity: Logarithmic. - std::pair insert(BOOST_RV_REF(movable_value_type) x) - { return this->base_t::insert_unique(boost::move(x)); } + BOOST_CONTAINER_FORCEINLINE std::pair insert(BOOST_RV_REF(movable_value_type) x) + { return this->try_emplace(boost::move(x.first), boost::move(x.second)); } //! Effects: Move constructs a new value from x if and only if there is //! no element in the container with key equivalent to the key of x. @@ -567,7 +692,7 @@ class map //! points to the element with key equivalent to the key of x. //! //! Complexity: Logarithmic. - std::pair insert(BOOST_RV_REF(value_type) x) + BOOST_CONTAINER_FORCEINLINE std::pair insert(BOOST_RV_REF(value_type) x) { return this->base_t::insert_unique(boost::move(x)); } //! Effects: Inserts a copy of x in the container if and only if there is @@ -579,7 +704,7 @@ class map //! //! Complexity: Logarithmic in general, but amortized constant if t //! is inserted right before p. - iterator insert(const_iterator p, const value_type& x) + BOOST_CONTAINER_FORCEINLINE iterator insert(const_iterator p, const value_type& x) { return this->base_t::insert_unique(p, x); } //! Effects: Move constructs a new value from x if and only if there is @@ -592,7 +717,7 @@ class map //! Complexity: Logarithmic in general, but amortized constant if t //! is inserted right before p. iterator insert(const_iterator p, BOOST_RV_REF(nonconst_value_type) x) - { return this->base_t::insert_unique(p, boost::move(x)); } + { return this->try_emplace(p, boost::move(x.first), boost::move(x.second)); } //! Effects: Move constructs a new value from x if and only if there is //! no element in the container with key equivalent to the key of x. @@ -604,7 +729,7 @@ class map //! Complexity: Logarithmic in general, but amortized constant if t //! is inserted right before p. iterator insert(const_iterator p, BOOST_RV_REF(movable_value_type) x) - { return this->base_t::insert_unique(p, boost::move(x)); } + { return this->try_emplace(p, boost::move(x.first), boost::move(x.second)); } //! Effects: Inserts a copy of x in the container. //! p is a hint pointing to where the insert should start to search. @@ -613,7 +738,7 @@ class map //! //! Complexity: Logarithmic. iterator insert(const_iterator p, const nonconst_value_type& x) - { return this->base_t::insert_unique(p, x); } + { return this->try_emplace(p, x.first, x.second); } //! Effects: Inserts an element move constructed from x in the container. //! p is a hint pointing to where the insert should start to search. @@ -631,7 +756,7 @@ class map //! //! Complexity: At most N log(size()+N) (N is the distance from first to last) template - void insert(InputIterator first, InputIterator last) + BOOST_CONTAINER_FORCEINLINE void insert(InputIterator first, InputIterator last) { this->base_t::insert_unique(first, last); } #if !defined(BOOST_NO_CXX11_HDR_INITIALIZER_LIST) @@ -639,10 +764,42 @@ class map //! if there is no element with key equivalent to the key of that element. //! //! Complexity: At most N log(size()+N) (N is the distance from il.begin() to il.end()) - void insert(std::initializer_list il) + BOOST_CONTAINER_FORCEINLINE void insert(std::initializer_list il) { this->base_t::insert_unique(il.begin(), il.end()); } #endif + //! Requires: nh is empty or this->get_allocator() == nh.get_allocator(). + //! + //! Effects: If nh is empty, has no effect. Otherwise, inserts the element owned + //! by nh if and only if there is no element in the container with a key equivalent to nh.key(). + //! + //! Returns: If nh is empty, insert_return_type.inserted is false, insert_return_type.position + //! is end(), and insert_return_type.node is empty. Otherwise if the insertion took place, + //! insert_return_type.inserted is true, insert_return_type.position points to the inserted element, + //! and insert_return_type.node is empty; if the insertion failed, insert_return_type.inserted is + //! false, insert_return_type.node has the previous value of nh, and insert_return_type.position + //! points to an element with a key equivalent to nh.key(). + //! + //! Complexity: Logarithmic + insert_return_type insert(BOOST_RV_REF_BEG_IF_CXX11 node_type BOOST_RV_REF_END_IF_CXX11 nh) + { + typename base_t::node_type n(boost::move(nh)); + typename base_t::insert_return_type base_ret(this->base_t::insert_unique_node(boost::move(n))); + return insert_return_type (base_ret.inserted, base_ret.position, boost::move(base_ret.node)); + } + + //! Effects: Same as `insert(node_type && nh)` but the element is inserted as close as possible + //! to the position just prior to "hint". + //! + //! Complexity: logarithmic in general, but amortized constant if the element is inserted + //! right before "hint". + insert_return_type insert(const_iterator hint, BOOST_RV_REF_BEG_IF_CXX11 node_type BOOST_RV_REF_END_IF_CXX11 nh) + { + typename base_t::node_type n(boost::move(nh)); + typename base_t::insert_return_type base_ret(this->base_t::insert_unique_node(hint, boost::move(n))); + return insert_return_type (base_ret.inserted, base_ret.position, boost::move(base_ret.node)); + } + #if !defined(BOOST_NO_CXX11_VARIADIC_TEMPLATES) || defined(BOOST_CONTAINER_DOXYGEN_INVOKED) //! Effects: Inserts an object x of type T constructed with @@ -657,7 +814,7 @@ class map //! Complexity: Logarithmic in general, but amortized constant if t //! is inserted right before p. template - std::pair emplace(BOOST_FWD_REF(Args)... args) + BOOST_CONTAINER_FORCEINLINE std::pair emplace(BOOST_FWD_REF(Args)... args) { return this->base_t::emplace_unique(boost::forward(args)...); } //! Effects: Inserts an object of type T constructed with @@ -671,19 +828,95 @@ class map //! Complexity: Logarithmic in general, but amortized constant if t //! is inserted right before p. template - iterator emplace_hint(const_iterator p, BOOST_FWD_REF(Args)... args) + BOOST_CONTAINER_FORCEINLINE iterator emplace_hint(const_iterator p, BOOST_FWD_REF(Args)... args) { return this->base_t::emplace_hint_unique(p, boost::forward(args)...); } + //! Requires: value_type shall be EmplaceConstructible into map from piecewise_construct, + //! forward_as_tuple(k), forward_as_tuple(forward(args)...). + //! + //! Effects: If the map already contains an element whose key is equivalent to k, there is no effect. Otherwise + //! inserts an object of type value_type constructed with piecewise_construct, forward_as_tuple(k), + //! forward_as_tuple(forward(args)...). + //! + //! Returns: The bool component of the returned pair is true if and only if the + //! insertion took place. The returned iterator points to the map element whose key is equivalent to k. + //! + //! Complexity: Logarithmic. + template + BOOST_CONTAINER_FORCEINLINE std::pair try_emplace(const key_type& k, BOOST_FWD_REF(Args)... args) + { return this->base_t::try_emplace(const_iterator(), k, boost::forward(args)...); } + + //! Requires: value_type shall be EmplaceConstructible into map from piecewise_construct, + //! forward_as_tuple(k), forward_as_tuple(forward(args)...). + //! + //! Effects: If the map already contains an element whose key is equivalent to k, there is no effect. Otherwise + //! inserts an object of type value_type constructed with piecewise_construct, forward_as_tuple(k), + //! forward_as_tuple(forward(args)...). + //! + //! Returns: The returned iterator points to the map element whose key is equivalent to k. + //! + //! Complexity: Logarithmic in general, but amortized constant if value + //! is inserted right before p. + template + BOOST_CONTAINER_FORCEINLINE iterator try_emplace(const_iterator hint, const key_type &k, BOOST_FWD_REF(Args)... args) + { return this->base_t::try_emplace(hint, k, boost::forward(args)...).first; } + + //! Requires: value_type shall be EmplaceConstructible into map from piecewise_construct, + //! forward_as_tuple(move(k)), forward_as_tuple(forward(args)...). + //! + //! Effects: If the map already contains an element whose key is equivalent to k, there is no effect. Otherwise + //! inserts an object of type value_type constructed with piecewise_construct, forward_as_tuple(move(k)), + //! forward_as_tuple(forward(args)...). + //! + //! Returns: The bool component of the returned pair is true if and only if the + //! insertion took place. The returned iterator points to the map element whose key is equivalent to k. + //! + //! Complexity: Logarithmic. + template + BOOST_CONTAINER_FORCEINLINE std::pair try_emplace(BOOST_RV_REF(key_type) k, BOOST_FWD_REF(Args)... args) + { return this->base_t::try_emplace(const_iterator(), boost::move(k), boost::forward(args)...); } + + //! Requires: value_type shall be EmplaceConstructible into map from piecewise_construct, + //! forward_as_tuple(move(k)), forward_as_tuple(forward(args)...). + //! + //! Effects: If the map already contains an element whose key is equivalent to k, there is no effect. Otherwise + //! inserts an object of type value_type constructed with piecewise_construct, forward_as_tuple(move(k)), + //! forward_as_tuple(forward(args)...). + //! + //! Returns: The returned iterator points to the map element whose key is equivalent to k. + //! + //! Complexity: Logarithmic in general, but amortized constant if value + //! is inserted right before p. + template + BOOST_CONTAINER_FORCEINLINE iterator try_emplace(const_iterator hint, BOOST_RV_REF(key_type) k, BOOST_FWD_REF(Args)... args) + { return this->base_t::try_emplace(hint, boost::move(k), boost::forward(args)...).first; } + #else // !defined(BOOST_NO_CXX11_VARIADIC_TEMPLATES) #define BOOST_CONTAINER_MAP_EMPLACE_CODE(N) \ BOOST_MOVE_TMPL_LT##N BOOST_MOVE_CLASS##N BOOST_MOVE_GT##N \ - std::pair emplace(BOOST_MOVE_UREF##N)\ + BOOST_CONTAINER_FORCEINLINE std::pair emplace(BOOST_MOVE_UREF##N)\ { return this->base_t::emplace_unique(BOOST_MOVE_FWD##N); }\ \ BOOST_MOVE_TMPL_LT##N BOOST_MOVE_CLASS##N BOOST_MOVE_GT##N \ - iterator emplace_hint(const_iterator hint BOOST_MOVE_I##N BOOST_MOVE_UREF##N)\ + BOOST_CONTAINER_FORCEINLINE iterator emplace_hint(const_iterator hint BOOST_MOVE_I##N BOOST_MOVE_UREF##N)\ { return this->base_t::emplace_hint_unique(hint BOOST_MOVE_I##N BOOST_MOVE_FWD##N); }\ + \ + BOOST_MOVE_TMPL_LT##N BOOST_MOVE_CLASS##N BOOST_MOVE_GT##N \ + BOOST_CONTAINER_FORCEINLINE std::pair try_emplace(const key_type& k BOOST_MOVE_I##N BOOST_MOVE_UREF##N)\ + { return this->base_t::try_emplace(const_iterator(), k BOOST_MOVE_I##N BOOST_MOVE_FWD##N); }\ + \ + BOOST_MOVE_TMPL_LT##N BOOST_MOVE_CLASS##N BOOST_MOVE_GT##N \ + BOOST_CONTAINER_FORCEINLINE iterator try_emplace(const_iterator hint, const key_type &k BOOST_MOVE_I##N BOOST_MOVE_UREF##N)\ + { return this->base_t::try_emplace(hint, k BOOST_MOVE_I##N BOOST_MOVE_FWD##N).first; }\ + \ + BOOST_MOVE_TMPL_LT##N BOOST_MOVE_CLASS##N BOOST_MOVE_GT##N \ + BOOST_CONTAINER_FORCEINLINE std::pair try_emplace(BOOST_RV_REF(key_type) k BOOST_MOVE_I##N BOOST_MOVE_UREF##N)\ + { return this->base_t::try_emplace(const_iterator(), boost::move(k) BOOST_MOVE_I##N BOOST_MOVE_FWD##N); }\ + \ + BOOST_MOVE_TMPL_LT##N BOOST_MOVE_CLASS##N BOOST_MOVE_GT##N \ + BOOST_CONTAINER_FORCEINLINE iterator try_emplace(const_iterator hint, BOOST_RV_REF(key_type) k BOOST_MOVE_I##N BOOST_MOVE_UREF##N)\ + { return this->base_t::try_emplace(hint, boost::move(k) BOOST_MOVE_I##N BOOST_MOVE_FWD##N).first; }\ // BOOST_MOVE_ITERATE_0TO9(BOOST_CONTAINER_MAP_EMPLACE_CODE) #undef BOOST_CONTAINER_MAP_EMPLACE_CODE @@ -715,6 +948,74 @@ class map //! Complexity: log(size())+N where N is the distance from first to last. iterator erase(const_iterator first, const_iterator last) BOOST_NOEXCEPT_OR_NOTHROW; + #endif + + //! Effects: Removes the first element in the container with key equivalent to k. + //! + //! Returns: A node_type owning the element if found, otherwise an empty node_type. + //! + //! Complexity: log(a.size()). + node_type extract(const key_type& k) + { + typename base_t::node_type base_nh(this->base_t::extract(k)); + node_type nh(boost::move(base_nh)); + return BOOST_MOVE_RET(node_type, nh); + } + + //! Effects: Removes the element pointed to by "position". + //! + //! Returns: A node_type owning the element, otherwise an empty node_type. + //! + //! Complexity: Amortized constant. + node_type extract(const_iterator position) + { + typename base_t::node_type base_nh(this->base_t::extract(position)); + node_type nh(boost::move(base_nh)); + return BOOST_MOVE_RET(node_type, nh); + } + + //! Requires: this->get_allocator() == source.get_allocator(). + //! + //! Effects: Attempts to extract each element in source and insert it into a using + //! the comparison object of *this. If there is an element in a with key equivalent to the + //! key of an element from source, then that element is not extracted from source. + //! + //! Postcondition: Pointers and references to the transferred elements of source refer + //! to those same elements but as members of *this. Iterators referring to the transferred + //! elements will continue to refer to their elements, but they now behave as iterators into *this, + //! not into source. + //! + //! Throws: Nothing unless the comparison object throws. + //! + //! Complexity: N log(a.size() + N) (N has the value source.size()) + template + BOOST_CONTAINER_FORCEINLINE void merge(map& source) + { + typedef container_detail::tree + base2_t; + this->merge_unique(static_cast(source)); + } + + //! @copydoc ::boost::container::map::merge(map&) + template + BOOST_CONTAINER_FORCEINLINE void merge(BOOST_RV_REF_BEG map BOOST_RV_REF_END source) + { return this->merge(static_cast&>(source)); } + + //! @copydoc ::boost::container::map::merge(map&) + template + BOOST_CONTAINER_FORCEINLINE void merge(multimap& source) + { + typedef container_detail::tree + base2_t; + this->base_t::merge_unique(static_cast(source)); + } + + //! @copydoc ::boost::container::map::merge(map&) + template + BOOST_CONTAINER_FORCEINLINE void merge(BOOST_RV_REF_BEG multimap BOOST_RV_REF_END source) + { return this->merge(static_cast&>(source)); } + + #if defined(BOOST_CONTAINER_DOXYGEN_INVOKED) //! Effects: Swaps the contents of *this and x. //! //! Throws: Nothing. @@ -760,7 +1061,7 @@ class map //! Returns: The number of elements with key equivalent to x. //! //! Complexity: log(size())+count(k) - size_type count(const key_type& x) const + BOOST_CONTAINER_FORCEINLINE size_type count(const key_type& x) const { return static_cast(this->find(x) != this->cend()); } #if defined(BOOST_CONTAINER_DOXYGEN_INVOKED) @@ -843,33 +1144,11 @@ class map #ifndef BOOST_CONTAINER_DOXYGEN_INVOKED private: - mapped_type& priv_subscript(const key_type &k) + template + BOOST_CONTAINER_FORCEINLINE mapped_type& priv_subscript(BOOST_FWD_REF(KeyConvertible) k) { - //we can optimize this - iterator i = this->lower_bound(k); - // i->first is greater than or equivalent to k. - if (i == this->end() || this->key_comp()(k, (*i).first)){ - container_detail::value_init m; - movable_value_type val(k, boost::move(m.m_t)); - i = insert(i, boost::move(val)); - } - return (*i).second; + return this->try_emplace(boost::forward(k)).first->second; } - - mapped_type& priv_subscript(BOOST_RV_REF(key_type) mk) - { - key_type &k = mk; - //we can optimize this - iterator i = this->lower_bound(k); - // i->first is greater than or equivalent to k. - if (i == this->end() || this->key_comp()(k, (*i).first)){ - container_detail::value_init m; - movable_value_type val(boost::move(k), boost::move(m.m_t)); - i = insert(i, boost::move(val)); - } - return (*i).second; - } - #endif //#ifndef BOOST_CONTAINER_DOXYGEN_INVOKED }; @@ -909,34 +1188,33 @@ namespace container { //! \tparam Compare is the ordering function for Keys (e.g. std::less). //! \tparam Allocator is the allocator to allocate the value_types //! (e.g. allocator< std::pair > ). -//! \tparam MultiMapOptions is an packed option type generated using using boost::container::tree_assoc_options. +//! \tparam Options is an packed option type generated using using boost::container::tree_assoc_options. template < class Key, class T, class Compare = std::less - , class Allocator = new_allocator< std::pair< const Key, T> >, class MultiMapOptions = tree_assoc_defaults> + , class Allocator = new_allocator< std::pair< const Key, T> >, class Options = tree_assoc_defaults> #else -template +template #endif class multimap ///@cond : public container_detail::tree - < Key, std::pair - , container_detail::select1st< std::pair > - , Compare, Allocator, MultiMapOptions> + < std::pair + , container_detail::select1st + , Compare, Allocator, Options> ///@endcond { #ifndef BOOST_CONTAINER_DOXYGEN_INVOKED private: BOOST_COPYABLE_AND_MOVABLE(multimap) - typedef std::pair value_type_impl; + typedef container_detail::select1st select_1st_t; + typedef std::pair value_type_impl; typedef container_detail::tree - , Compare, Allocator, MultiMapOptions> base_t; - typedef container_detail::pair movable_value_type_impl; - typedef container_detail::tree_value_compare - < Key, value_type_impl, Compare, container_detail::select1st - > value_compare_impl; + base_t; + typedef container_detail::pair movable_value_type_impl; + typedef typename base_t::value_compare value_compare_impl; #endif //#ifndef BOOST_CONTAINER_DOXYGEN_INVOKED - typedef ::boost::container::allocator_traits allocator_traits_type; + typedef ::boost::container::allocator_traits allocator_traits_type; public: ////////////////////////////////////////////// @@ -964,6 +1242,12 @@ class multimap typedef typename BOOST_CONTAINER_IMPDEF(base_t::const_reverse_iterator) const_reverse_iterator; typedef std::pair nonconst_value_type; typedef BOOST_CONTAINER_IMPDEF(movable_value_type_impl) movable_value_type; + typedef BOOST_CONTAINER_IMPDEF(node_handle< + typename base_t::node_type::container_node_type + BOOST_MOVE_I value_type + BOOST_MOVE_I allocator_type + BOOST_MOVE_I pair_key_mapped_of_value + >) node_type; ////////////////////////////////////////////// // @@ -974,7 +1258,9 @@ class multimap //! Effects: Default constructs an empty multimap. //! //! Complexity: Constant. - multimap() + BOOST_CONTAINER_FORCEINLINE + multimap() BOOST_NOEXCEPT_IF(container_detail::is_nothrow_default_constructible::value && + container_detail::is_nothrow_default_constructible::value) : base_t() { //A type must be std::pair @@ -984,6 +1270,7 @@ class multimap //! Effects: Constructs an empty multimap using the specified allocator. //! //! Complexity: Constant. + BOOST_CONTAINER_FORCEINLINE explicit multimap(const Compare& comp, const allocator_type& a = allocator_type()) : base_t(comp, a) { @@ -995,6 +1282,7 @@ class multimap //! object and allocator. //! //! Complexity: Constant. + BOOST_CONTAINER_FORCEINLINE explicit multimap(const allocator_type& a) : base_t(a) { @@ -1008,6 +1296,7 @@ class multimap //! Complexity: Linear in N if the range [first ,last ) is already sorted using //! comp and otherwise N logN, where N is last - first. template + BOOST_CONTAINER_FORCEINLINE multimap(InputIterator first, InputIterator last, const Compare& comp = Compare(), const allocator_type& a = allocator_type()) @@ -1017,13 +1306,13 @@ class multimap BOOST_STATIC_ASSERT((container_detail::is_same, typename Allocator::value_type>::value)); } - //! Effects: Constructs an empty multimap using the specified + //! Effects: Constructs an empty multimap using the specified //! allocator, and inserts elements from the range [first ,last ). //! //! Complexity: Linear in N if the range [first ,last ) is already sorted using //! comp and otherwise N logN, where N is last - first. template - multimap(InputIterator first, InputIterator last, const allocator_type& a) + BOOST_CONTAINER_FORCEINLINE multimap(InputIterator first, InputIterator last, const allocator_type& a) : base_t(false, first, last, Compare(), a) { //A type must be std::pair @@ -1040,7 +1329,7 @@ class multimap //! //! Note: Non-standard extension. template - multimap(ordered_range_t, InputIterator first, InputIterator last, const Compare& comp = Compare(), + BOOST_CONTAINER_FORCEINLINE multimap(ordered_range_t, InputIterator first, InputIterator last, const Compare& comp = Compare(), const allocator_type& a = allocator_type()) : base_t(ordered_range, first, last, comp, a) {} @@ -1051,6 +1340,7 @@ class multimap //! //! Complexity: Linear in N if the range [first ,last ) is already sorted using //! comp and otherwise N logN, where N is il.first() - il.end(). + BOOST_CONTAINER_FORCEINLINE multimap(std::initializer_list il, const Compare& comp = Compare(), const allocator_type& a = allocator_type()) : base_t(false, il.begin(), il.end(), comp, a) @@ -1064,6 +1354,7 @@ class multimap //! //! Complexity: Linear in N if the range [first ,last ) is already sorted using //! comp and otherwise N logN, where N is il.first() - il.end(). + BOOST_CONTAINER_FORCEINLINE multimap(std::initializer_list il, const allocator_type& a) : base_t(false, il.begin(), il.end(), Compare(), a) { @@ -1080,6 +1371,7 @@ class multimap //! Complexity: Linear in N. //! //! Note: Non-standard extension. + BOOST_CONTAINER_FORCEINLINE multimap(ordered_range_t, std::initializer_list il, const Compare& comp = Compare(), const allocator_type& a = allocator_type()) : base_t(ordered_range, il.begin(), il.end(), comp, a) @@ -1092,7 +1384,7 @@ class multimap //! Effects: Copy constructs a multimap. //! //! Complexity: Linear in x.size(). - multimap(const multimap& x) + BOOST_CONTAINER_FORCEINLINE multimap(const multimap& x) : base_t(static_cast(x)) { //A type must be std::pair @@ -1104,7 +1396,8 @@ class multimap //! Complexity: Constant. //! //! Postcondition: x is emptied. - multimap(BOOST_RV_REF(multimap) x) + BOOST_CONTAINER_FORCEINLINE multimap(BOOST_RV_REF(multimap) x) + BOOST_NOEXCEPT_IF(boost::container::container_detail::is_nothrow_move_constructible::value) : base_t(BOOST_MOVE_BASE(base_t, x)) { //A type must be std::pair @@ -1114,7 +1407,7 @@ class multimap //! Effects: Copy constructs a multimap. //! //! Complexity: Linear in x.size(). - multimap(const multimap& x, const allocator_type &a) + BOOST_CONTAINER_FORCEINLINE multimap(const multimap& x, const allocator_type &a) : base_t(static_cast(x), a) { //A type must be std::pair @@ -1126,7 +1419,7 @@ class multimap //! Complexity: Constant if a == x.get_allocator(), linear otherwise. //! //! Postcondition: x is emptied. - multimap(BOOST_RV_REF(multimap) x, const allocator_type &a) + BOOST_CONTAINER_FORCEINLINE multimap(BOOST_RV_REF(multimap) x, const allocator_type &a) : base_t(BOOST_MOVE_BASE(base_t, x), a) { //A type must be std::pair @@ -1136,21 +1429,22 @@ class multimap //! Effects: Makes *this a copy of x. //! //! Complexity: Linear in x.size(). - multimap& operator=(BOOST_COPY_ASSIGN_REF(multimap) x) + BOOST_CONTAINER_FORCEINLINE multimap& operator=(BOOST_COPY_ASSIGN_REF(multimap) x) { return static_cast(this->base_t::operator=(static_cast(x))); } //! Effects: this->swap(x.get()). //! //! Complexity: Constant. - multimap& operator=(BOOST_RV_REF(multimap) x) - BOOST_NOEXCEPT_IF( allocator_traits_type::is_always_equal::value - && boost::container::container_detail::is_nothrow_move_assignable::value ) + BOOST_CONTAINER_FORCEINLINE multimap& operator=(BOOST_RV_REF(multimap) x) + BOOST_NOEXCEPT_IF( (allocator_traits_type::propagate_on_container_move_assignment::value || + allocator_traits_type::is_always_equal::value) && + boost::container::container_detail::is_nothrow_move_assignable::value) { return static_cast(this->base_t::operator=(BOOST_MOVE_BASE(base_t, x))); } #if !defined(BOOST_NO_CXX11_HDR_INITIALIZER_LIST) //! Effects: Assign content of il to *this. //! - multimap& operator=(std::initializer_list il) + BOOST_CONTAINER_FORCEINLINE multimap& operator=(std::initializer_list il) { this->clear(); insert(il.begin(), il.end()); @@ -1228,7 +1522,7 @@ class multimap //! Complexity: Logarithmic in general, but amortized constant if t //! is inserted right before p. template - iterator emplace(BOOST_FWD_REF(Args)... args) + BOOST_CONTAINER_FORCEINLINE iterator emplace(BOOST_FWD_REF(Args)... args) { return this->base_t::emplace_equal(boost::forward(args)...); } //! Effects: Inserts an object of type T constructed with @@ -1241,18 +1535,18 @@ class multimap //! Complexity: Logarithmic in general, but amortized constant if t //! is inserted right before p. template - iterator emplace_hint(const_iterator p, BOOST_FWD_REF(Args)... args) + BOOST_CONTAINER_FORCEINLINE iterator emplace_hint(const_iterator p, BOOST_FWD_REF(Args)... args) { return this->base_t::emplace_hint_equal(p, boost::forward(args)...); } #else // !defined(BOOST_NO_CXX11_VARIADIC_TEMPLATES) #define BOOST_CONTAINER_MULTIMAP_EMPLACE_CODE(N) \ BOOST_MOVE_TMPL_LT##N BOOST_MOVE_CLASS##N BOOST_MOVE_GT##N \ - iterator emplace(BOOST_MOVE_UREF##N)\ + BOOST_CONTAINER_FORCEINLINE iterator emplace(BOOST_MOVE_UREF##N)\ { return this->base_t::emplace_equal(BOOST_MOVE_FWD##N); }\ \ BOOST_MOVE_TMPL_LT##N BOOST_MOVE_CLASS##N BOOST_MOVE_GT##N \ - iterator emplace_hint(const_iterator hint BOOST_MOVE_I##N BOOST_MOVE_UREF##N)\ + BOOST_CONTAINER_FORCEINLINE iterator emplace_hint(const_iterator hint BOOST_MOVE_I##N BOOST_MOVE_UREF##N)\ { return this->base_t::emplace_hint_equal(hint BOOST_MOVE_I##N BOOST_MOVE_FWD##N); }\ // BOOST_MOVE_ITERATE_0TO9(BOOST_CONTAINER_MULTIMAP_EMPLACE_CODE) @@ -1264,29 +1558,29 @@ class multimap //! newly inserted element. //! //! Complexity: Logarithmic. - iterator insert(const value_type& x) + BOOST_CONTAINER_FORCEINLINE iterator insert(const value_type& x) { return this->base_t::insert_equal(x); } //! Effects: Inserts a new value constructed from x and returns //! the iterator pointing to the newly inserted element. //! //! Complexity: Logarithmic. - iterator insert(const nonconst_value_type& x) - { return this->base_t::insert_equal(x); } + BOOST_CONTAINER_FORCEINLINE iterator insert(const nonconst_value_type& x) + { return this->base_t::emplace_equal(x); } //! Effects: Inserts a new value move-constructed from x and returns //! the iterator pointing to the newly inserted element. //! //! Complexity: Logarithmic. - iterator insert(BOOST_RV_REF(nonconst_value_type) x) - { return this->base_t::insert_equal(boost::move(x)); } + BOOST_CONTAINER_FORCEINLINE iterator insert(BOOST_RV_REF(nonconst_value_type) x) + { return this->base_t::emplace_equal(boost::move(x)); } //! Effects: Inserts a new value move-constructed from x and returns //! the iterator pointing to the newly inserted element. //! //! Complexity: Logarithmic. iterator insert(BOOST_RV_REF(movable_value_type) x) - { return this->base_t::insert_equal(boost::move(x)); } + { return this->base_t::emplace_equal(boost::move(x)); } //! Effects: Inserts a copy of x in the container. //! p is a hint pointing to where the insert should start to search. @@ -1296,7 +1590,7 @@ class multimap //! //! Complexity: Logarithmic in general, but amortized constant if t //! is inserted right before p. - iterator insert(const_iterator p, const value_type& x) + BOOST_CONTAINER_FORCEINLINE iterator insert(const_iterator p, const value_type& x) { return this->base_t::insert_equal(p, x); } //! Effects: Inserts a new value constructed from x in the container. @@ -1307,8 +1601,8 @@ class multimap //! //! Complexity: Logarithmic in general, but amortized constant if t //! is inserted right before p. - iterator insert(const_iterator p, const nonconst_value_type& x) - { return this->base_t::insert_equal(p, x); } + BOOST_CONTAINER_FORCEINLINE iterator insert(const_iterator p, const nonconst_value_type& x) + { return this->base_t::emplace_hint_equal(p, x); } //! Effects: Inserts a new value move constructed from x in the container. //! p is a hint pointing to where the insert should start to search. @@ -1318,8 +1612,8 @@ class multimap //! //! Complexity: Logarithmic in general, but amortized constant if t //! is inserted right before p. - iterator insert(const_iterator p, BOOST_RV_REF(nonconst_value_type) x) - { return this->base_t::insert_equal(p, boost::move(x)); } + BOOST_CONTAINER_FORCEINLINE iterator insert(const_iterator p, BOOST_RV_REF(nonconst_value_type) x) + { return this->base_t::emplace_hint_equal(p, boost::move(x)); } //! Effects: Inserts a new value move constructed from x in the container. //! p is a hint pointing to where the insert should start to search. @@ -1329,8 +1623,8 @@ class multimap //! //! Complexity: Logarithmic in general, but amortized constant if t //! is inserted right before p. - iterator insert(const_iterator p, BOOST_RV_REF(movable_value_type) x) - { return this->base_t::insert_equal(p, boost::move(x)); } + BOOST_CONTAINER_FORCEINLINE iterator insert(const_iterator p, BOOST_RV_REF(movable_value_type) x) + { return this->base_t::emplace_hint_equal(p, boost::move(x)); } //! Requires: first, last are not iterators into *this. //! @@ -1338,17 +1632,42 @@ class multimap //! //! Complexity: At most N log(size()+N) (N is the distance from first to last) template - void insert(InputIterator first, InputIterator last) + BOOST_CONTAINER_FORCEINLINE void insert(InputIterator first, InputIterator last) { this->base_t::insert_equal(first, last); } #if !defined(BOOST_NO_CXX11_HDR_INITIALIZER_LIST) //! Effects: inserts each element from the range [il.begin(), il.end(). //! //! Complexity: At most N log(size()+N) (N is the distance from il.begin() to il.end()) - void insert(std::initializer_list il) + BOOST_CONTAINER_FORCEINLINE void insert(std::initializer_list il) { this->base_t::insert_equal(il.begin(), il.end()); } #endif + //! Requires: nh is empty or this->get_allocator() == nh.get_allocator(). + //! + //! Effects/Returns: If nh is empty, has no effect and returns end(). Otherwise, inserts + //! the element owned by nh and returns an iterator pointing to the newly inserted element. + //! If a range containing elements with keys equivalent to nh.key() exists, + //! the element is inserted at the end of that range. nh is always emptied. + //! + //! Complexity: Logarithmic + iterator insert(BOOST_RV_REF_BEG_IF_CXX11 node_type BOOST_RV_REF_END_IF_CXX11 nh) + { + typename base_t::node_type n(boost::move(nh)); + return this->base_t::insert_equal_node(boost::move(n)); + } + + //! Effects: Same as `insert(node_type && nh)` but the element is inserted as close as possible + //! to the position just prior to "hint". + //! + //! Complexity: logarithmic in general, but amortized constant if the element is inserted + //! right before "hint". + iterator insert(const_iterator hint, BOOST_RV_REF_BEG_IF_CXX11 node_type BOOST_RV_REF_END_IF_CXX11 nh) + { + typename base_t::node_type n(boost::move(nh)); + return this->base_t::insert_equal_node(hint, boost::move(n)); + } + #if defined(BOOST_CONTAINER_DOXYGEN_INVOKED) //! @copydoc ::boost::container::set::erase(const_iterator) @@ -1359,7 +1678,63 @@ class multimap //! @copydoc ::boost::container::set::erase(const_iterator,const_iterator) iterator erase(const_iterator first, const_iterator last); + #endif + //! @copydoc ::boost::container::map::extract(const key_type&) + node_type extract(const key_type& k) + { + typename base_t::node_type base_nh(this->base_t::extract(k)); + return node_type(boost::move(base_nh)); + } + + //! @copydoc ::boost::container::map::extract(const_iterator) + node_type extract(const_iterator position) + { + typename base_t::node_type base_nh(this->base_t::extract(position)); + return node_type (boost::move(base_nh)); + } + + //! Requires: this->get_allocator() == source.get_allocator(). + //! + //! Effects: Extracts each element in source and insert it into a using + //! the comparison object of *this. + //! + //! Postcondition: Pointers and references to the transferred elements of source refer + //! to those same elements but as members of *this. Iterators referring to the transferred + //! elements will continue to refer to their elements, but they now behave as iterators into *this, + //! not into source. + //! + //! Throws: Nothing unless the comparison object throws. + //! + //! Complexity: N log(a.size() + N) (N has the value source.size()) + template + void merge(multimap& source) + { + typedef container_detail::tree + base2_t; + this->base_t::merge_equal(static_cast(source)); + } + + //! @copydoc ::boost::container::multimap::merge(multimap&) + template + void merge(BOOST_RV_REF_BEG multimap BOOST_RV_REF_END source) + { return this->merge(static_cast&>(source)); } + + //! @copydoc ::boost::container::multimap::merge(multimap&) + template + void merge(map& source) + { + typedef container_detail::tree + base2_t; + this->base_t::merge_equal(static_cast(source)); + } + + //! @copydoc ::boost::container::multimap::merge(multimap&) + template + void merge(BOOST_RV_REF_BEG map BOOST_RV_REF_END source) + { return this->merge(static_cast&>(source)); } + + #if defined(BOOST_CONTAINER_DOXYGEN_INVOKED) //! @copydoc ::boost::container::set::swap void swap(multiset& x) BOOST_NOEXCEPT_IF( allocator_traits_type::is_always_equal::value diff --git a/3party/boost/boost/container/new_allocator.hpp b/3party/boost/boost/container/new_allocator.hpp index 1ac15d8a25..51065efa73 100644 --- a/3party/boost/boost/container/new_allocator.hpp +++ b/3party/boost/boost/container/new_allocator.hpp @@ -29,6 +29,8 @@ namespace boost { namespace container { +/// @cond + template struct new_allocator_bool { static const bool value = Value; }; @@ -36,6 +38,8 @@ struct new_allocator_bool template class new_allocator; +/// @endcond + //! Specialization of new_allocator for void types template<> class new_allocator @@ -136,9 +140,9 @@ class new_allocator //!Throws std::bad_alloc if there is no enough memory pointer allocate(size_type count) { - if(BOOST_UNLIKELY(count > this->max_size())) - throw_bad_alloc(); - return static_cast(::operator new(count*sizeof(T))); + if(BOOST_UNLIKELY(count > this->max_size())) + throw_bad_alloc(); + return static_cast(::operator new(count*sizeof(T))); } //!Deallocates previously allocated memory. @@ -172,4 +176,4 @@ class new_allocator #include -#endif //BOOST_CONTAINER_ALLOCATOR_HPP +#endif //BOOST_CONTAINER_NEW_ALLOCATOR_HPP diff --git a/3party/boost/boost/container/node_allocator.hpp b/3party/boost/boost/container/node_allocator.hpp index c3d809078f..7a6988c4b0 100644 --- a/3party/boost/boost/container/node_allocator.hpp +++ b/3party/boost/boost/container/node_allocator.hpp @@ -26,7 +26,7 @@ #include #include #include -#include +#include #include #include @@ -109,9 +109,6 @@ class node_allocator template node_allocator& operator= (const node_allocator&); - - //!Not assignable from other node_allocator - node_allocator& operator=(const node_allocator&); #endif //#ifndef BOOST_CONTAINER_DOXYGEN_INVOKED public: @@ -157,7 +154,7 @@ class node_allocator return pointer(static_cast(singleton_t::instance().allocate_node())); } else{ - void *ret = boost_cont_malloc(count*sizeof(T)); + void *ret = dlmalloc_malloc(count*sizeof(T)); if(BOOST_UNLIKELY(!ret)) boost::container::throw_bad_alloc(); return static_cast(ret); @@ -176,7 +173,7 @@ class node_allocator singleton_t::instance().deallocate_node(ptr); } else{ - boost_cont_free(ptr); + dlmalloc_free(ptr); } } @@ -204,7 +201,7 @@ class node_allocator size_type size(pointer p) const BOOST_NOEXCEPT_OR_NOTHROW { BOOST_STATIC_ASSERT(( Version > 1 )); - return boost_cont_size(p); + return dlmalloc_size(p); } //!Allocates just one object. Memory allocated with this function @@ -259,9 +256,9 @@ class node_allocator void allocate_many(size_type elem_size, std::size_t n_elements, multiallocation_chain &chain) { BOOST_STATIC_ASSERT(( Version > 1 )); - boost_cont_memchain ch; + dlmalloc_memchain ch; BOOST_CONTAINER_MEMCHAIN_INIT(&ch); - if(BOOST_UNLIKELY(!boost_cont_multialloc_nodes(n_elements, elem_size*sizeof(T), DL_MULTIALLOC_DEFAULT_CONTIGUOUS, &ch))){ + if(BOOST_UNLIKELY(!dlmalloc_multialloc_nodes(n_elements, elem_size*sizeof(T), DL_MULTIALLOC_DEFAULT_CONTIGUOUS, &ch))){ boost::container::throw_bad_alloc(); } chain.incorporate_after( chain.before_begin() @@ -275,8 +272,8 @@ class node_allocator void allocate_many(const size_type *elem_sizes, size_type n_elements, multiallocation_chain &chain) { BOOST_STATIC_ASSERT(( Version > 1 )); - boost_cont_memchain ch; - boost_cont_multialloc_arrays(n_elements, elem_sizes, sizeof(T), DL_MULTIALLOC_DEFAULT_CONTIGUOUS, &ch); + dlmalloc_memchain ch; + dlmalloc_multialloc_arrays(n_elements, elem_sizes, sizeof(T), DL_MULTIALLOC_DEFAULT_CONTIGUOUS, &ch); if(BOOST_UNLIKELY(BOOST_CONTAINER_MEMCHAIN_EMPTY(&ch))){ boost::container::throw_bad_alloc(); } @@ -292,9 +289,9 @@ class node_allocator void *first = &*chain.begin(); void *last = &*chain.last(); size_t num = chain.size(); - boost_cont_memchain ch; + dlmalloc_memchain ch; BOOST_CONTAINER_MEMCHAIN_INIT_FROM(&ch, first, last, num); - boost_cont_multidealloc(&ch); + dlmalloc_multidealloc(&ch); } //!Swaps allocators. Does not throw. If each allocator is placed in a @@ -319,7 +316,7 @@ class node_allocator ,pointer &reuse) { std::size_t const preferred_size = prefer_in_recvd_out_size; - boost_cont_command_ret_t ret = {0 , 0}; + dlmalloc_command_ret_t ret = {0 , 0}; if((limit_size > this->max_size()) | (preferred_size > this->max_size())){ return pointer(); } @@ -328,7 +325,7 @@ class node_allocator std::size_t r_size; { void* reuse_ptr_void = reuse; - ret = boost_cont_allocation_command(command, sizeof(T), l_size, p_size, &r_size, reuse_ptr_void); + ret = dlmalloc_allocation_command(command, sizeof(T), l_size, p_size, &r_size, reuse_ptr_void); reuse = static_cast(reuse_ptr_void); } prefer_in_recvd_out_size = r_size/sizeof(T); diff --git a/3party/boost/boost/container/node_handle.hpp b/3party/boost/boost/container/node_handle.hpp new file mode 100644 index 0000000000..c46313cc4f --- /dev/null +++ b/3party/boost/boost/container/node_handle.hpp @@ -0,0 +1,399 @@ +////////////////////////////////////////////////////////////////////////////// +// +// (C) Copyright Ion Gaztanaga 2016-2016. 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) +// +// See http://www.boost.org/libs/container for documentation. +// +////////////////////////////////////////////////////////////////////////////// + +#ifndef BOOST_CONTAINER_NODE_HANDLE_HPP +#define BOOST_CONTAINER_NODE_HANDLE_HPP + +#ifndef BOOST_CONFIG_HPP +# include +#endif + +#if defined(BOOST_HAS_PRAGMA_ONCE) +# pragma once +#endif + +#include +#include +#include +#include +#include +#include +#include + +#include +#include + +#include + + +//!\file + +namespace boost { +namespace container { + +///@cond + +template::value> +struct node_handle_keymapped_traits +{ + typedef Value key_type; + typedef Value mapped_type; +}; + +template +struct node_handle_keymapped_traits +{ + typedef typename KeyMapped::key_type key_type; + typedef typename KeyMapped::mapped_type mapped_type; +}; + +///@endcond + +//! A node_handle is an object that accepts ownership of a single element from an associative container. +//! It may be used to transfer that ownership to another container with compatible nodes. Containers +//! with compatible nodes have the same node handle type. Elements may be transferred in either direction +//! between container types in the same row:. +//! +//! Container types with compatible nodes +//! +//! map <-> map +//! +//! map <-> multimap +//! +//! set <-> set +//! +//! set <-> multiset +//! +//! If a node handle is not empty, then it contains an allocator that is equal to the allocator of the container +//! when the element was extracted. If a node handle is empty, it contains no allocator. +template +class node_handle +{ + typedef node_handle_keymapped_traits keymapped_t; + + public: + typedef Value value_type; + typedef typename keymapped_t::key_type key_type; + typedef typename keymapped_t::mapped_type mapped_type; + typedef Allocator allocator_type; + typedef NodeType container_node_type; + + ///@cond + private: + BOOST_MOVABLE_BUT_NOT_COPYABLE(node_handle) + + typedef allocator_traits ator_traits; + typedef typename ator_traits::template portable_rebind_alloc + ::type nallocator_type; + typedef allocator_traits node_ator_traits; + typedef typename node_ator_traits::pointer node_pointer; + typedef ::boost::aligned_storage + ::value> nalloc_storage_t; + + node_pointer m_ptr; + nalloc_storage_t m_nalloc_storage; + + void move_construct_alloc(nallocator_type &al) + { ::new(m_nalloc_storage.address(), boost_container_new_t()) allocator_type(::boost::move(al)); } + + void destroy_node() + { + node_ator_traits::destroy(this->node_alloc(), container_detail::to_raw_pointer(m_ptr)); + node_ator_traits::deallocate(this->node_alloc(), m_ptr, 1u); + } + + template + void move_construct_end(OtherNodeHandle &nh) + { + if(m_ptr){ + ::new (m_nalloc_storage.address(), boost_container_new_t()) allocator_type(::boost::move(nh.node_alloc())); + nh.destroy_alloc(); + nh.get_node_pointer() = node_pointer(); + } + BOOST_ASSERT(nh.empty()); + } + + public: + + void destroy_alloc() + { static_cast(m_nalloc_storage.address())->~allocator_type(); } + + node_pointer &get_node_pointer() + { return m_ptr; } + + nallocator_type &node_alloc() + { return *static_cast(m_nalloc_storage.address()); } + + const nallocator_type &node_alloc() const + { return *static_cast(m_nalloc_storage.address()); } + + node_pointer release() + { + node_pointer p(m_ptr); + m_ptr = node_pointer(); + if(p) + this->destroy_alloc(); + return p; + } + + ///@endcond + + public: + //! Effects: Initializes m_ptr to nullptr. + //! + //! Postcondition: this->empty() + BOOST_CXX14_CONSTEXPR node_handle() BOOST_NOEXCEPT + : m_ptr(), m_nalloc_storage() + { BOOST_ASSERT(this->empty()); } + + //! Effects: Constructs a node_handle object initializing internal pointer with p. + //! If p != nullptr copy constructs internal allocator al. + node_handle(node_pointer p, const nallocator_type &al) BOOST_NOEXCEPT + : m_ptr(p), m_nalloc_storage() + { + if(m_ptr){ + ::new (m_nalloc_storage.address(), boost_container_new_t()) nallocator_type(al); + } + } + + //! Effects: Constructs a node_handle object initializing internal pointer with a related nh's internal pointer + //! and assigns nullptr to the later. If nh's internal pointer was not nullptr, move constructs internal + //! allocator with nh's internal allocator and destroy nh's internal allocator. + //! + //! Postcondition: nh.empty() + //! + //! Note: Two node_handle's are related if only one of KeyMapped template parameter + //! of a node handle is void. + template + node_handle( BOOST_RV_REF_BEG node_handle BOOST_RV_REF_END nh + , typename container_detail::enable_if_c + < ((unsigned)container_detail::is_same::value + + (unsigned)container_detail::is_same::value) == 1u + >::type* = 0) + : m_ptr(nh.get_node_pointer()), m_nalloc_storage() + { this->move_construct_end(nh); } + + //! Effects: Constructs a node_handle object initializing internal pointer with nh's internal pointer + //! and assigns nullptr to the later. If nh's internal pointer was not nullptr, move constructs internal + //! allocator with nh's internal allocator and destroy nh's internal allocator. + //! + //! Postcondition: nh.empty() + node_handle (BOOST_RV_REF(node_handle) nh) BOOST_NOEXCEPT + : m_ptr(nh.m_ptr), m_nalloc_storage() + { this->move_construct_end(nh); } + + //! Effects: If !this->empty(), destroys the value_type subobject in the container_node_type object + //! pointed to by c by calling allocator_traits::destroy, then deallocates m_ptr by calling + //! ator_traits::rebind_traits::deallocate. + ~node_handle () BOOST_NOEXCEPT + { + if(!this->empty()){ + this->destroy_node(); + this->destroy_alloc(); + } + } + + //! Requires: Either this->empty(), or ator_traits::propagate_on_container_move_assignment is true, or + //! node_alloc() == nh.node_alloc(). + //! + //! Effects: If m_ptr != nullptr, destroys the value_type subobject in the container_node_type object + //! pointed to by m_ptr by calling ator_traits::destroy, then deallocates m_ptr by calling ator_- + //! traits::rebind_traits::deallocate. Assigns nh.m_ptr to m_ptr. If this->empty() + //! or ator_traits::propagate_on_container_move_assignment is true, move assigns nh.node_alloc() to + //! node_alloc(). Assigns nullptr to nh.m_ptr and assigns nullopt to nh.node_alloc(). + //! Returns: *this. + //! + //! Throws: Nothing. + node_handle & operator=(BOOST_RV_REF(node_handle) nh) + { + BOOST_ASSERT(this->empty() || nh.empty() || ator_traits::propagate_on_container_move_assignment::value + || ator_traits::equal(node_alloc(), nh.node_alloc())); + + bool const was_this_non_null = !this->empty(); + bool const was_nh_non_null = !nh.empty(); + + if(was_nh_non_null){ + if(was_this_non_null){ + this->destroy_node(); + if(ator_traits::propagate_on_container_move_assignment::value){ + this->node_alloc() = ::boost::move(nh.node_alloc()); + } + } + else{ + this->move_construct_alloc(nh.node_alloc()); + } + m_ptr = nh.m_ptr; + nh.m_ptr = node_pointer(); + nh.destroy_alloc(); + } + else if(was_this_non_null){ + this->destroy_node(); + this->destroy_alloc(); + m_ptr = node_pointer(); + } + return *this; + } + + //! Requires: empty() == false. + //! + //! Returns: A reference to the value_type subobject in the container_node_type object pointed to by m_ptr + //! + //! Throws: Nothing. + value_type& value() const BOOST_NOEXCEPT + { + BOOST_STATIC_ASSERT((container_detail::is_same::value)); + BOOST_ASSERT(!empty()); + return m_ptr->get_data(); + } + + //! Requires: empty() == false. + //! + //! Returns: A non-const reference to the key_type member of the value_type subobject in the + //! container_node_type object pointed to by m_ptr. + //! + //! Throws: Nothing. + //! + //! Requires: Modifying the key through the returned reference is permitted. + key_type& key() const BOOST_NOEXCEPT + { + BOOST_STATIC_ASSERT((!container_detail::is_same::value)); + BOOST_ASSERT(!empty()); + return const_cast(KeyMapped().key_of_value(m_ptr->get_data())); + } + + //! Requires: empty() == false. + //! + //! Returns: A reference to the mapped_type member of the value_type subobject + //! in the container_node_type object pointed to by m_ptr + //! + //! Throws: Nothing. + mapped_type& mapped() const BOOST_NOEXCEPT + { + BOOST_STATIC_ASSERT((!container_detail::is_same::value)); + BOOST_ASSERT(!empty()); + return KeyMapped().mapped_of_value(m_ptr->get_data()); + } + + //! Requires: empty() == false. + //! + //! Returns: A copy of the internally hold allocator. + //! + //! Throws: Nothing. + allocator_type get_allocator() const + { + BOOST_ASSERT(!empty()); + return this->node_alloc(); + } + + //! Returns: m_ptr != nullptr. + //! + #ifdef BOOST_CONTAINER_DOXYGEN_INVOKED + BOOST_CONTAINER_FORCEINLINE explicit operator bool + #else + private: struct bool_conversion {int for_bool; int for_arg(); }; typedef int bool_conversion::* explicit_bool_arg; + public: BOOST_CONTAINER_FORCEINLINE operator explicit_bool_arg + #endif + ()const BOOST_NOEXCEPT + { return m_ptr ? &bool_conversion::for_bool : explicit_bool_arg(0); } + + //! Returns: m_ptr == nullptr. + //! + bool empty() const BOOST_NOEXCEPT + { + return !this->m_ptr; + } + + //! Requires: this->empty(), or nh.empty(), or ator_traits::propagate_on_container_swap is true, or + //! node_alloc() == nh.node_alloc(). + //! + //! Effects: Calls swap(m_ptr, nh.m_ptr). If this->empty(), or nh.empty(), or ator_traits::propagate_on_- + //! container_swap is true calls swap(node_alloc(), nh.node_alloc()). + void swap(node_handle &nh) + BOOST_NOEXCEPT_IF(ator_traits::propagate_on_container_swap::value || ator_traits::is_always_equal::value) + { + BOOST_ASSERT(this->empty() || nh.empty() || ator_traits::propagate_on_container_swap::value + || ator_traits::equal(node_alloc(), nh.node_alloc())); + + bool const was_this_non_null = !this->empty(); + bool const was_nh_non_null = !nh.empty(); + + if(was_nh_non_null){ + if(was_this_non_null){ + if(ator_traits::propagate_on_container_swap::value){ + ::boost::adl_move_swap(this->node_alloc(), nh.node_alloc()); + } + } + else{ + this->move_construct_alloc(nh.node_alloc()); + nh.destroy_alloc(); + } + } + else if(was_this_non_null){ + nh.move_construct_alloc(this->node_alloc()); + nh.destroy_alloc(); + } + ::boost::adl_move_swap(m_ptr, nh.m_ptr); + } + + //! Effects: x.swap(y). + //! + friend void swap(node_handle & x, node_handle & y) BOOST_NOEXCEPT_IF(BOOST_NOEXCEPT(x.swap(y))) + { x.swap(y); } +}; + +//! A class template used to describe the results of inserting a +//! Container::node_type in a Container with unique keys. +//! Includes at least the following non-static public data members: +//! +//!
  • bool inserted
  • ; +//!
  • Iterator position
  • ; +//!
  • NodeType node
+//! +//! This type is MoveConstructible, MoveAssignable, DefaultConstructible, +//! Destructible, and lvalues of that type are swappable +template +struct insert_return_type_base +{ + private: + BOOST_MOVABLE_BUT_NOT_COPYABLE(insert_return_type_base) + + public: + insert_return_type_base() + : inserted(false), position(), node() + {} + + insert_return_type_base(BOOST_RV_REF(insert_return_type_base) other) + : inserted(other.inserted), position(other.position), node(boost::move(other.node)) + {} + + template + insert_return_type_base(bool insert, RelatedIt it, BOOST_RV_REF(RelatedNode) node) + : inserted(insert), position(it), node(boost::move(node)) + {} + + insert_return_type_base & operator=(BOOST_RV_REF(insert_return_type_base) other) + { + inserted = other.inserted; + position = other.position; + node = boost::move(other.node); + return *this; + } + + bool inserted; + Iterator position; + NodeType node; +}; + +} //namespace container { +} //namespace boost { + +#include + +#endif //BOOST_CONTAINER_NODE_HANDLE_HPP diff --git a/3party/boost/boost/container/pmr/deque.hpp b/3party/boost/boost/container/pmr/deque.hpp new file mode 100644 index 0000000000..acb7da3d0d --- /dev/null +++ b/3party/boost/boost/container/pmr/deque.hpp @@ -0,0 +1,45 @@ +////////////////////////////////////////////////////////////////////////////// +// +// (C) Copyright Ion Gaztanaga 2015-2015. 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) +// +// See http://www.boost.org/libs/container for documentation. +// +////////////////////////////////////////////////////////////////////////////// + +#ifndef BOOST_CONTAINER_PMR_DEQUE_HPP +#define BOOST_CONTAINER_PMR_DEQUE_HPP + +#if defined (_MSC_VER) +# pragma once +#endif + +#include +#include + +namespace boost { +namespace container { +namespace pmr { + +#if !defined(BOOST_NO_CXX11_TEMPLATE_ALIASES) + +template +using deque = boost::container::deque>; + +#endif + +//! A portable metafunction to obtain a deque +//! that uses a polymorphic allocator +template +struct deque_of +{ + typedef boost::container::deque + < T, polymorphic_allocator > type; +}; + +} //namespace pmr { +} //namespace container { +} //namespace boost { + +#endif //BOOST_CONTAINER_PMR_DEQUE_HPP diff --git a/3party/boost/boost/container/pmr/flat_map.hpp b/3party/boost/boost/container/pmr/flat_map.hpp new file mode 100644 index 0000000000..150d5332f2 --- /dev/null +++ b/3party/boost/boost/container/pmr/flat_map.hpp @@ -0,0 +1,67 @@ +////////////////////////////////////////////////////////////////////////////// +// +// (C) Copyright Ion Gaztanaga 2015-2015. 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) +// +// See http://www.boost.org/libs/container for documentation. +// +////////////////////////////////////////////////////////////////////////////// + +#ifndef BOOST_CONTAINER_PMR_FLAT_MAP_HPP +#define BOOST_CONTAINER_PMR_FLAT_MAP_HPP + +#if defined (_MSC_VER) +# pragma once +#endif + +#include +#include + +namespace boost { +namespace container { +namespace pmr { + +#if !defined(BOOST_NO_CXX11_TEMPLATE_ALIASES) + +template + ,class Options = tree_assoc_defaults > +using flat_map = boost::container::flat_map > >; + +template + ,class Options = tree_assoc_defaults > +using flat_multimap = boost::container::flat_multimap > >; + +#endif + +//! A portable metafunction to obtain a flat_map +//! that uses a polymorphic allocator +template + ,class Options = tree_assoc_defaults > +struct flat_map_of +{ + typedef boost::container::flat_map > > type; +}; + +//! A portable metafunction to obtain a flat_multimap +//! that uses a polymorphic allocator +template + ,class Options = tree_assoc_defaults > +struct flat_multimap_of +{ + typedef boost::container::flat_multimap > > type; +}; + +} //namespace pmr { +} //namespace container { +} //namespace boost { + +#endif //BOOST_CONTAINER_PMR_FLAT_MAP_HPP diff --git a/3party/boost/boost/container/pmr/flat_set.hpp b/3party/boost/boost/container/pmr/flat_set.hpp new file mode 100644 index 0000000000..6d4292bfb4 --- /dev/null +++ b/3party/boost/boost/container/pmr/flat_set.hpp @@ -0,0 +1,63 @@ +////////////////////////////////////////////////////////////////////////////// +// +// (C) Copyright Ion Gaztanaga 2015-2015. 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) +// +// See http://www.boost.org/libs/container for documentation. +// +////////////////////////////////////////////////////////////////////////////// + +#ifndef BOOST_CONTAINER_PMR_SET_HPP +#define BOOST_CONTAINER_PMR_SET_HPP + +#if defined (_MSC_VER) +# pragma once +#endif + +#include +#include + +namespace boost { +namespace container { +namespace pmr { + +#if !defined(BOOST_NO_CXX11_TEMPLATE_ALIASES) + +template + ,class Options = tree_assoc_defaults > +using flat_set = boost::container::flat_set >; + +template + ,class Options = tree_assoc_defaults > +using flat_multiset = boost::container::flat_multiset >; + +#endif + +//! A portable metafunction to obtain a flat_set +//! that uses a polymorphic allocator +template + ,class Options = tree_assoc_defaults > +struct flat_set_of +{ + typedef boost::container::flat_set > type; +}; + +//! A portable metafunction to obtain a flat_multiset +//! that uses a polymorphic allocator +template + ,class Options = tree_assoc_defaults > +struct flat_multiset_of +{ + typedef boost::container::flat_multiset > type; +}; + +} //namespace pmr { +} //namespace container { +} //namespace boost { + +#endif //BOOST_CONTAINER_PMR_SET_HPP diff --git a/3party/boost/boost/container/pmr/global_resource.hpp b/3party/boost/boost/container/pmr/global_resource.hpp new file mode 100644 index 0000000000..219309b072 --- /dev/null +++ b/3party/boost/boost/container/pmr/global_resource.hpp @@ -0,0 +1,66 @@ +////////////////////////////////////////////////////////////////////////////// +// +// (C) Copyright Ion Gaztanaga 2015-2015. 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) +// +// See http://www.boost.org/libs/container for documentation. +// +////////////////////////////////////////////////////////////////////////////// + +#ifndef BOOST_CONTAINER_PMR_GLOBAL_RESOURCE_HPP +#define BOOST_CONTAINER_PMR_GLOBAL_RESOURCE_HPP + +#if defined (_MSC_VER) +# pragma once +#endif + +#include +#include +#include + +#include + +namespace boost { +namespace container { +namespace pmr { + +/// @cond +class memory_resource; +/// @endcond + +//! Returns: A pointer to a static-duration object of a type derived from +//! memory_resource that can serve as a resource for allocating memory using +//! global `operator new` and global `operator delete`. The same value is returned every time this function +//! is called. For return value p and memory resource r, p->is_equal(r) returns &r == p. +BOOST_CONTAINER_DECL memory_resource* new_delete_resource() BOOST_NOEXCEPT; + +//! Returns: A pointer to a static-duration object of a type derived from +//! memory_resource for which allocate() always throws bad_alloc and for which +//! deallocate() has no effect. The same value is returned every time this function +//! is called. For return value p and memory resource r, p->is_equal(r) returns &r == p. +BOOST_CONTAINER_DECL memory_resource* null_memory_resource() BOOST_NOEXCEPT; + +//! Effects: If r is non-null, sets the value of the default memory resource +//! pointer to r, otherwise sets the default memory resource pointer to new_delete_resource(). +//! +//! Postconditions: get_default_resource() == r. +//! +//! Returns: The previous value of the default memory resource pointer. +//! +//! Remarks: Calling the set_default_resource and get_default_resource functions shall +//! not incur a data race. A call to the set_default_resource function shall synchronize +//! with subsequent calls to the set_default_resource and get_default_resource functions. +BOOST_CONTAINER_DECL memory_resource* set_default_resource(memory_resource* r) BOOST_NOEXCEPT; + +//! Returns: The current value of the default +//! memory resource pointer. +BOOST_CONTAINER_DECL memory_resource* get_default_resource() BOOST_NOEXCEPT; + +} //namespace pmr { +} //namespace container { +} //namespace boost { + +#include + +#endif //BOOST_CONTAINER_PMR_GLOBAL_RESOURCE_HPP diff --git a/3party/boost/boost/container/pmr/list.hpp b/3party/boost/boost/container/pmr/list.hpp new file mode 100644 index 0000000000..f3676a3d17 --- /dev/null +++ b/3party/boost/boost/container/pmr/list.hpp @@ -0,0 +1,45 @@ +////////////////////////////////////////////////////////////////////////////// +// +// (C) Copyright Ion Gaztanaga 2015-2015. 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) +// +// See http://www.boost.org/libs/container for documentation. +// +////////////////////////////////////////////////////////////////////////////// + +#ifndef BOOST_CONTAINER_PMR_LIST_HPP +#define BOOST_CONTAINER_PMR_LIST_HPP + +#if defined (_MSC_VER) +# pragma once +#endif + +#include +#include + +namespace boost { +namespace container { +namespace pmr { + +#if !defined(BOOST_NO_CXX11_TEMPLATE_ALIASES) + +template +using list = boost::container::list>; + +#endif + +//! A portable metafunction to obtain a list +//! that uses a polymorphic allocator +template +struct list_of +{ + typedef boost::container::list + < T, polymorphic_allocator > type; +}; + +} //namespace pmr { +} //namespace container { +} //namespace boost { + +#endif //BOOST_CONTAINER_PMR_VECTOR_HPP diff --git a/3party/boost/boost/container/pmr/map.hpp b/3party/boost/boost/container/pmr/map.hpp new file mode 100644 index 0000000000..165a473373 --- /dev/null +++ b/3party/boost/boost/container/pmr/map.hpp @@ -0,0 +1,67 @@ +////////////////////////////////////////////////////////////////////////////// +// +// (C) Copyright Ion Gaztanaga 2015-2015. 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) +// +// See http://www.boost.org/libs/container for documentation. +// +////////////////////////////////////////////////////////////////////////////// + +#ifndef BOOST_CONTAINER_PMR_MAP_HPP +#define BOOST_CONTAINER_PMR_MAP_HPP + +#if defined (_MSC_VER) +# pragma once +#endif + +#include +#include + +namespace boost { +namespace container { +namespace pmr { + +#if !defined(BOOST_NO_CXX11_TEMPLATE_ALIASES) + +template + ,class Options = tree_assoc_defaults > +using map = boost::container::map >, Options>; + +template + ,class Options = tree_assoc_defaults > +using multimap = boost::container::multimap >, Options>; + +#endif + +//! A portable metafunction to obtain a map +//! that uses a polymorphic allocator +template + ,class Options = tree_assoc_defaults > +struct map_of +{ + typedef boost::container::map >, Options> type; +}; + +//! A portable metafunction to obtain a multimap +//! that uses a polymorphic allocator +template + ,class Options = tree_assoc_defaults > +struct multimap_of +{ + typedef boost::container::multimap >, Options> type; +}; + +} //namespace pmr { +} //namespace container { +} //namespace boost { + +#endif //BOOST_CONTAINER_PMR_MAP_HPP diff --git a/3party/boost/boost/container/pmr/memory_resource.hpp b/3party/boost/boost/container/pmr/memory_resource.hpp new file mode 100644 index 0000000000..72338a7559 --- /dev/null +++ b/3party/boost/boost/container/pmr/memory_resource.hpp @@ -0,0 +1,101 @@ +////////////////////////////////////////////////////////////////////////////// +// +// (C) Copyright Ion Gaztanaga 2015-2015. 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) +// +// See http://www.boost.org/libs/container for documentation. +// +////////////////////////////////////////////////////////////////////////////// + +#ifndef BOOST_CONTAINER_PMR_MEMORY_RESOURCE_HPP +#define BOOST_CONTAINER_PMR_MEMORY_RESOURCE_HPP + +#if defined (_MSC_VER) +# pragma once +#endif + +#include +#include +#include +#include + +namespace boost { +namespace container { +namespace pmr { + +//! The memory_resource class is an abstract interface to an +//! unbounded set of classes encapsulating memory resources. +class memory_resource +{ + public: + // For exposition only + static BOOST_CONSTEXPR_OR_CONST std::size_t max_align = + boost::move_detail::alignment_of::value; + + //! Effects: Destroys + //! this memory_resource. + virtual ~memory_resource(){} + + //! Effects: Equivalent to + //! `return do_allocate(bytes, alignment);` + void* allocate(std::size_t bytes, std::size_t alignment = max_align) + { return this->do_allocate(bytes, alignment); } + + //! Effects: Equivalent to + //! `return do_deallocate(bytes, alignment);` + void deallocate(void* p, std::size_t bytes, std::size_t alignment = max_align) + { return this->do_deallocate(p, bytes, alignment); } + + //! Effects: Equivalent to + //! `return return do_is_equal(other);` + bool is_equal(const memory_resource& other) const BOOST_NOEXCEPT + { return this->do_is_equal(other); } + + //! Returns: + //! `&a == &b || a.is_equal(b)`. + friend bool operator==(const memory_resource& a, const memory_resource& b) BOOST_NOEXCEPT + { return &a == &b || a.is_equal(b); } + + //! Returns: + //! !(a == b). + friend bool operator!=(const memory_resource& a, const memory_resource& b) BOOST_NOEXCEPT + { return !(a == b); } + + protected: + //! Requires: Alignment shall be a power of two. + //! + //! Returns: A derived class shall implement this function to return a pointer + //! to allocated storage with a size of at least bytes. The returned storage is + //! aligned to the specified alignment, if such alignment is supported; otherwise + //! it is aligned to max_align. + //! + //! Throws: A derived class implementation shall throw an appropriate exception if + //! it is unable to allocate memory with the requested size and alignment. + virtual void* do_allocate(std::size_t bytes, std::size_t alignment) = 0; + + //! Requires: p shall have been returned from a prior call to + //! `allocate(bytes, alignment)` on a memory resource equal to *this, and the storage + //! at p shall not yet have been deallocated. + //! + //! Effects: A derived class shall implement this function to dispose of allocated storage. + //! + //! Throws: Nothing. + virtual void do_deallocate(void* p, std::size_t bytes, std::size_t alignment) = 0; + + //! Returns: A derived class shall implement this function to return true if memory + //! allocated from this can be deallocated from other and vice-versa; otherwise it shall + //! return false. [Note: The most-derived type of other might not match the type of this. + //! For a derived class, D, a typical implementation of this function will compute + //! `dynamic_cast(&other)` and go no further (i.e., return false) + //! if it returns nullptr. - end note]. + virtual bool do_is_equal(const memory_resource& other) const BOOST_NOEXCEPT = 0; +}; + +} //namespace pmr { +} //namespace container { +} //namespace boost { + +#include + +#endif //BOOST_CONTAINER_PMR_MEMORY_RESOURCE_HPP diff --git a/3party/boost/boost/container/pmr/monotonic_buffer_resource.hpp b/3party/boost/boost/container/pmr/monotonic_buffer_resource.hpp new file mode 100644 index 0000000000..dfffe87dc3 --- /dev/null +++ b/3party/boost/boost/container/pmr/monotonic_buffer_resource.hpp @@ -0,0 +1,180 @@ +////////////////////////////////////////////////////////////////////////////// +// +// (C) Copyright Ion Gaztanaga 2015-2015. 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) +// +// See http://www.boost.org/libs/container for documentation. +// +////////////////////////////////////////////////////////////////////////////// + +#ifndef BOOST_CONTAINER_PMR_MONOTONIC_BUFFER_RESOURCE_HPP +#define BOOST_CONTAINER_PMR_MONOTONIC_BUFFER_RESOURCE_HPP + +#if defined (_MSC_VER) +# pragma once +#endif + +#include +#include +#include +#include +#include + +#include + +namespace boost { +namespace container { +namespace pmr { + +//! A monotonic_buffer_resource is a special-purpose memory resource intended for +//! very fast memory allocations in situations where memory is used to build up a +//! few objects and then is released all at once when the memory resource object +//! is destroyed. It has the following qualities: +//! +//! - A call to deallocate has no effect, thus the amount of memory consumed +//! increases monotonically until the resource is destroyed. +//! +//! - The program can supply an initial buffer, which the allocator uses to satisfy +//! memory requests. +//! +//! - When the initial buffer (if any) is exhausted, it obtains additional buffers +//! from an upstream memory resource supplied at construction. Each additional +//! buffer is larger than the previous one, following a geometric progression. +//! +//! - It is intended for access from one thread of control at a time. Specifically, +//! calls to allocate and deallocate do not synchronize with one another. +//! +//! - It owns the allocated memory and frees it on destruction, even if deallocate has +//! not been called for some of the allocated blocks. +class BOOST_CONTAINER_DECL monotonic_buffer_resource + : public memory_resource +{ + block_slist m_memory_blocks; + void* m_current_buffer; + std::size_t m_current_buffer_size; + std::size_t m_next_buffer_size; + + /// @cond + void increase_next_buffer(); + void increase_next_buffer_at_least_to(std::size_t minimum_size); + void *allocate_from_current(std::size_t aligner, std::size_t bytes); + /// @endcond + + public: + + //! The number of bytes that will be requested by the default in the first call + //! to the upstream allocator + //! + //! Note: Non-standard extension. + static const std::size_t initial_next_buffer_size = 32u*sizeof(void*); + + //! Requires: `upstream` shall be the address of a valid memory resource or `nullptr` + //! + //! Effects: If `upstream` is not nullptr, sets the internal resource to `upstream`, + //! to get_default_resource() otherwise. + //! Sets the internal `current_buffer` to `nullptr` and the internal `next_buffer_size` to an + //! implementation-defined size. + explicit monotonic_buffer_resource(memory_resource* upstream = 0) BOOST_NOEXCEPT; + + //! Requires: `upstream` shall be the address of a valid memory resource or `nullptr` + //! and `initial_size` shall be greater than zero. + //! + //! Effects: If `upstream` is not nullptr, sets the internal resource to `upstream`, + //! to get_default_resource() otherwise. Sets the internal `current_buffer` to `nullptr` and + //! `next_buffer_size` to at least `initial_size`. + explicit monotonic_buffer_resource(std::size_t initial_size, memory_resource* upstream = 0) BOOST_NOEXCEPT; + + //! Requires: `upstream` shall be the address of a valid memory resource or `nullptr`, + //! `buffer_size` shall be no larger than the number of bytes in buffer. + //! + //! Effects: If `upstream` is not nullptr, sets the internal resource to `upstream`, + //! to get_default_resource() otherwise. Sets the internal `current_buffer` to `buffer`, + //! and `next_buffer_size` to `buffer_size` (but not less than an implementation-defined size), + //! then increases `next_buffer_size` by an implementation-defined growth factor (which need not be integral). + monotonic_buffer_resource(void* buffer, std::size_t buffer_size, memory_resource* upstream = 0) BOOST_NOEXCEPT; + + #if !defined(BOOST_NO_CXX11_DELETED_FUNCTIONS) || defined(BOOST_CONTAINER_DOXYGEN_INVOKED) + monotonic_buffer_resource(const monotonic_buffer_resource&) = delete; + monotonic_buffer_resource operator=(const monotonic_buffer_resource&) = delete; + #else + private: + monotonic_buffer_resource (const monotonic_buffer_resource&); + monotonic_buffer_resource operator=(const monotonic_buffer_resource&); + public: + #endif + + //! Effects: Calls + //! `this->release()`. + virtual ~monotonic_buffer_resource(); + + //! Effects: `upstream_resource()->deallocate()` as necessary to release all allocated memory. + //! [Note: memory is released back to `upstream_resource()` even if some blocks that were allocated + //! from this have not been deallocated from this. - end note] + void release() BOOST_NOEXCEPT; + + //! Returns: The value of + //! the internal resource. + memory_resource* upstream_resource() const BOOST_NOEXCEPT; + + //! Returns: + //! The number of bytes of storage available for the specified alignment and + //! the number of bytes wasted due to the requested alignment. + //! + //! Note: Non-standard extension. + std::size_t remaining_storage(std::size_t alignment, std::size_t &wasted_due_to_alignment) const BOOST_NOEXCEPT; + + //! Returns: + //! The number of bytes of storage available for the specified alignment. + //! + //! Note: Non-standard extension. + std::size_t remaining_storage(std::size_t alignment = 1u) const BOOST_NOEXCEPT; + + //! Returns: + //! The number of bytes of storage available for the specified alignment. + //! + //! Note: Non-standard extension. + const void *current_buffer() const BOOST_NOEXCEPT; + + //! Returns: + //! The number of bytes that will be requested for the next buffer once the + //! current one is exhausted. + //! + //! Note: Non-standard extension. + std::size_t next_buffer_size() const BOOST_NOEXCEPT; + + protected: + + //! Returns: A pointer to allocated storage with a size of at least `bytes`. The size + //! and alignment of the allocated memory shall meet the requirements for a class derived + //! from `memory_resource`. + //! + //! Effects: If the unused space in the internal `current_buffer` can fit a block with the specified + //! bytes and alignment, then allocate the return block from the internal `current_buffer`; otherwise sets + //! the internal `current_buffer` to `upstream_resource()->allocate(n, m)`, where `n` is not less than + //! `max(bytes, next_buffer_size)` and `m` is not less than alignment, and increase + //! `next_buffer_size` by an implementation-defined growth factor (which need not be integral), + //! then allocate the return block from the newly-allocated internal `current_buffer`. + //! + //! Throws: Nothing unless `upstream_resource()->allocate()` throws. + virtual void* do_allocate(std::size_t bytes, std::size_t alignment); + + //! Effects: None + //! + //! Throws: Nothing + //! + //! Remarks: Memory used by this resource increases monotonically until its destruction. + virtual void do_deallocate(void* p, std::size_t bytes, std::size_t alignment) BOOST_NOEXCEPT; + + //! Returns: + //! `this == dynamic_cast(&other)`. + virtual bool do_is_equal(const memory_resource& other) const BOOST_NOEXCEPT; +}; + +} //namespace pmr { +} //namespace container { +} //namespace boost { + +#include + +#endif //BOOST_CONTAINER_PMR_MONOTONIC_BUFFER_RESOURCE_HPP diff --git a/3party/boost/boost/container/pmr/polymorphic_allocator.hpp b/3party/boost/boost/container/pmr/polymorphic_allocator.hpp new file mode 100644 index 0000000000..d189b3a311 --- /dev/null +++ b/3party/boost/boost/container/pmr/polymorphic_allocator.hpp @@ -0,0 +1,166 @@ +////////////////////////////////////////////////////////////////////////////// +// +// (C) Copyright Ion Gaztanaga 2015-2015. 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) +// +// See http://www.boost.org/libs/container for documentation. +// +////////////////////////////////////////////////////////////////////////////// + +#ifndef BOOST_CONTAINER_PMR_POLYMORPHIC_ALLOCATOR_HPP +#define BOOST_CONTAINER_PMR_POLYMORPHIC_ALLOCATOR_HPP + +#if defined (_MSC_VER) +# pragma once +#endif + +#include +#include +#include +#include +#include +#include +#include + +#include + +namespace boost { +namespace container { +namespace pmr { + +//! A specialization of class template `polymorphic_allocator` conforms to the Allocator requirements. +//! Constructed with different memory resources, different instances of the same specialization of +//! `polymorphic_allocator` can exhibit entirely different allocation behavior. This runtime +//! polymorphism allows objects that use polymorphic_allocator to behave as if they used different +//! allocator types at run time even though they use the same static allocator type. +template +class polymorphic_allocator +{ + public: + typedef T value_type; + + //! Effects: Sets m_resource to + //! `get_default_resource()`. + polymorphic_allocator() BOOST_NOEXCEPT + : m_resource(::boost::container::pmr::get_default_resource()) + {} + + //! Requires: r is non-null. + //! + //! Effects: Sets m_resource to r. + //! + //! Throws: Nothing + //! + //! Notes: This constructor provides an implicit conversion from memory_resource*. + //! Non-standard extension: if r is null m_resource is set to get_default_resource(). + polymorphic_allocator(memory_resource* r) + : m_resource(r ? r : ::boost::container::pmr::get_default_resource()) + {} + + //! Effects: Sets m_resource to + //! other.resource(). + polymorphic_allocator(const polymorphic_allocator& other) + : m_resource(other.m_resource) + {} + + //! Effects: Sets m_resource to + //! other.resource(). + template + polymorphic_allocator(const polymorphic_allocator& other) BOOST_NOEXCEPT + : m_resource(other.resource()) + {} + + //! Effects: Sets m_resource to + //! other.resource(). + polymorphic_allocator& operator=(const polymorphic_allocator& other) + { m_resource = other.m_resource; return *this; } + + //! Returns: Equivalent to + //! `static_cast(m_resource->allocate(n * sizeof(T), alignof(T)))`. + T* allocate(size_t n) + { return static_cast(m_resource->allocate(n*sizeof(T), ::boost::move_detail::alignment_of::value)); } + + //! Requires: p was allocated from a memory resource, x, equal to *m_resource, + //! using `x.allocate(n * sizeof(T), alignof(T))`. + //! + //! Effects: Equivalent to m_resource->deallocate(p, n * sizeof(T), alignof(T)). + //! + //! Throws: Nothing. + void deallocate(T* p, size_t n) + { m_resource->deallocate(p, n*sizeof(T), ::boost::move_detail::alignment_of::value); } + + #if !defined(BOOST_NO_CXX11_VARIADIC_TEMPLATES) || defined(BOOST_CONTAINER_DOXYGEN_INVOKED) + //! Requires: Uses-allocator construction of T with allocator + //! `this->resource()` and constructor arguments `std::forward(args)...` + //! is well-formed. [Note: uses-allocator construction is always well formed for + //! types that do not use allocators. - end note] + //! + //! Effects: Construct a T object at p by uses-allocator construction with allocator + //! `this->resource()` and constructor arguments `std::forward(args)...`. + //! + //! Throws: Nothing unless the constructor for T throws. + template < typename U, class ...Args> + void construct(U* p, BOOST_FWD_REF(Args)...args) + { + new_allocator na; + container_detail::dispatch_uses_allocator + (na, this->resource(), p, ::boost::forward(args)...); + } + + #else // #if !defined(BOOST_NO_CXX11_VARIADIC_TEMPLATES) || defined(BOOST_CONTAINER_DOXYGEN_INVOKED) + + //Disable this overload if the first argument is pair as some compilers have + //overload selection problems when the first parameter is a pair. + #define BOOST_CONTAINER_PMR_POLYMORPHIC_ALLOCATOR_CONSTRUCT_CODE(N) \ + template < typename U BOOST_MOVE_I##N BOOST_MOVE_CLASSQ##N >\ + void construct(U* p BOOST_MOVE_I##N BOOST_MOVE_UREFQ##N)\ + {\ + new_allocator na;\ + container_detail::dispatch_uses_allocator\ + (na, this->resource(), p BOOST_MOVE_I##N BOOST_MOVE_FWDQ##N);\ + }\ + // + BOOST_MOVE_ITERATE_0TO9(BOOST_CONTAINER_PMR_POLYMORPHIC_ALLOCATOR_CONSTRUCT_CODE) + #undef BOOST_CONTAINER_PMR_POLYMORPHIC_ALLOCATOR_CONSTRUCT_CODE + + #endif //#if !defined(BOOST_NO_CXX11_VARIADIC_TEMPLATES) || defined(BOOST_CONTAINER_DOXYGEN_INVOKED) + + //! Effects: + //! p->~U(). + template + void destroy(U* p) + { (void)p; p->~U(); } + + //! Returns: Equivalent to + //! `polymorphic_allocator()`. + polymorphic_allocator select_on_container_copy_construction() const + { return polymorphic_allocator(); } + + //! Returns: + //! m_resource. + memory_resource* resource() const + { return m_resource; } + + private: + memory_resource* m_resource; +}; + +//! Returns: +//! `*a.resource() == *b.resource()`. +template +bool operator==(const polymorphic_allocator& a, const polymorphic_allocator& b) BOOST_NOEXCEPT +{ return *a.resource() == *b.resource(); } + + +//! Returns: +//! `! (a == b)`. +template +bool operator!=(const polymorphic_allocator& a, const polymorphic_allocator& b) BOOST_NOEXCEPT +{ return *a.resource() != *b.resource(); } + +} //namespace pmr { +} //namespace container { +} //namespace boost { + +#endif //BOOST_CONTAINER_PMR_POLYMORPHIC_ALLOCATOR_HPP diff --git a/3party/boost/boost/container/pmr/pool_options.hpp b/3party/boost/boost/container/pmr/pool_options.hpp new file mode 100644 index 0000000000..e9f72896b1 --- /dev/null +++ b/3party/boost/boost/container/pmr/pool_options.hpp @@ -0,0 +1,52 @@ +////////////////////////////////////////////////////////////////////////////// +// +// (C) Copyright Ion Gaztanaga 2015-2015. 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) +// +// See http://www.boost.org/libs/container for documentation. +// +////////////////////////////////////////////////////////////////////////////// + +#ifndef BOOST_CONTAINER_PMR_POOL_OPTIONS_HPP +#define BOOST_CONTAINER_PMR_POOL_OPTIONS_HPP + +#if defined (_MSC_VER) +# pragma once +#endif + +#include + +namespace boost { +namespace container { +namespace pmr { + +//! The members of pool_options comprise a set of constructor options for pool resources. +//! The effect of each option on the pool resource behavior is described below: +//! +//! - `std::size_t max_blocks_per_chunk`: The maximum number of blocks that will be allocated +//! at once from the upstream memory resource to replenish a pool. If the value of +//! `max_blocks_per_chunk` is zero or is greater than an implementation-defined limit, +//! that limit is used instead. The implementation may choose to use a smaller value +//! than is specified in this field and may use different values for different pools. +//! +//! - `std::size_t largest_required_pool_block`: The largest allocation size that is required +//! to be fulfilled using the pooling mechanism. Attempts to allocate a single block +//! larger than this threshold will be allocated directly from the upstream memory +//! resource. If largest_required_pool_block is zero or is greater than an +//! implementation-defined limit, that limit is used instead. The implementation may +//! choose a pass-through threshold larger than specified in this field. +struct pool_options +{ + pool_options() + : max_blocks_per_chunk(0u), largest_required_pool_block(0u) + {} + std::size_t max_blocks_per_chunk; + std::size_t largest_required_pool_block; +}; + +} //namespace pmr { +} //namespace container { +} //namespace boost { + +#endif //BOOST_CONTAINER_PMR_POOL_OPTIONS_HPP diff --git a/3party/boost/boost/container/pmr/resource_adaptor.hpp b/3party/boost/boost/container/pmr/resource_adaptor.hpp new file mode 100644 index 0000000000..deece632e8 --- /dev/null +++ b/3party/boost/boost/container/pmr/resource_adaptor.hpp @@ -0,0 +1,193 @@ +////////////////////////////////////////////////////////////////////////////// +// +// (C) Copyright Ion Gaztanaga 2015-2015. 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) +// +// See http://www.boost.org/libs/container for documentation. +// +////////////////////////////////////////////////////////////////////////////// + +#ifndef BOOST_CONTAINER_PMR_RESOURCE_ADAPTOR_HPP +#define BOOST_CONTAINER_PMR_RESOURCE_ADAPTOR_HPP + +#if defined (_MSC_VER) +# pragma once +#endif + +#include +#include +#include +#include +#include + +namespace boost { +namespace container { +namespace pmr { + +//! An instance of resource_adaptor is an adaptor that wraps a memory_resource interface +//! around Allocator. In order that resource_adaptor> and resource_adaptor> are the same +//! type for any allocator template X and types T and U, resource_adaptor is rendered as +//! an alias to this class template such that Allocator is rebound to a char value type in every +//! specialization of the class template. The requirements on this class template are defined below. +//! In addition to the Allocator requirements, the parameter to resource_adaptor shall meet +//! the following additional requirements: +//! +//! - `typename allocator_traits:: pointer` shall be identical to +//! `typename allocator_traits:: value_type*`. +//! +//! - `typename allocator_traits:: const_pointer` shall be identical to +//! `typename allocator_traits:: value_type const*`. +//! +//! - `typename allocator_traits:: void_pointer` shall be identical to `void*`. +//! +//! - `typename allocator_traits:: const_void_pointer` shall be identical to `void const*`. +template +class resource_adaptor_imp + : public memory_resource + #ifndef BOOST_CONTAINER_DOXYGEN_INVOKED + , private ::boost::intrusive::detail::ebo_functor_holder + #endif +{ + #ifdef BOOST_CONTAINER_DOXYGEN_INVOKED + Allocator m_alloc; + #else + BOOST_COPYABLE_AND_MOVABLE(resource_adaptor_imp) + typedef ::boost::intrusive::detail::ebo_functor_holder ebo_alloc_t; + void static_assert_if_not_char_allocator() const + { + //This class can only be used with allocators type char + BOOST_STATIC_ASSERT((container_detail::is_same::value)); + } + #endif + + public: + typedef Allocator allocator_type; + + //! Effects: Default constructs + //! m_alloc. + resource_adaptor_imp() + { this->static_assert_if_not_char_allocator(); } + + //! Effects: Copy constructs + //! m_alloc. + resource_adaptor_imp(const resource_adaptor_imp &other) + : ebo_alloc_t(other.ebo_alloc_t::get()) + {} + + //! Effects: Move constructs + //! m_alloc. + resource_adaptor_imp(BOOST_RV_REF(resource_adaptor_imp) other) + : ebo_alloc_t(::boost::move(other.get())) + {} + + //! Effects: Initializes m_alloc with + //! a2. + explicit resource_adaptor_imp(const Allocator& a2) + : ebo_alloc_t(a2) + { this->static_assert_if_not_char_allocator(); } + + //! Effects: Initializes m_alloc with + //! a2. + explicit resource_adaptor_imp(BOOST_RV_REF(Allocator) a2) + : ebo_alloc_t(::boost::move(a2)) + { this->static_assert_if_not_char_allocator(); } + + //! Effects: Copy assigns + //! m_alloc. + resource_adaptor_imp& operator=(BOOST_COPY_ASSIGN_REF(resource_adaptor_imp) other) + { this->ebo_alloc_t::get() = other.ebo_alloc_t::get(); return *this; } + + //! Effects: Move assigns + //! m_alloc. + resource_adaptor_imp& operator=(BOOST_RV_REF(resource_adaptor_imp) other) + { this->ebo_alloc_t::get() = ::boost::move(other.ebo_alloc_t::get()); return *this; } + + //! Effects: Returns m_alloc. + allocator_type &get_allocator() + { return this->ebo_alloc_t::get(); } + + //! Effects: Returns m_alloc. + const allocator_type &get_allocator() const + { return this->ebo_alloc_t::get(); } + + protected: + //! Returns: Allocated memory obtained by calling m_alloc.allocate. The size and alignment + //! of the allocated memory shall meet the requirements for a class derived from memory_resource. + virtual void* do_allocate(size_t bytes, size_t alignment) + { (void)alignment; return this->ebo_alloc_t::get().allocate(bytes); } + + //! Requires: p was previously allocated using A.allocate, where A == m_alloc, and not + //! subsequently deallocated. + //! + //! Effects: Returns memory to the allocator using m_alloc.deallocate(). + virtual void do_deallocate(void* p, size_t bytes, size_t alignment) + { (void)alignment; this->ebo_alloc_t::get().deallocate((char*)p, bytes); } + + //! Let p be dynamic_cast(&other). + //! + //! Returns: false if p is null, otherwise the value of m_alloc == p->m_alloc. + virtual bool do_is_equal(const memory_resource& other) const BOOST_NOEXCEPT + { + const resource_adaptor_imp* p = dynamic_cast(&other); + return p && p->ebo_alloc_t::get() == this->ebo_alloc_t::get(); + } +}; + +#if !defined(BOOST_NO_CXX11_TEMPLATE_ALIASES) || defined(BOOST_CONTAINER_DOXYGEN_INVOKED) + +//! `resource_adaptor` is rendered as an alias to resource_adaptor_imp class template +//! such that Allocator is rebound to a char value type. +template +using resource_adaptor = resource_adaptor_imp + ::template rebind_alloc >; + +#else + +template +class resource_adaptor + : public resource_adaptor_imp + ::template portable_rebind_alloc::type> +{ + typedef resource_adaptor_imp + ::template portable_rebind_alloc::type> base_t; + + BOOST_COPYABLE_AND_MOVABLE(resource_adaptor) + + public: + resource_adaptor() + : base_t() + {} + + resource_adaptor(const resource_adaptor &other) + : base_t(other) + {} + + resource_adaptor(BOOST_RV_REF(resource_adaptor) other) + : base_t(BOOST_MOVE_BASE(base_t, other)) + {} + + explicit resource_adaptor(const Allocator& a2) + : base_t(a2) + {} + + explicit resource_adaptor(BOOST_RV_REF(Allocator) a2) + : base_t(BOOST_MOVE_BASE(base_t, a2)) + {} + + resource_adaptor& operator=(BOOST_COPY_ASSIGN_REF(resource_adaptor) other) + { return static_cast(this->base_t::operator=(other)); } + + resource_adaptor& operator=(BOOST_RV_REF(resource_adaptor) other) + { return static_cast(this->base_t::operator=(BOOST_MOVE_BASE(base_t, other))); } + + //get_allocator and protected functions are properly inherited +}; + +#endif + +} //namespace pmr { +} //namespace container { +} //namespace boost { + +#endif //BOOST_CONTAINER_PMR_RESOURCE_ADAPTOR_HPP diff --git a/3party/boost/boost/container/pmr/set.hpp b/3party/boost/boost/container/pmr/set.hpp new file mode 100644 index 0000000000..04583ce2dd --- /dev/null +++ b/3party/boost/boost/container/pmr/set.hpp @@ -0,0 +1,63 @@ +////////////////////////////////////////////////////////////////////////////// +// +// (C) Copyright Ion Gaztanaga 2015-2015. 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) +// +// See http://www.boost.org/libs/container for documentation. +// +////////////////////////////////////////////////////////////////////////////// + +#ifndef BOOST_CONTAINER_PMR_SET_HPP +#define BOOST_CONTAINER_PMR_SET_HPP + +#if defined (_MSC_VER) +# pragma once +#endif + +#include +#include + +namespace boost { +namespace container { +namespace pmr { + +#if !defined(BOOST_NO_CXX11_TEMPLATE_ALIASES) + +template + ,class Options = tree_assoc_defaults > +using set = boost::container::set, Options>; + +template + ,class Options = tree_assoc_defaults > +using multiset = boost::container::multiset, Options>; + +#endif + +//! A portable metafunction to obtain a set +//! that uses a polymorphic allocator +template + ,class Options = tree_assoc_defaults > +struct set_of +{ + typedef boost::container::set, Options> type; +}; + +//! A portable metafunction to obtain a multiset +//! that uses a polymorphic allocator +template + ,class Options = tree_assoc_defaults > +struct multiset_of +{ + typedef boost::container::multiset, Options> type; +}; + +} //namespace pmr { +} //namespace container { +} //namespace boost { + +#endif //BOOST_CONTAINER_PMR_SET_HPP diff --git a/3party/boost/boost/container/pmr/slist.hpp b/3party/boost/boost/container/pmr/slist.hpp new file mode 100644 index 0000000000..c90fd7d6cd --- /dev/null +++ b/3party/boost/boost/container/pmr/slist.hpp @@ -0,0 +1,45 @@ +////////////////////////////////////////////////////////////////////////////// +// +// (C) Copyright Ion Gaztanaga 2015-2015. 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) +// +// See http://www.boost.org/libs/container for documentation. +// +////////////////////////////////////////////////////////////////////////////// + +#ifndef BOOST_CONTAINER_PMR_SLIST_HPP +#define BOOST_CONTAINER_PMR_SLIST_HPP + +#if defined (_MSC_VER) +# pragma once +#endif + +#include +#include + +namespace boost { +namespace container { +namespace pmr { + +#if !defined(BOOST_NO_CXX11_TEMPLATE_ALIASES) + +template +using slist = boost::container::slist>; + +#endif + +//! A portable metafunction to obtain a slist +//! that uses a polymorphic allocator +template +struct slist_of +{ + typedef boost::container::slist + < T, polymorphic_allocator > type; +}; + +} //namespace pmr { +} //namespace container { +} //namespace boost { + +#endif //BOOST_CONTAINER_PMR_VECTOR_HPP diff --git a/3party/boost/boost/container/pmr/small_vector.hpp b/3party/boost/boost/container/pmr/small_vector.hpp new file mode 100644 index 0000000000..6eef149728 --- /dev/null +++ b/3party/boost/boost/container/pmr/small_vector.hpp @@ -0,0 +1,45 @@ +////////////////////////////////////////////////////////////////////////////// +// +// (C) Copyright Ion Gaztanaga 2015-2015. 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) +// +// See http://www.boost.org/libs/container for documentation. +// +////////////////////////////////////////////////////////////////////////////// + +#ifndef BOOST_CONTAINER_PMR_SMALL_VECTOR_HPP +#define BOOST_CONTAINER_PMR_SMALL_VECTOR_HPP + +#if defined (_MSC_VER) +# pragma once +#endif + +#include +#include + +namespace boost { +namespace container { +namespace pmr { + +#if !defined(BOOST_NO_CXX11_TEMPLATE_ALIASES) + +template +using small_vector = boost::container::small_vector>; + +#endif + +//! A portable metafunction to obtain a small_vector +//! that uses a polymorphic allocator +template +struct small_vector_of +{ + typedef boost::container::small_vector + < T, N, polymorphic_allocator > type; +}; + +} //namespace pmr { +} //namespace container { +} //namespace boost { + +#endif //BOOST_CONTAINER_PMR_SMALL_VECTOR_HPP diff --git a/3party/boost/boost/container/pmr/stable_vector.hpp b/3party/boost/boost/container/pmr/stable_vector.hpp new file mode 100644 index 0000000000..d11c426fc4 --- /dev/null +++ b/3party/boost/boost/container/pmr/stable_vector.hpp @@ -0,0 +1,45 @@ +////////////////////////////////////////////////////////////////////////////// +// +// (C) Copyright Ion Gaztanaga 2015-2015. 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) +// +// See http://www.boost.org/libs/container for documentation. +// +////////////////////////////////////////////////////////////////////////////// + +#ifndef BOOST_CONTAINER_PMR_STABLE_VECTOR_HPP +#define BOOST_CONTAINER_PMR_STABLE_VECTOR_HPP + +#if defined (_MSC_VER) +# pragma once +#endif + +#include +#include + +namespace boost { +namespace container { +namespace pmr { + +#if !defined(BOOST_NO_CXX11_TEMPLATE_ALIASES) + +template +using stable_vector = boost::container::stable_vector>; + +#endif + +//! A portable metafunction to obtain a stable_vector +//! that uses a polymorphic allocator +template +struct stable_vector_of +{ + typedef boost::container::stable_vector + < T, polymorphic_allocator > type; +}; + +} //namespace pmr { +} //namespace container { +} //namespace boost { + +#endif //BOOST_CONTAINER_PMR_STABLE_VECTOR_HPP diff --git a/3party/boost/boost/container/pmr/string.hpp b/3party/boost/boost/container/pmr/string.hpp new file mode 100644 index 0000000000..c1eba67296 --- /dev/null +++ b/3party/boost/boost/container/pmr/string.hpp @@ -0,0 +1,50 @@ +////////////////////////////////////////////////////////////////////////////// +// +// (C) Copyright Ion Gaztanaga 2015-2015. 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) +// +// See http://www.boost.org/libs/container for documentation. +// +////////////////////////////////////////////////////////////////////////////// + +#ifndef BOOST_CONTAINER_PMR_STRING_HPP +#define BOOST_CONTAINER_PMR_STRING_HPP + +#if defined (_MSC_VER) +# pragma once +#endif + +#include +#include + +namespace boost { +namespace container { +namespace pmr { + +#if !defined(BOOST_NO_CXX11_TEMPLATE_ALIASES) + +template > +using basic_string = + boost::container::basic_string >; + +#endif + +//! A portable metafunction to obtain a basic_string +//! that uses a polymorphic allocator +template > +struct basic_string_of +{ + typedef boost::container::basic_string + > type; +}; + +typedef basic_string_of::type string; + +typedef basic_string_of::type wstring; + +} //namespace pmr { +} //namespace container { +} //namespace boost { + +#endif //BOOST_CONTAINER_PMR_STRING_HPP diff --git a/3party/boost/boost/container/pmr/synchronized_pool_resource.hpp b/3party/boost/boost/container/pmr/synchronized_pool_resource.hpp new file mode 100644 index 0000000000..e4d4dd54a1 --- /dev/null +++ b/3party/boost/boost/container/pmr/synchronized_pool_resource.hpp @@ -0,0 +1,138 @@ +////////////////////////////////////////////////////////////////////////////// +// +// (C) Copyright Ion Gaztanaga 2015-2015. 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) +// +// See http://www.boost.org/libs/container for documentation. +// +////////////////////////////////////////////////////////////////////////////// + +#ifndef BOOST_CONTAINER_PMR_SYNCHRONIZED_POOL_RESOURCE_HPP +#define BOOST_CONTAINER_PMR_SYNCHRONIZED_POOL_RESOURCE_HPP + +#if defined (_MSC_VER) +# pragma once +#endif + +#include +#include +#include +#include +#include + +#include + +namespace boost { +namespace container { +namespace pmr { + +//! A synchronized_pool_resource is a general-purpose memory resources having +//! the following qualities: +//! +//! - Each resource owns the allocated memory, and frees it on destruction, +//! even if deallocate has not been called for some of the allocated blocks. +//! +//! - A pool resource consists of a collection of pools, serving +//! requests for different block sizes. Each individual pool manages a +//! collection of chunks that are in turn divided into blocks of uniform size, +//! returned via calls to do_allocate. Each call to do_allocate(size, alignment) +//! is dispatched to the pool serving the smallest blocks accommodating at +//! least size bytes. +//! +//! - When a particular pool is exhausted, allocating a block from that pool +//! results in the allocation of an additional chunk of memory from the upstream +//! allocator (supplied at construction), thus replenishing the pool. With +//! each successive replenishment, the chunk size obtained increases +//! geometrically. [ Note: By allocating memory in chunks, the pooling strategy +//! increases the chance that consecutive allocations will be close together +//! in memory. - end note ] +//! +//! - Allocation requests that exceed the largest block size of any pool are +//! fulfilled directly from the upstream allocator. +//! +//! - A pool_options struct may be passed to the pool resource constructors to +//! tune the largest block size and the maximum chunk size. +//! +//! A synchronized_pool_resource may be accessed from multiple threads without +//! external synchronization and may have thread-specific pools to reduce +//! synchronization costs. +class BOOST_CONTAINER_DECL synchronized_pool_resource + : public memory_resource +{ + pool_resource m_pool_resource; + void *m_opaque_sync; + + public: + + //! @copydoc ::boost::container::pmr::unsynchronized_pool_resource::unsynchronized_pool_resource(const pool_options&,memory_resource*) + synchronized_pool_resource(const pool_options& opts, memory_resource* upstream) BOOST_NOEXCEPT; + + //! @copydoc ::boost::container::pmr::unsynchronized_pool_resource::unsynchronized_pool_resource() + synchronized_pool_resource() BOOST_NOEXCEPT; + + //! @copydoc ::boost::container::pmr::unsynchronized_pool_resource::unsynchronized_pool_resource(memory_resource*) + explicit synchronized_pool_resource(memory_resource* upstream) BOOST_NOEXCEPT; + + //! @copydoc ::boost::container::pmr::unsynchronized_pool_resource::unsynchronized_pool_resource(const pool_options&) + explicit synchronized_pool_resource(const pool_options& opts) BOOST_NOEXCEPT; + + #if !defined(BOOST_NO_CXX11_DELETED_FUNCTIONS) || defined(BOOST_CONTAINER_DOXYGEN_INVOKED) + synchronized_pool_resource(const synchronized_pool_resource&) = delete; + synchronized_pool_resource operator=(const synchronized_pool_resource&) = delete; + #else + private: + synchronized_pool_resource (const synchronized_pool_resource&); + synchronized_pool_resource operator=(const synchronized_pool_resource&); + public: + #endif + + //! @copydoc ::boost::container::pmr::unsynchronized_pool_resource::~unsynchronized_pool_resource() + virtual ~synchronized_pool_resource(); + + //! @copydoc ::boost::container::pmr::unsynchronized_pool_resource::release() + void release(); + + //! @copydoc ::boost::container::pmr::unsynchronized_pool_resource::upstream_resource()const + memory_resource* upstream_resource() const; + + //! @copydoc ::boost::container::pmr::unsynchronized_pool_resource::options()const + pool_options options() const; + + protected: + + //! @copydoc ::boost::container::pmr::unsynchronized_pool_resource::do_allocate() + virtual void* do_allocate(std::size_t bytes, std::size_t alignment); + + //! @copydoc ::boost::container::pmr::unsynchronized_pool_resource::do_deallocate(void*,std::size_t,std::size_t) + virtual void do_deallocate(void* p, std::size_t bytes, std::size_t alignment); + + //! @copydoc ::boost::container::pmr::unsynchronized_pool_resource::do_is_equal(const memory_resource&)const + virtual bool do_is_equal(const memory_resource& other) const BOOST_NOEXCEPT; + + //Non-standard observers + public: + + //! @copydoc ::boost::container::pmr::unsynchronized_pool_resource::pool_count() + std::size_t pool_count() const; + + //! @copydoc ::boost::container::pmr::unsynchronized_pool_resource::pool_index(std::size_t)const + std::size_t pool_index(std::size_t bytes) const; + + //! @copydoc ::boost::container::pmr::unsynchronized_pool_resource::pool_next_blocks_per_chunk(std::size_t)const + std::size_t pool_next_blocks_per_chunk(std::size_t pool_idx) const; + + //! @copydoc ::boost::container::pmr::unsynchronized_pool_resource::pool_block(std::size_t)const + std::size_t pool_block(std::size_t pool_idx) const; + + //! @copydoc ::boost::container::pmr::unsynchronized_pool_resource::pool_cached_blocks(std::size_t)const + std::size_t pool_cached_blocks(std::size_t pool_idx) const; +}; + +} //namespace pmr { +} //namespace container { +} //namespace boost { + +#include + +#endif //BOOST_CONTAINER_PMR_SYNCHRONIZED_POOL_RESOURCE_HPP diff --git a/3party/boost/boost/container/pmr/unsynchronized_pool_resource.hpp b/3party/boost/boost/container/pmr/unsynchronized_pool_resource.hpp new file mode 100644 index 0000000000..21d30b1ebc --- /dev/null +++ b/3party/boost/boost/container/pmr/unsynchronized_pool_resource.hpp @@ -0,0 +1,194 @@ +////////////////////////////////////////////////////////////////////////////// +// +// (C) Copyright Ion Gaztanaga 2015-2015. 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) +// +// See http://www.boost.org/libs/container for documentation. +// +////////////////////////////////////////////////////////////////////////////// + +#ifndef BOOST_CONTAINER_PMR_UNSYNCHRONIZED_POOL_RESOURCE_HPP +#define BOOST_CONTAINER_PMR_UNSYNCHRONIZED_POOL_RESOURCE_HPP + +#if defined (_MSC_VER) +# pragma once +#endif + +#include +#include +#include +#include +#include + +#include + +namespace boost { +namespace container { +namespace pmr { + +//! A unsynchronized_pool_resource is a general-purpose memory resources having +//! the following qualities: +//! +//! - Each resource owns the allocated memory, and frees it on destruction, +//! even if deallocate has not been called for some of the allocated blocks. +//! +//! - A pool resource consists of a collection of pools, serving +//! requests for different block sizes. Each individual pool manages a +//! collection of chunks that are in turn divided into blocks of uniform size, +//! returned via calls to do_allocate. Each call to do_allocate(size, alignment) +//! is dispatched to the pool serving the smallest blocks accommodating at +//! least size bytes. +//! +//! - When a particular pool is exhausted, allocating a block from that pool +//! results in the allocation of an additional chunk of memory from the upstream +//! allocator (supplied at construction), thus replenishing the pool. With +//! each successive replenishment, the chunk size obtained increases +//! geometrically. [ Note: By allocating memory in chunks, the pooling strategy +//! increases the chance that consecutive allocations will be close together +//! in memory. - end note ] +//! +//! - Allocation requests that exceed the largest block size of any pool are +//! fulfilled directly from the upstream allocator. +//! +//! - A pool_options struct may be passed to the pool resource constructors to +//! tune the largest block size and the maximum chunk size. +//! +//! An unsynchronized_pool_resource class may not be accessed from multiple threads +//! simultaneously and thus avoids the cost of synchronization entirely in +//! single-threaded applications. +class BOOST_CONTAINER_DECL unsynchronized_pool_resource + : public memory_resource +{ + pool_resource m_resource; + + public: + + //! Requires: `upstream` is the address of a valid memory resource. + //! + //! Effects: Constructs a pool resource object that will obtain memory + //! from upstream whenever the pool resource is unable to satisfy a memory + //! request from its own internal data structures. The resulting object will hold + //! a copy of upstream, but will not own the resource to which upstream points. + //! [ Note: The intention is that calls to upstream->allocate() will be + //! substantially fewer than calls to this->allocate() in most cases. - end note + //! The behavior of the pooling mechanism is tuned according to the value of + //! the opts argument. + //! + //! Throws: Nothing unless upstream->allocate() throws. It is unspecified if + //! or under what conditions this constructor calls upstream->allocate(). + unsynchronized_pool_resource(const pool_options& opts, memory_resource* upstream) BOOST_NOEXCEPT; + + //! Effects: Same as + //! `unsynchronized_pool_resource(pool_options(), get_default_resource())`. + unsynchronized_pool_resource() BOOST_NOEXCEPT; + + //! Effects: Same as + //! `unsynchronized_pool_resource(pool_options(), upstream)`. + explicit unsynchronized_pool_resource(memory_resource* upstream) BOOST_NOEXCEPT; + + //! Effects: Same as + //! `unsynchronized_pool_resource(opts, get_default_resource())`. + explicit unsynchronized_pool_resource(const pool_options& opts) BOOST_NOEXCEPT; + + #if !defined(BOOST_NO_CXX11_DELETED_FUNCTIONS) || defined(BOOST_CONTAINER_DOXYGEN_INVOKED) + unsynchronized_pool_resource(const unsynchronized_pool_resource&) = delete; + unsynchronized_pool_resource operator=(const unsynchronized_pool_resource&) = delete; + #else + private: + unsynchronized_pool_resource (const unsynchronized_pool_resource&); + unsynchronized_pool_resource operator=(const unsynchronized_pool_resource&); + public: + #endif + + //! Effects: Calls + //! `this->release()`. + virtual ~unsynchronized_pool_resource(); + + //! Effects: Calls Calls `upstream_resource()->deallocate()` as necessary + //! to release all allocated memory. [ Note: memory is released back to + //! `upstream_resource()` even if deallocate has not been called for some + //! of the allocated blocks. - end note ] + void release(); + + //! Returns: The value of the upstream argument provided to the + //! constructor of this object. + memory_resource* upstream_resource() const; + + //! Returns: The options that control the pooling behavior of this resource. + //! The values in the returned struct may differ from those supplied to the pool + //! resource constructor in that values of zero will be replaced with + //! implementation-defined defaults and sizes may be rounded to unspecified granularity. + pool_options options() const; + + protected: + + //! Returns: A pointer to allocated storage with a size of at least `bytes`. + //! The size and alignment of the allocated memory shall meet the requirements for + //! a class derived from `memory_resource`. + //! + //! Effects: If the pool selected for a block of size bytes is unable to + //! satisfy the memory request from its own internal data structures, it will call + //! `upstream_resource()->allocate()` to obtain more memory. If `bytes` is larger + //! than that which the largest pool can handle, then memory will be allocated + //! using `upstream_resource()->allocate()`. + //! + //! Throws: Nothing unless `upstream_resource()->allocate()` throws. + virtual void* do_allocate(std::size_t bytes, std::size_t alignment); + + //! Effects: Return the memory at p to the pool. It is unspecified if or under + //! what circumstances this operation will result in a call to + //! `upstream_resource()->deallocate()`. + //! + //! Throws: Nothing. + virtual void do_deallocate(void* p, std::size_t bytes, std::size_t alignment); + + //! Returns: + //! `this == dynamic_cast(&other)`. + virtual bool do_is_equal(const memory_resource& other) const BOOST_NOEXCEPT; + + //Non-standard observers + public: + //! Returns: The number of pools that will be used in the pool resource. + //! + //! Note: Non-standard extension. + std::size_t pool_count() const; + + //! Returns: The index of the pool that will be used to serve the allocation of `bytes`. + //! Returns `pool_count()` if `bytes` is bigger + //! than `options().largest_required_pool_block` (no pool will be used to serve this). + //! + //! Note: Non-standard extension. + std::size_t pool_index(std::size_t bytes) const; + + //! Requires: `pool_idx < pool_index()` + //! + //! Returns: The number blocks that will be allocated in the next chunk + //! from the pool specified by `pool_idx`. + //! + //! Note: Non-standard extension. + std::size_t pool_next_blocks_per_chunk(std::size_t pool_idx) const; + + //! Requires: `pool_idx < pool_index()` + //! + //! Returns: The number of bytes of the block that the specified `pool_idx` pool manages. + //! + //! Note: Non-standard extension. + std::size_t pool_block(std::size_t pool_idx) const; + + //! Requires: `pool_idx < pool_index()` + //! + //! Returns: The number of blocks that the specified `pool_idx` pool has cached + //! and will be served without calling the upstream_allocator. + //! + //! Note: Non-standard extension. + std::size_t pool_cached_blocks(std::size_t pool_idx) const; +}; + +} //namespace pmr { +} //namespace container { +} //namespace boost { + +#include + +#endif //BOOST_CONTAINER_PMR_UNSYNCHRONIZED_POOL_RESOURCE_HPP diff --git a/3party/boost/boost/container/pmr/vector.hpp b/3party/boost/boost/container/pmr/vector.hpp new file mode 100644 index 0000000000..2bd9c157e0 --- /dev/null +++ b/3party/boost/boost/container/pmr/vector.hpp @@ -0,0 +1,45 @@ +////////////////////////////////////////////////////////////////////////////// +// +// (C) Copyright Ion Gaztanaga 2015-2015. 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) +// +// See http://www.boost.org/libs/container for documentation. +// +////////////////////////////////////////////////////////////////////////////// + +#ifndef BOOST_CONTAINER_PMR_VECTOR_HPP +#define BOOST_CONTAINER_PMR_VECTOR_HPP + +#if defined (_MSC_VER) +# pragma once +#endif + +#include +#include + +namespace boost { +namespace container { +namespace pmr { + +#if !defined(BOOST_NO_CXX11_TEMPLATE_ALIASES) + +template +using vector = boost::container::vector>; + +#endif + +//! A portable metafunction to obtain a vector +//! that uses a polymorphic allocator +template +struct vector_of +{ + typedef boost::container::vector + < T, polymorphic_allocator > type; +}; + +} //namespace pmr { +} //namespace container { +} //namespace boost { + +#endif //BOOST_CONTAINER_PMR_VECTOR_HPP diff --git a/3party/boost/boost/container/scoped_allocator.hpp b/3party/boost/boost/container/scoped_allocator.hpp index 31c27ecdee..6a041a653d 100644 --- a/3party/boost/boost/container/scoped_allocator.hpp +++ b/3party/boost/boost/container/scoped_allocator.hpp @@ -18,7 +18,7 @@ #define BOOST_CONTAINER_ALLOCATOR_SCOPED_ALLOCATOR_HPP #if defined (_MSC_VER) -# pragma once +# pragma once #endif #include @@ -26,8 +26,8 @@ #include #include +#include -#include #include #include #include @@ -42,143 +42,6 @@ namespace boost { namespace container { -//! Remark: if a specialization constructible_with_allocator_suffix::value is true, indicates that T may be constructed -//! with an allocator as its last constructor argument. Ideally, all constructors of T (including the -//! copy and move constructors) should have a variant that accepts a final argument of -//! allocator_type. -//! -//! Requires: if a specialization constructible_with_allocator_suffix::value is true, T must have a nested type, -//! allocator_type and at least one constructor for which allocator_type is the last -//! parameter. If not all constructors of T can be called with a final allocator_type argument, -//! and if T is used in a context where a container must call such a constructor, then the program is -//! ill-formed. -//! -//! -//! template > -//! class Z { -//! public: -//! typedef Allocator allocator_type; -//! -//! // Default constructor with optional allocator suffix -//! Z(const allocator_type& a = allocator_type()); -//! -//! // Copy constructor and allocator-extended copy constructor -//! Z(const Z& zz); -//! Z(const Z& zz, const allocator_type& a); -//! }; -//! -//! // Specialize trait for class template Z -//! template > -//! struct constructible_with_allocator_suffix > -//! { static const bool value = true; }; -//! -//! -//! Note: This trait is a workaround inspired by "N2554: The Scoped A Model (Rev 2)" -//! (Pablo Halpern, 2008-02-29) to backport the scoped allocator model to C++03, as -//! in C++03 there is no mechanism to detect if a type can be constructed from arbitrary arguments. -//! Applications aiming portability with several compilers should always define this trait. -//! -//! In conforming C++11 compilers or compilers supporting SFINAE expressions -//! (when BOOST_NO_SFINAE_EXPR is NOT defined), this trait is ignored and C++11 rules will be used -//! to detect if a type should be constructed with suffix or prefix allocator arguments. -template -struct constructible_with_allocator_suffix -{ static const bool value = false; }; - -//! Remark: if a specialization constructible_with_allocator_prefix::value is true, indicates that T may be constructed -//! with allocator_arg and T::allocator_type as its first two constructor arguments. -//! Ideally, all constructors of T (including the copy and move constructors) should have a variant -//! that accepts these two initial arguments. -//! -//! Requires: specialization constructible_with_allocator_prefix::value is true, T must have a nested type, -//! allocator_type and at least one constructor for which allocator_arg_t is the first -//! parameter and allocator_type is the second parameter. If not all constructors of T can be -//! called with these initial arguments, and if T is used in a context where a container must call such -//! a constructor, then the program is ill-formed. -//! -//! -//! template > -//! class Y { -//! public: -//! typedef Allocator allocator_type; -//! -//! // Default constructor with and allocator-extended default constructor -//! Y(); -//! Y(allocator_arg_t, const allocator_type& a); -//! -//! // Copy constructor and allocator-extended copy constructor -//! Y(const Y& yy); -//! Y(allocator_arg_t, const allocator_type& a, const Y& yy); -//! -//! // Variadic constructor and allocator-extended variadic constructor -//! template Y(Args&& args...); -//! template -//! Y(allocator_arg_t, const allocator_type& a, BOOST_FWD_REF(Args)... args); -//! }; -//! -//! // Specialize trait for class template Y -//! template > -//! struct constructible_with_allocator_prefix > -//! { static const bool value = true; }; -//! -//! -//! -//! Note: This trait is a workaround inspired by "N2554: The Scoped Allocator Model (Rev 2)" -//! (Pablo Halpern, 2008-02-29) to backport the scoped allocator model to C++03, as -//! in C++03 there is no mechanism to detect if a type can be constructed from arbitrary arguments. -//! Applications aiming portability with several compilers should always define this trait. -//! -//! In conforming C++11 compilers or compilers supporting SFINAE expressions -//! (when BOOST_NO_SFINAE_EXPR is NOT defined), this trait is ignored and C++11 rules will be used -//! to detect if a type should be constructed with suffix or prefix allocator arguments. -template -struct constructible_with_allocator_prefix -{ static const bool value = false; }; - -#ifndef BOOST_CONTAINER_DOXYGEN_INVOKED - -namespace container_detail { - -template -struct uses_allocator_imp -{ - // Use SFINAE (Substitution Failure Is Not An Error) to detect the - // presence of an 'allocator_type' nested type convertilble from Allocator. - private: - typedef char yes_type; - struct no_type{ char dummy[2]; }; - - // Match this function if TypeT::allocator_type exists and is - // implicitly convertible from Allocator - template - static yes_type test(typename U::allocator_type); - - // Match this function if TypeT::allocator_type does not exist or is - // not convertible from Allocator. - template - static no_type test(...); - static Allocator alloc; // Declared but not defined - - public: - static const bool value = sizeof(test(alloc)) == sizeof(yes_type); -}; - -} //namespace container_detail { - -#endif //#ifndef BOOST_CONTAINER_DOXYGEN_INVOKED - -//! Remark: Automatically detects if T has a nested allocator_type that is convertible from -//! Allocator. Meets the BinaryTypeTrait requirements ([meta.rqmts] 20.4.1). A program may -//! specialize this type to define uses_allocator::value as true for a T of user-defined type if T does not -//! have a nested allocator_type but is nonetheless constructible using the specified Allocator. -//! -//! Result: uses_allocator::value== true if Convertible, -//! false otherwise. -template -struct uses_allocator - : container_detail::uses_allocator_imp -{}; - #ifndef BOOST_CONTAINER_DOXYGEN_INVOKED namespace container_detail { @@ -249,198 +112,17 @@ struct outermost_allocator {}; template -typename container_detail::outermost_allocator_imp::type & +typename outermost_allocator::type & get_outermost_allocator(Allocator &a) -{ return container_detail::outermost_allocator_imp::get(a); } +{ return outermost_allocator::get(a); } template -const typename container_detail::outermost_allocator_imp::type & +const typename outermost_allocator::type & get_outermost_allocator(const Allocator &a) -{ return container_detail::outermost_allocator_imp::get(a); } +{ return outermost_allocator::get(a); } namespace container_detail { -// Check if we can detect is_convertible using advanced SFINAE expressions -#if !defined(BOOST_NO_CXX11_DECLTYPE) && !defined(BOOST_NO_CXX11_VARIADIC_TEMPLATES) - - //! Code inspired by Mathias Gaunard's is_convertible.cpp found in the Boost mailing list - //! http://boost.2283326.n4.nabble.com/type-traits-is-constructible-when-decltype-is-supported-td3575452.html - //! Thanks Mathias! - - //With variadic templates, we need a single class to implement the trait - template - struct is_constructible - { - typedef char yes_type; - struct no_type - { char padding[2]; }; - - template - struct dummy; - - template - static decltype(X(boost::move_detail::declval()...), true_type()) test(int); - - template - static no_type test(...); - - static const bool value = sizeof(test(0)) == sizeof(yes_type); - }; - - template - struct is_constructible_with_allocator_prefix - : is_constructible - {}; - -#else // #if !defined(BOOST_NO_SFINAE_EXPR) && !defined(BOOST_NO_CXX11_VARIADIC_TEMPLATES) - - //Without advanced SFINAE expressions, we can't use is_constructible - //so backup to constructible_with_allocator_xxx - - #if !defined(BOOST_NO_CXX11_VARIADIC_TEMPLATES) - - template - struct is_constructible_with_allocator_prefix - : constructible_with_allocator_prefix - {}; - - template - struct is_constructible_with_allocator_suffix - : constructible_with_allocator_suffix - {}; - - #else // #if !defined(BOOST_NO_CXX11_VARIADIC_TEMPLATES) - - template - struct is_constructible_with_allocator_prefix - : constructible_with_allocator_prefix - {}; - - template - struct is_constructible_with_allocator_suffix - : constructible_with_allocator_suffix - {}; - - #endif // #if !defined(BOOST_NO_CXX11_VARIADIC_TEMPLATES) - -#endif // #if !defined(BOOST_NO_SFINAE_EXPR) - -#if !defined(BOOST_NO_CXX11_VARIADIC_TEMPLATES) - -// allocator_arg_t -template < typename OutermostAlloc - , typename InnerAlloc - , typename T - , class ...Args - > -inline void dispatch_allocator_prefix_suffix - ( true_type use_alloc_prefix, OutermostAlloc& outermost_alloc - , InnerAlloc& inner_alloc, T* p, BOOST_FWD_REF(Args) ...args) -{ - (void)use_alloc_prefix; - allocator_traits::construct - ( outermost_alloc, p, allocator_arg, inner_alloc, ::boost::forward(args)...); -} - -// allocator suffix -template < typename OutermostAlloc - , typename InnerAlloc - , typename T - , class ...Args - > -inline void dispatch_allocator_prefix_suffix - ( false_type use_alloc_prefix, OutermostAlloc& outermost_alloc - , InnerAlloc &inner_alloc, T* p, BOOST_FWD_REF(Args)...args) -{ - (void)use_alloc_prefix; - allocator_traits::construct - (outermost_alloc, p, ::boost::forward(args)..., inner_alloc); -} - -template < typename OutermostAlloc - , typename InnerAlloc - , typename T - , class ...Args - > -inline void dispatch_uses_allocator - ( true_type uses_allocator, OutermostAlloc& outermost_alloc - , InnerAlloc& inner_alloc, T* p, BOOST_FWD_REF(Args)...args) -{ - (void)uses_allocator; - //BOOST_STATIC_ASSERT((is_constructible_with_allocator_prefix::value || - // is_constructible_with_allocator_suffix::value )); - dispatch_allocator_prefix_suffix - ( bool_< is_constructible_with_allocator_prefix::value>() - , outermost_alloc, inner_alloc, p, ::boost::forward(args)...); -} - -template < typename OutermostAlloc - , typename InnerAlloc - , typename T - , class ...Args - > -inline void dispatch_uses_allocator - ( false_type uses_allocator, OutermostAlloc & outermost_alloc - , InnerAlloc & inner_alloc - ,T* p, BOOST_FWD_REF(Args)...args) -{ - (void)uses_allocator; (void)inner_alloc; - allocator_traits::construct - (outermost_alloc, p, ::boost::forward(args)...); -} - -#else //#if !defined(BOOST_NO_CXX11_VARIADIC_TEMPLATES) - -#define BOOST_CONTAINER_SCOPED_ALLOCATOR_DISPATCH_USES_ALLOCATOR_CODE(N) \ -template < typename OutermostAlloc, typename InnerAlloc, typename T\ - BOOST_MOVE_I##N BOOST_MOVE_CLASS##N > \ -inline void dispatch_allocator_prefix_suffix\ - (true_type use_alloc_prefix, OutermostAlloc& outermost_alloc,\ - InnerAlloc& inner_alloc, T* p BOOST_MOVE_I##N BOOST_MOVE_UREF##N)\ -{\ - (void)use_alloc_prefix,\ - allocator_traits::construct\ - (outermost_alloc, p, allocator_arg, inner_alloc BOOST_MOVE_I##N BOOST_MOVE_FWD##N);\ -}\ -\ -template < typename OutermostAlloc, typename InnerAlloc, typename T\ - BOOST_MOVE_I##N BOOST_MOVE_CLASS##N >\ -inline void dispatch_allocator_prefix_suffix\ - (false_type use_alloc_prefix, OutermostAlloc& outermost_alloc,\ - InnerAlloc& inner_alloc, T* p BOOST_MOVE_I##N BOOST_MOVE_UREF##N)\ -{\ - (void)use_alloc_prefix;\ - allocator_traits::construct\ - (outermost_alloc, p BOOST_MOVE_I##N BOOST_MOVE_FWD##N, inner_alloc);\ -}\ -\ -template < typename OutermostAlloc, typename InnerAlloc, typename T\ - BOOST_MOVE_I##N BOOST_MOVE_CLASS##N >\ -inline void dispatch_uses_allocator\ - (true_type uses_allocator, OutermostAlloc& outermost_alloc,\ - InnerAlloc& inner_alloc, T* p BOOST_MOVE_I##N BOOST_MOVE_UREF##N)\ -{\ - (void)uses_allocator;\ - dispatch_allocator_prefix_suffix\ - ( bool_< is_constructible_with_allocator_prefix::value >()\ - , outermost_alloc, inner_alloc, p BOOST_MOVE_I##N BOOST_MOVE_FWD##N);\ -}\ -\ -template < typename OutermostAlloc, typename InnerAlloc, typename T\ - BOOST_MOVE_I##N BOOST_MOVE_CLASS##N >\ -inline void dispatch_uses_allocator\ - (false_type uses_allocator, OutermostAlloc &outermost_alloc,\ - InnerAlloc &inner_alloc, T* p BOOST_MOVE_I##N BOOST_MOVE_UREF##N)\ -{\ - (void)uses_allocator; (void)inner_alloc;\ - allocator_traits::construct(outermost_alloc, p BOOST_MOVE_I##N BOOST_MOVE_FWD##N);\ -}\ -// -BOOST_MOVE_ITERATE_0TO9(BOOST_CONTAINER_SCOPED_ALLOCATOR_DISPATCH_USES_ALLOCATOR_CODE) -#undef BOOST_CONTAINER_SCOPED_ALLOCATOR_DISPATCH_USES_ALLOCATOR_CODE - -#endif //#if !defined(BOOST_NO_CXX11_VARIADIC_TEMPLATES) - #if !defined(BOOST_NO_CXX11_VARIADIC_TEMPLATES) template @@ -923,24 +605,24 @@ class scoped_allocator_adaptor typedef typename outer_traits_type::void_pointer void_pointer; typedef typename outer_traits_type::const_void_pointer const_void_pointer; //! Type: A type with a constant boolean value == true if - //!`allocator_traits::propagate_on_container_copy_assignment::value` is + //!`allocator_traits:: propagate_on_container_copy_assignment::value` is //! true for any Allocator in the set of OuterAlloc and InnerAllocs..., false otherwise. typedef typename base_type:: propagate_on_container_copy_assignment propagate_on_container_copy_assignment; //! Type: A type with a constant boolean value == true if - //!`allocator_traits::propagate_on_container_move_assignment::value` is + //!`allocator_traits:: propagate_on_container_move_assignment::value` is //! true for any Allocator in the set of OuterAlloc and InnerAllocs..., false otherwise. typedef typename base_type:: propagate_on_container_move_assignment propagate_on_container_move_assignment; //! Type: A type with a constant boolean value == true if - //! `allocator_traits::propagate_on_container_swap::value` is + //! `allocator_traits:: propagate_on_container_swap::value` is //! true for any Allocator in the set of OuterAlloc and InnerAllocs..., false otherwise. typedef typename base_type:: propagate_on_container_swap propagate_on_container_swap; //! Type: A type with a constant boolean value == true if - //!`allocator_traits::is_always_equal::value` is + //!`allocator_traits:: is_always_equal::value` is //! true for all Allocator in the set of OuterAlloc and InnerAllocs..., false otherwise. typedef typename base_type:: is_always_equal is_always_equal; @@ -1053,12 +735,12 @@ class scoped_allocator_adaptor #endif //BOOST_CONTAINER_DOXYGEN_INVOKED //! Returns: - //! allocator_traits::max_size(outer_allocator()). + //! allocator_traits:: max_size(outer_allocator()). size_type max_size() const BOOST_NOEXCEPT_OR_NOTHROW { return outer_traits_type::max_size(this->outer_allocator()); } //! Effects: - //! calls OUTERMOST_ALLOC_TRAITS(*this)::destroy(OUTERMOST(*this), p). + //! calls OUTERMOST_ALLOC_TRAITS(*this):: destroy(OUTERMOST(*this), p). template void destroy(T* p) BOOST_NOEXCEPT_OR_NOTHROW { @@ -1099,12 +781,12 @@ class scoped_allocator_adaptor //! Effects: //! 1) If uses_allocator::value is false calls - //! OUTERMOST_ALLOC_TRAITS(*this)::construct - //! (OUTERMOST(*this), p, std::forward(args)...). + //! OUTERMOST_ALLOC_TRAITS(*this):: + //! construct(OUTERMOST(*this), p, std::forward(args)...). //! //! 2) Otherwise, if uses_allocator::value is true and - //! is_constructible::value is true, calls - //! OUTERMOST_ALLOC_TRAITS(*this)::construct(OUTERMOST(*this), p, allocator_arg, + //! is_constructible:: value is true, calls + //! OUTERMOST_ALLOC_TRAITS(*this):: construct(OUTERMOST(*this), p, allocator_arg, //! inner_allocator(), std::forward(args)...). //! //! [Note: In compilers without advanced decltype SFINAE support, is_constructible can't @@ -1112,13 +794,13 @@ class scoped_allocator_adaptor //! constructible_with_allocator_prefix::value. -end note] //! //! 3) Otherwise, if uses_allocator::value is true and - //! is_constructible::value is true, calls - //! OUTERMOST_ALLOC_TRAITS(*this)::construct(OUTERMOST(*this), p, + //! is_constructible:: value is true, calls + //! OUTERMOST_ALLOC_TRAITS(*this):: construct(OUTERMOST(*this), p, //! std::forward(args)..., inner_allocator()). //! //! [Note: In compilers without advanced decltype SFINAE support, is_constructible can't be //! implemented so that condition will be replaced by - //! constructible_with_allocator_suffix::value. -end note] + //! constructible_with_allocator_suffix:: value. -end note] //! //! 4) Otherwise, the program is ill-formed. //! @@ -1126,18 +808,11 @@ class scoped_allocator_adaptor //! to true but the specific constructor does not take an allocator. This definition prevents a silent //! failure to pass an inner allocator to a contained element. -end note] template < typename T, class ...Args> - #if defined(BOOST_CONTAINER_DOXYGEN_INVOKED) - void - #else - typename container_detail::enable_if >::type - #endif - construct(T* p, BOOST_FWD_REF(Args)...args) + void construct(T* p, BOOST_FWD_REF(Args)...args) { container_detail::dispatch_uses_allocator - ( container_detail::bool_::value>() - , get_outermost_allocator(this->outer_allocator()) - , this->inner_allocator() - , p, ::boost::forward(args)...); + ( (get_outermost_allocator)(this->outer_allocator()) + , this->inner_allocator(), p, ::boost::forward(args)...); } #else // #if !defined(BOOST_NO_CXX11_VARIADIC_TEMPLATES) || defined(BOOST_CONTAINER_DOXYGEN_INVOKED) @@ -1146,12 +821,10 @@ class scoped_allocator_adaptor //overload selection problems when the first parameter is a pair. #define BOOST_CONTAINER_SCOPED_ALLOCATOR_CONSTRUCT_CODE(N) \ template < typename T BOOST_MOVE_I##N BOOST_MOVE_CLASSQ##N >\ - typename container_detail::enable_if< container_detail::is_not_pair >::type\ - construct(T* p BOOST_MOVE_I##N BOOST_MOVE_UREFQ##N)\ + void construct(T* p BOOST_MOVE_I##N BOOST_MOVE_UREFQ##N)\ {\ container_detail::dispatch_uses_allocator\ - ( container_detail::bool_::value>()\ - , get_outermost_allocator(this->outer_allocator())\ + ( (get_outermost_allocator)(this->outer_allocator())\ , this->inner_allocator(), p BOOST_MOVE_I##N BOOST_MOVE_FWDQ##N);\ }\ // @@ -1160,81 +833,7 @@ class scoped_allocator_adaptor #endif // #if !defined(BOOST_NO_CXX11_VARIADIC_TEMPLATES) || defined(BOOST_CONTAINER_DOXYGEN_INVOKED) - template - void construct(std::pair* p) - { this->construct_pair(p); } - - template - void construct(container_detail::pair* p) - { this->construct_pair(p); } - - template - void construct(std::pair* p, BOOST_FWD_REF(U) x, BOOST_FWD_REF(V) y) - { this->construct_pair(p, ::boost::forward(x), ::boost::forward(y)); } - - template - void construct(container_detail::pair* p, BOOST_FWD_REF(U) x, BOOST_FWD_REF(V) y) - { this->construct_pair(p, ::boost::forward(x), ::boost::forward(y)); } - - template - void construct(std::pair* p, const std::pair& x) - { this->construct_pair(p, x); } - - template - void construct( container_detail::pair* p - , const container_detail::pair& x) - { this->construct_pair(p, x); } - - template - void construct( std::pair* p - , BOOST_RV_REF_BEG std::pair BOOST_RV_REF_END x) - { this->construct_pair(p, ::boost::move(x)); } - - template - void construct( container_detail::pair* p - , BOOST_RV_REF_BEG container_detail::pair BOOST_RV_REF_END x) - { this->construct_pair(p, ::boost::move(x)); } - #ifndef BOOST_CONTAINER_DOXYGEN_INVOKED - private: - template - void construct_pair(Pair* p) - { - this->construct(container_detail::addressof(p->first)); - BOOST_TRY{ - this->construct(container_detail::addressof(p->second)); - } - BOOST_CATCH(...){ - this->destroy(container_detail::addressof(p->first)); - BOOST_RETHROW - } - BOOST_CATCH_END - } - - template - void construct_pair(Pair* p, BOOST_FWD_REF(U) x, BOOST_FWD_REF(V) y) - { - this->construct(container_detail::addressof(p->first), ::boost::forward(x)); - BOOST_TRY{ - this->construct(container_detail::addressof(p->second), ::boost::forward(y)); - } - BOOST_CATCH(...){ - this->destroy(container_detail::addressof(p->first)); - BOOST_RETHROW - } - BOOST_CATCH_END - } - - template - void construct_pair(Pair* p, const Pair2& pr) - { this->construct_pair(p, pr.first, pr.second); } - - template - void construct_pair(Pair* p, BOOST_RV_REF(Pair2) pr) - { this->construct_pair(p, ::boost::move(pr.first), ::boost::move(pr.second)); } - - //template - //void construct(pair* p, piecewise_construct_t, tuple x, tuple y); public: //Internal function @@ -1246,10 +845,12 @@ class scoped_allocator_adaptor #endif //#ifndef BOOST_CONTAINER_DOXYGEN_INVOKED }; +/// @cond + template struct scoped_allocator_operator_equal { - //Optimize equal outer allocator types with + //Optimize equal outer allocator types with //allocator_traits::equal which uses is_always_equal template static bool equal_outer(const IA &l, const IA &r) @@ -1278,6 +879,7 @@ struct scoped_allocator_operator_equal { return true; } }; +/// @endcond template inline bool operator==(const scoped_allocator_adaptor& a diff --git a/3party/boost/boost/container/scoped_allocator_fwd.hpp b/3party/boost/boost/container/scoped_allocator_fwd.hpp index 003ed9f7f7..cddf7fad15 100644 --- a/3party/boost/boost/container/scoped_allocator_fwd.hpp +++ b/3party/boost/boost/container/scoped_allocator_fwd.hpp @@ -1,6 +1,6 @@ ////////////////////////////////////////////////////////////////////////////// // -// (C) Copyright Ion Gaztanaga 2011-2013. Distributed under the Boost +// (C) Copyright Ion Gaztanaga 2015-2015. 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) // @@ -13,7 +13,6 @@ //! \file //! This header file forward declares boost::container::scoped_allocator_adaptor -//! and defines the following types: #ifndef BOOST_CONFIG_HPP # include @@ -26,6 +25,7 @@ #include #include #include +#include #if defined(BOOST_NO_CXX11_VARIADIC_TEMPLATES) #include @@ -59,38 +59,11 @@ namespace boost { namespace container { #endif - template - struct std_allocator_arg_holder - { - static ::std::allocator_arg_t *dummy; - }; - - template - ::std::allocator_arg_t *std_allocator_arg_holder::dummy; #else //BOOST_CONTAINER_DOXYGEN_INVOKED #endif //#ifndef BOOST_CONTAINER_DOXYGEN_INVOKED -//! The allocator_arg_t struct is an empty structure type used as a unique type to -//! disambiguate constructor and function overloading. Specifically, several types -//! have constructors with allocator_arg_t as the first argument, immediately followed -//! by an argument of a type that satisfies Allocator requirements -typedef const std::allocator_arg_t & allocator_arg_t; - -//! A instance of type allocator_arg_t -//! -static allocator_arg_t allocator_arg = BOOST_CONTAINER_DOC1ST(unspecified, *std_allocator_arg_holder<>::dummy); - -template -struct constructible_with_allocator_suffix; - -template -struct constructible_with_allocator_prefix; - -template -struct uses_allocator; - }} // namespace boost { namespace container { #include diff --git a/3party/boost/boost/container/set.hpp b/3party/boost/boost/container/set.hpp index 79fa1aec66..5cf0f964a5 100644 --- a/3party/boost/boost/container/set.hpp +++ b/3party/boost/boost/container/set.hpp @@ -59,22 +59,22 @@ namespace container { //! \tparam Key is the type to be inserted in the set, which is also the key_type //! \tparam Compare is the comparison functor used to order keys //! \tparam Allocator is the allocator to be used to allocate memory for this container -//! \tparam SetOptions is an packed option type generated using using boost::container::tree_assoc_options. -template , class Allocator = new_allocator, class SetOptions = tree_assoc_defaults > +//! \tparam Options is an packed option type generated using using boost::container::tree_assoc_options. +template , class Allocator = new_allocator, class Options = tree_assoc_defaults > #else -template +template #endif class set ///@cond : public container_detail::tree - < Key, Key, container_detail::identity, Compare, Allocator, SetOptions> + < Key, container_detail::identity, Compare, Allocator, Options> ///@endcond { #ifndef BOOST_CONTAINER_DOXYGEN_INVOKED private: BOOST_COPYABLE_AND_MOVABLE(set) typedef container_detail::tree - < Key, Key, container_detail::identity, Compare, Allocator, SetOptions> base_t; + < Key, container_detail::identity, Compare, Allocator, Options> base_t; #endif //#ifndef BOOST_CONTAINER_DOXYGEN_INVOKED public: @@ -100,6 +100,8 @@ class set typedef typename BOOST_CONTAINER_IMPDEF(base_t::const_iterator) const_iterator; typedef typename BOOST_CONTAINER_IMPDEF(base_t::reverse_iterator) reverse_iterator; typedef typename BOOST_CONTAINER_IMPDEF(base_t::const_reverse_iterator) const_reverse_iterator; + typedef typename BOOST_CONTAINER_IMPDEF(base_t::node_type) node_type; + typedef typename BOOST_CONTAINER_IMPDEF(base_t::insert_return_type) insert_return_type; ////////////////////////////////////////////// // @@ -110,7 +112,8 @@ class set //! Effects: Default constructs an empty set. //! //! Complexity: Constant. - set() + set() BOOST_NOEXCEPT_IF(container_detail::is_nothrow_default_constructible::value && + container_detail::is_nothrow_default_constructible::value) : base_t() {} @@ -215,6 +218,7 @@ class set //! //! Postcondition: x is emptied. set(BOOST_RV_REF(set) x) + BOOST_NOEXCEPT_IF(boost::container::container_detail::is_nothrow_move_constructible::value) : base_t(BOOST_MOVE_BASE(base_t, x)) {} @@ -248,11 +252,15 @@ class set //! propagate_on_container_move_assignment is true or //! this->get>allocator() == x.get_allocator(). Linear otherwise. set& operator=(BOOST_RV_REF(set) x) - BOOST_NOEXCEPT_IF( allocator_traits_type::is_always_equal::value - && boost::container::container_detail::is_nothrow_move_assignable::value ) + BOOST_NOEXCEPT_IF( (allocator_traits_type::propagate_on_container_move_assignment::value || + allocator_traits_type::is_always_equal::value) && + boost::container::container_detail::is_nothrow_move_assignable::value) { return static_cast(this->base_t::operator=(BOOST_MOVE_BASE(base_t, x))); } #if !defined(BOOST_NO_CXX11_HDR_INITIALIZER_LIST) + //! Effects: Copy all elements from il to *this. + //! + //! Complexity: Linear in il.size(). set& operator=(std::initializer_list il) { this->clear(); @@ -517,6 +525,42 @@ class set { this->base_t::insert_unique(il.begin(), il.end()); } #endif + //! @copydoc ::boost::container::map::insert(node_type&&) + insert_return_type insert(BOOST_RV_REF_BEG_IF_CXX11 node_type BOOST_RV_REF_END_IF_CXX11 nh) + { return this->base_t::insert_unique_node(boost::move(nh)); } + + //! @copydoc ::boost::container::map::insert(const_iterator, node_type&&) + insert_return_type insert(const_iterator hint, BOOST_RV_REF_BEG_IF_CXX11 node_type BOOST_RV_REF_END_IF_CXX11 nh) + { return this->base_t::insert_unique_node(hint, boost::move(nh)); } + + //! @copydoc ::boost::container::map::merge(map&) + template + BOOST_CONTAINER_FORCEINLINE void merge(set& source) + { + typedef container_detail::tree + , C2, Allocator, Options> base2_t; + this->base_t::merge_unique(static_cast(source)); + } + + //! @copydoc ::boost::container::set::merge(set&) + template + BOOST_CONTAINER_FORCEINLINE void merge(BOOST_RV_REF_BEG set BOOST_RV_REF_END source) + { return this->merge(static_cast&>(source)); } + + //! @copydoc ::boost::container::map::merge(multimap&) + template + BOOST_CONTAINER_FORCEINLINE void merge(multiset& source) + { + typedef container_detail::tree + , C2, Allocator, Options> base2_t; + this->base_t::merge_unique(static_cast(source)); + } + + //! @copydoc ::boost::container::set::merge(multiset&) + template + BOOST_CONTAINER_FORCEINLINE void merge(BOOST_RV_REF_BEG multiset BOOST_RV_REF_END source) + { return this->merge(static_cast&>(source)); } + #if defined(BOOST_CONTAINER_DOXYGEN_INVOKED) //! Effects: Erases the element pointed to by p. @@ -708,8 +752,8 @@ class set //!has_trivial_destructor_after_move<> == true_type //!specialization for optimizations -template -struct has_trivial_destructor_after_move > +template +struct has_trivial_destructor_after_move > { typedef typename ::boost::container::allocator_traits::pointer pointer; static const bool value = ::boost::has_trivial_destructor_after_move::value && @@ -734,22 +778,22 @@ namespace container { //! \tparam Key is the type to be inserted in the set, which is also the key_type //! \tparam Compare is the comparison functor used to order keys //! \tparam Allocator is the allocator to be used to allocate memory for this container -//! \tparam MultiSetOptions is an packed option type generated using using boost::container::tree_assoc_options. -template , class Allocator = new_allocator, class MultiSetOptions = tree_assoc_defaults > +//! \tparam Options is an packed option type generated using using boost::container::tree_assoc_options. +template , class Allocator = new_allocator, class Options = tree_assoc_defaults > #else -template +template #endif class multiset /// @cond : public container_detail::tree - , Compare, Allocator, MultiSetOptions> + , Compare, Allocator, Options> /// @endcond { #ifndef BOOST_CONTAINER_DOXYGEN_INVOKED private: BOOST_COPYABLE_AND_MOVABLE(multiset) typedef container_detail::tree - , Compare, Allocator, MultiSetOptions> base_t; + , Compare, Allocator, Options> base_t; #endif //#ifndef BOOST_CONTAINER_DOXYGEN_INVOKED public: @@ -776,6 +820,7 @@ class multiset typedef typename BOOST_CONTAINER_IMPDEF(base_t::const_iterator) const_iterator; typedef typename BOOST_CONTAINER_IMPDEF(base_t::reverse_iterator) reverse_iterator; typedef typename BOOST_CONTAINER_IMPDEF(base_t::const_reverse_iterator) const_reverse_iterator; + typedef typename BOOST_CONTAINER_IMPDEF(base_t::node_type) node_type; ////////////////////////////////////////////// // @@ -784,7 +829,8 @@ class multiset ////////////////////////////////////////////// //! @copydoc ::boost::container::set::set() - multiset() + multiset() BOOST_NOEXCEPT_IF(container_detail::is_nothrow_default_constructible::value && + container_detail::is_nothrow_default_constructible::value) : base_t() {} @@ -851,17 +897,18 @@ class multiset : base_t(static_cast(x)) {} - //! @copydoc ::boost::container::set(set &&) + //! @copydoc ::boost::container::set::set(set &&) multiset(BOOST_RV_REF(multiset) x) + BOOST_NOEXCEPT_IF(boost::container::container_detail::is_nothrow_move_constructible::value) : base_t(BOOST_MOVE_BASE(base_t, x)) {} - //! @copydoc ::boost::container::set(const set &, const allocator_type &) + //! @copydoc ::boost::container::set::set(const set &, const allocator_type &) multiset(const multiset& x, const allocator_type &a) : base_t(static_cast(x), a) {} - //! @copydoc ::boost::container::set(set &&, const allocator_type &) + //! @copydoc ::boost::container::set::set(set &&, const allocator_type &) multiset(BOOST_RV_REF(multiset) x, const allocator_type &a) : base_t(BOOST_MOVE_BASE(base_t, x), a) {} @@ -872,8 +919,9 @@ class multiset //! @copydoc ::boost::container::set::operator=(set &&) multiset& operator=(BOOST_RV_REF(multiset) x) - BOOST_NOEXCEPT_IF( allocator_traits_type::is_always_equal::value - && boost::container::container_detail::is_nothrow_move_assignable::value ) + BOOST_NOEXCEPT_IF( (allocator_traits_type::propagate_on_container_move_assignment::value || + allocator_traits_type::is_always_equal::value) && + boost::container::container_detail::is_nothrow_move_assignable::value) { return static_cast(this->base_t::operator=(BOOST_MOVE_BASE(base_t, x))); } #if !defined(BOOST_NO_CXX11_HDR_INITIALIZER_LIST) @@ -1040,6 +1088,42 @@ class multiset { this->base_t::insert_equal(il.begin(), il.end()); } #endif + //! @copydoc ::boost::container::multimap::insert(node_type&&) + iterator insert(BOOST_RV_REF_BEG_IF_CXX11 node_type BOOST_RV_REF_END_IF_CXX11 nh) + { return this->base_t::insert_equal_node(boost::move(nh)); } + + //! @copydoc ::boost::container::multimap::insert(const_iterator, node_type&&) + iterator insert(const_iterator hint, BOOST_RV_REF_BEG_IF_CXX11 node_type BOOST_RV_REF_END_IF_CXX11 nh) + { return this->base_t::insert_equal_node(hint, boost::move(nh)); } + + //! @copydoc ::boost::container::multimap::merge(multimap&) + template + BOOST_CONTAINER_FORCEINLINE void merge(multiset& source) + { + typedef container_detail::tree + , C2, Allocator, Options> base2_t; + this->base_t::merge_equal(static_cast(source)); + } + + //! @copydoc ::boost::container::multiset::merge(multiset&) + template + BOOST_CONTAINER_FORCEINLINE void merge(BOOST_RV_REF_BEG multiset BOOST_RV_REF_END source) + { return this->merge(static_cast&>(source)); } + + //! @copydoc ::boost::container::multimap::merge(map&) + template + BOOST_CONTAINER_FORCEINLINE void merge(set& source) + { + typedef container_detail::tree + , C2, Allocator, Options> base2_t; + this->base_t::merge_equal(static_cast(source)); + } + + //! @copydoc ::boost::container::multiset::merge(set&) + template + BOOST_CONTAINER_FORCEINLINE void merge(BOOST_RV_REF_BEG set BOOST_RV_REF_END source) + { return this->merge(static_cast&>(source)); } + #if defined(BOOST_CONTAINER_DOXYGEN_INVOKED) //! @copydoc ::boost::container::set::erase(const_iterator) @@ -1151,8 +1235,8 @@ class multiset //!has_trivial_destructor_after_move<> == true_type //!specialization for optimizations -template -struct has_trivial_destructor_after_move > +template +struct has_trivial_destructor_after_move > { typedef typename ::boost::container::allocator_traits::pointer pointer; static const bool value = ::boost::has_trivial_destructor_after_move::value && diff --git a/3party/boost/boost/container/slist.hpp b/3party/boost/boost/container/slist.hpp index 2b53df132f..3a1d66bb6d 100644 --- a/3party/boost/boost/container/slist.hpp +++ b/3party/boost/boost/container/slist.hpp @@ -1,6 +1,6 @@ ////////////////////////////////////////////////////////////////////////////// // -// (C) Copyright Ion Gaztanaga 2004-2013. Distributed under the Boost +// (C) Copyright Ion Gaztanaga 2004-2015. 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) // @@ -216,7 +216,7 @@ class slist //! Throws: If allocator_type's copy constructor throws. //! //! Complexity: Constant. - slist() + slist() BOOST_NOEXCEPT_IF(container_detail::is_nothrow_default_constructible::value) : AllocHolder() {} @@ -303,7 +303,7 @@ class slist //! Throws: If allocator_type's copy constructor throws. //! //! Complexity: Constant. - slist(BOOST_RV_REF(slist) x) + slist(BOOST_RV_REF(slist) x) BOOST_NOEXCEPT_OR_NOTHROW : AllocHolder(BOOST_MOVE_BASE(AllocHolder, x)) {} @@ -379,7 +379,7 @@ class slist //! Complexity: Constant if allocator_traits_type:: //! propagate_on_container_move_assignment is true or //! this->get>allocator() == x.get_allocator(). Linear otherwise. - slist& operator= (BOOST_RV_REF(slist) x) + slist& operator=(BOOST_RV_REF(slist) x) BOOST_NOEXCEPT_IF(allocator_traits_type::propagate_on_container_move_assignment::value || allocator_traits_type::is_always_equal::value) { @@ -684,7 +684,10 @@ class slist //! //! Complexity: Constant. reference front() - { return *this->begin(); } + { + BOOST_ASSERT(!this->empty()); + return *this->begin(); + } //! Requires: !empty() //! @@ -695,7 +698,10 @@ class slist //! //! Complexity: Constant. const_reference front() const - { return *this->begin(); } + { + BOOST_ASSERT(!this->empty()); + return *this->begin(); + } ////////////////////////////////////////////// // @@ -708,13 +714,15 @@ class slist //! Effects: Inserts an object of type T constructed with //! std::forward(args)... in the front of the list //! + //! Returns: A reference to the created object. + //! //! Throws: If memory allocation throws or //! T's copy constructor throws. //! //! Complexity: Amortized constant time. template - void emplace_front(BOOST_FWD_REF(Args)... args) - { this->emplace_after(this->cbefore_begin(), boost::forward(args)...); } + reference emplace_front(BOOST_FWD_REF(Args)... args) + { return *this->emplace_after(this->cbefore_begin(), boost::forward(args)...); } //! Effects: Inserts an object of type T constructed with //! std::forward(args)... after prev @@ -734,8 +742,8 @@ class slist #define BOOST_CONTAINER_SLIST_EMPLACE_CODE(N) \ BOOST_MOVE_TMPL_LT##N BOOST_MOVE_CLASS##N BOOST_MOVE_GT##N \ - void emplace_front(BOOST_MOVE_UREF##N)\ - { this->emplace_after(this->cbefore_begin() BOOST_MOVE_I##N BOOST_MOVE_FWD##N);}\ + reference emplace_front(BOOST_MOVE_UREF##N)\ + { return *this->emplace_after(this->cbefore_begin() BOOST_MOVE_I##N BOOST_MOVE_FWD##N);}\ \ BOOST_MOVE_TMPL_LT##N BOOST_MOVE_CLASS##N BOOST_MOVE_GT##N \ iterator emplace_after(const_iterator p BOOST_MOVE_I##N BOOST_MOVE_UREF##N)\ @@ -788,7 +796,7 @@ class slist //! Requires: prev_p must be a valid iterator of *this. //! //! Effects: Inserts a move constructed copy object from the value after the - //! p pointed by prev_p. + //! element pointed by prev_p. //! //! Returns: An iterator to the inserted element. //! @@ -897,7 +905,10 @@ class slist //! //! Complexity: Amortized constant time. void pop_front() - { this->icont().pop_front_and_dispose(Destroyer(this->node_alloc())); } + { + BOOST_ASSERT(!this->empty()); + this->icont().pop_front_and_dispose(Destroyer(this->node_alloc())); + } //! Effects: Erases the element after the element pointed by prev_p //! of the list. @@ -939,7 +950,12 @@ class slist void swap(slist& x) BOOST_NOEXCEPT_IF( allocator_traits_type::propagate_on_container_swap::value || allocator_traits_type::is_always_equal::value) - { AllocHolder::swap(x); } + { + BOOST_ASSERT(allocator_traits_type::propagate_on_container_swap::value || + allocator_traits_type::is_always_equal::value || + this->get_stored_allocator() == x.get_stored_allocator()); + AllocHolder::swap(x); + } //! Effects: Erases all the elements of the list. //! @@ -1390,7 +1406,7 @@ class slist //! Requires: p must be a valid iterator of *this. //! - //! Effects: Erases the element at p p. + //! Effects: Erases the element at p. //! //! Throws: Nothing. //! @@ -1444,7 +1460,7 @@ class slist //! this' allocator and x's allocator shall compare equal //! //! Effects: Transfers the value pointed by i, from list x to this list, - //! before the the element pointed by p. No destructors or copy constructors are called. + //! before the element pointed by p. No destructors or copy constructors are called. //! If p == i or p == ++i, this function is a null operation. //! //! Throws: Nothing @@ -1461,7 +1477,7 @@ class slist //! this' allocator and x's allocator shall compare equal. //! //! Effects: Transfers the value pointed by i, from list x to this list, - //! before the the element pointed by p. No destructors or copy constructors are called. + //! before the element pointed by p. No destructors or copy constructors are called. //! If p == i or p == ++i, this function is a null operation. //! //! Throws: Nothing @@ -1477,7 +1493,7 @@ class slist //! by this list. first and last must point to elements contained in list x. //! //! Effects: Transfers the range pointed by first and last from list x to this list, - //! before the the element pointed by p. No destructors or copy constructors are called. + //! before the element pointed by p. No destructors or copy constructors are called. //! this' allocator and x's allocator shall compare equal. //! //! Throws: Nothing @@ -1495,7 +1511,7 @@ class slist //! this' allocator and x's allocator shall compare equal //! //! Effects: Transfers the range pointed by first and last from list x to this list, - //! before the the element pointed by p. No destructors or copy constructors are called. + //! before the element pointed by p. No destructors or copy constructors are called. //! //! Throws: Nothing //! @@ -1652,30 +1668,26 @@ struct has_trivial_destructor_after_move > namespace container { -#endif //#ifndef BOOST_CONTAINER_DOXYGEN_INVOKED - }} //namespace boost{ namespace container { +#endif //#ifndef BOOST_CONTAINER_DOXYGEN_INVOKED + // Specialization of insert_iterator so that insertions will be constant // time rather than linear time. -#ifndef BOOST_CONTAINER_DOXYGEN_INVOKED - -#if defined(__clang__) && defined(_LIBCPP_VERSION) - #define BOOST_CONTAINER_CLANG_INLINE_STD_NS - #pragma GCC diagnostic push - #pragma GCC diagnostic ignored "-Wc++11-extensions" -#endif - -BOOST_CONTAINER_STD_NS_BEG +#include +BOOST_CONTAINER_DOC1ST(namespace std {, BOOST_MOVE_STD_NS_BEG) +//! A specialization of insert_iterator +//! that works with slist template class insert_iterator > { - protected: + private: typedef boost::container::slist Container; Container* container; typename Container::iterator iter; + public: typedef Container container_type; typedef output_iterator_tag iterator_category; @@ -1700,14 +1712,8 @@ class insert_iterator > insert_iterator& operator++(int){ return *this; } }; -BOOST_CONTAINER_STD_NS_END - -#ifdef BOOST_CONTAINER_CLANG_INLINE_STD_NS - #pragma GCC diagnostic pop - #undef BOOST_CONTAINER_CLANG_INLINE_STD_NS -#endif //BOOST_CONTAINER_CLANG_INLINE_STD_NS - -#endif //#ifndef BOOST_CONTAINER_DOXYGEN_INVOKED +BOOST_CONTAINER_DOC1ST( }, BOOST_MOVE_STD_NS_END) +#include #include diff --git a/3party/boost/boost/container/small_vector.hpp b/3party/boost/boost/container/small_vector.hpp index 11b02832ea..14446247ac 100644 --- a/3party/boost/boost/container/small_vector.hpp +++ b/3party/boost/boost/container/small_vector.hpp @@ -58,14 +58,14 @@ class small_vector_base; //! A non-standard allocator used to implement `small_vector`. //! Users should never use it directly. It is described here //! for documentation purposes. -//! +//! //! This allocator inherits from a standard-conforming allocator //! and forwards member functions to the standard allocator except //! when internal storage is being used as memory source. //! //! This allocator is a "partially_propagable" allocator and //! defines `is_partially_propagable` as true_type. -//! +//! //! A partially propagable allocator means that not all storage //! allocatod by an instance of `small_vector_allocator` can be //! deallocated by another instance of this type, even if both @@ -91,10 +91,10 @@ class small_vector_allocator BOOST_COPYABLE_AND_MOVABLE(small_vector_allocator) - const Allocator &as_base() const + BOOST_CONTAINER_FORCEINLINE const Allocator &as_base() const { return static_cast(*this); } - Allocator &as_base() + BOOST_CONTAINER_FORCEINLINE Allocator &as_base() { return static_cast(*this); } #endif //#ifndef BOOST_CONTAINER_DOXYGEN_INVOKED @@ -117,9 +117,9 @@ class small_vector_allocator typedef typename allocator_traits::propagate_on_container_copy_assignment propagate_on_container_copy_assignment; typedef typename allocator_traits::propagate_on_container_move_assignment propagate_on_container_move_assignment; typedef typename allocator_traits::propagate_on_container_swap propagate_on_container_swap; - //! An integral constant with member `::value == false` + //! An integral constant with member `value == false` typedef BOOST_CONTAINER_IMPDEF(container_detail::bool_) is_always_equal; - //! An integral constant with member `::value == true` + //! An integral constant with member `value == true` typedef BOOST_CONTAINER_IMPDEF(container_detail::bool_) is_partially_propagable; BOOST_CONTAINER_DOCIGN(typedef container_detail::version_type version;) @@ -135,13 +135,13 @@ class small_vector_allocator #if !defined(BOOST_NO_CXX11_VARIADIC_TEMPLATES) || defined(BOOST_CONTAINER_DOXYGEN_INVOKED) //!Constructor from arbitrary arguments template - explicit small_vector_allocator(BOOST_FWD_REF(Args) ...args) + BOOST_CONTAINER_FORCEINLINE explicit small_vector_allocator(BOOST_FWD_REF(Args) ...args) : Allocator(::boost::forward(args)...) {} #else #define BOOST_CONTAINER_SMALL_VECTOR_ALLOCATOR_CTOR_CODE(N) \ BOOST_MOVE_TMPL_LT##N BOOST_MOVE_CLASS##N BOOST_MOVE_GT##N \ - explicit small_vector_allocator(BOOST_MOVE_UREF##N)\ + BOOST_CONTAINER_FORCEINLINE explicit small_vector_allocator(BOOST_MOVE_UREF##N)\ : Allocator(BOOST_MOVE_FWD##N)\ {}\ // @@ -151,54 +151,62 @@ class small_vector_allocator //!Constructor from other small_vector_allocator. //!Never throws - small_vector_allocator(const small_vector_allocator &other) BOOST_NOEXCEPT_OR_NOTHROW + BOOST_CONTAINER_FORCEINLINE small_vector_allocator + (const small_vector_allocator &other) BOOST_NOEXCEPT_OR_NOTHROW : Allocator(other.as_base()) {} //!Move constructor from small_vector_allocator. //!Never throws - small_vector_allocator(BOOST_RV_REF(small_vector_allocator) other) BOOST_NOEXCEPT_OR_NOTHROW + BOOST_CONTAINER_FORCEINLINE small_vector_allocator + (BOOST_RV_REF(small_vector_allocator) other) BOOST_NOEXCEPT_OR_NOTHROW : Allocator(::boost::move(other.as_base())) {} //!Constructor from related small_vector_allocator. //!Never throws template - small_vector_allocator(const small_vector_allocator &other) BOOST_NOEXCEPT_OR_NOTHROW + BOOST_CONTAINER_FORCEINLINE small_vector_allocator + (const small_vector_allocator &other) BOOST_NOEXCEPT_OR_NOTHROW : Allocator(other.as_base()) {} //!Move constructor from related small_vector_allocator. //!Never throws template - small_vector_allocator(BOOST_RV_REF(small_vector_allocator) other) BOOST_NOEXCEPT_OR_NOTHROW + BOOST_CONTAINER_FORCEINLINE small_vector_allocator + (BOOST_RV_REF(small_vector_allocator) other) BOOST_NOEXCEPT_OR_NOTHROW : Allocator(::boost::move(other.as_base())) {} //!Assignment from other small_vector_allocator. //!Never throws - small_vector_allocator & operator=(BOOST_COPY_ASSIGN_REF(small_vector_allocator) other) BOOST_NOEXCEPT_OR_NOTHROW + BOOST_CONTAINER_FORCEINLINE small_vector_allocator & + operator=(BOOST_COPY_ASSIGN_REF(small_vector_allocator) other) BOOST_NOEXCEPT_OR_NOTHROW { return static_cast(this->Allocator::operator=(other.as_base())); } //!Move constructor from other small_vector_allocator. //!Never throws - small_vector_allocator & operator=(BOOST_RV_REF(small_vector_allocator) other) BOOST_NOEXCEPT_OR_NOTHROW + BOOST_CONTAINER_FORCEINLINE small_vector_allocator & + operator=(BOOST_RV_REF(small_vector_allocator) other) BOOST_NOEXCEPT_OR_NOTHROW { return static_cast(this->Allocator::operator=(::boost::move(other.as_base()))); } //!Assignment from related small_vector_allocator. //!Never throws template - small_vector_allocator & operator=(BOOST_COPY_ASSIGN_REF(small_vector_allocator) other) BOOST_NOEXCEPT_OR_NOTHROW + BOOST_CONTAINER_FORCEINLINE small_vector_allocator & + operator=(BOOST_COPY_ASSIGN_REF(small_vector_allocator) other) BOOST_NOEXCEPT_OR_NOTHROW { return static_cast(this->Allocator::operator=(other.as_base())); } //!Move assignment from related small_vector_allocator. //!Never throws template - small_vector_allocator & operator=(BOOST_RV_REF(small_vector_allocator) other) BOOST_NOEXCEPT_OR_NOTHROW + BOOST_CONTAINER_FORCEINLINE small_vector_allocator & + operator=(BOOST_RV_REF(small_vector_allocator) other) BOOST_NOEXCEPT_OR_NOTHROW { return static_cast(this->Allocator::operator=(::boost::move(other.as_base()))); } //!Allocates storage from the standard-conforming allocator - pointer allocate(size_type count, const_void_pointer hint = const_void_pointer()) + BOOST_CONTAINER_FORCEINLINE pointer allocate(size_type count, const_void_pointer hint = const_void_pointer()) { return allocator_traits_type::allocate(this->as_base(), count, hint); } //!Deallocates previously allocated memory. @@ -211,7 +219,7 @@ class small_vector_allocator //!Returns the maximum number of elements that could be allocated. //!Never throws - size_type max_size() const BOOST_NOEXCEPT_OR_NOTHROW + BOOST_CONTAINER_FORCEINLINE size_type max_size() const BOOST_NOEXCEPT_OR_NOTHROW { return allocator_traits_type::max_size(this->as_base()); } small_vector_allocator select_on_container_copy_construction() const @@ -222,17 +230,17 @@ class small_vector_allocator //!Swaps two allocators, does nothing //!because this small_vector_allocator is stateless - friend void swap(small_vector_allocator &l, small_vector_allocator &r) BOOST_NOEXCEPT_OR_NOTHROW + BOOST_CONTAINER_FORCEINLINE friend void swap(small_vector_allocator &l, small_vector_allocator &r) BOOST_NOEXCEPT_OR_NOTHROW { boost::adl_move_swap(l.as_base(), r.as_base()); } //!An small_vector_allocator always compares to true, as memory allocated with one //!instance can be deallocated by another instance (except for unpropagable storage) - friend bool operator==(const small_vector_allocator &l, const small_vector_allocator &r) BOOST_NOEXCEPT_OR_NOTHROW + BOOST_CONTAINER_FORCEINLINE friend bool operator==(const small_vector_allocator &l, const small_vector_allocator &r) BOOST_NOEXCEPT_OR_NOTHROW { return allocator_traits_type::equal(l.as_base(), r.as_base()); } //!An small_vector_allocator always compares to false, as memory allocated with one //!instance can be deallocated by another instance - friend bool operator!=(const small_vector_allocator &l, const small_vector_allocator &r) BOOST_NOEXCEPT_OR_NOTHROW + BOOST_CONTAINER_FORCEINLINE friend bool operator!=(const small_vector_allocator &l, const small_vector_allocator &r) BOOST_NOEXCEPT_OR_NOTHROW { return !(l == r); } #ifndef BOOST_CONTAINER_DOXYGEN_INVOKED @@ -268,7 +276,7 @@ class small_vector_allocator using Allocator::allocate_many; using Allocator::deallocate_many;*/ - bool is_internal_storage(pointer p) const + BOOST_CONTAINER_FORCEINLINE bool is_internal_storage(pointer p) const { return this->internal_storage() == p; } pointer internal_storage() const @@ -287,22 +295,27 @@ class small_vector_allocator }; //! This class consists of common code from all small_vector types that don't depend on the -//! "N" template parameter. This class is non-copyable and non-destructible, so this class tipically +//! "N" template parameter. This class is non-copyable and non-destructible, so this class typically //! used as reference argument to functions that read or write small vectors. Since `small_vector` -//! derives from `small_vector_base`, the conversion to `small_vector_base` is implicit: -//! +//! derives from `small_vector_base`, the conversion to `small_vector_base` is implicit +//!
 //!
 //! //Clients can pass any small_vector.
 //! void read_any_small_vector_of_foo(const small_vector_base &in_parameter);
-//! void modify_any_small_vector_of_foo(small_vector_base &out_parameter);
+//!
+//! void modify_any_small_vector_of_foo(small_vector_base &in_out_parameter);
 //!
 //! void some_function()
 //! {
+//! 
 //!    small_vector myvector;
+//!
 //!    read_any_small_vector_of_foo(myvector);   // Reads myvector
+//!
 //!    modify_any_small_vector_of_foo(myvector); // Modifies myvector
+//! 
 //! }
-//! 
+//! 
//! //! All `boost::container:vector` member functions are inherited. See `vector` documentation for details. //! @@ -316,7 +329,7 @@ class small_vector_base //must have this public member typedef typename allocator_traits::pointer pointer; - private: + private: BOOST_COPYABLE_AND_MOVABLE(small_vector_base) friend class small_vector_allocator; @@ -339,19 +352,16 @@ class small_vector_base protected: typedef typename base_type::initial_capacity_t initial_capacity_t; - explicit small_vector_base(initial_capacity_t, std::size_t initial_capacity) + BOOST_CONTAINER_FORCEINLINE explicit small_vector_base(initial_capacity_t, std::size_t initial_capacity) : base_type(initial_capacity_t(), this->internal_storage(), initial_capacity) {} template - explicit small_vector_base(initial_capacity_t, std::size_t capacity, BOOST_FWD_REF(AllocFwd) a) + BOOST_CONTAINER_FORCEINLINE explicit small_vector_base(initial_capacity_t, std::size_t capacity, BOOST_FWD_REF(AllocFwd) a) : base_type(initial_capacity_t(), this->internal_storage(), capacity, ::boost::forward(a)) {} - ~small_vector_base(){} - - using base_type::is_propagable_from; - using base_type::steal_resources; + //~small_vector_base(){} private: //The only member @@ -360,14 +370,29 @@ class small_vector_base #endif //#ifndef BOOST_CONTAINER_DOXYGEN_INVOKED public: - small_vector_base& operator=(BOOST_COPY_ASSIGN_REF(small_vector_base) other) + BOOST_CONTAINER_FORCEINLINE small_vector_base& operator=(BOOST_COPY_ASSIGN_REF(small_vector_base) other) { return static_cast(this->base_type::operator=(static_cast(other))); } - small_vector_base& operator=(BOOST_RV_REF(small_vector_base) other) + BOOST_CONTAINER_FORCEINLINE small_vector_base& operator=(BOOST_RV_REF(small_vector_base) other) { return static_cast(this->base_type::operator=(BOOST_MOVE_BASE(base_type, other))); } - void swap(small_vector_base &other) + BOOST_CONTAINER_FORCEINLINE void swap(small_vector_base &other) { return this->base_type::swap(other); } + + #ifndef BOOST_CONTAINER_DOXYGEN_INVOKED + protected: + void move_construct_impl(base_type &x, const allocator_type &a) + { + if(base_type::is_propagable_from(x.get_stored_allocator(), x.data(), a, true)){ + this->steal_resources(x); + } + else{ + this->assign( boost::make_move_iterator(container_detail::iterator_to_raw_pointer(x.begin())) + , boost::make_move_iterator(container_detail::iterator_to_raw_pointer(x.end ())) + ); + } + } + #endif //#ifndef BOOST_CONTAINER_DOXYGEN_INVOKED }; #ifndef BOOST_CONTAINER_DOXYGEN_INVOKED @@ -472,76 +497,114 @@ class small_vector : public small_vector_base typedef typename base_type::size_type size_type; typedef typename base_type::value_type value_type; - static std::size_t internal_capacity() + BOOST_CONTAINER_FORCEINLINE static std::size_t internal_capacity() { return (sizeof(small_vector) - storage_test::s_start)/sizeof(T); } #endif //#ifndef BOOST_CONTAINER_DOXYGEN_INVOKED + //! @brief The capacity/max size of the container + static const size_type static_capacity = N; + public: - small_vector() + BOOST_CONTAINER_FORCEINLINE small_vector() + BOOST_NOEXCEPT_IF(container_detail::is_nothrow_default_constructible::value) : base_type(initial_capacity_t(), internal_capacity()) {} - explicit small_vector(size_type n) - : base_type(initial_capacity_t(), internal_capacity()) - { this->resize(n); } - - explicit small_vector(const allocator_type &a) + BOOST_CONTAINER_FORCEINLINE explicit small_vector(const allocator_type &a) : base_type(initial_capacity_t(), internal_capacity(), a) {} - small_vector(size_type n, const allocator_type &a) + BOOST_CONTAINER_FORCEINLINE explicit small_vector(size_type n) + : base_type(initial_capacity_t(), internal_capacity()) + { this->resize(n); } + + BOOST_CONTAINER_FORCEINLINE small_vector(size_type n, const allocator_type &a) : base_type(initial_capacity_t(), internal_capacity(), a) { this->resize(n); } - small_vector(const small_vector &other) + BOOST_CONTAINER_FORCEINLINE small_vector(size_type n, default_init_t) + : base_type(initial_capacity_t(), internal_capacity()) + { this->resize(n, default_init_t()); } + + BOOST_CONTAINER_FORCEINLINE small_vector(size_type n, default_init_t, const allocator_type &a) + : base_type(initial_capacity_t(), internal_capacity(), a) + { this->resize(n, default_init_t()); } + + BOOST_CONTAINER_FORCEINLINE small_vector(size_type n, const value_type &v) + : base_type(initial_capacity_t(), internal_capacity()) + { this->resize(n, v); } + + BOOST_CONTAINER_FORCEINLINE small_vector(size_type n, const value_type &v, const allocator_type &a) + : base_type(initial_capacity_t(), internal_capacity(), a) + { this->resize(n, v); } + + template + BOOST_CONTAINER_FORCEINLINE small_vector(InIt first, InIt last + BOOST_CONTAINER_DOCIGN(BOOST_MOVE_I typename container_detail::disable_if_c + < container_detail::is_convertible::value + BOOST_MOVE_I container_detail::nat >::type * = 0) + ) + : base_type(initial_capacity_t(), internal_capacity()) + { this->assign(first, last); } + + template + BOOST_CONTAINER_FORCEINLINE small_vector(InIt first, InIt last, const allocator_type& a + BOOST_CONTAINER_DOCIGN(BOOST_MOVE_I typename container_detail::disable_if_c + < container_detail::is_convertible::value + BOOST_MOVE_I container_detail::nat >::type * = 0) + ) + : base_type(initial_capacity_t(), internal_capacity(), a) + { this->assign(first, last); } + + BOOST_CONTAINER_FORCEINLINE small_vector(const small_vector &other) : base_type( initial_capacity_t(), internal_capacity() , allocator_traits_type::select_on_container_copy_construction(other.get_stored_allocator())) { this->assign(other.cbegin(), other.cend()); } - small_vector(const small_vector &other, const allocator_type &a) + BOOST_CONTAINER_FORCEINLINE small_vector(const small_vector &other, const allocator_type &a) : base_type(initial_capacity_t(), internal_capacity(), a) { this->assign(other.cbegin(), other.cend()); } - small_vector(BOOST_RV_REF(small_vector) other) + BOOST_CONTAINER_FORCEINLINE explicit small_vector(const base_type &other) + : base_type( initial_capacity_t(), internal_capacity() + , allocator_traits_type::select_on_container_copy_construction(other.get_stored_allocator())) + { this->assign(other.cbegin(), other.cend()); } + + BOOST_CONTAINER_FORCEINLINE explicit small_vector(BOOST_RV_REF(base_type) other) : base_type(initial_capacity_t(), internal_capacity(), ::boost::move(other.get_stored_allocator())) { this->move_construct_impl(other, other.get_stored_allocator()); } - small_vector(BOOST_RV_REF(small_vector) other, const allocator_type &a) + BOOST_CONTAINER_FORCEINLINE small_vector(BOOST_RV_REF(small_vector) other) + : base_type(initial_capacity_t(), internal_capacity(), ::boost::move(other.get_stored_allocator())) + { this->move_construct_impl(other, other.get_stored_allocator()); } + + BOOST_CONTAINER_FORCEINLINE small_vector(BOOST_RV_REF(small_vector) other, const allocator_type &a) : base_type(initial_capacity_t(), internal_capacity(), a) { this->move_construct_impl(other, a); } #if !defined(BOOST_NO_CXX11_HDR_INITIALIZER_LIST) - small_vector(std::initializer_list il, const allocator_type& a = allocator_type()) + BOOST_CONTAINER_FORCEINLINE small_vector(std::initializer_list il, const allocator_type& a = allocator_type()) : base_type(initial_capacity_t(), internal_capacity(), a) { this->assign(il.begin(), il.end()); } #endif - small_vector& operator=(BOOST_COPY_ASSIGN_REF(small_vector) other) + BOOST_CONTAINER_FORCEINLINE small_vector& operator=(BOOST_COPY_ASSIGN_REF(small_vector) other) { return static_cast(this->base_type::operator=(static_cast(other))); } - small_vector& operator=(BOOST_RV_REF(small_vector) other) + BOOST_CONTAINER_FORCEINLINE small_vector& operator=(BOOST_RV_REF(small_vector) other) { return static_cast(this->base_type::operator=(BOOST_MOVE_BASE(base_type, other))); } - void swap(small_vector &other) - { return this->base_type::swap(other); } + BOOST_CONTAINER_FORCEINLINE small_vector& operator=(const base_type &other) + { return static_cast(this->base_type::operator=(other)); } - #ifndef BOOST_CONTAINER_DOXYGEN_INVOKED - private: - void move_construct_impl(small_vector &x, const allocator_type &a) - { - if(base_type::is_propagable_from(x.get_stored_allocator(), x.data(), a, true)){ - this->steal_resources(x); - } - else{ - this->assign( boost::make_move_iterator(container_detail::iterator_to_raw_pointer(x.begin())) - , boost::make_move_iterator(container_detail::iterator_to_raw_pointer(x.end ())) - ); - } - } - #endif //#ifndef BOOST_CONTAINER_DOXYGEN_INVOKED + BOOST_CONTAINER_FORCEINLINE small_vector& operator=(BOOST_RV_REF(base_type) other) + { return static_cast(this->base_type::operator=(boost::move(other))); } + + BOOST_CONTAINER_FORCEINLINE void swap(small_vector &other) + { return this->base_type::swap(other); } }; }} diff --git a/3party/boost/boost/container/stable_vector.hpp b/3party/boost/boost/container/stable_vector.hpp index 9952a141db..5d6dc0f228 100644 --- a/3party/boost/boost/container/stable_vector.hpp +++ b/3party/boost/boost/container/stable_vector.hpp @@ -1,6 +1,6 @@ ////////////////////////////////////////////////////////////////////////////// // -// (C) Copyright Ion Gaztanaga 2008-2013. Distributed under the Boost +// (C) Copyright Ion Gaztanaga 2008-2015. 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) // @@ -540,7 +540,7 @@ class stable_vector //! Throws: If allocator_type's default constructor throws. //! //! Complexity: Constant. - stable_vector() + stable_vector() BOOST_NOEXCEPT_IF(container_detail::is_nothrow_default_constructible::value) : internal_data(), index() { STABLE_VECTOR_CHECK_INVARIANT; @@ -698,7 +698,7 @@ class stable_vector //! Throws: If allocator_type's copy constructor throws. //! //! Complexity: Constant. - stable_vector(BOOST_RV_REF(stable_vector) x) + stable_vector(BOOST_RV_REF(stable_vector) x) BOOST_NOEXCEPT_OR_NOTHROW : internal_data(boost::move(x.priv_node_alloc())), index(boost::move(x.index)) { this->priv_swap_members(x); @@ -728,7 +728,7 @@ class stable_vector : internal_data(a), index(a) { if(this->priv_node_alloc() == x.priv_node_alloc()){ - this->index.swap(x.index); + this->index.swap(x.index); this->priv_swap_members(x); } else{ @@ -1196,7 +1196,10 @@ class stable_vector //! //! Complexity: Constant. reference front() BOOST_NOEXCEPT_OR_NOTHROW - { return static_cast(*this->index.front()).value; } + { + BOOST_ASSERT(!this->empty()); + return static_cast(*this->index.front()).value; + } //! Requires: !empty() //! @@ -1207,7 +1210,10 @@ class stable_vector //! //! Complexity: Constant. const_reference front() const BOOST_NOEXCEPT_OR_NOTHROW - { return static_cast(*this->index.front()).value; } + { + BOOST_ASSERT(!this->empty()); + return static_cast(*this->index.front()).value; + } //! Requires: !empty() //! @@ -1218,7 +1224,10 @@ class stable_vector //! //! Complexity: Constant. reference back() BOOST_NOEXCEPT_OR_NOTHROW - { return static_cast(*this->index[this->size()-1u]).value; } + { + BOOST_ASSERT(!this->empty()); + return static_cast(*this->index[this->size()-1u]).value; + } //! Requires: !empty() //! @@ -1229,7 +1238,10 @@ class stable_vector //! //! Complexity: Constant. const_reference back() const BOOST_NOEXCEPT_OR_NOTHROW - { return static_cast(*this->index[this->size()-1u]).value; } + { + BOOST_ASSERT(!this->empty()); + return static_cast(*this->index[this->size()-1u]).value; + } //! Requires: size() > n. //! @@ -1241,7 +1253,7 @@ class stable_vector //! Complexity: Constant. reference operator[](size_type n) BOOST_NOEXCEPT_OR_NOTHROW { - BOOST_ASSERT(n < this->size()); + BOOST_ASSERT(this->size() > n); return static_cast(*this->index[n]).value; } @@ -1255,7 +1267,7 @@ class stable_vector //! Complexity: Constant. const_reference operator[](size_type n) const BOOST_NOEXCEPT_OR_NOTHROW { - BOOST_ASSERT(n < this->size()); + BOOST_ASSERT(this->size() > n); return static_cast(*this->index[n]).value; } @@ -1362,16 +1374,18 @@ class stable_vector //! Effects: Inserts an object of type T constructed with //! std::forward(args)... in the end of the stable_vector. //! + //! Returns: A reference to the created object. + //! //! Throws: If memory allocation throws or the in-place constructor throws. //! //! Complexity: Amortized constant time. template - void emplace_back(Args &&...args) + reference emplace_back(Args &&...args) { typedef emplace_functor EmplaceFunctor; typedef emplace_iterator EmplaceIterator; EmplaceFunctor &&ef = EmplaceFunctor(boost::forward(args)...); - this->insert(this->cend(), EmplaceIterator(ef), EmplaceIterator()); + return *this->insert(this->cend(), EmplaceIterator(ef), EmplaceIterator()); } //! Requires: p must be a valid iterator of *this. @@ -1386,6 +1400,7 @@ class stable_vector template iterator emplace(const_iterator p, Args && ...args) { + BOOST_ASSERT(this->priv_in_range_or_end(p)); size_type pos_n = p - cbegin(); typedef emplace_functor EmplaceFunctor; typedef emplace_iterator EmplaceIterator; @@ -1398,18 +1413,19 @@ class stable_vector #define BOOST_CONTAINER_STABLE_VECTOR_EMPLACE_CODE(N) \ BOOST_MOVE_TMPL_LT##N BOOST_MOVE_CLASS##N BOOST_MOVE_GT##N \ - void emplace_back(BOOST_MOVE_UREF##N)\ + reference emplace_back(BOOST_MOVE_UREF##N)\ {\ typedef emplace_functor##N\ BOOST_MOVE_LT##N BOOST_MOVE_TARG##N BOOST_MOVE_GT##N EmplaceFunctor;\ typedef emplace_iterator EmplaceIterator;\ EmplaceFunctor ef BOOST_MOVE_LP##N BOOST_MOVE_FWD##N BOOST_MOVE_RP##N;\ - this->insert(this->cend() , EmplaceIterator(ef), EmplaceIterator());\ + return *this->insert(this->cend() , EmplaceIterator(ef), EmplaceIterator());\ }\ \ BOOST_MOVE_TMPL_LT##N BOOST_MOVE_CLASS##N BOOST_MOVE_GT##N \ iterator emplace(const_iterator p BOOST_MOVE_I##N BOOST_MOVE_UREF##N)\ {\ + BOOST_ASSERT(this->priv_in_range_or_end(p));\ typedef emplace_functor##N\ BOOST_MOVE_LT##N BOOST_MOVE_TARG##N BOOST_MOVE_GT##N EmplaceFunctor;\ typedef emplace_iterator EmplaceIterator;\ @@ -1483,6 +1499,7 @@ class stable_vector //! Complexity: Linear to n. iterator insert(const_iterator p, size_type n, const T& t) { + BOOST_ASSERT(this->priv_in_range_or_end(p)); STABLE_VECTOR_CHECK_INVARIANT; typedef constant_iterator cvalue_iterator; return this->insert(p, cvalue_iterator(t, n), cvalue_iterator()); @@ -1499,6 +1516,7 @@ class stable_vector //! Complexity: Linear to distance [il.begin(), il.end()). iterator insert(const_iterator p, std::initializer_list il) { + //Position checks done by insert() STABLE_VECTOR_CHECK_INVARIANT; return insert(p, il.begin(), il.end()); } @@ -1515,17 +1533,19 @@ class stable_vector //! //! Complexity: Linear to distance [first, last). template - #if !defined(BOOST_CONTAINER_DOXYGEN_INVOKED) - typename container_detail::disable_if_or - < iterator - , container_detail::is_convertible - , container_detail::is_not_input_iterator - >::type - #else - iterator - #endif - insert(const_iterator p, InputIterator first, InputIterator last) + iterator insert(const_iterator p, InputIterator first, InputIterator last + #if !defined(BOOST_CONTAINER_DOXYGEN_INVOKED) + //Put this as argument instead of the return type as old GCC's like 3.4 + //detect this and the next disable_if_or as overloads + , typename container_detail::disable_if_or + < void + , container_detail::is_convertible + , container_detail::is_not_input_iterator + >::type* = 0 + #endif + ) { + BOOST_ASSERT(this->priv_in_range_or_end(p)); STABLE_VECTOR_CHECK_INVARIANT; const size_type pos_n = p - this->cbegin(); for(; first != last; ++first){ @@ -1543,6 +1563,7 @@ class stable_vector >::type insert(const_iterator p, FwdIt first, FwdIt last) { + BOOST_ASSERT(this->priv_in_range_or_end(p)); const size_type num_new = static_cast(boost::container::iterator_distance(first, last)); const size_type idx = static_cast(p - this->cbegin()); if(num_new){ @@ -1556,12 +1577,12 @@ class stable_vector //Prepare rollback insert_rollback rollback(*this, it_past_newly_constructed, it_past_new); while(first != last){ - const node_ptr p = this->priv_get_from_pool(); - BOOST_ASSERT(!!p); + const node_ptr n = this->priv_get_from_pool(); + BOOST_ASSERT(!!n); //Put it in the index so rollback can return it in pool if construct_in_place throws - *it_past_newly_constructed = p; + *it_past_newly_constructed = n; //Constructs and fixes up pointers This can throw - this->priv_build_node_from_it(p, it_past_newly_constructed, first); + this->priv_build_node_from_it(n, it_past_newly_constructed, first); ++first; ++it_past_newly_constructed; } @@ -1581,7 +1602,10 @@ class stable_vector //! //! Complexity: Constant time. void pop_back() BOOST_NOEXCEPT_OR_NOTHROW - { this->erase(--this->cend()); } + { + BOOST_ASSERT(!this->empty()); + this->erase(--this->cend()); + } //! Effects: Erases the element at p. //! @@ -1591,6 +1615,7 @@ class stable_vector //! last element. Constant if p is the last element. iterator erase(const_iterator p) BOOST_NOEXCEPT_OR_NOTHROW { + BOOST_ASSERT(this->priv_in_range(p)); STABLE_VECTOR_CHECK_INVARIANT; const size_type d = p - this->cbegin(); index_iterator it = this->index.begin() + d; @@ -1608,6 +1633,8 @@ class stable_vector //! plus linear to the elements between p and the last element. iterator erase(const_iterator first, const_iterator last) BOOST_NOEXCEPT_OR_NOTHROW { + BOOST_ASSERT(first == last || + (first < last && this->priv_in_range(first) && this->priv_in_range_or_end(last))); STABLE_VECTOR_CHECK_INVARIANT; const const_iterator cbeg(this->cbegin()); const size_type d1 = static_cast(first - cbeg), @@ -1641,6 +1668,9 @@ class stable_vector BOOST_NOEXCEPT_IF( allocator_traits_type::propagate_on_container_swap::value || allocator_traits_type::is_always_equal::value) { + BOOST_ASSERT(allocator_traits_type::propagate_on_container_swap::value || + allocator_traits_type::is_always_equal::value || + this->get_stored_allocator() == x.get_stored_allocator()); STABLE_VECTOR_CHECK_INVARIANT; container_detail::bool_ flag; container_detail::swap_alloc(this->priv_node_alloc(), x.priv_node_alloc(), flag); @@ -1702,6 +1732,16 @@ class stable_vector #ifndef BOOST_CONTAINER_DOXYGEN_INVOKED private: + bool priv_in_range(const_iterator pos) const + { + return (this->begin() <= pos) && (pos < this->end()); + } + + bool priv_in_range_or_end(const_iterator pos) const + { + return (this->begin() <= pos) && (pos <= this->end()); + } + size_type priv_index_of(node_ptr p) const { //Check range @@ -1807,12 +1847,14 @@ class stable_vector iterator priv_insert(const_iterator p, const value_type &t) { + BOOST_ASSERT(this->priv_in_range_or_end(p)); typedef constant_iterator cvalue_iterator; return this->insert(p, cvalue_iterator(t, 1), cvalue_iterator()); } iterator priv_insert(const_iterator p, BOOST_RV_REF(T) x) { + BOOST_ASSERT(this->priv_in_range_or_end(p)); typedef repeat_iterator repeat_it; typedef boost::move_iterator repeat_move_it; //Just call more general insert(p, size, value) and return iterator diff --git a/3party/boost/boost/container/static_vector.hpp b/3party/boost/boost/container/static_vector.hpp index c36832dfa3..21168cbf96 100644 --- a/3party/boost/boost/container/static_vector.hpp +++ b/3party/boost/boost/container/static_vector.hpp @@ -41,29 +41,32 @@ class static_storage_allocator public: typedef T value_type; - static_storage_allocator() BOOST_NOEXCEPT_OR_NOTHROW + BOOST_CONTAINER_FORCEINLINE static_storage_allocator() BOOST_NOEXCEPT_OR_NOTHROW {} - static_storage_allocator(const static_storage_allocator &) BOOST_NOEXCEPT_OR_NOTHROW + BOOST_CONTAINER_FORCEINLINE static_storage_allocator(const static_storage_allocator &) BOOST_NOEXCEPT_OR_NOTHROW {} - static_storage_allocator & operator=(const static_storage_allocator &) BOOST_NOEXCEPT_OR_NOTHROW - {} + BOOST_CONTAINER_FORCEINLINE static_storage_allocator & operator=(const static_storage_allocator &) BOOST_NOEXCEPT_OR_NOTHROW + { return *this; } - T* internal_storage() const BOOST_NOEXCEPT_OR_NOTHROW + BOOST_CONTAINER_FORCEINLINE T* internal_storage() const BOOST_NOEXCEPT_OR_NOTHROW { return const_cast(static_cast(static_cast(&storage))); } - T* internal_storage() BOOST_NOEXCEPT_OR_NOTHROW + BOOST_CONTAINER_FORCEINLINE T* internal_storage() BOOST_NOEXCEPT_OR_NOTHROW { return static_cast(static_cast(&storage)); } static const std::size_t internal_capacity = N; + std::size_t max_size() const + { return N; } + typedef boost::container::container_detail::version_type version; - friend bool operator==(const static_storage_allocator &, const static_storage_allocator &) BOOST_NOEXCEPT_OR_NOTHROW + BOOST_CONTAINER_FORCEINLINE friend bool operator==(const static_storage_allocator &, const static_storage_allocator &) BOOST_NOEXCEPT_OR_NOTHROW { return false; } - friend bool operator!=(const static_storage_allocator &, const static_storage_allocator &) BOOST_NOEXCEPT_OR_NOTHROW + BOOST_CONTAINER_FORCEINLINE friend bool operator!=(const static_storage_allocator &, const static_storage_allocator &) BOOST_NOEXCEPT_OR_NOTHROW { return true; } private: @@ -136,6 +139,9 @@ public: //! @brief The const reverse iterator. typedef typename base_t::const_reverse_iterator const_reverse_iterator; + //! @brief The capacity/max size of the container + static const size_type static_capacity = Capacity; + //! @brief Constructs an empty static_vector. //! //! @par Throws @@ -143,7 +149,7 @@ public: //! //! @par Complexity //! Constant O(1). - static_vector() BOOST_NOEXCEPT_OR_NOTHROW + BOOST_CONTAINER_FORCEINLINE static_vector() BOOST_NOEXCEPT_OR_NOTHROW : base_t() {} @@ -158,7 +164,7 @@ public: //! //! @par Complexity //! Linear O(N). - explicit static_vector(size_type count) + BOOST_CONTAINER_FORCEINLINE explicit static_vector(size_type count) : base_t(count) {} @@ -176,7 +182,7 @@ public: //! //! @par Note //! Non-standard extension - static_vector(size_type count, default_init_t) + BOOST_CONTAINER_FORCEINLINE static_vector(size_type count, default_init_t) : base_t(count, default_init_t()) {} @@ -192,7 +198,7 @@ public: //! //! @par Complexity //! Linear O(N). - static_vector(size_type count, value_type const& value) + BOOST_CONTAINER_FORCEINLINE static_vector(size_type count, value_type const& value) : base_t(count, value) {} @@ -211,7 +217,7 @@ public: //! @par Complexity //! Linear O(N). template - static_vector(Iterator first, Iterator last) + BOOST_CONTAINER_FORCEINLINE static_vector(Iterator first, Iterator last) : base_t(first, last) {} @@ -228,7 +234,7 @@ public: //! //! @par Complexity //! Linear O(N). - static_vector(std::initializer_list il) + BOOST_CONTAINER_FORCEINLINE static_vector(std::initializer_list il) : base_t(il) {} #endif @@ -242,7 +248,7 @@ public: //! //! @par Complexity //! Linear O(N). - static_vector(static_vector const& other) + BOOST_CONTAINER_FORCEINLINE static_vector(static_vector const& other) : base_t(other) {} @@ -258,7 +264,7 @@ public: //! @par Complexity //! Linear O(N). template - static_vector(static_vector const& other) + BOOST_CONTAINER_FORCEINLINE static_vector(static_vector const& other) : base_t(other) {} @@ -272,7 +278,8 @@ public: //! //! @par Complexity //! Linear O(N). - static_vector(BOOST_RV_REF(static_vector) other) + BOOST_CONTAINER_FORCEINLINE static_vector(BOOST_RV_REF(static_vector) other) + BOOST_NOEXCEPT_IF(boost::container::container_detail::is_nothrow_move_constructible::value) : base_t(BOOST_MOVE_BASE(base_t, other)) {} @@ -289,7 +296,7 @@ public: //! @par Complexity //! Linear O(N). template - static_vector(BOOST_RV_REF_BEG static_vector BOOST_RV_REF_END other) + BOOST_CONTAINER_FORCEINLINE static_vector(BOOST_RV_REF_BEG static_vector BOOST_RV_REF_END other) : base_t(BOOST_MOVE_BASE(typename static_vector::base_t, other)) {} @@ -302,7 +309,7 @@ public: //! //! @par Complexity //! Linear O(N). - static_vector & operator=(BOOST_COPY_ASSIGN_REF(static_vector) other) + BOOST_CONTAINER_FORCEINLINE static_vector & operator=(BOOST_COPY_ASSIGN_REF(static_vector) other) { return static_cast(base_t::operator=(static_cast(other))); } @@ -317,7 +324,7 @@ public: //! //! @par Complexity //! Linear O(N). - static_vector & operator=(std::initializer_list il) + BOOST_CONTAINER_FORCEINLINE static_vector & operator=(std::initializer_list il) { return static_cast(base_t::operator=(il)); } #endif @@ -333,7 +340,7 @@ public: //! @par Complexity //! Linear O(N). template - static_vector & operator=(static_vector const& other) + BOOST_CONTAINER_FORCEINLINE static_vector & operator=(static_vector const& other) { return static_cast(base_t::operator= (static_cast::base_t const&>(other))); @@ -349,7 +356,7 @@ public: //! //! @par Complexity //! Linear O(N). - static_vector & operator=(BOOST_RV_REF(static_vector) other) + BOOST_CONTAINER_FORCEINLINE static_vector & operator=(BOOST_RV_REF(static_vector) other) { return static_cast(base_t::operator=(BOOST_MOVE_BASE(base_t, other))); } @@ -367,7 +374,7 @@ public: //! @par Complexity //! Linear O(N). template - static_vector & operator=(BOOST_RV_REF_BEG static_vector BOOST_RV_REF_END other) + BOOST_CONTAINER_FORCEINLINE static_vector & operator=(BOOST_RV_REF_BEG static_vector BOOST_RV_REF_END other) { return static_cast(base_t::operator= (BOOST_MOVE_BASE(typename static_vector::base_t, other))); @@ -578,7 +585,6 @@ public: template iterator insert(const_iterator p, Iterator first, Iterator last); -#if !defined(BOOST_NO_CXX11_HDR_INITIALIZER_LIST) //! @pre //! @li \c p must be a valid iterator of \c *this in range [begin(), end()]. //! @li distance(il.begin(), il.end()) <= capacity() @@ -594,7 +600,6 @@ public: //! @par Complexity //! Linear O(N). iterator insert(const_iterator p, std::initializer_list il); -#endif //! @pre \c p must be a valid iterator of \c *this in range [begin(), end()) //! @@ -640,12 +645,11 @@ public: template void assign(Iterator first, Iterator last); -#if !defined(BOOST_NO_CXX11_HDR_INITIALIZER_LIST) //! @pre distance(il.begin(), il.end()) <= capacity() //! //! @brief Assigns a range [il.begin(), il.end()) of Values to this container. //! - //! @param first std::initializer_list with values used to construct new content of this container. + //! @param il std::initializer_list with values used to construct new content of this container. //! //! @par Throws //! If Value's copy constructor or copy assignment throws, @@ -653,7 +657,6 @@ public: //! @par Complexity //! Linear O(N). void assign(std::initializer_list il); -#endif //! @pre count <= capacity() //! @@ -674,6 +677,8 @@ public: //! @brief Inserts a Value constructed with //! \c std::forward(args)... in the end of the container. //! + //! @return A reference to the created object. + //! //! @param args The arguments of the constructor of the new element which will be created at the end of the container. //! //! @par Throws @@ -682,7 +687,7 @@ public: //! @par Complexity //! Constant O(1). template - void emplace_back(Args &&...args); + reference emplace_back(Args &&...args); //! @pre //! @li \c p must be a valid iterator of \c *this in range [begin(), end()] @@ -809,7 +814,7 @@ public: //! //! @brief Returns the index of the element pointed by p. //! - //! @param i The element's index. + //! @param p An iterator to the element. //! //! @return The index of the element pointed by p. //! @@ -824,7 +829,7 @@ public: //! //! @brief Returns the index of the element pointed by p. //! - //! @param i The index of the element pointed by p. + //! @param p A const_iterator to the element. //! //! @return a const_iterator to the i-th element. //! @@ -1095,7 +1100,7 @@ public: bool empty() const BOOST_NOEXCEPT_OR_NOTHROW; #else - friend void swap(static_vector &x, static_vector &y) + BOOST_CONTAINER_FORCEINLINE friend void swap(static_vector &x, static_vector &y) { x.swap(y); } diff --git a/3party/boost/boost/container/string.hpp b/3party/boost/boost/container/string.hpp index 7399223904..7b780fd588 100644 --- a/3party/boost/boost/container/string.hpp +++ b/3party/boost/boost/container/string.hpp @@ -1,6 +1,6 @@ ////////////////////////////////////////////////////////////////////////////// // -// (C) Copyright Ion Gaztanaga 2005-2013. Distributed under the Boost +// (C) Copyright Ion Gaztanaga 2005-2015. 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) // @@ -37,15 +37,18 @@ #include #include #include +#include +#include + +#include #include #include -#include -#include -#include -#include -#include +#include +#include +#include +#include #include #include //bind2nd, etc. @@ -56,8 +59,12 @@ #include #include #include -#include -#include + +//std +#if !defined(BOOST_NO_CXX11_HDR_INITIALIZER_LIST) +#include //for std::initializer_list +#endif + namespace boost { namespace container { @@ -93,11 +100,11 @@ class basic_string_base : members_() { init(); } - basic_string_base(const allocator_type& a) + explicit basic_string_base(const allocator_type& a) : members_(a) { init(); } - basic_string_base(BOOST_RV_REF(allocator_type) a) + explicit basic_string_base(BOOST_RV_REF(allocator_type) a) : members_(boost::move(a)) { this->init(); } @@ -108,6 +115,13 @@ class basic_string_base this->allocate_initial_block(n); } + explicit basic_string_base(size_type n) + : members_() + { + this->init(); + this->allocate_initial_block(n); + } + ~basic_string_base() { if(!this->is_short()){ @@ -223,7 +237,14 @@ class basic_string_base protected: bool is_short() const - { return static_cast(this->members_.m_repr.s.h.is_short != 0); } + { + //Access and copy (to avoid UB) the first byte of the union to know if the + //active representation is short or long + short_header hdr; + BOOST_STATIC_ASSERT((sizeof(short_header) == 1)); + *(unsigned char*)&hdr = *(unsigned char*)&this->members_.m_repr; + return hdr.is_short != 0; + } void is_short(bool yes) { @@ -577,7 +598,7 @@ class basic_string //! Effects: Default constructs a basic_string. //! //! Throws: If allocator_type's default constructor throws. - basic_string() + basic_string() BOOST_NOEXCEPT_IF(container_detail::is_nothrow_default_constructible::value) : base_t() { this->priv_terminate_string(); } @@ -601,6 +622,17 @@ class basic_string this->assign(s.begin(), s.end()); } + //! Effects: Same as basic_string(sv.data(), sv.size(), a). + //! + //! Throws: If allocator_type's default constructor or allocation throws. + template