@@ -26,9 +26,8 @@ namespace daw::json_to_cpp::types::impl {
2626 inline constexpr size_t ti_kv_pos = 7 ;
2727
2828 template <typename Variant, typename T, size_t Pos>
29- inline constexpr bool validate_pos_value_v = std::is_same_v<
30- daw::remove_cvref_t <decltype ( std::get<Pos>( std::declval<Variant>( ) ) )>,
31- T>;
29+ inline constexpr bool validate_pos_value_v =
30+ std::is_same_v<daw::remove_cvref_t <decltype ( std::get<Pos>( std::declval<Variant>( ) ) )>, T>;
3231
3332 template <typename ... Ts>
3433 struct pack_list {};
@@ -37,8 +36,7 @@ namespace daw::json_to_cpp::types::impl {
3736 auto var_to_pack_impl ( Variant<Args...> ) -> pack_list<Args...>;
3837
3938 template <typename Variant>
40- using var_to_pack_t =
41- decltype ( var_to_pack_impl( std::declval<Variant>( ) ) );
39+ using var_to_pack_t = decltype ( var_to_pack_impl( std::declval<Variant>( ) ) );
4240
4341 template <typename ... Args0, typename ... Args1>
4442 constexpr bool are_same ( pack_list<Args0...>, pack_list<Args1...> ) noexcept {
@@ -49,15 +47,21 @@ namespace daw::json_to_cpp::types::impl {
4947 return ( std::is_same_v<Args0, Args1> and ... );
5048 }
5149
52- inline std::string format_member_name ( daw::string_view name, bool use_cpp20,
53- daw::string_view parent_name ) {
50+ inline std::string
51+ format_member_name ( daw::string_view name, bool use_cpp20, daw::string_view parent_name ) {
5452 if ( use_cpp20 ) {
55- return " \" " + name + " \" " ;
53+ std::string result = " \" " ;
54+ result.reserve ( name.size ( ) + 2 );
55+ result.append ( std::data ( name ), daw::data_end ( name ) );
56+ result += " \" " ;
57+ return result;
5658 }
5759 if ( parent_name.empty ( ) ) {
58- return name;
60+ return static_cast <std::string>( name ) ;
5961 }
60- std::string result = " mem_" + name;
62+ std::string result = " mem_" ;
63+ result.reserve ( name.size ( ) + 4 );
64+ result.append ( std::data ( name ), daw::data_end ( name ) );
6165 return result;
6266 }
6367} // namespace daw::json_to_cpp::types::impl
0 commit comments