diff options
Diffstat (limited to 'libs/kstd')
| -rw-r--r-- | libs/kstd/kstd/bits/basic_string.hpp | 16 | ||||
| -rw-r--r-- | libs/kstd/kstd/bits/format/error.hpp | 6 | ||||
| -rw-r--r-- | libs/kstd/kstd/bits/format/formatter.hpp | 6 | ||||
| -rw-r--r-- | libs/kstd/kstd/bits/mutex/lock_guard.hpp | 4 | ||||
| -rw-r--r-- | libs/kstd/kstd/bits/observer_ptr.hpp | 2 | ||||
| -rw-r--r-- | libs/kstd/kstd/bits/shared_ptr.hpp | 4 | ||||
| -rw-r--r-- | libs/kstd/kstd/cstring.hpp | 4 | ||||
| -rw-r--r-- | libs/kstd/kstd/posix.hpp | 4 | ||||
| -rw-r--r-- | libs/kstd/kstd/print.hpp | 4 | ||||
| -rw-r--r-- | libs/kstd/kstd/ranges.hpp | 4 | ||||
| -rw-r--r-- | libs/kstd/kstd/system_error.hpp | 4 | ||||
| -rw-r--r-- | libs/kstd/kstd/vector.hpp | 12 |
12 files changed, 43 insertions, 27 deletions
diff --git a/libs/kstd/kstd/bits/basic_string.hpp b/libs/kstd/kstd/bits/basic_string.hpp index 1f8b60af..a2dd7f15 100644 --- a/libs/kstd/kstd/bits/basic_string.hpp +++ b/libs/kstd/kstd/bits/basic_string.hpp @@ -8,7 +8,6 @@ #include <algorithm> #include <array> -#include <compare> #include <cstddef> #include <functional> #include <initializer_list> @@ -1329,23 +1328,27 @@ namespace kstd } [[nodiscard]] constexpr friend auto operator<=>(basic_string const & lhs, basic_string const & rhs) noexcept + -> traits_type::comparison_category { return std::lexicographical_compare_three_way(std::cbegin(lhs), std::cend(lhs), std::cbegin(rhs), std::cend(rhs)); } [[nodiscard]] constexpr friend auto operator<=>(basic_string const & lhs, std::basic_string_view<value_type, traits_type> const & rhs) noexcept + -> traits_type::comparison_category { return std::lexicographical_compare_three_way(std::cbegin(lhs), std::cend(lhs), std::cbegin(rhs), std::cend(rhs)); } [[nodiscard]] constexpr friend auto operator<=>(std::basic_string_view<value_type, traits_type> const & lhs, - basic_string const & rhs) noexcept -> std::strong_ordering + basic_string const & rhs) noexcept + -> traits_type::comparison_category { return std::lexicographical_compare_three_way(std::cbegin(lhs), std::cend(lhs), std::cbegin(rhs), std::cend(rhs)); } [[nodiscard]] constexpr friend auto operator<=>(basic_string const & lhs, const_pointer rhs) noexcept + -> traits_type::comparison_category { if (rhs == nullptr) { @@ -1356,6 +1359,7 @@ namespace kstd } [[nodiscard]] constexpr friend auto operator<=>(const_pointer lhs, basic_string const & rhs) noexcept + -> traits_type::comparison_category { if (rhs == nullptr) { @@ -1443,7 +1447,7 @@ namespace kstd } [[nodiscard]] constexpr auto static do_compare(std::basic_string_view<value_type, traits_type> lhs, - std::basic_string_view<value_type, traits_type> rhs) noexcept + std::basic_string_view<value_type, traits_type> rhs) noexcept -> int { // clang-tidy is not smart enough to see that whe are, in essence, passing the correct length. // NOLINTNEXTLINE(bugprone-suspicious-stringview-data-usage) @@ -1466,7 +1470,7 @@ namespace kstd //! Copy elements from a range described by an input iterator pair. //! //! @param first An iterator pointing to the first element to copy. - //! @param last An iterator pointing beyond the last elemento copy. + //! @param last An iterator pointing beyond the last element to copy. template<typename InputIterator, typename Sentinel> requires std::input_iterator<std::remove_cvref_t<InputIterator>> constexpr auto forward_from(InputIterator && first, Sentinel last) -> void @@ -1496,7 +1500,7 @@ namespace kstd //! Copy elements from a range described by a forward iterator pair. //! //! @param first An iterator pointing to the first element to copy. - //! @param last An iterator pointing beyond the last elemento copy. + //! @param last An iterator pointing beyond the last element to copy. template<typename ForwardIterator, typename Sentinel> requires std::forward_iterator<std::remove_cvref_t<ForwardIterator>> constexpr auto forward_from(ForwardIterator && first, Sentinel last) -> void @@ -1551,7 +1555,7 @@ namespace kstd //! Release the current buffer of this string. //! //! This function can be called even if this string is currently in tis SSO state. - [[nodiscard]] constexpr auto release_buffer() + constexpr auto release_buffer() -> void { if (!in_sso_state()) { diff --git a/libs/kstd/kstd/bits/format/error.hpp b/libs/kstd/kstd/bits/format/error.hpp index 30cb7523..1442d2be 100644 --- a/libs/kstd/kstd/bits/format/error.hpp +++ b/libs/kstd/kstd/bits/format/error.hpp @@ -3,14 +3,16 @@ #include <kstd/os/error.hpp> +#include <string_view> + namespace kstd::bits::format { - constexpr auto error(char const * message) -> void + constexpr auto error(std::string_view message) -> void { if consteval { - extern void compile_time_format_error_triggered(char const *); + extern auto compile_time_format_error_triggered(std::string_view)->void; compile_time_format_error_triggered(message); } else diff --git a/libs/kstd/kstd/bits/format/formatter.hpp b/libs/kstd/kstd/bits/format/formatter.hpp index c26907b2..5f1d89c6 100644 --- a/libs/kstd/kstd/bits/format/formatter.hpp +++ b/libs/kstd/kstd/bits/format/formatter.hpp @@ -30,13 +30,13 @@ namespace kstd m_separator = sep; } - constexpr auto set_brackets(std::string_view opening, std::string_view closing) + constexpr auto set_brackets(std::string_view opening, std::string_view closing) -> void { m_prefix = opening; m_suffix = closing; } - constexpr auto parse(format_parse_context & context) + constexpr auto parse(format_parse_context & context) -> format_parse_context::iterator { auto it = context.begin(); auto const end = context.end(); @@ -63,7 +63,7 @@ namespace kstd } template<typename Range> - auto format(Range const & range, format_context & context) + auto format(Range const & range, format_context & context) -> void { context.push(m_prefix); diff --git a/libs/kstd/kstd/bits/mutex/lock_guard.hpp b/libs/kstd/kstd/bits/mutex/lock_guard.hpp index b4762c36..40221b0f 100644 --- a/libs/kstd/kstd/bits/mutex/lock_guard.hpp +++ b/libs/kstd/kstd/bits/mutex/lock_guard.hpp @@ -1,5 +1,5 @@ -#ifndef KSTD_BITS_MUTEX_LOCK_GUARD -#define KSTD_BITS_MUTEX_LOCK_GUARD +#ifndef KSTD_BITS_MUTEX_LOCK_GUARD_HPP +#define KSTD_BITS_MUTEX_LOCK_GUARD_HPP // IWYU pragma: private, include <kstd/mutex.hpp> diff --git a/libs/kstd/kstd/bits/observer_ptr.hpp b/libs/kstd/kstd/bits/observer_ptr.hpp index 260d9d33..d53ab5a0 100644 --- a/libs/kstd/kstd/bits/observer_ptr.hpp +++ b/libs/kstd/kstd/bits/observer_ptr.hpp @@ -24,6 +24,8 @@ namespace kstd constexpr observer_ptr() noexcept = default; //! Construct an empty observer pointer from a null pointer. + //! + //! @note this constructor is deliberately not explicit, as required by the standard. constexpr observer_ptr(std::nullptr_t) noexcept {} //! Construct an observer pointer from a raw pointer. diff --git a/libs/kstd/kstd/bits/shared_ptr.hpp b/libs/kstd/kstd/bits/shared_ptr.hpp index 1c1ae08c..378030dc 100644 --- a/libs/kstd/kstd/bits/shared_ptr.hpp +++ b/libs/kstd/kstd/bits/shared_ptr.hpp @@ -227,6 +227,8 @@ namespace kstd } //! Construct a weak pointer which shares ownership of the object managed by other. + //! + //! @note this constructor is deliberately not explicit, as required by the standard. template<typename Y> requires bits::is_shared_pointer_ctor_compatible<Y *, T *>::value constexpr weak_ptr(weak_ptr<Y> const & other) noexcept @@ -452,6 +454,8 @@ namespace kstd {} //! @brief Construct an empty shared pointer. + //! + //! @note this constructor is deliberately not explicit, as required by the standard. constexpr shared_ptr(std::nullptr_t) noexcept : m_pointer(nullptr) , m_control_block(nullptr) diff --git a/libs/kstd/kstd/cstring.hpp b/libs/kstd/kstd/cstring.hpp index 9678f77f..bc83181b 100644 --- a/libs/kstd/kstd/cstring.hpp +++ b/libs/kstd/kstd/cstring.hpp @@ -1,5 +1,5 @@ -#ifndef KSTD_CSTRING -#define KSTD_CSTRING +#ifndef KSTD_CSTRING_HPP +#define KSTD_CSTRING_HPP #include <cstddef> diff --git a/libs/kstd/kstd/posix.hpp b/libs/kstd/kstd/posix.hpp index 12bd5ec0..fc66a4b0 100644 --- a/libs/kstd/kstd/posix.hpp +++ b/libs/kstd/kstd/posix.hpp @@ -1,5 +1,5 @@ -#ifndef KSTD_CERRNO_HPP -#define KSTD_CERRNO_HPP +#ifndef KSTD_POSIX_HPP +#define KSTD_POSIX_HPP namespace kstd::posix { diff --git a/libs/kstd/kstd/print.hpp b/libs/kstd/kstd/print.hpp index 0d37efbe..10adcf43 100644 --- a/libs/kstd/kstd/print.hpp +++ b/libs/kstd/kstd/print.hpp @@ -1,5 +1,5 @@ -#ifndef KSTD_PRINT -#define KSTD_PRINT +#ifndef KSTD_PRINT_HPP +#define KSTD_PRINT_HPP #include <kstd/bits/print_sink.hpp> // IWYU pragma: export #include <kstd/format.hpp> diff --git a/libs/kstd/kstd/ranges.hpp b/libs/kstd/kstd/ranges.hpp index 78c3adbf..64b73968 100644 --- a/libs/kstd/kstd/ranges.hpp +++ b/libs/kstd/kstd/ranges.hpp @@ -1,5 +1,5 @@ -#ifndef KSTD_RANGES -#define KSTD_RANGES +#ifndef KSTD_RANGES_HPP +#define KSTD_RANGES_HPP #include <ranges> // IWYU pragma: export diff --git a/libs/kstd/kstd/system_error.hpp b/libs/kstd/kstd/system_error.hpp index d6e78ffe..3b8e628a 100644 --- a/libs/kstd/kstd/system_error.hpp +++ b/libs/kstd/kstd/system_error.hpp @@ -152,6 +152,8 @@ namespace kstd //! Construct an error condition from an error condition enumeration value. //! + //! @note this constructor is deliberately not explicit, as required by the standard. + //! //! @tparam Enum The error condition enumeration type. //! @param value The error condition enumeration value. template<error_condition_enum Enum> @@ -237,6 +239,8 @@ namespace kstd //! Construct an error code from an error code enumeration value. //! + //! @note this constructor is deliberately not explicit, as required by the standard. + //! //! @tparam Enum The error code enumeration type. //! @param value The error code enumeration value. template<error_code_enum Enum> diff --git a/libs/kstd/kstd/vector.hpp b/libs/kstd/kstd/vector.hpp index 5a56381b..fc3020c7 100644 --- a/libs/kstd/kstd/vector.hpp +++ b/libs/kstd/kstd/vector.hpp @@ -898,7 +898,7 @@ namespace kstd } //! Release the memory of this vector. - constexpr auto deallocate() + constexpr auto deallocate() -> void { if (m_data) { @@ -914,7 +914,7 @@ namespace kstd //! @param position The position to insert the element at. //! @param value The value to insert. template<typename U> - constexpr auto do_insert(const_iterator position, U && value) + constexpr auto do_insert(const_iterator position, U && value) -> iterator { auto prefix_size = std::ranges::distance(cbegin(), position); if (position == cend()) @@ -969,7 +969,7 @@ namespace kstd //! @param to The start of the target range inside this vector. //! @param count The number of elements to copy template<typename SourceIterator> - constexpr auto uninitialized_copy_with_allocator(SourceIterator from, iterator to, size_type count) + constexpr auto uninitialized_copy_with_allocator(SourceIterator from, iterator to, size_type count) -> void { for (auto i = 0uz; i < count; ++i) { @@ -983,7 +983,7 @@ namespace kstd //! @param to The start of the target range inside this vector. //! @param count The number of elements to copy template<typename SourceIterator> - constexpr auto uninitialized_move_with_allocator(SourceIterator from, iterator to, size_type count) + constexpr auto uninitialized_move_with_allocator(SourceIterator from, iterator to, size_type count) -> void { for (auto i = 0uz; i < count; ++i) { @@ -1004,7 +1004,7 @@ namespace kstd } //! Shift all elements, starting the given position, one position back inside the vector. - constexpr auto shift_back(iterator starting_at) + constexpr auto shift_back(iterator starting_at) -> void { std::allocator_traits<allocator_type>::construct(m_allocator, end(), std::move(*(end() - 1))); std::ranges::move_backward(starting_at, end() - 1, end()); @@ -1015,7 +1015,7 @@ namespace kstd //! @param position The position to insert the element at. //! @param args The constructor arguments for the inserted element. template<typename... Args> - constexpr auto reallocate_and_insert(iterator position, Args &&... args) + constexpr auto reallocate_and_insert(iterator position, Args &&... args) -> void { auto prefix_size = std::ranges::distance(begin(), position); auto suffix_size = std::ranges::distance(position, end()); |
