aboutsummaryrefslogtreecommitdiff
path: root/libs/kstd
diff options
context:
space:
mode:
Diffstat (limited to 'libs/kstd')
-rw-r--r--libs/kstd/kstd/bits/basic_string.hpp16
-rw-r--r--libs/kstd/kstd/bits/format/error.hpp6
-rw-r--r--libs/kstd/kstd/bits/format/formatter.hpp6
-rw-r--r--libs/kstd/kstd/vector.hpp12
4 files changed, 23 insertions, 17 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/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());