Skip to content

Code cleanup#33

Open
mingxwa wants to merge 2 commits intongcpp:mainfrom
mingxwa:user/mingxwa/refactor
Open

Code cleanup#33
mingxwa wants to merge 2 commits intongcpp:mainfrom
mingxwa:user/mingxwa/refactor

Conversation

@mingxwa
Copy link
Copy Markdown
Collaborator

@mingxwa mingxwa commented May 3, 2026

Changes

  • Updated the wording for "pointer-like type eligible for proxy" in named requirements ProFacade: Removed clause "P is not a specialization of proxy". This does not align with the standard wording style.
  • In the value constructors / assignments of proxy, specified that they won't participate overload resolution if std::decay_t<P> is a specialization of proxy.
  • Split detail::ptr_traits into concept pointer_like and concept specialization_of.
  • Added missing requires clause in swap().
  • Removed redundant <F> from invoke().
  • Added a unit test case for proxiable eligibility.

Comment thread include/proxy/v4/proxy.h
template <class F>
struct ptr_traits<proxy<F>> : inapplicable_traits {};
template <class T>
concept pointer_like = (requires { *std::declval<T&>(); } ||
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

Is it requires(T& p) { *p; }?

Comment thread include/proxy/v4/proxy.h
Comment on lines +638 to +639
template <class T>
concept pointer_like = (requires { *std::declval<T&>(); } ||
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

Q: does it work for void*?

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

It looks like pointer_like<std::shared_ptr<void>> yields true but pointer_like<void*> is false.

Comment thread include/proxy/v4/proxy.h
template <template <class...> class TT, class... Args>
struct specialization_traits<TT<Args...>, TT> : applicable_traits {};
template <class T, template <class...> class TT>
concept specialization_of = specialization_traits<T, TT>::applicable;
Copy link
Copy Markdown
Collaborator

@tian-lt-personal tian-lt-personal May 7, 2026

Choose a reason for hiding this comment

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

specialization_of<std::vector<int>, std::vector> is true,
specialization_of<const std::vector<int>, std::vector> is false.
Is this by-design?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants