diff --git a/include/fast_io_dsal/impl/list.h b/include/fast_io_dsal/impl/list.h index d395e386..3a302749 100644 --- a/include/fast_io_dsal/impl/list.h +++ b/include/fast_io_dsal/impl/list.h @@ -605,11 +605,17 @@ class list return const_reverse_iterator({__builtin_addressof(imp)}); } +#if __has_cpp_attribute(__gnu__::__pure__) + [[__gnu__::__pure__]] +#endif [[nodiscard]] inline constexpr bool empty() const noexcept { return imp.next == __builtin_addressof(imp); } +#if __has_cpp_attribute(__gnu__::__pure__) + [[__gnu__::__pure__]] +#endif [[nodiscard]] inline constexpr bool is_empty() const noexcept { return imp.next == __builtin_addressof(imp); @@ -908,9 +914,9 @@ class list inline constexpr list(list &&other) noexcept : imp(other.imp) - #if 0 +#if 0 , allochdl(std::move(other.allochdl)) - #endif +#endif { auto prev = static_cast<::fast_io::containers::details::list_node_common *>(imp.prev); auto next = static_cast<::fast_io::containers::details::list_node_common *>(imp.next); @@ -924,9 +930,9 @@ class list { this->destroy(); imp = other.imp; - #if 0 +#if 0 allochdl = ::std::move(other.allochdl); - #endif +#endif auto prev = static_cast<::fast_io::containers::details::list_node_common *>(imp.prev); auto next = static_cast<::fast_io::containers::details::list_node_common *>(imp.next); next->prev = prev->next = __builtin_addressof(imp); diff --git a/include/fast_io_dsal/impl/queue.h b/include/fast_io_dsal/impl/queue.h index 07e27dbf..7f86ec85 100644 --- a/include/fast_io_dsal/impl/queue.h +++ b/include/fast_io_dsal/impl/queue.h @@ -69,6 +69,10 @@ class queue return container.back_unchecked(); } +#if __has_cpp_attribute(__gnu__::__pure__) + [[__gnu__::__pure__]] +#endif + [[nodiscard]] inline constexpr bool empty() const noexcept { if constexpr (requires() { @@ -83,11 +87,19 @@ class queue } } +#if __has_cpp_attribute(__gnu__::__pure__) + [[__gnu__::__pure__]] +#endif + [[nodiscard]] inline constexpr bool is_empty() const noexcept { return container.is_empty(); } +#if __has_cpp_attribute(__gnu__::__pure__) + [[__gnu__::__pure__]] +#endif + [[nodiscard]] inline constexpr size_type size() const noexcept requires(requires() { container.size(); @@ -95,6 +107,7 @@ class queue { return container.size(); } + inline constexpr void push(value_type const &value) { container.push_back(value); diff --git a/include/fast_io_dsal/impl/stack.h b/include/fast_io_dsal/impl/stack.h index 5fab80c1..8773f90b 100644 --- a/include/fast_io_dsal/impl/stack.h +++ b/include/fast_io_dsal/impl/stack.h @@ -87,6 +87,10 @@ class stack } } +#if __has_cpp_attribute(__gnu__::__pure__) + [[__gnu__::__pure__]] +#endif + [[nodiscard]] inline constexpr bool empty() const noexcept { if constexpr (requires() { @@ -101,11 +105,19 @@ class stack } } +#if __has_cpp_attribute(__gnu__::__pure__) + [[__gnu__::__pure__]] +#endif + [[nodiscard]] inline constexpr bool is_empty() const noexcept { return container.is_empty(); } +#if __has_cpp_attribute(__gnu__::__pure__) + [[__gnu__::__pure__]] +#endif + [[nodiscard]] inline constexpr size_type size() const noexcept requires(requires() { container.size(); @@ -113,6 +125,7 @@ class stack { return container.size(); } + inline constexpr void push(value_type const &value) { if constexpr (requires() { diff --git a/include/fast_io_dsal/impl/string.h b/include/fast_io_dsal/impl/string.h index 5f4eedf7..057e2309 100644 --- a/include/fast_io_dsal/impl/string.h +++ b/include/fast_io_dsal/impl/string.h @@ -218,20 +218,33 @@ class basic_string FAST_IO_TRIVIALLY_RELOCATABLE_IF_ELIGIBLE return imp.begin_ptr; } +#if __has_cpp_attribute(__gnu__::__pure__) + [[__gnu__::__pure__]] +#endif + [[nodiscard]] inline constexpr bool is_empty() const noexcept { return imp.begin_ptr == imp.curr_ptr; } +#if __has_cpp_attribute(__gnu__::__pure__) + [[__gnu__::__pure__]] +#endif + [[nodiscard]] inline constexpr bool empty() const noexcept { return imp.begin_ptr == imp.curr_ptr; } +#if __has_cpp_attribute(__gnu__::__pure__) + [[__gnu__::__pure__]] +#endif + [[nodiscard]] inline constexpr size_type size() const noexcept { return static_cast(imp.curr_ptr - imp.begin_ptr); } + inline constexpr size_type size_bytes() const noexcept { return static_cast(imp.curr_ptr - imp.begin_ptr) * sizeof(value_type); @@ -524,7 +537,7 @@ class basic_string FAST_IO_TRIVIALLY_RELOCATABLE_IF_ELIGIBLE this->assign_impl(other.imp.begin_ptr, static_cast<::std::size_t>(other.imp.curr_ptr - other.imp.begin_ptr)); return *this; } - inline constexpr basic_string& operator=(string_view_type const &other) noexcept + inline constexpr basic_string &operator=(string_view_type const &other) noexcept { this->assign(other); return *this; diff --git a/include/fast_io_dsal/impl/string_view.h b/include/fast_io_dsal/impl/string_view.h index ac377d3c..dd0dc8f7 100644 --- a/include/fast_io_dsal/impl/string_view.h +++ b/include/fast_io_dsal/impl/string_view.h @@ -66,16 +66,25 @@ class basic_string_view const_pointer ptr{}; size_type n{}; +#if __has_cpp_attribute(__gnu__::__pure__) + [[__gnu__::__pure__]] +#endif [[nodiscard]] inline constexpr bool is_empty() const noexcept { return !n; } +#if __has_cpp_attribute(__gnu__::__pure__) + [[__gnu__::__pure__]] +#endif [[nodiscard]] inline constexpr bool empty() const noexcept { return !n; } +#if __has_cpp_attribute(__gnu__::__pure__) + [[__gnu__::__pure__]] +#endif [[nodiscard]] inline constexpr size_type size() const noexcept { return n;