Skip to content

Commit 2a5ccf3

Browse files
committed
Remove redundant inline specifier from constexpr functions
For functions, constexpr implies inline.
1 parent 867585c commit 2a5ccf3

File tree

8 files changed

+35
-35
lines changed

8 files changed

+35
-35
lines changed

fly/traits/traits.hpp

+3-3
Original file line numberDiff line numberDiff line change
@@ -82,7 +82,7 @@ struct all_same :
8282

8383
template <typename T, typename A, typename... As>
8484
// NOLINTNEXTLINE(readability-identifier-naming)
85-
inline constexpr bool all_same_v = all_same<T, A, As...>::value;
85+
constexpr inline bool all_same_v = all_same<T, A, As...>::value;
8686

8787
/**
8888
* Wrapper around std::is_same for testing that any type in a sequence of types are the same as a
@@ -104,7 +104,7 @@ struct any_same :
104104

105105
template <typename T, typename A, typename... As>
106106
// NOLINTNEXTLINE(readability-identifier-naming)
107-
inline constexpr bool any_same_v = any_same<T, A, As...>::value;
107+
constexpr inline bool any_same_v = any_same<T, A, As...>::value;
108108

109109
/**
110110
* Trait for testing if the size of a given type is the provided size.
@@ -114,7 +114,7 @@ using size_of_type_is = std::bool_constant<sizeof(T) == Size>;
114114

115115
template <typename T, std::size_t Size>
116116
// NOLINTNEXTLINE(readability-identifier-naming)
117-
inline constexpr bool size_of_type_is_v = size_of_type_is<T, Size>::value;
117+
constexpr inline bool size_of_type_is_v = size_of_type_is<T, Size>::value;
118118

119119
/**
120120
* Overloaded visitation pattern for std::visit. Allows providing a variadic list of lambdas for

fly/types/numeric/endian.hpp

+5-5
Original file line numberDiff line numberDiff line change
@@ -30,14 +30,14 @@
3030
// Windows has _byteswap_ushort, _byteswap_ulong, and _byteswap_uint64, but they are non-constexpr.
3131
// So to allow endian swapping to be used at compile time, use custom byte swapping methods.
3232

33-
constexpr inline std::uint16_t byte_swap_16(std::uint16_t value)
33+
constexpr std::uint16_t byte_swap_16(std::uint16_t value)
3434
{
3535
using namespace fly::literals::numeric_literals;
3636

3737
return ((value & 0xff00_u16) >> 8) | ((value & 0x00ff_u16) << 8);
3838
}
3939

40-
constexpr inline std::uint32_t byte_swap_32(std::uint32_t value)
40+
constexpr std::uint32_t byte_swap_32(std::uint32_t value)
4141
{
4242
using namespace fly::literals::numeric_literals;
4343

@@ -46,7 +46,7 @@ constexpr inline std::uint32_t byte_swap_32(std::uint32_t value)
4646
((value & 0x0000'ff00_u32) << 8) | ((value & 0x0000'00ff_u32) << 24));
4747
}
4848

49-
constexpr inline std::uint64_t byte_swap_64(std::uint64_t value)
49+
constexpr std::uint64_t byte_swap_64(std::uint64_t value)
5050
{
5151
using namespace fly::literals::numeric_literals;
5252

@@ -73,7 +73,7 @@ namespace fly {
7373
* @return The swapped value.
7474
*/
7575
template <typename T>
76-
constexpr inline T endian_swap(T value)
76+
constexpr T endian_swap(T value)
7777
{
7878
static_assert(
7979
detail::EndianTraits::is_supported_integer_v<T>,
@@ -109,7 +109,7 @@ constexpr inline T endian_swap(T value)
109109
* @return The swapped value.
110110
*/
111111
template <std::endian Endianness, typename T>
112-
constexpr inline T endian_swap_if_non_native(T value)
112+
constexpr T endian_swap_if_non_native(T value)
113113
{
114114
if constexpr (Endianness == std::endian::native)
115115
{

fly/types/string/detail/classifier.hpp

+11-11
Original file line numberDiff line numberDiff line change
@@ -188,7 +188,7 @@ class BasicClassifier
188188
//==================================================================================================
189189
template <typename CharType>
190190
template <StringLike T>
191-
constexpr inline auto BasicClassifier<CharType>::size(T &&value) -> size_type
191+
constexpr auto BasicClassifier<CharType>::size(T &&value) -> size_type
192192
{
193193
using U = std::remove_cvref_t<T>;
194194

@@ -205,36 +205,36 @@ constexpr inline auto BasicClassifier<CharType>::size(T &&value) -> size_type
205205
//==================================================================================================
206206
template <typename CharType>
207207
template <std::size_t N>
208-
constexpr inline auto BasicClassifier<CharType>::size(const CharType (&value)[N]) -> size_type
208+
constexpr auto BasicClassifier<CharType>::size(const CharType (&value)[N]) -> size_type
209209
{
210210
static_assert(N > 0, "Character arrays must have non-zero size");
211211
return N - ((value[N - 1] == s_null_terminator) ? 1 : 0);
212212
}
213213

214214
//==================================================================================================
215215
template <typename CharType>
216-
constexpr inline bool BasicClassifier<CharType>::is_alpha(CharType ch)
216+
constexpr bool BasicClassifier<CharType>::is_alpha(CharType ch)
217217
{
218218
return is_upper(unify_az_characters(ch));
219219
}
220220

221221
//==================================================================================================
222222
template <typename CharType>
223-
constexpr inline bool BasicClassifier<CharType>::is_upper(CharType ch)
223+
constexpr bool BasicClassifier<CharType>::is_upper(CharType ch)
224224
{
225225
return (ch >= s_upper_a) && (ch <= s_upper_z);
226226
}
227227

228228
//==================================================================================================
229229
template <typename CharType>
230-
constexpr inline bool BasicClassifier<CharType>::is_lower(CharType ch)
230+
constexpr bool BasicClassifier<CharType>::is_lower(CharType ch)
231231
{
232232
return (ch >= s_lower_a) && (ch <= s_lower_z);
233233
}
234234

235235
//==================================================================================================
236236
template <typename CharType>
237-
constexpr inline CharType BasicClassifier<CharType>::to_upper(CharType ch)
237+
constexpr CharType BasicClassifier<CharType>::to_upper(CharType ch)
238238
{
239239
if (is_lower(ch))
240240
{
@@ -246,7 +246,7 @@ constexpr inline CharType BasicClassifier<CharType>::to_upper(CharType ch)
246246

247247
//==================================================================================================
248248
template <typename CharType>
249-
constexpr inline CharType BasicClassifier<CharType>::to_lower(CharType ch)
249+
constexpr CharType BasicClassifier<CharType>::to_lower(CharType ch)
250250
{
251251
if (is_upper(ch))
252252
{
@@ -258,30 +258,30 @@ constexpr inline CharType BasicClassifier<CharType>::to_lower(CharType ch)
258258

259259
//==================================================================================================
260260
template <typename CharType>
261-
constexpr inline bool BasicClassifier<CharType>::is_digit(CharType ch)
261+
constexpr bool BasicClassifier<CharType>::is_digit(CharType ch)
262262
{
263263
return (ch ^ s_zero) < 10;
264264
}
265265

266266
//==================================================================================================
267267
template <typename CharType>
268-
constexpr inline bool BasicClassifier<CharType>::is_x_digit(CharType ch)
268+
constexpr bool BasicClassifier<CharType>::is_x_digit(CharType ch)
269269
{
270270
const auto alpha = unify_az_characters(ch);
271271
return is_digit(ch) || ((alpha >= s_upper_a) && (alpha <= s_upper_f));
272272
}
273273

274274
//==================================================================================================
275275
template <typename CharType>
276-
constexpr inline bool BasicClassifier<CharType>::is_space(CharType ch)
276+
constexpr bool BasicClassifier<CharType>::is_space(CharType ch)
277277
{
278278
return (ch == s_space) || (ch == s_form_feed) || (ch == s_line_feed) ||
279279
(ch == s_carriage_return) || (ch == s_horizontal_tab) || (ch == s_vertical_tab);
280280
}
281281

282282
//==================================================================================================
283283
template <typename CharType>
284-
constexpr inline CharType BasicClassifier<CharType>::unify_az_characters(CharType ch)
284+
constexpr CharType BasicClassifier<CharType>::unify_az_characters(CharType ch)
285285
{
286286
return static_cast<CharType>(static_cast<int_type>(ch) & s_case_mask);
287287
}

fly/types/string/detail/format_context.hpp

+1-1
Original file line numberDiff line numberDiff line change
@@ -65,7 +65,7 @@ class BasicFormatContext
6565
//==================================================================================================
6666
template <typename OutputIterator, typename CharType>
6767
template <typename... Parameters>
68-
constexpr inline BasicFormatContext<OutputIterator, CharType>::BasicFormatContext(
68+
constexpr BasicFormatContext<OutputIterator, CharType>::BasicFormatContext(
6969
OutputIterator out,
7070
const BasicFormatParameters<BasicFormatContext, Parameters...> &parameters) noexcept :
7171
m_out(std::move(out)),

fly/types/string/detail/format_parse_context.hpp

+1-1
Original file line numberDiff line numberDiff line change
@@ -168,7 +168,7 @@ BasicFormatParseContext<CharType>::parameter_type(std::size_t position)
168168

169169
//==================================================================================================
170170
template <typename CharType>
171-
constexpr inline fly::BasicLexer<CharType> &BasicFormatParseContext<CharType>::lexer()
171+
constexpr fly::BasicLexer<CharType> &BasicFormatParseContext<CharType>::lexer()
172172
{
173173
return m_lexer;
174174
}

fly/types/string/detail/string_traits.hpp

+3-3
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ using is_supported_string =
1717

1818
template <typename StringType>
1919
// NOLINTNEXTLINE(readability-identifier-naming)
20-
inline constexpr bool is_supported_string_v = is_supported_string<StringType>::value;
20+
constexpr inline bool is_supported_string_v = is_supported_string<StringType>::value;
2121

2222
/**
2323
* Define a trait for testing if CharType is a supported std::basic_string specialization's
@@ -28,7 +28,7 @@ using is_supported_character = any_same<CharType, char, wchar_t, char8_t, char16
2828

2929
template <typename CharType>
3030
// NOLINTNEXTLINE(readability-identifier-naming)
31-
inline constexpr bool is_supported_character_v = is_supported_character<CharType>::value;
31+
constexpr inline bool is_supported_character_v = is_supported_character<CharType>::value;
3232

3333
/**
3434
* Define a trait for testing if StringType is like a supported std::basic_string specialization. A
@@ -78,7 +78,7 @@ using is_like_supported_string_t = typename is_like_supported_string<StringType>
7878

7979
template <typename StringType>
8080
// NOLINTNEXTLINE(readability-identifier-naming)
81-
inline constexpr bool is_like_supported_string_v = is_like_supported_string<StringType>::value;
81+
constexpr inline bool is_like_supported_string_v = is_like_supported_string<StringType>::value;
8282

8383
/**
8484
* Traits for basic properties of standard std::basic_string specializations.

fly/types/string/string.hpp

+9-9
Original file line numberDiff line numberDiff line change
@@ -578,63 +578,63 @@ class BasicString
578578
//==================================================================================================
579579
template <typename CharType>
580580
template <detail::StringLike T>
581-
constexpr inline auto BasicString<CharType>::size(T &&value) -> size_type
581+
constexpr auto BasicString<CharType>::size(T &&value) -> size_type
582582
{
583583
return detail::BasicClassifier<char_type>::size(std::forward<T>(value));
584584
}
585585

586586
//==================================================================================================
587587
template <typename CharType>
588-
constexpr inline bool BasicString<CharType>::is_alpha(char_type ch)
588+
constexpr bool BasicString<CharType>::is_alpha(char_type ch)
589589
{
590590
return detail::BasicClassifier<char_type>::is_alpha(ch);
591591
}
592592

593593
//==================================================================================================
594594
template <typename CharType>
595-
constexpr inline bool BasicString<CharType>::is_upper(char_type ch)
595+
constexpr bool BasicString<CharType>::is_upper(char_type ch)
596596
{
597597
return detail::BasicClassifier<char_type>::is_upper(ch);
598598
}
599599

600600
//==================================================================================================
601601
template <typename CharType>
602-
constexpr inline bool BasicString<CharType>::is_lower(char_type ch)
602+
constexpr bool BasicString<CharType>::is_lower(char_type ch)
603603
{
604604
return detail::BasicClassifier<char_type>::is_lower(ch);
605605
}
606606

607607
//==================================================================================================
608608
template <typename CharType>
609-
constexpr inline bool BasicString<CharType>::is_digit(char_type ch)
609+
constexpr bool BasicString<CharType>::is_digit(char_type ch)
610610
{
611611
return detail::BasicClassifier<char_type>::is_digit(ch);
612612
}
613613

614614
//==================================================================================================
615615
template <typename CharType>
616-
constexpr inline auto BasicString<CharType>::to_upper(char_type ch) -> char_type
616+
constexpr auto BasicString<CharType>::to_upper(char_type ch) -> char_type
617617
{
618618
return detail::BasicClassifier<char_type>::to_upper(ch);
619619
}
620620

621621
//==================================================================================================
622622
template <typename CharType>
623-
constexpr inline auto BasicString<CharType>::to_lower(char_type ch) -> char_type
623+
constexpr auto BasicString<CharType>::to_lower(char_type ch) -> char_type
624624
{
625625
return detail::BasicClassifier<char_type>::to_lower(ch);
626626
}
627627

628628
//==================================================================================================
629629
template <typename CharType>
630-
constexpr inline bool BasicString<CharType>::is_x_digit(char_type ch)
630+
constexpr bool BasicString<CharType>::is_x_digit(char_type ch)
631631
{
632632
return detail::BasicClassifier<char_type>::is_x_digit(ch);
633633
}
634634

635635
//==================================================================================================
636636
template <typename CharType>
637-
constexpr inline bool BasicString<CharType>::is_space(char_type ch)
637+
constexpr bool BasicString<CharType>::is_space(char_type ch)
638638
{
639639
return detail::BasicClassifier<char_type>::is_space(ch);
640640
}

test/types/json/json_helpers.hpp

+2-2
Original file line numberDiff line numberDiff line change
@@ -140,12 +140,12 @@ namespace fly::test {
140140

141141
template <typename T>
142142
// NOLINTNEXTLINE(readability-identifier-naming)
143-
inline constexpr bool is_object_or_array_or_string_v =
143+
constexpr inline bool is_object_or_array_or_string_v =
144144
fly::any_same_v<T, fly::json_string_type, fly::json_object_type, fly::json_array_type>;
145145

146146
template <typename T, typename Other>
147147
// NOLINTNEXTLINE(readability-identifier-naming)
148-
inline constexpr bool is_null_or_other_type_v = fly::any_same_v<T, fly::json_null_type, Other>;
148+
constexpr inline bool is_null_or_other_type_v = fly::any_same_v<T, fly::json_null_type, Other>;
149149

150150
template <typename T, typename StringType = fly::json_string_type>
151151
fly::Json create_json()

0 commit comments

Comments
 (0)