@@ -26,9 +26,8 @@ namespace daw::json_to_cpp::types::impl {
26
26
inline constexpr size_t ti_kv_pos = 7 ;
27
27
28
28
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>;
32
31
33
32
template <typename ... Ts>
34
33
struct pack_list {};
@@ -37,8 +36,7 @@ namespace daw::json_to_cpp::types::impl {
37
36
auto var_to_pack_impl ( Variant<Args...> ) -> pack_list<Args...>;
38
37
39
38
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>( ) ) );
42
40
43
41
template <typename ... Args0, typename ... Args1>
44
42
constexpr bool are_same ( pack_list<Args0...>, pack_list<Args1...> ) noexcept {
@@ -49,15 +47,21 @@ namespace daw::json_to_cpp::types::impl {
49
47
return ( std::is_same_v<Args0, Args1> and ... );
50
48
}
51
49
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 ) {
54
52
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;
56
58
}
57
59
if ( parent_name.empty ( ) ) {
58
- return name;
60
+ return static_cast <std::string>( name ) ;
59
61
}
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 ) );
61
65
return result;
62
66
}
63
67
} // namespace daw::json_to_cpp::types::impl
0 commit comments