From 87211ba8775bc37d7e5035a5e0c7f5472e5789d8 Mon Sep 17 00:00:00 2001 From: trcrsired Date: Sat, 17 Jan 2026 15:28:05 +0800 Subject: [PATCH 1/5] Partially implements insert_range for deque.h --- include/fast_io_dsal/impl/deque.h | 40 +++++++++++++++++++++++++------ 1 file changed, 33 insertions(+), 7 deletions(-) diff --git a/include/fast_io_dsal/impl/deque.h b/include/fast_io_dsal/impl/deque.h index f376c3e4..59750766 100644 --- a/include/fast_io_dsal/impl/deque.h +++ b/include/fast_io_dsal/impl/deque.h @@ -1956,21 +1956,47 @@ class deque FAST_IO_TRIVIALLY_RELOCATABLE_IF_ELIGIBLE inline constexpr insert_range_result insert_range_impl(size_type pos, R &&rg, size_type old_size) noexcept(::std::is_nothrow_constructible_v>) { #if 0 - size_type const halfold_size{old_size >> 1u}; if constexpr(::std::ranges::sized_range) { size_type const rgsize{::std::ranges::size(rg)}; + size_type const half_size{old_size >> 1u}; + if (pos < half_size) + { + + } + else + { + } } else #endif { - this->append_range(rg); - auto bg{this->begin()}; - iterator rotfirst = bg + pos; - iterator rotmid = bg + old_size; - iterator rotlast = this->end(); + size_type const quarterold_size{old_size >> 2u}; + size_type retpos; + iterator retit, rotfirst, rotmid, rotlast; + if (pos < quarterold_size) + { + this->prepend_range(rg); + size_type const new_size{this->size()}; + size_type const inserted{new_size - old_size}; + auto bg{this->begin()}; + size_type newpos{pos + inserted}; + rotfirst = bg; + rotmid = bg + inserted; + retpos = newpos; + retit = rotlast = bg + newpos; + } + else + { + this->append_range(rg); + auto bg{this->begin()}; + rotfirst = retit = bg + pos; + rotmid = bg + old_size; + rotlast = this->end(); + retpos = pos; + } ::fast_io::containers::rotate_for_fast_io_deque(rotfirst, rotmid, rotlast); - return {pos, rotfirst}; + return {retpos, retit}; } } From 9ddafb7cf57d293cd83204495910c072290403c9 Mon Sep 17 00:00:00 2001 From: trcrsired Date: Sat, 17 Jan 2026 18:08:43 +0800 Subject: [PATCH 2/5] cleanup part of code in deque for preparing insertion --- include/fast_io_dsal/impl/deque.h | 40 ++++++++++++++++++++++++++++--- 1 file changed, 37 insertions(+), 3 deletions(-) diff --git a/include/fast_io_dsal/impl/deque.h b/include/fast_io_dsal/impl/deque.h index 59750766..da04c2db 100644 --- a/include/fast_io_dsal/impl/deque.h +++ b/include/fast_io_dsal/impl/deque.h @@ -564,11 +564,16 @@ inline constexpr void deque_rebalance_or_grow_2x_after_blocks_impl(dequecontrolt } template -inline constexpr void deque_allocate_on_empty_common_impl(dequecontroltype &controller, ::std::size_t align, ::std::size_t bytes) noexcept +inline constexpr void deque_allocate_on_empty_common_with_n_impl(dequecontroltype &controller, ::std::size_t align, ::std::size_t bytes, + ::std::size_t initial_allocated_block_counts) noexcept { + constexpr ::std::size_t maxval{::std::numeric_limits<::std::size_t>::max()}; + if (initial_allocated_block_counts == maxval) [[unlikely]] + { + ::fast_io::fast_terminate(); + } + ::std::size_t initial_allocated_block_counts_with_sentinel{initial_allocated_block_counts + 1u}; using block_typed_allocator = ::fast_io::typed_generic_allocator_adapter; - constexpr ::std::size_t initial_allocated_block_counts{3}; - constexpr ::std::size_t initial_allocated_block_counts_with_sentinel{initial_allocated_block_counts + 1u}; auto [allocated_blocks_ptr, allocated_blocks_count] = block_typed_allocator::allocate_at_least(initial_allocated_block_counts_with_sentinel); // we need a null terminator as sentinel like c style string does --allocated_blocks_count; @@ -596,6 +601,13 @@ inline constexpr void deque_allocate_on_empty_common_impl(dequecontroltype &cont back_block.curr_ptr = halfposptr; } +template +inline constexpr void deque_allocate_on_empty_common_impl(dequecontroltype &controller, ::std::size_t align, ::std::size_t bytes) noexcept +{ + constexpr ::std::size_t initial_allocated_block_counts{3}; + ::fast_io::containers::details::deque_allocate_on_empty_common_with_n_impl(controller, align, bytes, initial_allocated_block_counts); +} + template inline constexpr void deque_grow_back_common_impl( dequecontroltype &controller, @@ -1193,6 +1205,28 @@ deque_erase_common_trivial_impl(::fast_io::containers::details::deque_controller return first; } +#if 0 +template +inline constexpr void deque_reserve_back_spaces_impl(dequecontroltype &controller, ::std::size_t n, ::std::size_t align, ::std::size_t blockbytes) noexcept +{ + ::std::size_t const nb{n/blockbytes}; + + if (controller.controller_block.controller_start_ptr == nullptr) + { + ::fast_io::containers::details::deque_allocate_on_empty_common_with_n_impl( + controller, align, blockbytes, nb); + return; + } + +} + +template +inline constexpr void deque_reserve_back_spaces(dequecontroltype &controller, ::std::size_t n) +{ + +} +#endif + } // namespace details template <::std::forward_iterator ForwardIt> From 33b5dbffa856d53a99c0b34f6bb3aadd3f952aa2 Mon Sep 17 00:00:00 2001 From: trcrsired Date: Sat, 17 Jan 2026 18:34:29 +0800 Subject: [PATCH 3/5] Remove spanops in core --- include/fast_io_core.h | 2 - .../operations/readimpl/impl.h | 1 - .../operations/readimpl/spanops.h | 192 ------------------ .../operations/writeimpl/impl.h | 1 - .../operations/writeimpl/spanops.h | 192 ------------------ include/fast_io_hosted.h | 3 +- 6 files changed, 2 insertions(+), 389 deletions(-) delete mode 100644 include/fast_io_core_impl/operations/readimpl/spanops.h delete mode 100644 include/fast_io_core_impl/operations/writeimpl/spanops.h diff --git a/include/fast_io_core.h b/include/fast_io_core.h index 5baeecc5..4cfee028 100644 --- a/include/fast_io_core.h +++ b/include/fast_io_core.h @@ -64,8 +64,6 @@ // #include"fast_io_core_impl/manip/impl.h" #include "fast_io_core_impl/mode.h" #include "fast_io_core_impl/perms.h" -#include "fast_io_dsal/impl/common.h" -#include "fast_io_dsal/impl/span.h" #include "fast_io_core_impl/operations/impl.h" // This should provide an option macro to disable any generation for table in freestanding environments. diff --git a/include/fast_io_core_impl/operations/readimpl/impl.h b/include/fast_io_core_impl/operations/readimpl/impl.h index 575ca172..e67109b7 100644 --- a/include/fast_io_core_impl/operations/readimpl/impl.h +++ b/include/fast_io_core_impl/operations/readimpl/impl.h @@ -7,5 +7,4 @@ #include "scatterp.h" #include "scatterpbytes.h" #include "decay.h" -#include "spanops.h" #include "ptrops.h" diff --git a/include/fast_io_core_impl/operations/readimpl/spanops.h b/include/fast_io_core_impl/operations/readimpl/spanops.h deleted file mode 100644 index dbab9b9c..00000000 --- a/include/fast_io_core_impl/operations/readimpl/spanops.h +++ /dev/null @@ -1,192 +0,0 @@ -#pragma once - - -namespace fast_io::operations -{ - -template -#if __has_cpp_attribute(__gnu__::__always_inline__) -[[__gnu__::__always_inline__]] -#elif __has_cpp_attribute(msvc::forceinline) -[[msvc::forceinline]] -#endif -inline constexpr ::fast_io::containers::span read_some_span(outstmtype &&outstm, ::fast_io::containers::span sp) -{ - auto first{sp.data()}; - auto last{first + sp.size()}; - return ::fast_io::containers::span(first, ::fast_io::details::read_some_impl(::fast_io::operations::input_stream_ref(outstm), first, last)); -} - -template -#if __has_cpp_attribute(__gnu__::__always_inline__) -[[__gnu__::__always_inline__]] -#elif __has_cpp_attribute(msvc::forceinline) -[[msvc::forceinline]] -#endif -inline constexpr void read_all_span(outstmtype &&outstm, ::fast_io::containers::span sp) -{ - auto first{sp.data()}; - auto last{first + sp.size()}; - ::fast_io::details::read_some_impl(::fast_io::operations::input_stream_ref(outstm), first, last); -} - -template -#if __has_cpp_attribute(__gnu__::__always_inline__) -[[__gnu__::__always_inline__]] -#elif __has_cpp_attribute(msvc::forceinline) -[[msvc::forceinline]] -#endif -inline constexpr ::fast_io::containers::span<::std::byte const> read_some_bytes_span(outstmtype &&outstm, ::fast_io::containers::span<::std::byte const> sp) -{ - auto first{sp.data()}; - auto last{first + sp.size()}; - return ::fast_io::containers::span<::std::byte const>(first, ::fast_io::details::read_some_bytes_impl(::fast_io::operations::input_stream_ref(outstm), first, last)); -} - -template -#if __has_cpp_attribute(__gnu__::__always_inline__) -[[__gnu__::__always_inline__]] -#elif __has_cpp_attribute(msvc::forceinline) -[[msvc::forceinline]] -#endif -inline constexpr void read_all_bytes_span(outstmtype &&outstm, ::fast_io::containers::span<::std::byte const> sp) -{ - auto first{sp.data()}; - auto last{first + sp.size()}; - ::fast_io::details::read_all_bytes_impl(::fast_io::operations::input_stream_ref(outstm), first, last); -} - -template -inline constexpr io_scatter_status_t scatter_read_some_bytes_span(outstmtype &&outstm, ::fast_io::containers::span<::fast_io::io_scatter_t const> sp) -{ - using io_scatter_may_alias_const_ptr -#if __has_cpp_attribute(__gnu__::__may_alias__) - [[__gnu__::__may_alias__]] -#endif - = io_scatter_t const *; - return ::fast_io::details::scatter_read_some_bytes_impl(::fast_io::operations::input_stream_ref(outstm), - reinterpret_cast(sp.data()), - sp.size()); -} - -template -inline constexpr void scatter_read_all_bytes_span(outstmtype &&outstm, ::fast_io::containers::span<::fast_io::io_scatter_t const> sp) -{ - using io_scatter_may_alias_const_ptr -#if __has_cpp_attribute(__gnu__::__may_alias__) - [[__gnu__::__may_alias__]] -#endif - = io_scatter_t const *; - ::fast_io::details::scatter_read_all_bytes_impl(::fast_io::operations::input_stream_ref(outstm), - reinterpret_cast(sp.data()), - sp.size()); -} - -template -inline constexpr io_scatter_status_t scatter_read_some_span(outstmtype &&outstm, ::fast_io::containers::span<::fast_io::basic_io_scatter_t const> sp) -{ - using io_scatter_may_alias_const_ptr -#if __has_cpp_attribute(__gnu__::__may_alias__) - [[__gnu__::__may_alias__]] -#endif - = basic_io_scatter_t const *; - return ::fast_io::details::scatter_read_some_impl(::fast_io::operations::input_stream_ref(outstm), - reinterpret_cast(sp.data()), - sp.size()); -} - -template -inline constexpr void scatter_read_all_span(outstmtype &&outstm, ::fast_io::containers::span<::fast_io::basic_io_scatter_t const> sp) -{ - using io_scatter_may_alias_const_ptr -#if __has_cpp_attribute(__gnu__::__may_alias__) - [[__gnu__::__may_alias__]] -#endif - = basic_io_scatter_t const *; - ::fast_io::details::scatter_read_all_impl(::fast_io::operations::input_stream_ref(outstm), - reinterpret_cast(sp.data()), - sp.size()); -} - -template -#if __has_cpp_attribute(__gnu__::__always_inline__) -[[__gnu__::__always_inline__]] -#elif __has_cpp_attribute(msvc::forceinline) -[[msvc::forceinline]] -#endif -inline constexpr ::fast_io::containers::span pread_some_span(outstmtype &&outstm, ::fast_io::containers::span sp, ::fast_io::intfpos_t off) -{ - auto first{sp.data()}; - auto last{first + sp.size()}; - return ::fast_io::containers::span(first, ::fast_io::details::pread_some_impl(::fast_io::operations::input_stream_ref(outstm), first, last, off)); -} - -template -#if __has_cpp_attribute(__gnu__::__always_inline__) -[[__gnu__::__always_inline__]] -#elif __has_cpp_attribute(msvc::forceinline) -[[msvc::forceinline]] -#endif -inline constexpr void pread_all_span(outstmtype &&outstm, ::fast_io::containers::span sp, ::fast_io::intfpos_t off) -{ - auto first{sp.data()}; - auto last{first + sp.size()}; - ::fast_io::details::pread_all_impl(::fast_io::operations::input_stream_ref(outstm), first, last, off); -} - -template -#if __has_cpp_attribute(__gnu__::__always_inline__) -[[__gnu__::__always_inline__]] -#elif __has_cpp_attribute(msvc::forceinline) -[[msvc::forceinline]] -#endif -inline constexpr ::fast_io::containers::span<::std::byte const> pread_some_bytes_span(outstmtype &&outstm, ::fast_io::containers::span<::std::byte const> sp, ::fast_io::intfpos_t off) -{ - auto first{sp.data()}; - auto last{first + sp.size()}; - return ::fast_io::containers::span<::std::byte const>(first, ::fast_io::details::pread_some_bytes_impl(::fast_io::operations::input_stream_ref(outstm), first, last, off)); -} - -template -#if __has_cpp_attribute(__gnu__::__always_inline__) -[[__gnu__::__always_inline__]] -#elif __has_cpp_attribute(msvc::forceinline) -[[msvc::forceinline]] -#endif -inline constexpr void pread_all_bytes_span(outstmtype &&outstm, ::fast_io::containers::span<::std::byte const> sp, ::fast_io::intfpos_t off) -{ - auto first{sp.data()}; - auto last{first + sp.size()}; - ::fast_io::details::pread_all_bytes_impl(::fast_io::operations::input_stream_ref(outstm), first, last, off); -} - -template -inline constexpr io_scatter_status_t scatter_pread_some_bytes_span(outstmtype &&outstm, ::fast_io::containers::span<::fast_io::io_scatter_t const> sp, ::fast_io::intfpos_t off) -{ - - return ::fast_io::details::scatter_pread_some_bytes_impl(::fast_io::operations::input_stream_ref(outstm), - sp.data(), sp.size(), off); -} - -template -inline constexpr void scatter_pread_all_bytes_span(outstmtype &&outstm, ::fast_io::containers::span<::fast_io::io_scatter_t const> sp, ::fast_io::intfpos_t off) -{ - ::fast_io::details::scatter_pread_all_bytes_impl(::fast_io::operations::input_stream_ref(outstm), - sp.data(), sp.size(), off); -} - -template -inline constexpr io_scatter_status_t scatter_pread_some_span(outstmtype &&outstm, ::fast_io::containers::span<::fast_io::basic_io_scatter_t const> sp, ::fast_io::intfpos_t off) -{ - return ::fast_io::details::scatter_pread_some_impl(::fast_io::operations::input_stream_ref(outstm), - sp.data(), sp.size(), off); -} - -template -inline constexpr void scatter_pread_all_span(outstmtype &&outstm, ::fast_io::containers::span<::fast_io::basic_io_scatter_t const> sp, ::fast_io::intfpos_t off) -{ - - ::fast_io::details::scatter_pread_all_impl(::fast_io::operations::input_stream_ref(outstm), sp.data(), sp.size(), off); -} - -} // namespace fast_io::operations diff --git a/include/fast_io_core_impl/operations/writeimpl/impl.h b/include/fast_io_core_impl/operations/writeimpl/impl.h index 26a0644a..2b6d71ab 100644 --- a/include/fast_io_core_impl/operations/writeimpl/impl.h +++ b/include/fast_io_core_impl/operations/writeimpl/impl.h @@ -8,5 +8,4 @@ #include "scatterpbytes.h" #include "decay.h" #include "range.h" -#include "spanops.h" #include "ptrops.h" diff --git a/include/fast_io_core_impl/operations/writeimpl/spanops.h b/include/fast_io_core_impl/operations/writeimpl/spanops.h deleted file mode 100644 index f6d37c87..00000000 --- a/include/fast_io_core_impl/operations/writeimpl/spanops.h +++ /dev/null @@ -1,192 +0,0 @@ -#pragma once - - -namespace fast_io::operations -{ - -template -#if __has_cpp_attribute(__gnu__::__always_inline__) -[[__gnu__::__always_inline__]] -#elif __has_cpp_attribute(msvc::forceinline) -[[msvc::forceinline]] -#endif -inline constexpr ::fast_io::containers::span write_some_span(outstmtype &&outstm, ::fast_io::containers::span sp) -{ - auto first{sp.data()}; - auto last{first + sp.size()}; - return ::fast_io::containers::span(first, ::fast_io::details::write_some_impl(::fast_io::operations::output_stream_ref(outstm), first, last)); -} - -template -#if __has_cpp_attribute(__gnu__::__always_inline__) -[[__gnu__::__always_inline__]] -#elif __has_cpp_attribute(msvc::forceinline) -[[msvc::forceinline]] -#endif -inline constexpr void write_all_span(outstmtype &&outstm, ::fast_io::containers::span sp) -{ - auto first{sp.data()}; - auto last{first + sp.size()}; - ::fast_io::details::write_some_impl(::fast_io::operations::output_stream_ref(outstm), first, last); -} - -template -#if __has_cpp_attribute(__gnu__::__always_inline__) -[[__gnu__::__always_inline__]] -#elif __has_cpp_attribute(msvc::forceinline) -[[msvc::forceinline]] -#endif -inline constexpr ::fast_io::containers::span<::std::byte const> write_some_bytes_span(outstmtype &&outstm, ::fast_io::containers::span<::std::byte const> sp) -{ - auto first{sp.data()}; - auto last{first + sp.size()}; - return ::fast_io::containers::span<::std::byte const>(first, ::fast_io::details::write_some_bytes_impl(::fast_io::operations::output_stream_ref(outstm), first, last)); -} - -template -#if __has_cpp_attribute(__gnu__::__always_inline__) -[[__gnu__::__always_inline__]] -#elif __has_cpp_attribute(msvc::forceinline) -[[msvc::forceinline]] -#endif -inline constexpr void write_all_bytes_span(outstmtype &&outstm, ::fast_io::containers::span<::std::byte const> sp) -{ - auto first{sp.data()}; - auto last{first + sp.size()}; - ::fast_io::details::write_all_bytes_impl(::fast_io::operations::output_stream_ref(outstm), first, last); -} - -template -inline constexpr io_scatter_status_t scatter_write_some_bytes_span(outstmtype &&outstm, ::fast_io::containers::span<::fast_io::io_scatter_t const> sp) -{ - using io_scatter_may_alias_const_ptr -#if __has_cpp_attribute(__gnu__::__may_alias__) - [[__gnu__::__may_alias__]] -#endif - = io_scatter_t const *; - return ::fast_io::details::scatter_write_some_bytes_impl(::fast_io::operations::output_stream_ref(outstm), - reinterpret_cast(sp.data()), - sp.size()); -} - -template -inline constexpr void scatter_write_all_bytes_span(outstmtype &&outstm, ::fast_io::containers::span<::fast_io::io_scatter_t const> sp) -{ - using io_scatter_may_alias_const_ptr -#if __has_cpp_attribute(__gnu__::__may_alias__) - [[__gnu__::__may_alias__]] -#endif - = io_scatter_t const *; - ::fast_io::details::scatter_write_all_bytes_impl(::fast_io::operations::output_stream_ref(outstm), - reinterpret_cast(sp.data()), - sp.size()); -} - -template -inline constexpr io_scatter_status_t scatter_write_some_span(outstmtype &&outstm, ::fast_io::containers::span<::fast_io::basic_io_scatter_t const> sp) -{ - using io_scatter_may_alias_const_ptr -#if __has_cpp_attribute(__gnu__::__may_alias__) - [[__gnu__::__may_alias__]] -#endif - = basic_io_scatter_t const *; - return ::fast_io::details::scatter_write_some_impl(::fast_io::operations::output_stream_ref(outstm), - reinterpret_cast(sp.data()), - sp.size()); -} - -template -inline constexpr void scatter_write_all_span(outstmtype &&outstm, ::fast_io::containers::span<::fast_io::basic_io_scatter_t const> sp) -{ - using io_scatter_may_alias_const_ptr -#if __has_cpp_attribute(__gnu__::__may_alias__) - [[__gnu__::__may_alias__]] -#endif - = basic_io_scatter_t const *; - ::fast_io::details::scatter_write_all_impl(::fast_io::operations::output_stream_ref(outstm), - reinterpret_cast(sp.data()), - sp.size()); -} - -template -#if __has_cpp_attribute(__gnu__::__always_inline__) -[[__gnu__::__always_inline__]] -#elif __has_cpp_attribute(msvc::forceinline) -[[msvc::forceinline]] -#endif -inline constexpr ::fast_io::containers::span pwrite_some_span(outstmtype &&outstm, ::fast_io::containers::span sp, ::fast_io::intfpos_t off) -{ - auto first{sp.data()}; - auto last{first + sp.size()}; - return ::fast_io::containers::span(first, ::fast_io::details::pwrite_some_impl(::fast_io::operations::output_stream_ref(outstm), first, last, off)); -} - -template -#if __has_cpp_attribute(__gnu__::__always_inline__) -[[__gnu__::__always_inline__]] -#elif __has_cpp_attribute(msvc::forceinline) -[[msvc::forceinline]] -#endif -inline constexpr void pwrite_all_span(outstmtype &&outstm, ::fast_io::containers::span sp, ::fast_io::intfpos_t off) -{ - auto first{sp.data()}; - auto last{first + sp.size()}; - ::fast_io::details::pwrite_all_impl(::fast_io::operations::output_stream_ref(outstm), first, last, off); -} - -template -#if __has_cpp_attribute(__gnu__::__always_inline__) -[[__gnu__::__always_inline__]] -#elif __has_cpp_attribute(msvc::forceinline) -[[msvc::forceinline]] -#endif -inline constexpr ::fast_io::containers::span<::std::byte const> pwrite_some_bytes_span(outstmtype &&outstm, ::fast_io::containers::span<::std::byte const> sp, ::fast_io::intfpos_t off) -{ - auto first{sp.data()}; - auto last{first + sp.size()}; - return ::fast_io::containers::span<::std::byte const>(first, ::fast_io::details::pwrite_some_bytes_impl(::fast_io::operations::output_stream_ref(outstm), first, last, off)); -} - -template -#if __has_cpp_attribute(__gnu__::__always_inline__) -[[__gnu__::__always_inline__]] -#elif __has_cpp_attribute(msvc::forceinline) -[[msvc::forceinline]] -#endif -inline constexpr void pwrite_all_bytes_span(outstmtype &&outstm, ::fast_io::containers::span<::std::byte const> sp, ::fast_io::intfpos_t off) -{ - auto first{sp.data()}; - auto last{first + sp.size()}; - ::fast_io::details::pwrite_all_bytes_impl(::fast_io::operations::output_stream_ref(outstm), first, last, off); -} - -template -inline constexpr io_scatter_status_t scatter_pwrite_some_bytes_span(outstmtype &&outstm, ::fast_io::containers::span<::fast_io::io_scatter_t const> sp, ::fast_io::intfpos_t off) -{ - - return ::fast_io::details::scatter_pwrite_some_bytes_impl(::fast_io::operations::output_stream_ref(outstm), - sp.data(), sp.size(), off); -} - -template -inline constexpr void scatter_pwrite_all_bytes_span(outstmtype &&outstm, ::fast_io::containers::span<::fast_io::io_scatter_t const> sp, ::fast_io::intfpos_t off) -{ - ::fast_io::details::scatter_pwrite_all_bytes_impl(::fast_io::operations::output_stream_ref(outstm), - sp.data(), sp.size(), off); -} - -template -inline constexpr io_scatter_status_t scatter_pwrite_some_span(outstmtype &&outstm, ::fast_io::containers::span<::fast_io::basic_io_scatter_t const> sp, ::fast_io::intfpos_t off) -{ - return ::fast_io::details::scatter_pwrite_some_impl(::fast_io::operations::output_stream_ref(outstm), - sp.data(), sp.size(), off); -} - -template -inline constexpr void scatter_pwrite_all_span(outstmtype &&outstm, ::fast_io::containers::span<::fast_io::basic_io_scatter_t const> sp, ::fast_io::intfpos_t off) -{ - - ::fast_io::details::scatter_pwrite_all_impl(::fast_io::operations::output_stream_ref(outstm), sp.data(), sp.size(), off); -} - -} // namespace fast_io::operations diff --git a/include/fast_io_hosted.h b/include/fast_io_hosted.h index 446be448..f76a7e8e 100644 --- a/include/fast_io_hosted.h +++ b/include/fast_io_hosted.h @@ -60,11 +60,12 @@ freestanding ones. #endif #if !defined(__AVR__) +#include "fast_io_dsal/impl/common.h" #include "fast_io_dsal/impl/tuple.h" #include "fast_io_dsal/impl/string_view.h" #include "fast_io_dsal/impl/cstring_view.h" #include "fast_io_dsal/impl/string.h" -#include "fast_io_dsal/impl/vector.h" +// #include "fast_io_dsal/impl/vector.h" #include "fast_io_hosted/platforms/native.h" #include "fast_io_hosted/file_loaders/impl.h" From 041b83bc2846ec0114a5fee8c226c219f7fc524f Mon Sep 17 00:00:00 2001 From: trcrsired Date: Sat, 17 Jan 2026 18:44:50 +0800 Subject: [PATCH 4/5] comment out ipc since the api hasn't yet done correctly Avoid containers as much as possible --- include/fast_io_hosted.h | 3 +-- include/fast_io_hosted/process/process.h | 2 ++ 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/include/fast_io_hosted.h b/include/fast_io_hosted.h index f76a7e8e..e003b812 100644 --- a/include/fast_io_hosted.h +++ b/include/fast_io_hosted.h @@ -65,8 +65,7 @@ freestanding ones. #include "fast_io_dsal/impl/string_view.h" #include "fast_io_dsal/impl/cstring_view.h" #include "fast_io_dsal/impl/string.h" -// #include "fast_io_dsal/impl/vector.h" - +#include "fast_io_dsal/impl/vector.h" #include "fast_io_hosted/platforms/native.h" #include "fast_io_hosted/file_loaders/impl.h" #include "fast_io_hosted/wrapper.h" diff --git a/include/fast_io_hosted/process/process.h b/include/fast_io_hosted/process/process.h index d39008d1..f231846f 100644 --- a/include/fast_io_hosted/process/process.h +++ b/include/fast_io_hosted/process/process.h @@ -1,3 +1,5 @@ #pragma once #include "process/native.h" +#if 0 #include "ipc/native.h" +#endif From 6cccc99f4f70b5db488cdff4282b9529a37617f1 Mon Sep 17 00:00:00 2001 From: trcrsired Date: Sat, 17 Jan 2026 18:55:54 +0800 Subject: [PATCH 5/5] remove ipc in example --- examples/0037.ipc/.test_prop.toml | 7 ----- examples/0037.ipc/nt_alpc/client.cc | 24 -------------- examples/0037.ipc/nt_alpc/server.cc | 31 ------------------- .../win32_named_pipe/client_receiver.cc | 26 ---------------- .../win32_named_pipe/server_sender.cc | 30 ------------------ 5 files changed, 118 deletions(-) delete mode 100644 examples/0037.ipc/.test_prop.toml delete mode 100644 examples/0037.ipc/nt_alpc/client.cc delete mode 100644 examples/0037.ipc/nt_alpc/server.cc delete mode 100644 examples/0037.ipc/win32_named_pipe/client_receiver.cc delete mode 100644 examples/0037.ipc/win32_named_pipe/server_sender.cc diff --git a/examples/0037.ipc/.test_prop.toml b/examples/0037.ipc/.test_prop.toml deleted file mode 100644 index 6e3ff797..00000000 --- a/examples/0037.ipc/.test_prop.toml +++ /dev/null @@ -1,7 +0,0 @@ -["win32_named_pipe"] -interactive = true -platform = "windows" - -["nt_alpc"] -ignore = true -platform = "windows" diff --git a/examples/0037.ipc/nt_alpc/client.cc b/examples/0037.ipc/nt_alpc/client.cc deleted file mode 100644 index 9e162548..00000000 --- a/examples/0037.ipc/nt_alpc/client.cc +++ /dev/null @@ -1,24 +0,0 @@ -#include -#include -#include - -int main() -{ - try - { - ::fast_io::io::perrln("client -> connect -> server: ", "try to connect"); - ::fast_io::basic_nt_family_alpc_ipc_client<::fast_io::nt_family::nt, char> c{"test", ::fast_io::ipc_mode::out, "try to connect!\n"}; - ::fast_io::basic_ibuf<::fast_io::basic_nt_family_alpc_ipc_client_observer<::fast_io::nt_family::nt, char>> c_buf{c}; - - ::fast_io::string str{}; - ::fast_io::io::scan(c_buf, ::fast_io::mnp::line_get(str)); - ::fast_io::io::perrln("server -> accept -> client: ", str); - - ::fast_io::io::scan(c_buf, ::fast_io::mnp::line_get(str)); - ::fast_io::io::perrln("client -> recv -> server ", str); - } - catch (::fast_io::error e) - { - ::fast_io::io::perrln(e); - } -} diff --git a/examples/0037.ipc/nt_alpc/server.cc b/examples/0037.ipc/nt_alpc/server.cc deleted file mode 100644 index 6fd27d11..00000000 --- a/examples/0037.ipc/nt_alpc/server.cc +++ /dev/null @@ -1,31 +0,0 @@ -#include -#include -#include - -int main(int argc, char **argv) -{ - try - { - ::fast_io::io::perrln("server create: ", "test"); - ::fast_io::basic_nt_family_alpc_ipc_server<::fast_io::nt_family::nt, char> s{"test", ::fast_io::ipc_mode::in}; - ::fast_io::basic_ibuf<::fast_io::basic_nt_family_alpc_ipc_server_observer<::fast_io::nt_family::nt, char>> s_buf{s}; - - auto c{wait_for_connect(s)}; - ::fast_io::string str{}; - ::fast_io::io::scan(s_buf, ::fast_io::mnp::line_get(str)); - ::fast_io::io::perrln("client -> connect -> server: ", str); - - ::fast_io::io::perrln("server -> accept -> client: ", "good"); - - ::fast_io::io::print(s, "good\n"); - accept_connect(s, c, true); - - ::fast_io::io::perrln("server -> send -> client: ", "hello"); - ::fast_io::io::print(s, "hello\n"); - } - catch (::fast_io::error e) - { - ::fast_io::io::perrln(e); - } - -} diff --git a/examples/0037.ipc/win32_named_pipe/client_receiver.cc b/examples/0037.ipc/win32_named_pipe/client_receiver.cc deleted file mode 100644 index e23356bd..00000000 --- a/examples/0037.ipc/win32_named_pipe/client_receiver.cc +++ /dev/null @@ -1,26 +0,0 @@ -#include -#include -#include - -int main() -{ - try - { - ::fast_io::io::print(::fast_io::u8out(), u8"connect to win32 named pipe server sender!\nserver name: "); - ::fast_io::u8string pipe_name{}; - ::fast_io::scan(::fast_io::u8c_stdin(), ::fast_io::mnp::line_get(pipe_name)); - ::fast_io::u8win32_named_pipe_ipc_client s{pipe_name, ::fast_io::ipc_mode::in}; - ::fast_io::basic_ibuf<::fast_io::u8win32_named_pipe_ipc_client_observer> s_ibuf{s}; - ::fast_io::io::print(::fast_io::u8out(), u8"connected!\n"); - for (;;) - { - ::fast_io::u8string str_name{}; - ::fast_io::scan(s_ibuf, ::fast_io::mnp::line_get(str_name)); - ::fast_io::println(::fast_io::u8out(), str_name); - } - } - catch (::fast_io::error e) - { - ::fast_io::io::perrln(e); - } -} diff --git a/examples/0037.ipc/win32_named_pipe/server_sender.cc b/examples/0037.ipc/win32_named_pipe/server_sender.cc deleted file mode 100644 index bfa69809..00000000 --- a/examples/0037.ipc/win32_named_pipe/server_sender.cc +++ /dev/null @@ -1,30 +0,0 @@ -#include -#include -#include - -int main() -{ - try - { - ::fast_io::io::print(::fast_io::u8out(), u8"create win32 named pipe server sender!\nserver name: "); - ::fast_io::u8string pipe_name{}; - ::fast_io::scan(::fast_io::u8c_stdin(), ::fast_io::mnp::line_get(pipe_name)); - ::fast_io::u8win32_named_pipe_ipc_server s{pipe_name, ::fast_io::ipc_mode::out}; - ::fast_io::basic_obuf<::fast_io::u8win32_named_pipe_ipc_server> s_obuf{s}; - ::fast_io::io::print(::fast_io::u8out(), u8"wait for connect\n"); - wait_for_connect(s); - ::fast_io::io::print(::fast_io::u8out(), u8"connected!\n"); - for (;;) - { - ::fast_io::u8string str_name{}; - ::fast_io::io::print(::fast_io::u8out(), u8"send: "); - ::fast_io::scan(::fast_io::u8c_stdin(), ::fast_io::mnp::line_get(str_name)); - ::fast_io::println(s_obuf, str_name); - ::fast_io::details::close_basic_io_buffer(s_obuf); - } - } - catch (::fast_io::error e) - { - ::fast_io::io::perrln(e); - } -}