Skip to content

Commit

Permalink
⬆️ Update dependent fmt version to 10.0.0
Browse files Browse the repository at this point in the history
  • Loading branch information
yosh-matsuda committed Jun 15, 2023
1 parent 0fa16e7 commit 20256ff
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 10 deletions.
4 changes: 2 additions & 2 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
cmake_minimum_required(VERSION 3.16)
project(cpp_yyjson VERSION 0.0.1 LANGUAGES CXX)
project(cpp_yyjson VERSION 0.2.0 LANGUAGES CXX)

# check if the project is top-level
if(CMAKE_PROJECT_NAME STREQUAL PROJECT_NAME)
Expand Down Expand Up @@ -36,7 +36,7 @@ endif()
# dependencies
find_package(yyjson CONFIG REQUIRED)
target_link_libraries(${PROJECT_NAME} INTERFACE yyjson::yyjson)
find_package(fmt CONFIG REQUIRED)
find_package(fmt 10.0.0 CONFIG REQUIRED)
target_link_libraries(${PROJECT_NAME} INTERFACE fmt::fmt-header-only)
find_package(nameof CONFIG REQUIRED)
target_link_libraries(${PROJECT_NAME} INTERFACE nameof::nameof)
Expand Down
2 changes: 1 addition & 1 deletion cmake/cpp_yyjsonConfig.cmake.in
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ set(CPPYYJSON_VERSION @PROJECT_VERSION@)

include(CMakeFindDependencyMacro)
find_dependency(yyjson CONFIG REQUIRED)
find_dependency(fmt CONFIG REQUIRED)
find_dependency(fmt 10.0.0 CONFIG REQUIRED)
find_dependency(nameof CONFIG REQUIRED)

include("${CMAKE_CURRENT_LIST_DIR}/@PROJECT_NAME@Targets.cmake")
Expand Down
14 changes: 7 additions & 7 deletions include/cpp_yyjson.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -3913,25 +3913,25 @@ namespace yyjson
};
} // namespace yyjson

template <typename T> // clang-format off
template <typename T>
requires requires(const T& t) {
// clang-format off
{t.write()} -> std::same_as<yyjson::json_string>;
// clang-format on
}
class fmt::formatter<T> // clang-format on
struct fmt::formatter<T>
{
public:
constexpr auto parse(format_parse_context& ctx) const -> decltype(ctx.begin())
constexpr auto parse(fmt::format_parse_context& ctx) -> fmt::format_parse_context::iterator
{
const auto i = ctx.begin();
if (i != ctx.end() && *i != '}')
{
throw format_error("invalid format");
throw fmt::format_error("invalid format");
}
return i;
}

template <typename FmtContext>
auto format(const T& t, FmtContext& ctx) const -> decltype(ctx.out())
auto format(const T& t, fmt::format_context& ctx) const -> fmt::format_context::iterator
{
return fmt::format_to(ctx.out(), "{}", t.write());
}
Expand Down

0 comments on commit 20256ff

Please sign in to comment.