diff --git a/examples/0037.ipc/.test_prop.toml b/examples/0037.ipc/.test_prop.toml deleted file mode 100644 index 6e3ff797e..000000000 --- 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 9e1625484..000000000 --- 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 6fd27d110..000000000 --- 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 e23356bd6..000000000 --- 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 bfa698098..000000000 --- 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); - } -} diff --git a/include/fast_io_core.h b/include/fast_io_core.h index 5baeecc5b..4cfee0287 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 575ca172c..e67109b7e 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 dbab9b9c3..000000000 --- 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 26a0644a6..2b6d71ab3 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 f6d37c875..000000000 --- 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_dsal/impl/deque.h b/include/fast_io_dsal/impl/deque.h index f376c3e4a..da04c2dbe 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> @@ -1956,21 +1990,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}; } } diff --git a/include/fast_io_hosted.h b/include/fast_io_hosted.h index 446be4480..e003b8129 100644 --- a/include/fast_io_hosted.h +++ b/include/fast_io_hosted.h @@ -60,12 +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_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 d39008d1e..f231846f4 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