Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix new clang -Wdeprecated-literal-operator (no whitespace between ""… #159

Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
18 changes: 9 additions & 9 deletions include/tao/json/binary.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -19,9 +19,9 @@ namespace tao::json
{
namespace internal
{
[[nodiscard]] constexpr char unhex_char( const char c ) noexcept
[[nodiscard]] constexpr char unhex_char(const char c) noexcept
{
return static_cast< char >( ( c < 'A' ) ? ( c - '0' ) : ( ( c < 'a' ) ? ( c - 'A' + 10 ) : ( c - 'a' + 10 ) ) );
return static_cast<char>((c < 'A') ? (c - '0') : ((c < 'a') ? (c - 'A' + 10) : (c - 'a' + 10)));
}

template< typename V, V... >
Expand All @@ -43,7 +43,7 @@ namespace tao::json
struct unhex_helper< T, vlist< V, Vs... >, C >
: unhex_helper< T, vlist< V > >
{
static_assert( internal::dependent_false< T >, "digits must occur in pairs" );
static_assert(internal::dependent_false< T >, "digits must occur in pairs");
};

template< typename T, typename V, V... Vs, char C1, char... Cs >
Expand All @@ -56,27 +56,27 @@ namespace tao::json
struct unhex_helper< T, vlist< V, Vs... >, C0, '\'', Cs... >
: unhex_helper< T, vlist< V > >
{
static_assert( internal::dependent_false< T >, "digit separator only allowed between pairs of digits" );
static_assert(internal::dependent_false< T >, "digit separator only allowed between pairs of digits");
};

template< typename T, typename V, V... Vs, char C0, char C1, char... Cs >
struct unhex_helper< T, vlist< V, Vs... >, C0, C1, Cs... >
: unhex_helper< T, vlist< V, Vs..., V( ( unhex_char( C0 ) << 4 ) + unhex_char( C1 ) ) >, Cs... >
: unhex_helper< T, vlist< V, Vs..., V((unhex_char(C0) << 4) + unhex_char(C1)) >, Cs... >
{
};

template< typename T, typename V, char C >
[[nodiscard]] constexpr T unhex()
{
static_assert( internal::dependent_false< T >, "not a hex literal" );
static_assert(internal::dependent_false< T >, "not a hex literal");
return T{};
}

template< typename T, typename V, char C0, char C1, char... Cs >
[[nodiscard]] constexpr T unhex()
{
static_assert( C0 == '0', "not a hex literal" );
static_assert( C1 == 'x' || C1 == 'X', "not a hex literal" );
static_assert(C0 == '0', "not a hex literal");
static_assert(C1 == 'x' || C1 == 'X', "not a hex literal");
return unhex_helper< T, vlist< V >, Cs... >::unhex();
}

Expand All @@ -91,7 +91,7 @@ namespace tao::json
inline namespace literals
{
template< char... Cs >
[[nodiscard]] std::vector< std::byte > operator"" _binary()
[[nodiscard]] std::vector< std::byte > operator""_binary()
{
return internal::unhex< std::vector< std::byte >, Cs... >();
}
Expand Down
14 changes: 7 additions & 7 deletions include/tao/json/from_string.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -14,24 +14,24 @@
namespace tao::json
{
template< template< typename... > class Traits, template< typename... > class... Transformers, typename... Ts >
[[nodiscard]] basic_value< Traits > basic_from_string( Ts&&... ts )
[[nodiscard]] basic_value< Traits > basic_from_string(Ts&&... ts)
{
events::transformer< events::to_basic_value< Traits >, Transformers... > consumer;
events::from_string( consumer, std::forward< Ts >( ts )... );
return std::move( consumer.value );
events::from_string(consumer, std::forward< Ts >(ts)...);
return std::move(consumer.value);
}

template< template< typename... > class... Transformers, typename... Ts >
[[nodiscard]] value from_string( Ts&&... ts )
[[nodiscard]] value from_string(Ts&&... ts)
{
return basic_from_string< traits, Transformers... >( std::forward< Ts >( ts )... );
return basic_from_string< traits, Transformers... >(std::forward< Ts >(ts)...);
}

inline namespace literals
{
[[nodiscard]] inline value operator"" _json( const char* data, const std::size_t size )
[[nodiscard]] inline value operator""_json(const char* data, const std::size_t size)
{
return json::from_string( data, size, "literal" );
return json::from_string(data, size, "literal");
}

} // namespace literals
Expand Down
14 changes: 7 additions & 7 deletions include/tao/json/jaxn/from_string.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -15,24 +15,24 @@
namespace tao::json::jaxn
{
template< template< typename... > class Traits, template< typename... > class... Transformers, typename... Ts >
[[nodiscard]] basic_value< Traits > basic_from_string( Ts&&... ts )
[[nodiscard]] basic_value< Traits > basic_from_string(Ts&&... ts)
{
json::events::transformer< json::events::to_basic_value< Traits >, Transformers... > consumer;
events::from_string( consumer, std::forward< Ts >( ts )... );
return std::move( consumer.value );
events::from_string(consumer, std::forward< Ts >(ts)...);
return std::move(consumer.value);
}

template< template< typename... > class... Transformers, typename... Ts >
[[nodiscard]] value from_string( Ts&&... ts )
[[nodiscard]] value from_string(Ts&&... ts)
{
return basic_from_string< traits, Transformers... >( std::forward< Ts >( ts )... );
return basic_from_string< traits, Transformers... >(std::forward< Ts >(ts)...);
}

inline namespace literals
{
[[nodiscard]] inline value operator"" _jaxn( const char* data, const std::size_t size )
[[nodiscard]] inline value operator""_jaxn(const char* data, const std::size_t size)
{
return jaxn::from_string( data, size, "literal" );
return jaxn::from_string(data, size, "literal");
}

} // namespace literals
Expand Down
Loading
Loading