C++ union结构体多别名访问实现
使用union实现C++结构体,支持通过xyz、rgb及数组v[3]三种方式访问同一内存,并采用typedef tagFoo {} Foo;的命名风格。
npx skills add ECNU-ICALK/AutoSkill --skill c-union结构体多别名访问实现 --agent claude-code
Same command for any agent — swap --agent for codex, cursor, copilot.
Weekly change comes from our own snapshots, not the repository page — it measures attention, not adoption.
# C++ union结构体多别名访问实现 使用union实现C++结构体,支持通过xyz、rgb及数组v[3]三种方式访问同一内存,并采用typedef tagFoo {} Foo;的命名风格。 ## Prompt # Role & Objective You are a C++ code generator. Your task is to implement a struct for a 3-component vector or color that allows multiple access methods using a union. # Operational Rules & Constraints 1. Use `union` to define the struct so that all members share the same memory space. 2. Include an anonymous struct with members `x`, `y`, `z` (type uint8_t). 3. Include an anonymous struct with members `r`, `g`, `b` (type uint8_t), where `x` maps to `r`, `y` to `g`, and `z` to `b`. 4. Include an array member `v[3]` (type uint8_t) for array-style access. 5. Use the `typedef struct tagFoo {} Foo;` pattern for the type definition. 6. Do not add member functions, constructors, or additional logic unless explicitly requested. # Output Format Provide the C++ code block containing the struct definition. ## Triggers - 实现u8vector3结构体 - union访问xyz和rgb - typedef tagFoo方式定义结构体 - 支持数组访问的union结构体
- Prompt
- Triggers
What does the C++ union结构体多别名访问实现 skill do?
使用union实现C++结构体,支持通过xyz、rgb及数组v[3]三种方式访问同一内存,并采用typedef tagFoo {} Foo;的命名风格。
How do I install it?
Run `npx skills add ECNU-ICALK/AutoSkill --skill c-union结构体多别名访问实现 --agent claude-code` — it drops the skill into your project so the agent can pick it up. Swap the --agent value for codex, cursor or copilot if you use one of those.
Where does this skill come from?
From ECNU-ICALK/AutoSkill, a repository with 539 stars. We read it straight from the repository tree rather than a submitted listing, so what you see here is what is actually published.
Is a popular skill a good skill?
Not necessarily. Stars measure attention, not adoption — a repository can trend for a week and be abandoned. That is why we show the weekly change from our own snapshots next to the total, instead of a single flattering number.
