mirror of
https://github.com/nlohmann/json.git
synced 2026-10-20 21:18:15 +00:00
Allow the string literal parameter of scan_literal() for clang-tidy
The parameter takes the literal by array reference so that its length is a template parameter; this is the same exemption the C array overloads of to_json() and from_json() have. Signed-off-by: Niels Lohmann <mail@nlohmann.me>
This commit is contained in:
2 files changed
+2
-2
No files matched your search
@@ -1862,7 +1862,7 @@ scan_number_done:
|
|||||||
@param[in] return_type the token type to return on success
|
@param[in] return_type the token type to return on success
|
||||||
*/
|
*/
|
||||||
template<std::size_t N>
|
template<std::size_t N>
|
||||||
JSON_HEDLEY_NEVER_INLINE token_type scan_literal(const char (&rest)[N], token_type return_type)
|
JSON_HEDLEY_NEVER_INLINE token_type scan_literal(const char (&rest)[N], token_type return_type) // NOLINT(cppcoreguidelines-avoid-c-arrays,hicpp-avoid-c-arrays,modernize-avoid-c-arrays)
|
||||||
{
|
{
|
||||||
constexpr std::size_t length = N - 1;
|
constexpr std::size_t length = N - 1;
|
||||||
if (scan_literal_bulk(rest, length, std::integral_constant<bool, bulk_scan> {}))
|
if (scan_literal_bulk(rest, length, std::integral_constant<bool, bulk_scan> {}))
|
||||||
|
|||||||
Generated
+1
-1
@@ -13857,7 +13857,7 @@ scan_number_done:
|
|||||||
@param[in] return_type the token type to return on success
|
@param[in] return_type the token type to return on success
|
||||||
*/
|
*/
|
||||||
template<std::size_t N>
|
template<std::size_t N>
|
||||||
JSON_HEDLEY_NEVER_INLINE token_type scan_literal(const char (&rest)[N], token_type return_type)
|
JSON_HEDLEY_NEVER_INLINE token_type scan_literal(const char (&rest)[N], token_type return_type) // NOLINT(cppcoreguidelines-avoid-c-arrays,hicpp-avoid-c-arrays,modernize-avoid-c-arrays)
|
||||||
{
|
{
|
||||||
constexpr std::size_t length = N - 1;
|
constexpr std::size_t length = N - 1;
|
||||||
if (scan_literal_bulk(rest, length, std::integral_constant<bool, bulk_scan> {}))
|
if (scan_literal_bulk(rest, length, std::integral_constant<bool, bulk_scan> {}))
|
||||||
|
|||||||
Reference in new issue
Block a user