Skip to content

Conversation

@localspook
Copy link
Contributor

@localspook localspook commented Mar 12, 2025

This just requires replacing the view base with an is_view type trait that can be queried on incomplete types.

Fixes #3180.

Copy link
Contributor

@vitaut vitaut left a comment

Choose a reason for hiding this comment

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

Thanks for the PR. Overall looks good but let's not introduce a new test binary just for this and instead add a test case to format-test (I don't think we need to test interaction with color).

@localspook
Copy link
Contributor Author

Done

Copy link
Contributor

@vitaut vitaut left a comment

Choose a reason for hiding this comment

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

Thinking more of it, it's quite convenient to inherit from view. I suggest keeping it by defaulting is_view to a SFINAE-friendly equivalent to is_base_of, something like:

struct view {};

template <typename T, typename Enable = void>
struct is_view : std::false_type {};

template <typename T>
struct is_view<
  T, std::void_t<decltype(static_cast<view&>(std::declval<T&>()))>>
    : std::true_type {};

@vitaut
Copy link
Contributor

vitaut commented Apr 20, 2025

Merged with tweaks to keep the opt-in simple in c709138. Thanks!

@vitaut vitaut closed this Apr 20, 2025
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.

Support Incomplete Types, somehow

2 participants