Skip to content

Commit

Permalink
Add missing inline
Browse files Browse the repository at this point in the history
  • Loading branch information
MacroModel committed Nov 28, 2024
1 parent 60c19c4 commit 946e0da
Show file tree
Hide file tree
Showing 35 changed files with 196 additions and 192 deletions.
56 changes: 28 additions & 28 deletions include/fast_io_core_impl/buffer_view.h
Original file line number Diff line number Diff line change
Expand Up @@ -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<Iter>>, 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<rg>, char_type> &&
!::std::is_array_v<::std::remove_cvref_t<rg>>)
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;
}
Expand Down Expand Up @@ -79,31 +79,31 @@ inline constexpr basic_ibuffer_view_ref<ch_type> input_bytes_stream_ref_define(b
}

template <::std::integral ch_type>
[[nodiscard]] constexpr ch_type const *ibuffer_begin(basic_ibuffer_view_ref<ch_type> view) noexcept
[[nodiscard]] inline constexpr ch_type const *ibuffer_begin(basic_ibuffer_view_ref<ch_type> view) noexcept
{
return view.ptr->begin_ptr;
}

template <::std::integral ch_type>
[[nodiscard]] constexpr ch_type const *ibuffer_curr(basic_ibuffer_view_ref<ch_type> view) noexcept
[[nodiscard]] inline constexpr ch_type const *ibuffer_curr(basic_ibuffer_view_ref<ch_type> view) noexcept
{
return view.ptr->curr_ptr;
}

template <::std::integral ch_type>
[[nodiscard]] constexpr ch_type const *ibuffer_end(basic_ibuffer_view_ref<ch_type> view) noexcept
[[nodiscard]] inline constexpr ch_type const *ibuffer_end(basic_ibuffer_view_ref<ch_type> view) noexcept
{
return view.ptr->end_ptr;
}

template <::std::integral ch_type>
constexpr void ibuffer_set_curr(basic_ibuffer_view_ref<ch_type> view, ch_type const *ptr) noexcept
inline constexpr void ibuffer_set_curr(basic_ibuffer_view_ref<ch_type> 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<ch_type>) noexcept
[[nodiscard]] inline constexpr bool ibuffer_underflow(basic_ibuffer_view_ref<ch_type>) noexcept
{
return false;
}
Expand All @@ -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<Iter>, 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<rg>, char_type> &&
!::std::is_array_v<::std::remove_cvref_t<rg>>)
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);
}
Expand Down Expand Up @@ -229,31 +229,31 @@ inline constexpr basic_obuffer_view_ref<ch_type> output_bytes_stream_ref_define(
}

template <::std::integral ch_type>
[[nodiscard]] constexpr ch_type *obuffer_begin(basic_obuffer_view_ref<ch_type> view) noexcept
[[nodiscard]] inline constexpr ch_type *obuffer_begin(basic_obuffer_view_ref<ch_type> view) noexcept
{
return view.ptr->begin_ptr;
}

template <::std::integral ch_type>
[[nodiscard]] constexpr ch_type *obuffer_curr(basic_obuffer_view_ref<ch_type> view) noexcept
[[nodiscard]] inline constexpr ch_type *obuffer_curr(basic_obuffer_view_ref<ch_type> view) noexcept
{
return view.ptr->curr_ptr;
}

template <::std::integral ch_type>
[[nodiscard]] constexpr ch_type *obuffer_end(basic_obuffer_view_ref<ch_type> view) noexcept
[[nodiscard]] inline constexpr ch_type *obuffer_end(basic_obuffer_view_ref<ch_type> view) noexcept
{
return view.ptr->end_ptr;
}

template <::std::integral ch_type>
constexpr void obuffer_set_curr(basic_obuffer_view_ref<ch_type> view, ch_type *ptr) noexcept
inline constexpr void obuffer_set_curr(basic_obuffer_view_ref<ch_type> 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>, ch_type) noexcept
inline constexpr void obuffer_overflow(basic_obuffer_view_ref<ch_type>, ch_type) noexcept
{
fast_terminate();
}
Expand Down
7 changes: 4 additions & 3 deletions include/fast_io_core_impl/concat/concat_buffer.h
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
16 changes: 8 additions & 8 deletions include/fast_io_core_impl/concepts/operation.h
Original file line number Diff line number Diff line change
Expand Up @@ -301,22 +301,22 @@ struct parameter

template <::std::integral char_type, typename output, typename value_type>
requires(printable<char_type, ::std::remove_cvref_t<value_type>> && ::std::is_trivially_copyable_v<output>)
constexpr void print_define(io_reserve_type_t<char_type, parameter<value_type>>, output out,
inline constexpr void print_define(io_reserve_type_t<char_type, parameter<value_type>>, output out,
parameter<value_type> wrapper)
{
print_define(io_reserve_type<char_type, ::std::remove_cvref_t<value_type>>, out, wrapper.reference);
}

template <::std::integral char_type, typename value_type>
requires reserve_printable<char_type, ::std::remove_cvref_t<value_type>>
constexpr ::std::size_t print_reserve_size(io_reserve_type_t<char_type, parameter<value_type>>)
inline constexpr ::std::size_t print_reserve_size(io_reserve_type_t<char_type, parameter<value_type>>)
{
return print_reserve_size(io_reserve_type<char_type, ::std::remove_cvref_t<value_type>>);
}

template <::std::integral char_type, typename value_type>
requires dynamic_reserve_printable<char_type, ::std::remove_cvref_t<value_type>>
constexpr ::std::size_t print_reserve_size(io_reserve_type_t<char_type, parameter<value_type>>,
inline constexpr ::std::size_t print_reserve_size(io_reserve_type_t<char_type, parameter<value_type>>,
parameter<value_type> para)
{
return print_reserve_size(io_reserve_type<char_type, ::std::remove_cvref_t<value_type>>, para.reference);
Expand All @@ -325,15 +325,15 @@ constexpr ::std::size_t print_reserve_size(io_reserve_type_t<char_type, paramete
template <::std::integral char_type, typename value_type>
requires(reserve_printable<char_type, ::std::remove_cvref_t<value_type>> ||
dynamic_reserve_printable<char_type, ::std::remove_cvref_t<value_type>>)
constexpr auto print_reserve_define(io_reserve_type_t<char_type, parameter<value_type>>, char_type *begin,
inline constexpr auto print_reserve_define(io_reserve_type_t<char_type, parameter<value_type>>, char_type *begin,
parameter<value_type> para)
{
return print_reserve_define(io_reserve_type<char_type, ::std::remove_cvref_t<value_type>>, begin, para.reference);
}

template <::std::integral char_type, typename value_type, typename Iter>
requires(printable_internal_shift<char_type, ::std::remove_cvref_t<value_type>>)
constexpr auto print_define_internal_shift(io_reserve_type_t<char_type, parameter<value_type>>, Iter begin,
inline constexpr auto print_define_internal_shift(io_reserve_type_t<char_type, parameter<value_type>>, Iter begin,
parameter<value_type> para)
{
return print_define_internal_shift(io_reserve_type<char_type, ::std::remove_cvref_t<value_type>>, begin,
Expand All @@ -342,15 +342,15 @@ constexpr auto print_define_internal_shift(io_reserve_type_t<char_type, paramete

template <::std::integral char_type, typename value_type>
requires precise_reserve_printable<char_type, ::std::remove_cvref_t<value_type>>
constexpr ::std::size_t print_reserve_precise_size(io_reserve_type_t<char_type, parameter<value_type>>,
inline constexpr ::std::size_t print_reserve_precise_size(io_reserve_type_t<char_type, parameter<value_type>>,
parameter<value_type> para)
{
return print_reserve_precise_size(io_reserve_type<char_type, ::std::remove_cvref_t<value_type>>, para.reference);
}

template <::std::integral char_type, typename value_type, typename Iter>
requires precise_reserve_printable<char_type, ::std::remove_cvref_t<value_type>>
constexpr void print_reserve_precise_define(io_reserve_type_t<char_type, parameter<value_type>>, Iter begin,
inline constexpr void print_reserve_precise_define(io_reserve_type_t<char_type, parameter<value_type>>, Iter begin,
::std::size_t n, parameter<value_type> para)
{
print_reserve_precise_define(io_reserve_type<char_type, ::std::remove_cvref_t<value_type>>, begin, n,
Expand All @@ -359,7 +359,7 @@ constexpr void print_reserve_precise_define(io_reserve_type_t<char_type, paramet

template <::std::integral char_type, typename value_type>
requires scatter_printable<char_type, ::std::remove_cvref_t<value_type>>
constexpr auto print_scatter_define(io_reserve_type_t<char_type, parameter<value_type>>, parameter<value_type> para)
inline constexpr auto print_scatter_define(io_reserve_type_t<char_type, parameter<value_type>>, parameter<value_type> para)
{
return print_scatter_define(io_reserve_type<char_type, ::std::remove_cvref_t<value_type>>, para.reference);
}
Expand Down
2 changes: 1 addition & 1 deletion include/fast_io_core_impl/concepts/strlike.h
Original file line number Diff line number Diff line change
Expand Up @@ -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>
Expand Down
8 changes: 4 additions & 4 deletions include/fast_io_core_impl/concepts/type.h
Original file line number Diff line number Diff line change
Expand Up @@ -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<char_type, T> io_reserve_type{};
Expand All @@ -80,15 +80,15 @@ 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{};

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>
Expand Down Expand Up @@ -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{};
Expand Down
8 changes: 4 additions & 4 deletions include/fast_io_core_impl/dll_mode.h
Original file line number Diff line number Diff line change
Expand Up @@ -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<dll_mode>::type;
return static_cast<dll_mode>(static_cast<utype>(x) & static_cast<utype>(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<dll_mode>::type;
return static_cast<dll_mode>(static_cast<utype>(x) | static_cast<utype>(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<dll_mode>::type;
return static_cast<dll_mode>(static_cast<utype>(x) ^ static_cast<utype>(y));
}

constexpr dll_mode operator~(dll_mode x) noexcept
inline constexpr dll_mode operator~(dll_mode x) noexcept
{
using utype = typename ::std::underlying_type<dll_mode>::type;
return static_cast<dll_mode>(~static_cast<utype>(x));
Expand Down
4 changes: 2 additions & 2 deletions include/fast_io_core_impl/drain.h
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ namespace fast_io
{

template <buffer_output_stream source_type>
constexpr basic_io_scatter_t<typename ::std::remove_cvref_t<source_type>::char_type>
inline constexpr basic_io_scatter_t<typename ::std::remove_cvref_t<source_type>::char_type>
print_alias_define(io_alias_t, manip::drainage<source_type &> source)
{
auto bg{obuffer_begin(source.reference)};
Expand All @@ -18,4 +18,4 @@ inline constexpr void drain(dest_type &&dest, source_type &&source)
print_freestanding(::std::forward<dest_type>(dest), drainage(source));
}

} // namespace fast_io
} // namespace fast_io
8 changes: 4 additions & 4 deletions include/fast_io_core_impl/dynamic_output_buffer.h
Original file line number Diff line number Diff line change
Expand Up @@ -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)
{
Expand Down
Loading

0 comments on commit 946e0da

Please sign in to comment.