Skip to content

Conversation

@xiegx94
Copy link
Collaborator

@xiegx94 xiegx94 commented Dec 20, 2022

Main Changes

  • Implement MergePatch and Merge API following RFC 7386 API.
  • Provide UpdateFrom and Update API
  • Remove GenericNode template parameter Allocator.

using alloc_type =
typename NodeTraits<NodeType>::alloc_type; ///< Dervied class allocator
///< type.
using Allocator = alloc_type;
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

allocator 名字和 alloc_type 重复

typename std::enable_if<is_base_of_template<T, GenericNode>::value &&
is_base_of_template<P, GenericNode>::value,
bool>::type = false>
static inline void Merge(T& original, const P& patch, Allocator& alloc) {
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

可能做出 genericnode的成员函数会比较好?

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

GenericNode里提供了 MergePatch 的方法,实现了 Merge 的语义

typename std::enable_if<is_base_of_template<T, GenericNode>::value &&
is_base_of_template<S, GenericNode>::value,
bool>::type = false>
static inline void Update(T& original, const S& src, Allocator& alloc) {
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

不用模板参数,使用 inherit 命名?

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

没有必要吧,两者逻辑差不多,只有些微区别。额外添加一个函数反而维护起来很麻烦。

@xiegx94 xiegx94 changed the title feat: New APIs of merge, diff and update feat: new APIs of merge, diff and update Jan 6, 2023
@xiegx94
Copy link
Collaborator Author

xiegx94 commented Mar 8, 2023

Remove diff API.

@xiegx94 xiegx94 force-pushed the feat/merge-diff-update branch from 14ce2e2 to 6e4a0ed Compare March 8, 2023 07:59
@liuq19 liuq19 marked this pull request as draft November 18, 2024 03:00
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants