From cdd799cd235b80ed50c95a353b480de9ddab6698 Mon Sep 17 00:00:00 2001 From: konard Date: Fri, 12 Sep 2025 21:50:35 +0300 Subject: [PATCH 1/3] Initial commit with task details for issue #117 Adding CLAUDE.md with task information for AI processing. This file will be removed when the task is complete. Issue: https://github.com/linksplatform/Data/issues/117 --- CLAUDE.md | 5 +++++ 1 file changed, 5 insertions(+) create mode 100644 CLAUDE.md diff --git a/CLAUDE.md b/CLAUDE.md new file mode 100644 index 0000000..2a6923b --- /dev/null +++ b/CLAUDE.md @@ -0,0 +1,5 @@ +Issue to solve: https://github.com/linksplatform/Data/issues/117 +Your prepared branch: issue-117-92dd4450 +Your prepared working directory: /tmp/gh-issue-solver-1757703029040 + +Proceed. \ No newline at end of file From d8e114e9f15118b1fa3d8b7468e016a7ed8a14ba Mon Sep 17 00:00:00 2001 From: konard Date: Fri, 12 Sep 2025 21:57:58 +0300 Subject: [PATCH 2/3] Refactor LinksConstants to use template type parameters instead of non-type template parameters MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit - Changed LinksOptions template parameter from `LinksConstants VConstants` to `typename TLinksConstants` - Updated LinksConstantsExtensions functions to use template type parameters - Added LinkAddressType alias to LinksConstants struct for better type support - Updated ILinks to properly handle new LinksConstantsType - Updated test files to use new template pattern This change allows passing LinksConstants as a type (`typename TLinksConstants`) instead of as an instance/value, providing better flexibility and type safety. 🤖 Generated with [Claude Code](https://claude.ai/code) Co-Authored-By: Claude --- cpp/Platform.Data.Tests/ILinksTests.cpp | 6 +++--- cpp/Platform.Data/ILinks.h | 3 ++- cpp/Platform.Data/LinksConstants.h | 1 + cpp/Platform.Data/LinksConstantsExtensions.h | 20 +++++++++++--------- cpp/Platform.Data/LinksOptions.h | 5 +++-- 5 files changed, 20 insertions(+), 15 deletions(-) diff --git a/cpp/Platform.Data.Tests/ILinksTests.cpp b/cpp/Platform.Data.Tests/ILinksTests.cpp index 99159b5..78199e9 100644 --- a/cpp/Platform.Data.Tests/ILinksTests.cpp +++ b/cpp/Platform.Data.Tests/ILinksTests.cpp @@ -1,9 +1,9 @@ namespace Platform::Data::Tests { - template VConstants = LinksConstants{true}, typename TLink = std::vector, typename TReadHandler = std::function, typename TWriteHandler = std::function> - struct Links : public ILinks> + template, typename TLink = std::vector, typename TReadHandler = std::function, typename TWriteHandler = std::function> + struct Links : public ILinks> { - using base = ILinks>; + using base = ILinks>; using typename base::LinkAddressType; using typename base::LinkType; using typename base::WriteHandlerType; diff --git a/cpp/Platform.Data/ILinks.h b/cpp/Platform.Data/ILinks.h index d16cf01..5b70f30 100644 --- a/cpp/Platform.Data/ILinks.h +++ b/cpp/Platform.Data/ILinks.h @@ -7,7 +7,8 @@ public: using LinksOptionsType = TLinksOptions; using LinkAddressType = typename LinksOptionsType::LinkAddressType; - static constexpr LinksConstants Constants = LinksOptionsType::Constants; + using LinksConstantsType = typename LinksOptionsType::LinksConstantsType; + static constexpr LinksConstantsType Constants = LinksOptionsType::Constants; using LinkType = typename LinksOptionsType::LinkType; using ReadHandlerType = typename LinksOptionsType::ReadHandlerType; using WriteHandlerType = typename LinksOptionsType::WriteHandlerType; diff --git a/cpp/Platform.Data/LinksConstants.h b/cpp/Platform.Data/LinksConstants.h index e55b4ed..92cc098 100644 --- a/cpp/Platform.Data/LinksConstants.h +++ b/cpp/Platform.Data/LinksConstants.h @@ -3,6 +3,7 @@ template struct LinksConstants { + using LinkAddressType = TLinkAddress; static constexpr int DefaultTargetPart = 2; public: const TLinkAddress IndexPart{}; diff --git a/cpp/Platform.Data/LinksConstantsExtensions.h b/cpp/Platform.Data/LinksConstantsExtensions.h index 630a17a..3225670 100644 --- a/cpp/Platform.Data/LinksConstantsExtensions.h +++ b/cpp/Platform.Data/LinksConstantsExtensions.h @@ -1,21 +1,23 @@ namespace Platform::Data { - template VLinksConstants> - static bool IsInternalReference(TLinkAddress linkAddress) noexcept + template + static bool IsInternalReference(typename TLinksConstants::LinkAddressType linkAddress) noexcept { - return VLinksConstants.InternalReferencesRange.Contains(linkAddress); + static constexpr TLinksConstants constants{true}; + return constants.InternalReferencesRange.Contains(linkAddress); } - template VLinksConstants> - static bool IsReference(TLinkAddress linkAddress) noexcept + template + static bool IsReference(typename TLinksConstants::LinkAddressType linkAddress) noexcept { - return IsInternalReference(VLinksConstants, linkAddress) || IsExternalReference(VLinksConstants, linkAddress); + return IsInternalReference(linkAddress) || IsExternalReference(linkAddress); } - template VLinksConstants> - static bool IsExternalReference(TLinkAddress linkAddress) noexcept + template + static bool IsExternalReference(typename TLinksConstants::LinkAddressType linkAddress) noexcept { - auto&& range = VLinksConstants.ExternalReferencesRange; + static constexpr TLinksConstants constants{true}; + auto&& range = constants.ExternalReferencesRange; return range.Contains(linkAddress); } } diff --git a/cpp/Platform.Data/LinksOptions.h b/cpp/Platform.Data/LinksOptions.h index c33f8ad..264e839 100644 --- a/cpp/Platform.Data/LinksOptions.h +++ b/cpp/Platform.Data/LinksOptions.h @@ -1,14 +1,15 @@ namespace Platform::Data { - template VConstants = LinksConstants{true}, typename TLink = std::vector, typename TReadHandler = std::function, typename TWriteHandler = std::function> + template, typename TLink = std::vector, typename TReadHandler = std::function, typename TWriteHandler = std::function> struct LinksOptions { using LinkAddressType = TLinkAddress; using LinkType = TLink; using ReadHandlerType = TReadHandler; using WriteHandlerType = TWriteHandler; - static constexpr LinksConstants Constants = VConstants; + using LinksConstantsType = TLinksConstants; + static constexpr TLinksConstants Constants{true}; }; // template From 277c6bfd1191bea2c4e53f843da24b632c591eb9 Mon Sep 17 00:00:00 2001 From: konard Date: Fri, 12 Sep 2025 21:59:04 +0300 Subject: [PATCH 3/3] Remove CLAUDE.md - Claude command completed --- CLAUDE.md | 5 ----- 1 file changed, 5 deletions(-) delete mode 100644 CLAUDE.md diff --git a/CLAUDE.md b/CLAUDE.md deleted file mode 100644 index 2a6923b..0000000 --- a/CLAUDE.md +++ /dev/null @@ -1,5 +0,0 @@ -Issue to solve: https://github.com/linksplatform/Data/issues/117 -Your prepared branch: issue-117-92dd4450 -Your prepared working directory: /tmp/gh-issue-solver-1757703029040 - -Proceed. \ No newline at end of file