12#include "../macros.hpp"
20hi_export_module(hikogui.utility.misc);
25hi_warning_ignore_msvc(26472);
27hi_export
namespace hi {
34constexpr std::size_t operator""_uz(
unsigned long long lhs)
noexcept
39constexpr std::size_t operator""_zu(
unsigned long long lhs)
noexcept
44constexpr std::ptrdiff_t operator""_z(
unsigned long long lhs)
noexcept
52template<
typename T,
typename U>
56 lhs = std::forward<U>(rhs);
68template<
typename T,
typename U>
71 return lhs.exchange(rhs, std::memory_order::relaxed) != rhs;
85template<
class T,
class U>
86[[nodiscard]]
constexpr auto&& forward_like(U&& x)
noexcept
88 constexpr bool is_adding_const = std::is_const_v<std::remove_reference_t<T>>;
89 if constexpr (std::is_lvalue_reference_v<T&&>) {
90 if constexpr (is_adding_const) {
91 return std::as_const(x);
93 return static_cast<U&
>(x);
96 if constexpr (is_adding_const) {
111template<
typename CharT,
typename Traits = std::
char_traits<CharT>>
116 while (r.size() < max_size) {
118 if (c == Traits::eof()) {
121 }
else if (c ==
'\r') {
128 }
else if (c ==
'\n') {
132 r += Traits::to_char_type(c);
138[[nodiscard]]
constexpr size_t count(std::string_view haystack, std::string_view needle)
noexcept
144 auto i = haystack.find(needle, pos);
145 if (i == haystack.npos) {
150 pos = i + needle.size();
159 auto i = haystack.find(needle, pos);
160 if (i == haystack.npos) {
164 haystack.replace(i, needle.size(), replace);
The HikoGUI namespace.
Definition array_generic.hpp:20
bool compare_store(T &lhs, U &&rhs) noexcept
Compare then store if there was a change.
Definition misc.hpp:53
std::basic_string< CharT, Traits > getline(std::basic_istream< CharT, Traits > &in, size_t max_size) noexcept
Get a line from an input string, upto a maximum size.
Definition misc.hpp:112
DOXYGEN BUG.
Definition algorithm_misc.hpp:20
A type that can not be constructed, copied, moved or destructed.
Definition misc.hpp:76