From 946e0da1f69795f9abcbe8509506ac8af1edf6d2 Mon Sep 17 00:00:00 2001 From: MacroModel <33865334+MacroModel@users.noreply.github.com> Date: Thu, 28 Nov 2024 22:53:22 +0800 Subject: [PATCH] Add missing inline --- include/fast_io_core_impl/buffer_view.h | 56 +++++++++---------- .../fast_io_core_impl/concat/concat_buffer.h | 7 ++- .../fast_io_core_impl/concepts/operation.h | 16 +++--- include/fast_io_core_impl/concepts/strlike.h | 2 +- include/fast_io_core_impl/concepts/type.h | 8 +-- include/fast_io_core_impl/dll_mode.h | 8 +-- include/fast_io_core_impl/drain.h | 4 +- .../fast_io_core_impl/dynamic_output_buffer.h | 8 +-- include/fast_io_core_impl/enums/access_how.h | 8 +-- include/fast_io_core_impl/enums/flock.h | 14 ++--- include/fast_io_core_impl/enums/mmap_flags.h | 16 +++--- include/fast_io_core_impl/enums/utime_flags.h | 8 +-- .../freestanding/algorithm.h | 8 +-- .../freestanding/allocator.h | 4 +- .../fast_io_core_impl/freestanding/bytes.h | 8 +-- .../fast_io_core_impl/freestanding/ranges.h | 2 +- .../freestanding/relocatable.h | 2 +- include/fast_io_core_impl/integers/impl.h | 12 ++-- include/fast_io_core_impl/io_deco_ref.h | 16 +++--- include/fast_io_core_impl/io_lockable.h | 40 ++++++------- include/fast_io_core_impl/iso/iso8601.h | 4 +- .../fast_io_core_impl/local_new_array_ptr.h | 19 ++++--- include/fast_io_core_impl/mode.h | 24 ++++---- .../fast_io_core_impl/operations/lockguard.h | 8 +-- .../multiblock_iterator_view/libstdc++.h | 2 +- .../operations/transcodeimpl/defines.h | 4 +- .../operations/writeimpl/range.h | 2 +- include/fast_io_core_impl/perms.h | 8 +-- .../fast_io_core_impl/secure_clear_guard.h | 12 ++-- include/fast_io_core_impl/simd/gcc_clang.h | 8 +-- include/fast_io_core_impl/simd/generic.h | 6 +- include/fast_io_core_impl/simd/zero_spec.h | 4 +- include/fast_io_core_impl/socket/ip.h | 8 +-- .../unit_character_input_buffer.h | 16 +++--- include/fast_io_core_impl/utils.h | 16 +++--- 35 files changed, 196 insertions(+), 192 deletions(-) diff --git a/include/fast_io_core_impl/buffer_view.h b/include/fast_io_core_impl/buffer_view.h index 2533453f1..b1d20c0d4 100644 --- a/include/fast_io_core_impl/buffer_view.h +++ b/include/fast_io_core_impl/buffer_view.h @@ -11,21 +11,21 @@ struct basic_ibuffer_view char_type const *begin_ptr{}; char_type const *curr_ptr{}; char_type const *end_ptr{}; - constexpr basic_ibuffer_view() noexcept = default; + inline constexpr basic_ibuffer_view() noexcept = default; template <::std::contiguous_iterator Iter> requires ::std::same_as<::std::remove_cvref_t<::std::iter_value_t>, char_type> - constexpr basic_ibuffer_view(Iter first, Iter last) noexcept + inline constexpr basic_ibuffer_view(Iter first, Iter last) noexcept : begin_ptr{::std::to_address(first)}, curr_ptr{begin_ptr}, end_ptr{curr_ptr + (last - first)} { } template <::std::ranges::contiguous_range rg> requires(::std::same_as<::std::ranges::range_value_t, char_type> && !::std::is_array_v<::std::remove_cvref_t>) - explicit constexpr basic_ibuffer_view(rg &r) noexcept + inline explicit constexpr basic_ibuffer_view(rg &r) noexcept : basic_ibuffer_view(::std::ranges::cbegin(r), ::std::ranges::cend(r)) { } - constexpr void clear() noexcept + inline constexpr void clear() noexcept { curr_ptr = end_ptr; } @@ -79,31 +79,31 @@ inline constexpr basic_ibuffer_view_ref input_bytes_stream_ref_define(b } template <::std::integral ch_type> -[[nodiscard]] constexpr ch_type const *ibuffer_begin(basic_ibuffer_view_ref view) noexcept +[[nodiscard]] inline constexpr ch_type const *ibuffer_begin(basic_ibuffer_view_ref view) noexcept { return view.ptr->begin_ptr; } template <::std::integral ch_type> -[[nodiscard]] constexpr ch_type const *ibuffer_curr(basic_ibuffer_view_ref view) noexcept +[[nodiscard]] inline constexpr ch_type const *ibuffer_curr(basic_ibuffer_view_ref view) noexcept { return view.ptr->curr_ptr; } template <::std::integral ch_type> -[[nodiscard]] constexpr ch_type const *ibuffer_end(basic_ibuffer_view_ref view) noexcept +[[nodiscard]] inline constexpr ch_type const *ibuffer_end(basic_ibuffer_view_ref view) noexcept { return view.ptr->end_ptr; } template <::std::integral ch_type> -constexpr void ibuffer_set_curr(basic_ibuffer_view_ref view, ch_type const *ptr) noexcept +inline constexpr void ibuffer_set_curr(basic_ibuffer_view_ref view, ch_type const *ptr) noexcept { view.ptr->curr_ptr = ptr; } template <::std::integral ch_type> -[[nodiscard]] constexpr bool ibuffer_underflow(basic_ibuffer_view_ref) noexcept +[[nodiscard]] inline constexpr bool ibuffer_underflow(basic_ibuffer_view_ref) noexcept { return false; } @@ -120,64 +120,64 @@ struct basic_obuffer_view using char_type = ch_type; using output_char_type = char_type; char_type *begin_ptr{}, *curr_ptr{}, *end_ptr{}; - constexpr basic_obuffer_view() noexcept = default; + inline constexpr basic_obuffer_view() noexcept = default; template <::std::contiguous_iterator Iter> requires ::std::same_as<::std::iter_value_t, char_type> - constexpr basic_obuffer_view(Iter first, Iter last) noexcept + inline constexpr basic_obuffer_view(Iter first, Iter last) noexcept : begin_ptr{::std::to_address(first)}, curr_ptr{begin_ptr}, end_ptr{::std::to_address(last)} { } template <::std::ranges::contiguous_range rg> requires(::std::same_as<::std::ranges::range_value_t, char_type> && !::std::is_array_v<::std::remove_cvref_t>) - explicit constexpr basic_obuffer_view(rg &r) noexcept + inline explicit constexpr basic_obuffer_view(rg &r) noexcept : basic_obuffer_view(::std::ranges::begin(r), ::std::ranges::end(r)) { } - constexpr void clear() noexcept + inline constexpr void clear() noexcept { curr_ptr = begin_ptr; } - constexpr char_type const *cbegin() const noexcept + inline constexpr char_type const *cbegin() const noexcept { return begin_ptr; } - constexpr char_type const *cend() const noexcept + inline constexpr char_type const *cend() const noexcept { return curr_ptr; } - constexpr char_type const *begin() const noexcept + inline constexpr char_type const *begin() const noexcept { return begin_ptr; } - constexpr char_type const *end() const noexcept + inline constexpr char_type const *end() const noexcept { return curr_ptr; } - constexpr char_type *begin() noexcept + inline constexpr char_type *begin() noexcept { return begin_ptr; } - constexpr char_type *end() noexcept + inline constexpr char_type *end() noexcept { return curr_ptr; } - constexpr char_type const *data() const noexcept + inline constexpr char_type const *data() const noexcept { return begin_ptr; } - constexpr char_type *data() noexcept + inline constexpr char_type *data() noexcept { return begin_ptr; } - constexpr ::std::size_t size() const noexcept + inline constexpr ::std::size_t size() const noexcept { return static_cast<::std::size_t>(curr_ptr - begin_ptr); } - constexpr ::std::size_t capacity() const noexcept + inline constexpr ::std::size_t capacity() const noexcept { return static_cast<::std::size_t>(end_ptr - begin_ptr); } @@ -229,31 +229,31 @@ inline constexpr basic_obuffer_view_ref output_bytes_stream_ref_define( } template <::std::integral ch_type> -[[nodiscard]] constexpr ch_type *obuffer_begin(basic_obuffer_view_ref view) noexcept +[[nodiscard]] inline constexpr ch_type *obuffer_begin(basic_obuffer_view_ref view) noexcept { return view.ptr->begin_ptr; } template <::std::integral ch_type> -[[nodiscard]] constexpr ch_type *obuffer_curr(basic_obuffer_view_ref view) noexcept +[[nodiscard]] inline constexpr ch_type *obuffer_curr(basic_obuffer_view_ref view) noexcept { return view.ptr->curr_ptr; } template <::std::integral ch_type> -[[nodiscard]] constexpr ch_type *obuffer_end(basic_obuffer_view_ref view) noexcept +[[nodiscard]] inline constexpr ch_type *obuffer_end(basic_obuffer_view_ref view) noexcept { return view.ptr->end_ptr; } template <::std::integral ch_type> -constexpr void obuffer_set_curr(basic_obuffer_view_ref view, ch_type *ptr) noexcept +inline constexpr void obuffer_set_curr(basic_obuffer_view_ref view, ch_type *ptr) noexcept { view.ptr->curr_ptr = ptr; } template <::std::integral ch_type> -constexpr void obuffer_overflow(basic_obuffer_view_ref, ch_type) noexcept +inline constexpr void obuffer_overflow(basic_obuffer_view_ref, ch_type) noexcept { fast_terminate(); } diff --git a/include/fast_io_core_impl/concat/concat_buffer.h b/include/fast_io_core_impl/concat/concat_buffer.h index f51caf680..0a4d3c11b 100644 --- a/include/fast_io_core_impl/concat/concat_buffer.h +++ b/include/fast_io_core_impl/concat/concat_buffer.h @@ -10,12 +10,13 @@ struct basic_concat_buffer static inline constexpr ::std::size_t buffer_size{2048u / sizeof(ch_type)}; char_type *buffer_begin, *buffer_curr, *buffer_end; char_type stack_buffer[buffer_size]; - constexpr basic_concat_buffer() noexcept + inline constexpr basic_concat_buffer() noexcept : buffer_begin{stack_buffer}, buffer_curr{stack_buffer}, buffer_end{stack_buffer + buffer_size} { } - basic_concat_buffer(basic_concat_buffer const &) = delete; - basic_concat_buffer &operator=(basic_concat_buffer const &) = delete; + inline basic_concat_buffer(basic_concat_buffer const &) = delete; + inline basic_concat_buffer &operator=(basic_concat_buffer const &) = delete; + inline #if __cpp_constexpr_dynamic_alloc >= 201907L constexpr #endif diff --git a/include/fast_io_core_impl/concepts/operation.h b/include/fast_io_core_impl/concepts/operation.h index 6a7081eae..a0217b7a7 100644 --- a/include/fast_io_core_impl/concepts/operation.h +++ b/include/fast_io_core_impl/concepts/operation.h @@ -301,7 +301,7 @@ struct parameter template <::std::integral char_type, typename output, typename value_type> requires(printable> && ::std::is_trivially_copyable_v) -constexpr void print_define(io_reserve_type_t>, output out, +inline constexpr void print_define(io_reserve_type_t>, output out, parameter wrapper) { print_define(io_reserve_type>, out, wrapper.reference); @@ -309,14 +309,14 @@ constexpr void print_define(io_reserve_type_t>, template <::std::integral char_type, typename value_type> requires reserve_printable> -constexpr ::std::size_t print_reserve_size(io_reserve_type_t>) +inline constexpr ::std::size_t print_reserve_size(io_reserve_type_t>) { return print_reserve_size(io_reserve_type>); } template <::std::integral char_type, typename value_type> requires dynamic_reserve_printable> -constexpr ::std::size_t print_reserve_size(io_reserve_type_t>, +inline constexpr ::std::size_t print_reserve_size(io_reserve_type_t>, parameter para) { return print_reserve_size(io_reserve_type>, para.reference); @@ -325,7 +325,7 @@ constexpr ::std::size_t print_reserve_size(io_reserve_type_t requires(reserve_printable> || dynamic_reserve_printable>) -constexpr auto print_reserve_define(io_reserve_type_t>, char_type *begin, +inline constexpr auto print_reserve_define(io_reserve_type_t>, char_type *begin, parameter para) { return print_reserve_define(io_reserve_type>, begin, para.reference); @@ -333,7 +333,7 @@ constexpr auto print_reserve_define(io_reserve_type_t requires(printable_internal_shift>) -constexpr auto print_define_internal_shift(io_reserve_type_t>, Iter begin, +inline constexpr auto print_define_internal_shift(io_reserve_type_t>, Iter begin, parameter para) { return print_define_internal_shift(io_reserve_type>, begin, @@ -342,7 +342,7 @@ constexpr auto print_define_internal_shift(io_reserve_type_t requires precise_reserve_printable> -constexpr ::std::size_t print_reserve_precise_size(io_reserve_type_t>, +inline constexpr ::std::size_t print_reserve_precise_size(io_reserve_type_t>, parameter para) { return print_reserve_precise_size(io_reserve_type>, para.reference); @@ -350,7 +350,7 @@ constexpr ::std::size_t print_reserve_precise_size(io_reserve_type_t requires precise_reserve_printable> -constexpr void print_reserve_precise_define(io_reserve_type_t>, Iter begin, +inline constexpr void print_reserve_precise_define(io_reserve_type_t>, Iter begin, ::std::size_t n, parameter para) { print_reserve_precise_define(io_reserve_type>, begin, n, @@ -359,7 +359,7 @@ constexpr void print_reserve_precise_define(io_reserve_type_t requires scatter_printable> -constexpr auto print_scatter_define(io_reserve_type_t>, parameter para) +inline constexpr auto print_scatter_define(io_reserve_type_t>, parameter para) { return print_scatter_define(io_reserve_type>, para.reference); } diff --git a/include/fast_io_core_impl/concepts/strlike.h b/include/fast_io_core_impl/concepts/strlike.h index c7d815b7a..4678270c0 100644 --- a/include/fast_io_core_impl/concepts/strlike.h +++ b/include/fast_io_core_impl/concepts/strlike.h @@ -6,7 +6,7 @@ namespace fast_io template <::std::integral char_type, typename T> struct io_strlike_type_t { - explicit constexpr io_strlike_type_t() noexcept = default; + inline explicit constexpr io_strlike_type_t() noexcept = default; }; template <::std::integral char_type, typename T> diff --git a/include/fast_io_core_impl/concepts/type.h b/include/fast_io_core_impl/concepts/type.h index e7dea00f2..77f6ad81f 100644 --- a/include/fast_io_core_impl/concepts/type.h +++ b/include/fast_io_core_impl/concepts/type.h @@ -60,7 +60,7 @@ struct cross_code_cvt_t template <::std::integral char_type, typename T> struct io_reserve_type_t { - explicit constexpr io_reserve_type_t() noexcept = default; + inline explicit constexpr io_reserve_type_t() noexcept = default; }; template <::std::integral char_type, typename T> inline constexpr io_reserve_type_t io_reserve_type{}; @@ -80,7 +80,7 @@ struct basic_reserve_scatters_define_result struct io_alias_t { - explicit constexpr io_alias_t() noexcept = default; + inline explicit constexpr io_alias_t() noexcept = default; }; inline constexpr io_alias_t io_alias{}; @@ -88,7 +88,7 @@ inline constexpr io_alias_t io_alias{}; template <::std::integral char_type> struct io_alias_type_t { - explicit constexpr io_alias_type_t() noexcept = default; + inline explicit constexpr io_alias_type_t() noexcept = default; }; template <::std::integral char_type> @@ -120,7 +120,7 @@ using intfpos_t = ::std::intmax_t; struct io_construct_t { - explicit constexpr io_construct_t() noexcept = default; + inline explicit constexpr io_construct_t() noexcept = default; }; inline constexpr io_construct_t io_construct{}; diff --git a/include/fast_io_core_impl/dll_mode.h b/include/fast_io_core_impl/dll_mode.h index ece3887f2..f5c8431c5 100644 --- a/include/fast_io_core_impl/dll_mode.h +++ b/include/fast_io_core_impl/dll_mode.h @@ -29,25 +29,25 @@ enum class dll_mode : ::std::uint_least32_t win32_load_library_safe_current_dirs = static_cast<::std::uint_least32_t>(1) << 22 }; -constexpr dll_mode operator&(dll_mode x, dll_mode y) noexcept +inline constexpr dll_mode operator&(dll_mode x, dll_mode y) noexcept { using utype = typename ::std::underlying_type::type; return static_cast(static_cast(x) & static_cast(y)); } -constexpr dll_mode operator|(dll_mode x, dll_mode y) noexcept +inline constexpr dll_mode operator|(dll_mode x, dll_mode y) noexcept { using utype = typename ::std::underlying_type::type; return static_cast(static_cast(x) | static_cast(y)); } -constexpr dll_mode operator^(dll_mode x, dll_mode y) noexcept +inline constexpr dll_mode operator^(dll_mode x, dll_mode y) noexcept { using utype = typename ::std::underlying_type::type; return static_cast(static_cast(x) ^ static_cast(y)); } -constexpr dll_mode operator~(dll_mode x) noexcept +inline constexpr dll_mode operator~(dll_mode x) noexcept { using utype = typename ::std::underlying_type::type; return static_cast(~static_cast(x)); diff --git a/include/fast_io_core_impl/drain.h b/include/fast_io_core_impl/drain.h index 59b8f8fea..de74e71f3 100644 --- a/include/fast_io_core_impl/drain.h +++ b/include/fast_io_core_impl/drain.h @@ -4,7 +4,7 @@ namespace fast_io { template -constexpr basic_io_scatter_t::char_type> +inline constexpr basic_io_scatter_t::char_type> print_alias_define(io_alias_t, manip::drainage source) { auto bg{obuffer_begin(source.reference)}; @@ -18,4 +18,4 @@ inline constexpr void drain(dest_type &&dest, source_type &&source) print_freestanding(::std::forward(dest), drainage(source)); } -} // namespace fast_io \ No newline at end of file +} // namespace fast_io diff --git a/include/fast_io_core_impl/dynamic_output_buffer.h b/include/fast_io_core_impl/dynamic_output_buffer.h index 3b4692e65..879fa944b 100644 --- a/include/fast_io_core_impl/dynamic_output_buffer.h +++ b/include/fast_io_core_impl/dynamic_output_buffer.h @@ -12,12 +12,12 @@ class basic_generic_dynamic_output_buffer static inline constexpr ::std::size_t buffer_size{buffersize}; char_type *begin_ptr{buffer}, *curr_ptr{buffer}, *end_ptr{buffer + buffer_size}; char_type buffer[buffersize]; - constexpr basic_generic_dynamic_output_buffer() noexcept = default; + inline constexpr basic_generic_dynamic_output_buffer() noexcept = default; - basic_generic_dynamic_output_buffer(basic_generic_dynamic_output_buffer const &) = delete; - basic_generic_dynamic_output_buffer &operator=(basic_generic_dynamic_output_buffer const &) = delete; + inline basic_generic_dynamic_output_buffer(basic_generic_dynamic_output_buffer const &) = delete; + inline basic_generic_dynamic_output_buffer &operator=(basic_generic_dynamic_output_buffer const &) = delete; - constexpr ~basic_generic_dynamic_output_buffer() + inline constexpr ~basic_generic_dynamic_output_buffer() { if (begin_ptr && begin_ptr != buffer) { diff --git a/include/fast_io_core_impl/enums/access_how.h b/include/fast_io_core_impl/enums/access_how.h index 9d7b06f1c..2f7f17189 100644 --- a/include/fast_io_core_impl/enums/access_how.h +++ b/include/fast_io_core_impl/enums/access_how.h @@ -11,25 +11,25 @@ enum class access_how : ::std::uint_fast8_t r_ok = 4 }; -constexpr access_how operator&(access_how x, access_how y) noexcept +inline constexpr access_how operator&(access_how x, access_how y) noexcept { using utype = typename ::std::underlying_type::type; return static_cast(static_cast(x) & static_cast(y)); } -constexpr access_how operator|(access_how x, access_how y) noexcept +inline constexpr access_how operator|(access_how x, access_how y) noexcept { using utype = typename ::std::underlying_type::type; return static_cast(static_cast(x) | static_cast(y)); } -constexpr access_how operator^(access_how x, access_how y) noexcept +inline constexpr access_how operator^(access_how x, access_how y) noexcept { using utype = typename ::std::underlying_type::type; return static_cast(static_cast(x) ^ static_cast(y)); } -constexpr access_how operator~(access_how x) noexcept +inline constexpr access_how operator~(access_how x) noexcept { using utype = typename ::std::underlying_type::type; return static_cast(~static_cast(x)); diff --git a/include/fast_io_core_impl/enums/flock.h b/include/fast_io_core_impl/enums/flock.h index 1b257277f..8a8c9ee0b 100644 --- a/include/fast_io_core_impl/enums/flock.h +++ b/include/fast_io_core_impl/enums/flock.h @@ -25,13 +25,13 @@ using flock_request_l64 = basic_flock_request<::std::int_least64_t>; struct nop_file_lock { template - constexpr void lock(RequestType const &) noexcept + inline constexpr void lock(RequestType const &) noexcept {} template - constexpr void unlock(RequestType const &) noexcept + inline constexpr void unlock(RequestType const &) noexcept {} template - constexpr bool try_lock(RequestType const &) noexcept + inline constexpr bool try_lock(RequestType const &) noexcept { return true; } @@ -48,14 +48,14 @@ struct file_lock_guard using request_type = RequestT; file_lock_type lock; request_type request; - explicit constexpr file_lock_guard(file_lock_type const &lk, request_type const &flk) + inline explicit constexpr file_lock_guard(file_lock_type const &lk, request_type const &flk) : lock(lk), request(flk) { lock.lock(request); } - file_lock_guard(file_lock_guard const &) = delete; - file_lock_guard &operator=(file_lock_guard const &) = delete; - constexpr ~file_lock_guard() + inline file_lock_guard(file_lock_guard const &) = delete; + inline file_lock_guard &operator=(file_lock_guard const &) = delete; + inline constexpr ~file_lock_guard() { lock.unlock(request); } diff --git a/include/fast_io_core_impl/enums/mmap_flags.h b/include/fast_io_core_impl/enums/mmap_flags.h index b9026cd56..55c40a7d4 100644 --- a/include/fast_io_core_impl/enums/mmap_flags.h +++ b/include/fast_io_core_impl/enums/mmap_flags.h @@ -15,25 +15,25 @@ enum class mmap_prot : ::std::uint_least32_t prot_growsup = 0x02000000, /* mprotect flag: extend change to end of growsup vma */ }; -constexpr mmap_prot operator&(mmap_prot x, mmap_prot y) noexcept +inline constexpr mmap_prot operator&(mmap_prot x, mmap_prot y) noexcept { using utype = typename ::std::underlying_type::type; return static_cast(static_cast(x) & static_cast(y)); } -constexpr mmap_prot operator|(mmap_prot x, mmap_prot y) noexcept +inline constexpr mmap_prot operator|(mmap_prot x, mmap_prot y) noexcept { using utype = typename ::std::underlying_type::type; return static_cast(static_cast(x) | static_cast(y)); } -constexpr mmap_prot operator^(mmap_prot x, mmap_prot y) noexcept +inline constexpr mmap_prot operator^(mmap_prot x, mmap_prot y) noexcept { using utype = typename ::std::underlying_type::type; return static_cast(static_cast(x) ^ static_cast(y)); } -constexpr mmap_prot operator~(mmap_prot x) noexcept +inline constexpr mmap_prot operator~(mmap_prot x) noexcept { using utype = typename ::std::underlying_type::type; return static_cast(~static_cast(x)); @@ -86,25 +86,25 @@ enum class mmap_flags : ::std::uint_least32_t map_huge_1gb = 30u << 26, }; -constexpr mmap_flags operator&(mmap_flags x, mmap_flags y) noexcept +inline constexpr mmap_flags operator&(mmap_flags x, mmap_flags y) noexcept { using utype = typename ::std::underlying_type::type; return static_cast(static_cast(x) & static_cast(y)); } -constexpr mmap_flags operator|(mmap_flags x, mmap_flags y) noexcept +inline constexpr mmap_flags operator|(mmap_flags x, mmap_flags y) noexcept { using utype = typename ::std::underlying_type::type; return static_cast(static_cast(x) | static_cast(y)); } -constexpr mmap_flags operator^(mmap_flags x, mmap_flags y) noexcept +inline constexpr mmap_flags operator^(mmap_flags x, mmap_flags y) noexcept { using utype = typename ::std::underlying_type::type; return static_cast(static_cast(x) ^ static_cast(y)); } -constexpr mmap_flags operator~(mmap_flags x) noexcept +inline constexpr mmap_flags operator~(mmap_flags x) noexcept { using utype = typename ::std::underlying_type::type; return static_cast(~static_cast(x)); diff --git a/include/fast_io_core_impl/enums/utime_flags.h b/include/fast_io_core_impl/enums/utime_flags.h index db27dcec6..fbfe6de3e 100644 --- a/include/fast_io_core_impl/enums/utime_flags.h +++ b/include/fast_io_core_impl/enums/utime_flags.h @@ -14,13 +14,13 @@ struct unix_timestamp_option { utime_flags flags{utime_flags::omit}; unix_timestamp timestamp{}; - constexpr unix_timestamp_option() noexcept = default; - constexpr unix_timestamp_option(unix_timestamp ts) noexcept + inline constexpr unix_timestamp_option() noexcept = default; + inline constexpr unix_timestamp_option(unix_timestamp ts) noexcept : flags(utime_flags::none), timestamp(ts) {} - constexpr unix_timestamp_option(utime_flags fg) noexcept + inline constexpr unix_timestamp_option(utime_flags fg) noexcept : flags(fg) {} }; -} // namespace fast_io \ No newline at end of file +} // namespace fast_io diff --git a/include/fast_io_core_impl/freestanding/algorithm.h b/include/fast_io_core_impl/freestanding/algorithm.h index 6485e2002..cd280716a 100644 --- a/include/fast_io_core_impl/freestanding/algorithm.h +++ b/include/fast_io_core_impl/freestanding/algorithm.h @@ -104,7 +104,7 @@ inline constexpr void fill_n(fwd_iter first, ::std::size_t n, T value) } template <::std::bidirectional_iterator BidirIt1, ::std::bidirectional_iterator BidirIt2> -constexpr BidirIt2 copy_backward(BidirIt1 first, BidirIt1 last, BidirIt2 d_last) +inline constexpr BidirIt2 copy_backward(BidirIt1 first, BidirIt1 last, BidirIt2 d_last) { for (; first != last; *(--d_last) = *(--last)) ; @@ -112,7 +112,7 @@ constexpr BidirIt2 copy_backward(BidirIt1 first, BidirIt1 last, BidirIt2 d_last) } template <::std::bidirectional_iterator BidirIt1, ::std::bidirectional_iterator BidirIt2> -constexpr BidirIt2 move_backward(BidirIt1 first, BidirIt1 last, BidirIt2 d_last) +inline constexpr BidirIt2 move_backward(BidirIt1 first, BidirIt1 last, BidirIt2 d_last) { for (; first != last; *(--d_last) = ::std::move(*(--last))) ; @@ -563,7 +563,7 @@ inline constexpr NoThrowForwardIt uninitialized_copy(InputIt first, InputIt last { NoThrowForwardIt d_first; NoThrowForwardIt current; - constexpr ~destroyer() + inline constexpr ~destroyer() { for (; d_first != current; ++d_first) { @@ -619,7 +619,7 @@ uninitialized_copy_n(InputIt first, ::std::size_t n, NoThrowForwardIt d_first) n { NoThrowForwardIt d_first; NoThrowForwardIt current; - constexpr ~destroyer() noexcept + inline constexpr ~destroyer() noexcept { for (; d_first != current; ++d_first) { diff --git a/include/fast_io_core_impl/freestanding/allocator.h b/include/fast_io_core_impl/freestanding/allocator.h index bf6f541e7..96145f62a 100644 --- a/include/fast_io_core_impl/freestanding/allocator.h +++ b/include/fast_io_core_impl/freestanding/allocator.h @@ -6,7 +6,7 @@ namespace fast_io::freestanding template struct allocator { - constexpr T *allocate([[maybe_unused]] ::std::size_t n) noexcept + inline constexpr T *allocate([[maybe_unused]] ::std::size_t n) noexcept { constexpr ::std::size_t mx{(~static_cast<::std::size_t>(0u)) / sizeof(T)}; if (n > mx) @@ -20,7 +20,7 @@ struct allocator return nullptr; #endif } - constexpr void deallocate([[maybe_unused]] T *ptr, [[maybe_unused]] ::std::size_t n) noexcept + inline constexpr void deallocate([[maybe_unused]] T *ptr, [[maybe_unused]] ::std::size_t n) noexcept { #if __has_builtin(__builtin_operator_delete) __builtin_operator_delete(ptr, sizeof(T) * n); diff --git a/include/fast_io_core_impl/freestanding/bytes.h b/include/fast_io_core_impl/freestanding/bytes.h index 99c8d4319..eb0c7f09f 100644 --- a/include/fast_io_core_impl/freestanding/bytes.h +++ b/include/fast_io_core_impl/freestanding/bytes.h @@ -7,12 +7,12 @@ template struct overlapped_copy_buffer_ptr { T *ptr; - explicit constexpr overlapped_copy_buffer_ptr(::std::size_t n) noexcept + inline explicit constexpr overlapped_copy_buffer_ptr(::std::size_t n) noexcept : ptr(new T[n]) {} - overlapped_copy_buffer_ptr(overlapped_copy_buffer_ptr const &) = delete; - overlapped_copy_buffer_ptr &operator=(overlapped_copy_buffer_ptr const &) = delete; - constexpr ~overlapped_copy_buffer_ptr() + inline overlapped_copy_buffer_ptr(overlapped_copy_buffer_ptr const &) = delete; + inline overlapped_copy_buffer_ptr &operator=(overlapped_copy_buffer_ptr const &) = delete; + inline constexpr ~overlapped_copy_buffer_ptr() { delete[] ptr; } diff --git a/include/fast_io_core_impl/freestanding/ranges.h b/include/fast_io_core_impl/freestanding/ranges.h index 604fd5daf..c158937a1 100644 --- a/include/fast_io_core_impl/freestanding/ranges.h +++ b/include/fast_io_core_impl/freestanding/ranges.h @@ -9,7 +9,7 @@ using ::std::from_range; #else struct from_range_t { - explicit constexpr from_range_t() noexcept = default; + inline explicit constexpr from_range_t() noexcept = default; }; inline constexpr ::fast_io::freestanding::from_range_t from_range{}; #endif diff --git a/include/fast_io_core_impl/freestanding/relocatable.h b/include/fast_io_core_impl/freestanding/relocatable.h index 942fbf2cd..9aae9abe9 100644 --- a/include/fast_io_core_impl/freestanding/relocatable.h +++ b/include/fast_io_core_impl/freestanding/relocatable.h @@ -32,7 +32,7 @@ namespace fast_io struct for_overwrite_t { - explicit constexpr for_overwrite_t() noexcept = default; + inline explicit constexpr for_overwrite_t() noexcept = default; }; inline constexpr for_overwrite_t for_overwrite{}; diff --git a/include/fast_io_core_impl/integers/impl.h b/include/fast_io_core_impl/integers/impl.h index 121a68566..e1c2ab4dc 100644 --- a/include/fast_io_core_impl/integers/impl.h +++ b/include/fast_io_core_impl/integers/impl.h @@ -953,7 +953,7 @@ template <::std::integral char_type, ::std::size_t base> inline constexpr auto base_prefix_array{generate_base_prefix_array()}; template <::std::size_t base, bool uppercase_showbase, ::std::integral char_type> -constexpr char_type *print_reserve_show_base_impl(char_type *iter) +inline constexpr char_type *print_reserve_show_base_impl(char_type *iter) { static_assert(2 <= base && base <= 36); if constexpr (base == 2) @@ -1118,7 +1118,7 @@ constexpr char_type *print_reserve_show_base_impl(char_type *iter) } template <::std::size_t base, bool uppercase, bool ryu_mode = false, ::std::integral char_type, typename T> -constexpr void print_reserve_integral_main_impl(char_type *iter, T t, ::std::size_t len) +inline constexpr void print_reserve_integral_main_impl(char_type *iter, T t, ::std::size_t len) { if constexpr (base <= 10 && uppercase) { @@ -1230,7 +1230,7 @@ constexpr void print_reserve_integral_main_impl(char_type *iter, T t, ::std::siz } template -constexpr char_type *print_reserve_integral_withfull_main_impl(char_type *first, T u) +inline constexpr char_type *print_reserve_integral_withfull_main_impl(char_type *first, T u) { if constexpr (base <= 10 && uppercase) { @@ -1297,7 +1297,7 @@ inline constexpr void print_reserve_integral_withfull_precise_main_impl(char_typ template <::std::size_t base, bool showbase = false, bool uppercase_showbase = false, bool showpos = false, bool uppercase = false, bool full = false, typename int_type, ::std::integral char_type> -constexpr char_type *print_reserve_integral_define(char_type *first, int_type t) +inline constexpr char_type *print_reserve_integral_define(char_type *first, int_type t) { if constexpr (base <= 10 && uppercase) { @@ -1371,7 +1371,7 @@ constexpr char_type *print_reserve_integral_define(char_type *first, int_type t) template <::std::size_t base, bool showbase = false, bool uppercase_showbase = false, bool showpos = false, bool uppercase = false, typename int_type, ::std::integral char_type> -constexpr void print_reserve_integral_define_precise(char_type *start, ::std::size_t n, int_type t) +inline constexpr void print_reserve_integral_define_precise(char_type *start, ::std::size_t n, int_type t) { if constexpr (base <= 10 && uppercase) { @@ -1986,7 +1986,7 @@ template <::std::integral char_type, manipulators::scalar_flags flags, typename #if __has_cpp_attribute(__gnu__::__always_inline__) [[__gnu__::__always_inline__]] // always inline to reduce inline depth in GCC and LLVM clang #endif -constexpr char_type * +inline constexpr char_type * print_reserve_define(io_reserve_type_t>, char_type *iter, ::fast_io::manipulators::scalar_manip_t t) noexcept { diff --git a/include/fast_io_core_impl/io_deco_ref.h b/include/fast_io_core_impl/io_deco_ref.h index d7661b23f..3729bc364 100644 --- a/include/fast_io_core_impl/io_deco_ref.h +++ b/include/fast_io_core_impl/io_deco_ref.h @@ -11,7 +11,7 @@ struct deco_reference_wrapper }; template -constexpr deco_reference_wrapper deco_value_handle(deco_reference_wrapper wrap) noexcept +inline constexpr deco_reference_wrapper deco_value_handle(deco_reference_wrapper wrap) noexcept { return wrap; } @@ -39,7 +39,7 @@ template <::std::integral to_char_type, typename decot> requires requires(decot &dc, ::std::size_t size) { { deco_reserve_size(io_reserve_type, dc, size) } -> ::std::same_as<::std::size_t>; } -constexpr ::std::size_t deco_reserve_size(io_reserve_type_t>, +inline constexpr ::std::size_t deco_reserve_size(io_reserve_type_t>, deco_reference_wrapper deco, ::std::size_t size) { return deco_reserve_size(io_reserve_type, *deco.ptr, size); @@ -51,7 +51,7 @@ template <::std::random_access_iterator srcIter, ::std::random_access_iterator t deco_reserve_define(io_reserve_type<::std::iter_value_t, decot>, deco, srcit, srcit, toit) } -> ::std::convertible_to; } -constexpr toIter deco_reserve_define(io_reserve_type_t<::std::iter_value_t, deco_reference_wrapper>, +inline constexpr toIter deco_reserve_define(io_reserve_type_t<::std::iter_value_t, deco_reference_wrapper>, deco_reference_wrapper deco, srcIter first, srcIter last, toIter iter) { return deco_reserve_define(io_reserve_type<::std::iter_value_t, decot>, *deco.ptr, first, last, iter); @@ -63,7 +63,7 @@ requires requires(decot& deco,fromIter from_it) { {deco_reserve_size(io_reserve_type,deco,from_it,from_it)}->::std::same_as<::std::size_t>; } -constexpr ::std::size_t deco_reserve_size(io_reserve_type_t>, +inline constexpr ::std::size_t deco_reserve_size(io_reserve_type_t>, deco_reference_wrapper deco,fromIter from_first,fromIter from_last) { return deco_reserve_size(io_reserve_type,*deco.ptr,from_first,from_last); @@ -74,7 +74,7 @@ requires requires(decot& deco,fromIter from_it,toIter to_it) { {deco_reserve_define(io_reserve_type,deco,from_it,from_it,to_it,to_it)}->::std::same_as<::std::size_t>; } -constexpr toIter deco_reserve_define(io_reserve_type_t>, +inline constexpr toIter deco_reserve_define(io_reserve_type_t>, deco_reference_wrapper deco,fromIter from_first,fromIter from_last,toIter to_first,toIter to_last) { return deco_reserve_define(io_reserve_type,*deco.ptr,from_first,from_last,to_first,to_last); @@ -83,18 +83,18 @@ constexpr toIter deco_reserve_define(io_reserve_type_t requires maybe_noop_decorator -constexpr bool deco_maybe_noop(io_reserve_type_t>,deco_reference_wrapper deco) +inline constexpr bool deco_maybe_noop(io_reserve_type_t>,deco_reference_wrapper deco) { return deco_maybe_noop(io_reserve_type,*deco.ptr); }; template<::std::integral to_char_type,typename decot> requires always_noop_decorator -constexpr void deco_always_noop(io_reserve_type_t>,deco_reference_wrapper deco){}; +inline constexpr void deco_always_noop(io_reserve_type_t>,deco_reference_wrapper deco){}; template<::std::integral to_char_type,typename decot> requires reserve_inverse_size_decorator -constexpr ::std::size_t deco_reserve_inverse_size(io_reserve_type_t>,deco_reference_wrapper deco,::std::size_t size) +inline constexpr ::std::size_t deco_reserve_inverse_size(io_reserve_type_t>,deco_reference_wrapper deco,::std::size_t size) { return deco_reserve_inverse_size(io_reserve_type,*deco.ptr,size); } diff --git a/include/fast_io_core_impl/io_lockable.h b/include/fast_io_core_impl/io_lockable.h index 2019f6110..d8dcdc5e8 100644 --- a/include/fast_io_core_impl/io_lockable.h +++ b/include/fast_io_core_impl/io_lockable.h @@ -31,14 +31,14 @@ struct basic_general_io_lockable_nonmovable template requires ::std::constructible_from - explicit constexpr basic_general_io_lockable_nonmovable(Args &&...args) + inline explicit constexpr basic_general_io_lockable_nonmovable(Args &&...args) : handle(::std::forward(args)...) { } template requires(::std::constructible_from) - constexpr void reopen(Args &&...args) + inline constexpr void reopen(Args &&...args) { ::fast_io::io_lock_guard guard(mutex); if constexpr (requires() { @@ -52,7 +52,7 @@ struct basic_general_io_lockable_nonmovable this->handle = T(::std::forward(args)...); } } - constexpr void close() noexcept(noexcept(handle.close())) + inline constexpr void close() noexcept(noexcept(handle.close())) { ::fast_io::io_lock_guard guard(mutex); handle.close(); @@ -70,19 +70,19 @@ struct heap_allocate_guard using allocator_type = Allocator; using typed_allocator_type = ::fast_io::typed_generic_allocator_adapter; native_handle_type ptr; - explicit constexpr heap_allocate_guard() noexcept + inline explicit constexpr heap_allocate_guard() noexcept : ptr{typed_allocator_type::allocate(1)} { } - heap_allocate_guard(heap_allocate_guard const &) = delete; - heap_allocate_guard &operator=(heap_allocate_guard const &) = delete; - constexpr native_handle_type release() noexcept + inline heap_allocate_guard(heap_allocate_guard const &) = delete; + inline heap_allocate_guard &operator=(heap_allocate_guard const &) = delete; + inline constexpr native_handle_type release() noexcept { auto temp{this->ptr}; this->ptr = nullptr; return temp; } - constexpr ~heap_allocate_guard() + inline constexpr ~heap_allocate_guard() { typed_allocator_type::deallocate_n(ptr, 1); } @@ -132,7 +132,7 @@ struct basic_general_mutex_movable mutex_type *pmutex{}; private: - constexpr void construct_default() noexcept(::std::is_nothrow_default_constructible_v) + inline constexpr void construct_default() noexcept(::std::is_nothrow_default_constructible_v) { ::fast_io::details::heap_allocate_guard g; ::std::construct_at(g.ptr); @@ -140,17 +140,17 @@ struct basic_general_mutex_movable } public: - explicit constexpr basic_general_mutex_movable() noexcept(::std::is_nothrow_default_constructible_v) + inline explicit constexpr basic_general_mutex_movable() noexcept(::std::is_nothrow_default_constructible_v) { this->construct_default(); } - explicit constexpr basic_general_mutex_movable(::fast_io::for_overwrite_t) noexcept + inline explicit constexpr basic_general_mutex_movable(::fast_io::for_overwrite_t) noexcept { } private: - constexpr void destroy() noexcept + inline constexpr void destroy() noexcept { if (pmutex) { @@ -160,32 +160,32 @@ struct basic_general_mutex_movable } public: - constexpr void close() noexcept + inline constexpr void close() noexcept { this->destroy(); this->pmutex = nullptr; } - constexpr void reopen() noexcept(::std::is_nothrow_default_constructible_v) + inline constexpr void reopen() noexcept(::std::is_nothrow_default_constructible_v) { this->close(); this->construct_default(); } - constexpr native_handle_type release() noexcept + inline constexpr native_handle_type release() noexcept { auto temp{this->pmutex}; this->pmutex = nullptr; return temp; } - basic_general_mutex_movable(basic_general_mutex_movable const &) = delete; - basic_general_mutex_movable &operator=(basic_general_mutex_movable const &) = delete; - constexpr basic_general_mutex_movable(basic_general_mutex_movable &&other) noexcept + inline basic_general_mutex_movable(basic_general_mutex_movable const &) = delete; + inline basic_general_mutex_movable &operator=(basic_general_mutex_movable const &) = delete; + inline constexpr basic_general_mutex_movable(basic_general_mutex_movable &&other) noexcept : pmutex{other.pmutex} { other.pmutex = nullptr; } - constexpr basic_general_mutex_movable &operator=(basic_general_mutex_movable &&other) noexcept + inline constexpr basic_general_mutex_movable &operator=(basic_general_mutex_movable &&other) noexcept { if (__builtin_addressof(other) == this) { @@ -197,7 +197,7 @@ struct basic_general_mutex_movable return *this; } - constexpr ~basic_general_mutex_movable() + inline constexpr ~basic_general_mutex_movable() { this->destroy(); } diff --git a/include/fast_io_core_impl/iso/iso8601.h b/include/fast_io_core_impl/iso/iso8601.h index ad005e389..90ec82aaa 100644 --- a/include/fast_io_core_impl/iso/iso8601.h +++ b/include/fast_io_core_impl/iso/iso8601.h @@ -10,7 +10,7 @@ struct basic_timestamp ::std::int_least64_t seconds{}; ::std::uint_least64_t subseconds{}; template <::std::int_least64_t new_off_to_epoch> - explicit constexpr operator basic_timestamp() noexcept + inline explicit constexpr operator basic_timestamp() noexcept requires(off_to_epoch != new_off_to_epoch) { constexpr ::std::int_least64_t diff{off_to_epoch - new_off_to_epoch}; @@ -18,7 +18,7 @@ struct basic_timestamp } template <::std::floating_point flt_type> - explicit constexpr operator flt_type() const noexcept + inline explicit constexpr operator flt_type() const noexcept { // I know this is not accurate. but it is better than nothing constexpr flt_type precision{static_cast(::fast_io::uint_least64_subseconds_per_second)}; diff --git a/include/fast_io_core_impl/local_new_array_ptr.h b/include/fast_io_core_impl/local_new_array_ptr.h index 32af660f9..3a26213a4 100644 --- a/include/fast_io_core_impl/local_new_array_ptr.h +++ b/include/fast_io_core_impl/local_new_array_ptr.h @@ -77,8 +77,8 @@ struct buffer_alloc_arr_ptr using allocator_type = Allocator; T *ptr{}; ::std::size_t size{}; - constexpr buffer_alloc_arr_ptr() noexcept = default; - explicit + inline constexpr buffer_alloc_arr_ptr() noexcept = default; + inline explicit #if __cpp_constexpr >= 201907L && __cpp_constexpr_dynamic_alloc >= 201907L && \ (__cpp_lib_is_constant_evaluated >= 201811L || __cpp_if_consteval >= 202106L) constexpr @@ -88,28 +88,29 @@ struct buffer_alloc_arr_ptr { } - buffer_alloc_arr_ptr(buffer_alloc_arr_ptr const &) = delete; - buffer_alloc_arr_ptr &operator=(buffer_alloc_arr_ptr const &) = delete; - constexpr T *allocate_new(::std::size_t n) noexcept + inline buffer_alloc_arr_ptr(buffer_alloc_arr_ptr const &) = delete; + inline buffer_alloc_arr_ptr &operator=(buffer_alloc_arr_ptr const &) = delete; + inline constexpr T *allocate_new(::std::size_t n) noexcept { return (ptr = allocate_iobuf_space(size = n)); } - constexpr T *get() noexcept + inline constexpr T *get() noexcept { return ptr; } - constexpr T const *get() const noexcept + inline constexpr T const *get() const noexcept { return ptr; } - constexpr T &operator[](::std::size_t pos) noexcept + inline constexpr T &operator[](::std::size_t pos) noexcept { return ptr[pos]; } - constexpr T const &operator[](::std::size_t pos) const noexcept + inline constexpr T const &operator[](::std::size_t pos) const noexcept { return ptr[pos]; } + inline #if __cpp_constexpr >= 201907L && __cpp_constexpr_dynamic_alloc >= 201907L && \ (__cpp_lib_is_constant_evaluated >= 201811L || __cpp_if_consteval >= 202106L) constexpr diff --git a/include/fast_io_core_impl/mode.h b/include/fast_io_core_impl/mode.h index aa78a12b4..b91a48d68 100644 --- a/include/fast_io_core_impl/mode.h +++ b/include/fast_io_core_impl/mode.h @@ -291,25 +291,25 @@ enum class open_mode : ::std::uint_least64_t // [Windows NT] use nt path on nt file }; -constexpr open_mode operator&(open_mode x, open_mode y) noexcept +inline constexpr open_mode operator&(open_mode x, open_mode y) noexcept { using utype = typename ::std::underlying_type::type; return static_cast(static_cast(x) & static_cast(y)); } -constexpr open_mode operator|(open_mode x, open_mode y) noexcept +inline constexpr open_mode operator|(open_mode x, open_mode y) noexcept { using utype = typename ::std::underlying_type::type; return static_cast(static_cast(x) | static_cast(y)); } -constexpr open_mode operator^(open_mode x, open_mode y) noexcept +inline constexpr open_mode operator^(open_mode x, open_mode y) noexcept { using utype = typename ::std::underlying_type::type; return static_cast(static_cast(x) ^ static_cast(y)); } -constexpr open_mode operator~(open_mode x) noexcept +inline constexpr open_mode operator~(open_mode x) noexcept { using utype = typename ::std::underlying_type::type; return static_cast(~static_cast(x)); @@ -579,39 +579,39 @@ inline constexpr char_type *print_reserve_define(io_reserve_type_t { iter._M_last } -> ::std::same_as; { iter._M_node } -> ::std::same_as; } -constexpr auto multiblock_iterator_view_ref_define(Iter iter) noexcept +inline constexpr auto multiblock_iterator_view_ref_define(Iter iter) noexcept -> ::fast_io::multiblock_iterator_view<::fast_io::details::glibcxxdequebufsize, ::std::iter_value_t> { diff --git a/include/fast_io_core_impl/operations/transcodeimpl/defines.h b/include/fast_io_core_impl/operations/transcodeimpl/defines.h index fa38c4e35..ef4c24786 100644 --- a/include/fast_io_core_impl/operations/transcodeimpl/defines.h +++ b/include/fast_io_core_impl/operations/transcodeimpl/defines.h @@ -6,7 +6,7 @@ namespace fast_io template struct transcode_reserve_t { - explicit constexpr transcode_reserve_t() noexcept = default; + inline explicit constexpr transcode_reserve_t() noexcept = default; }; template inline constexpr transcode_reserve_t transcode_reserve{}; @@ -119,4 +119,4 @@ concept has_transcode_bytes_imaginary_define = requires(T &t, ::std::byte const }; } // namespace operations::defines -} // namespace fast_io \ No newline at end of file +} // namespace fast_io diff --git a/include/fast_io_core_impl/operations/writeimpl/range.h b/include/fast_io_core_impl/operations/writeimpl/range.h index d85ec7f8a..ece4790d2 100644 --- a/include/fast_io_core_impl/operations/writeimpl/range.h +++ b/include/fast_io_core_impl/operations/writeimpl/range.h @@ -53,7 +53,7 @@ bytes_copy_punning_impl(FromItbg fromfirst, FromIted fromlast, ToIter tofirst, T } template <::std::size_t blocksize, typename outstmtype, typename T1, typename T> -constexpr void write_all_iterator_decay_multiblock_common_impl(outstmtype outsm, T1 **controller_first, +inline constexpr void write_all_iterator_decay_multiblock_common_impl(outstmtype outsm, T1 **controller_first, T const *firstblock_curr, T const *firstblock_end, T1 **controller_last, T const *lastblock_first, T const *lastblock_curr) diff --git a/include/fast_io_core_impl/perms.h b/include/fast_io_core_impl/perms.h index 52446c47f..cb71e8d77 100644 --- a/include/fast_io_core_impl/perms.h +++ b/include/fast_io_core_impl/perms.h @@ -29,25 +29,25 @@ enum class perms : ::std::uint_least32_t symlink_nofollow = 0x40000 }; -constexpr perms operator&(perms x, perms y) noexcept +inline constexpr perms operator&(perms x, perms y) noexcept { using utype = typename ::std::underlying_type::type; return static_cast(static_cast(x) & static_cast(y)); } -constexpr perms operator|(perms x, perms y) noexcept +inline constexpr perms operator|(perms x, perms y) noexcept { using utype = typename ::std::underlying_type::type; return static_cast(static_cast(x) | static_cast(y)); } -constexpr perms operator^(perms x, perms y) noexcept +inline constexpr perms operator^(perms x, perms y) noexcept { using utype = typename ::std::underlying_type::type; return static_cast(static_cast(x) ^ static_cast(y)); } -constexpr perms operator~(perms x) noexcept +inline constexpr perms operator~(perms x) noexcept { using utype = typename ::std::underlying_type::type; return static_cast(~static_cast(x)); diff --git a/include/fast_io_core_impl/secure_clear_guard.h b/include/fast_io_core_impl/secure_clear_guard.h index f6ca74613..29015c3a2 100644 --- a/include/fast_io_core_impl/secure_clear_guard.h +++ b/include/fast_io_core_impl/secure_clear_guard.h @@ -178,12 +178,12 @@ class secure_clear_guard public: T *region; ::std::size_t count; - secure_clear_guard(T *rg, ::std::size_t bts) + inline secure_clear_guard(T *rg, ::std::size_t bts) : region(rg), count(bts) {} - secure_clear_guard(secure_clear_guard const &) = delete; - secure_clear_guard &operator=(secure_clear_guard const &) = delete; - ~secure_clear_guard() + inline secure_clear_guard(secure_clear_guard const &) = delete; + inline secure_clear_guard &operator=(secure_clear_guard const &) = delete; + inline ~secure_clear_guard() { secure_clear(region, count * sizeof(T)); } @@ -193,10 +193,10 @@ template class secure_clear_no_op { public: - constexpr secure_clear_no_op(T *, ::std::size_t) {}; + inline constexpr secure_clear_no_op(T *, ::std::size_t) {}; }; template using conditional_secure_clear_guard = ::std::conditional_t, secure_clear_no_op>; -} // namespace fast_io \ No newline at end of file +} // namespace fast_io diff --git a/include/fast_io_core_impl/simd/gcc_clang.h b/include/fast_io_core_impl/simd/gcc_clang.h index 74fcbaeca..11d6d991c 100644 --- a/include/fast_io_core_impl/simd/gcc_clang.h +++ b/include/fast_io_core_impl/simd/gcc_clang.h @@ -37,11 +37,11 @@ struct simd_vector using value_type = T; using vec_type [[__gnu__::__vector_size__(N * sizeof(T))]] = T; vec_type value; - constexpr T const *data() const noexcept + inline constexpr T const *data() const noexcept { return __builtin_addressof(value[0]); } - constexpr T *data() noexcept + inline constexpr T *data() noexcept { return __builtin_addressof(value[0]); } @@ -219,7 +219,7 @@ struct simd_vector } template requires(sizeof(T1) * N1 == sizeof(T) * N && !::std::same_as) - explicit + inline explicit #if __has_builtin(__builtin_bit_cast) constexpr #endif @@ -233,7 +233,7 @@ struct simd_vector return v; #endif } - constexpr operator vec_type const &() const noexcept + inline constexpr operator vec_type const &() const noexcept { return value; } diff --git a/include/fast_io_core_impl/simd/generic.h b/include/fast_io_core_impl/simd/generic.h index 644cf833c..2e6bec9ad 100644 --- a/include/fast_io_core_impl/simd/generic.h +++ b/include/fast_io_core_impl/simd/generic.h @@ -23,11 +23,11 @@ struct using value_type = T; using vec_type = value_type[N]; vec_type value; - constexpr T const *data() const noexcept + inline constexpr T const *data() const noexcept { return __builtin_addressof(value[0]); } - constexpr T *data() noexcept + inline constexpr T *data() noexcept { return __builtin_addressof(value[0]); } @@ -116,7 +116,7 @@ struct template requires(sizeof(T1) * N1 == sizeof(T) * N && !::std::same_as) - explicit constexpr operator simd_vector() const noexcept + inline explicit constexpr operator simd_vector() const noexcept { return __builtin_bit_cast(simd_vector, *this); } diff --git a/include/fast_io_core_impl/simd/zero_spec.h b/include/fast_io_core_impl/simd/zero_spec.h index 2201adb84..111f53fba 100644 --- a/include/fast_io_core_impl/simd/zero_spec.h +++ b/include/fast_io_core_impl/simd/zero_spec.h @@ -7,11 +7,11 @@ template struct simd_vector { using value_type = T; - constexpr T const *data() const noexcept + inline constexpr T const *data() const noexcept { return nullptr; } - constexpr T *data() noexcept + inline constexpr T *data() noexcept { return nullptr; } diff --git a/include/fast_io_core_impl/socket/ip.h b/include/fast_io_core_impl/socket/ip.h index 57ef22862..e511d1d69 100644 --- a/include/fast_io_core_impl/socket/ip.h +++ b/include/fast_io_core_impl/socket/ip.h @@ -39,14 +39,14 @@ struct ip return !address.isv4; } - explicit constexpr ip() noexcept = default; - explicit constexpr ip(ipv4 add) + inline explicit constexpr ip() noexcept = default; + inline explicit constexpr ip(ipv4 add) : address{.address = {.v4 = add.address}, .isv4 = true}, port(add.port) {} - explicit constexpr ip(ipv6 add) + inline explicit constexpr ip(ipv6 add) : address{.address = {.v6 = add.address}}, port(add.port) {} - explicit constexpr ip(ip_address addr, ::std::uint_least16_t prt) + inline explicit constexpr ip(ip_address addr, ::std::uint_least16_t prt) : address{addr}, port{prt} {} }; diff --git a/include/fast_io_core_impl/unit_character_input_buffer.h b/include/fast_io_core_impl/unit_character_input_buffer.h index 3046a4e58..ddb19fe01 100644 --- a/include/fast_io_core_impl/unit_character_input_buffer.h +++ b/include/fast_io_core_impl/unit_character_input_buffer.h @@ -18,7 +18,7 @@ struct single_character_input_buffer template requires(::std::same_as> || ::std::same_as) -constexpr Iter read(single_character_input_buffer &in, Iter begin, Iter end) +inline constexpr Iter read(single_character_input_buffer &in, Iter begin, Iter end) { if constexpr (::std::same_as>) { @@ -42,29 +42,29 @@ constexpr Iter read(single_character_input_buffer &in, Iter begin, Iter e } template -constexpr auto ibuffer_begin(single_character_input_buffer &in) +inline constexpr auto ibuffer_begin(single_character_input_buffer &in) { return __builtin_addressof(in.single_character); } template -constexpr auto ibuffer_curr(single_character_input_buffer &in) +inline constexpr auto ibuffer_curr(single_character_input_buffer &in) { return __builtin_addressof(in.single_character) + static_cast<::std::size_t>(in.pos); } template -constexpr auto ibuffer_end(single_character_input_buffer &in) +inline constexpr auto ibuffer_end(single_character_input_buffer &in) { return __builtin_addressof(in.single_character) + static_cast<::std::size_t>(in.pos_end); } template -constexpr void ibuffer_set_curr(single_character_input_buffer &in, typename input::char_type *ptr) +inline constexpr void ibuffer_set_curr(single_character_input_buffer &in, typename input::char_type *ptr) { in.pos = (ptr != __builtin_addressof(in.single_character)); } template -constexpr bool ibuffer_underflow(single_character_input_buffer &in) +inline constexpr bool ibuffer_underflow(single_character_input_buffer &in) { in.pos_end = (read(in.reference, __builtin_addressof(in.single_character), __builtin_addressof(in.single_character) + 1) != __builtin_addressof(in.single_character)); @@ -73,7 +73,7 @@ constexpr bool ibuffer_underflow(single_character_input_buffer &in) } template -constexpr void avoid_scan_reserve(single_character_input_buffer &) +inline constexpr void avoid_scan_reserve(single_character_input_buffer &) {} -} // namespace fast_io \ No newline at end of file +} // namespace fast_io diff --git a/include/fast_io_core_impl/utils.h b/include/fast_io_core_impl/utils.h index 5f87f19b0..b09491482 100644 --- a/include/fast_io_core_impl/utils.h +++ b/include/fast_io_core_impl/utils.h @@ -45,12 +45,13 @@ struct io_lock_guard { using mutex_type = mutx_type; mutex_type &device; - explicit constexpr io_lock_guard(mutex_type &m) noexcept + inline explicit constexpr io_lock_guard(mutex_type &m) noexcept : device(m) { device.lock(); } + inline #if __cpp_constexpr >= 201907L constexpr #endif @@ -59,8 +60,8 @@ struct io_lock_guard device.unlock(); } - io_lock_guard(io_lock_guard const &) = delete; - io_lock_guard &operator=(io_lock_guard const &) = delete; + inline io_lock_guard(io_lock_guard const &) = delete; + inline io_lock_guard &operator=(io_lock_guard const &) = delete; }; template @@ -68,10 +69,11 @@ struct io_flush_guard { using handle_type = stream_type; handle_type &device; - explicit constexpr io_flush_guard(handle_type &m) noexcept + inline explicit constexpr io_flush_guard(handle_type &m) noexcept : device(m) {} + inline #if __cpp_constexpr >= 201907L constexpr #endif @@ -93,8 +95,8 @@ struct io_flush_guard #endif #endif } - io_flush_guard(io_flush_guard const &) = delete; - io_flush_guard &operator=(io_flush_guard const &) = delete; + inline io_flush_guard(io_flush_guard const &) = delete; + inline io_flush_guard &operator=(io_flush_guard const &) = delete; }; namespace details @@ -490,7 +492,7 @@ inline constexpr bool need_seperate_print{(sizeof(T) > sizeof(optimal_print_unsi template <::std::uint_least32_t base, bool ryu_mode = false, ::std::size_t mx_size = ::std::numeric_limits<::std::size_t>::max(), my_unsigned_integral U> -constexpr ::std::size_t chars_len(U value) noexcept +inline constexpr ::std::size_t chars_len(U value) noexcept { if constexpr (base == 10 && sizeof(U) <= 16) {