Skip to content

Commit 42d506e

Browse files
committed
Replaced all C-style casts in access.hpp
1 parent 01d3b7a commit 42d506e

File tree

1 file changed

+6
-6
lines changed

1 file changed

+6
-6
lines changed

cppcodec/data/access.hpp

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -188,14 +188,14 @@ class direct_data_access_result_state
188188
// Have it here in the factory function instead.
189189
template <typename Result,
190190
typename = typename std::enable_if<
191-
data_is_mutable((Result*)nullptr)>::type>
191+
data_is_mutable(static_cast<Result*>(nullptr))>::type>
192192
CPPCODEC_ALWAYS_INLINE direct_data_access_result_state<Result> create_state(Result&, specific_t)
193193
{
194194
return direct_data_access_result_state<Result>();
195195
}
196196

197197
static_assert(std::is_same<
198-
decltype(create_state(*(std::vector<uint8_t>*)nullptr, specific_t())),
198+
decltype(create_state(*static_cast<std::vector<uint8_t>*>(nullptr), specific_t())),
199199
direct_data_access_result_state<std::vector<uint8_t>>>::value,
200200
"std::vector<uint8_t> must be handled by direct_data_access_result_state");
201201

@@ -269,21 +269,21 @@ class array_access_result_state
269269
// Have it here in the factory function instead.
270270
template <typename Result,
271271
typename = typename std::enable_if<
272-
!data_is_mutable((Result*)nullptr) // no more than one template option
273-
&& array_access_is_mutable((Result*)nullptr)>::type>
272+
!data_is_mutable(static_cast<Result*>(nullptr)) // no more than one template option
273+
&& array_access_is_mutable(static_cast<Result*>(nullptr))>::type>
274274
CPPCODEC_ALWAYS_INLINE array_access_result_state<Result> create_state(Result&, specific_t)
275275
{
276276
return array_access_result_state<Result>();
277277
}
278278

279279
#if __cplusplus >= 201703L || (defined(_MSVC_LANG) && _MSVC_LANG > 201703L)
280280
static_assert(std::is_same<
281-
decltype(create_state(*(std::string*)nullptr, specific_t())),
281+
decltype(create_state(*static_cast<std::string*>(nullptr), specific_t())),
282282
direct_data_access_result_state<std::string>>::value,
283283
"std::string (C++17 and later) must be handled by direct_data_access_result_state");
284284
#elif __cplusplus < 201703 && !defined(_MSVC_LANG) // we can't trust MSVC to set this right
285285
static_assert(std::is_same<
286-
decltype(create_state(*(std::string*)nullptr, specific_t())),
286+
decltype(create_state(*static_cast<std::string*>(nullptr), specific_t())),
287287
array_access_result_state<std::string>>::value,
288288
"std::string (pre-C++17) must be handled by array_access_result_state");
289289
#endif

0 commit comments

Comments
 (0)