Skip to content

[C++] Add duplicated fields detection in FURY_FIELD_INFO macro#1151

Merged
chaokunyang merged 2 commits intoapache:mainfrom
PragmaTwice:field-info-check-dup
Nov 27, 2023
Merged

[C++] Add duplicated fields detection in FURY_FIELD_INFO macro#1151
chaokunyang merged 2 commits intoapache:mainfrom
PragmaTwice:field-info-check-dup

Conversation

@PragmaTwice
Copy link
Member

@PragmaTwice PragmaTwice commented Nov 27, 2023

What do these changes do?

It will prevent such code to be successfully compiled:
(previously, such code can be compiled without error, which make code error-prone.)

struct A {
  int x;
  float y;
};

FURY_FIELD_INFO(A, x, y, x); // compile error: duplicated fields in FURY_FIELD_INFO arguments are detected

Besides, we move type traits to meta/type_traits.h.

Copy link
Collaborator

@chaokunyang chaokunyang left a comment

Choose a reason for hiding this comment

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

LGTM, awsome meta programing tricks

@chaokunyang chaokunyang merged commit 9282a1c into apache:main Nov 27, 2023
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