Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: new APIs of merge, diff and update #38

Open
wants to merge 2 commits into
base: master
Choose a base branch
from

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.

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.

None yet

2 participants