Skip to content

Commit 78a603a

Browse files
committed
Updated to reflect changes in header_libraries
1 parent 54b83b2 commit 78a603a

File tree

5 files changed

+113
-131
lines changed

5 files changed

+113
-131
lines changed

CMakeLists.txt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@
88
cmake_minimum_required(VERSION 3.13)
99

1010
project("json_to_cpp"
11-
VERSION "2.1.0"
11+
VERSION "2.1.1"
1212
DESCRIPTION "Try to use the JSON structures to make C++ structures and bindings"
1313
HOMEPAGE_URL "https://github.com/beached/json_to_cpp"
1414
LANGUAGES C CXX)

extern/CMakeLists.txt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ include(FetchContent)
1717
FetchContent_Declare(
1818
daw_parse_json
1919
GIT_REPOSITORY https://github.com/beached/parse_json.git
20-
GIT_TAG v1.1.0
20+
GIT_TAG v1.1.1
2121
)
2222

2323
FetchContent_Declare(

include/types/ti_base.h

Lines changed: 14 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -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

Comments
 (0)