Skip to content

Commit d439e45

Browse files
committed
Cleanup
1 parent 05cc26e commit d439e45

1 file changed

Lines changed: 8 additions & 14 deletions

File tree

string/string_helpers.hpp

Lines changed: 8 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -4,54 +4,48 @@
44
#include <string_view>
55
#include <type_traits>
66

7-
#if !defined __GNUC__ || __GNUC__ >= 12
8-
#define GCC_CONSTEXPR_WORKAROUND constexpr
9-
#else
10-
#define GCC_CONSTEXPR_WORKAROUND
11-
#endif
12-
13-
[[nodiscard]] inline GCC_CONSTEXPR_WORKAROUND bool operator==(const std::string& str, const char ch) noexcept
7+
[[nodiscard]] inline bool operator==(const std::string& str, const char ch) noexcept
148
{
159
return str.size() == 1 && str[0] == ch;
1610
}
1711

18-
[[nodiscard]] inline GCC_CONSTEXPR_WORKAROUND bool operator==(const char ch, const std::string& str) noexcept
12+
[[nodiscard]] inline bool operator==(const char ch, const std::string& str) noexcept
1913
{
2014
return str == ch;
2115
}
2216

2317
template<class CharT, class CharTraits, class Alloc>
24-
GCC_CONSTEXPR_WORKAROUND std::basic_string<CharT, CharTraits, Alloc>& operator<<(std::basic_string<CharT, CharTraits, Alloc>& str, const char* s)
18+
inline std::basic_string<CharT, CharTraits, Alloc>& operator<<(std::basic_string<CharT, CharTraits, Alloc>& str, const char* s)
2519
{
2620
return str += s;
2721
}
2822

2923
template<class CharT, class CharTraits, class Alloc>
30-
GCC_CONSTEXPR_WORKAROUND std::basic_string<CharT, CharTraits, Alloc>& operator<<(std::basic_string<CharT, CharTraits, Alloc>& str, const std::basic_string<CharT, CharTraits, Alloc>& s)
24+
inline std::basic_string<CharT, CharTraits, Alloc>& operator<<(std::basic_string<CharT, CharTraits, Alloc>& str, const std::basic_string<CharT, CharTraits, Alloc>& s)
3125
{
3226
return str += s;
3327
}
3428

3529
template <class CharT, class CharTraits, class Alloc, typename T, std::enable_if_t<std::is_integral_v<T> || std::is_floating_point_v<T>>* = nullptr>
36-
GCC_CONSTEXPR_WORKAROUND std::basic_string<CharT, CharTraits, Alloc>& operator<<(std::basic_string<CharT, CharTraits, Alloc>& str, const T value)
30+
std::basic_string<CharT, CharTraits, Alloc>& operator<<(std::basic_string<CharT, CharTraits, Alloc>& str, const T value)
3731
{
3832
return str += std::to_string(value);
3933
}
4034

4135
template <class CharT, class CharTraits, class Alloc, typename T, std::enable_if_t<std::is_integral_v<T> || std::is_floating_point_v<T>>* = nullptr>
42-
GCC_CONSTEXPR_WORKAROUND std::basic_string<CharT, CharTraits, Alloc>& operator+=(std::basic_string<CharT, CharTraits, Alloc>& str, const T value)
36+
inline std::basic_string<CharT, CharTraits, Alloc>& operator+=(std::basic_string<CharT, CharTraits, Alloc>& str, const T value)
4337
{
4438
return str << value;
4539
}
4640

4741
template <class CharT, class CharTraits, class Alloc, typename T, std::enable_if_t<std::is_integral_v<T> || std::is_floating_point_v<T>>* = nullptr>
48-
GCC_CONSTEXPR_WORKAROUND std::basic_string<CharT, CharTraits, Alloc> operator+(std::basic_string<CharT, CharTraits, Alloc> str, const T value)
42+
inline std::basic_string<CharT, CharTraits, Alloc> operator+(std::basic_string<CharT, CharTraits, Alloc> str, const T value)
4943
{
5044
return str << value;
5145
}
5246

5347
template<class CharT, class CharTraits, class Alloc>
54-
GCC_CONSTEXPR_WORKAROUND std::basic_string<CharT, CharTraits, Alloc>& operator<<(std::basic_string<CharT, CharTraits, Alloc>& str, std::string_view sv)
48+
inline std::basic_string<CharT, CharTraits, Alloc>& operator<<(std::basic_string<CharT, CharTraits, Alloc>& str, std::string_view sv)
5549
{
5650
return str += sv;
5751
}

0 commit comments

Comments
 (0)