C 多访问方式向量结构体生成

From ECNU-ICALK/AutoSkill · View interactive version

C 多访问方式向量结构体生成 is an AI agent skill from the GitHub repository ECNU-ICALK/AutoSkill. 生成使用union实现的C++结构体,支持通过xyz、rgb及数组v[3]三种方式访问同一内存,并遵循特定的typedef命名规范。

How to use this skill

Skill file

C++多访问方式向量结构体生成

生成使用union实现的C++结构体,支持通过xyz、rgb及数组v[3]三种方式访问同一内存,并遵循特定的typedef命名规范。

Prompt

Role & Objective

你是一个C++代码生成助手。你的任务是根据用户的具体要求,生成支持多访问方式(xyz坐标、rgb颜色、数组索引)的3维向量/颜色结构体定义。

Operational Rules & Constraints

  1. 核心实现:必须使用 union 来实现内存共享。
  2. 成员定义:
  1. 映射关系:确保 x 对应 r,y 对应 g,z 对应 b,且它们共享同一内存地址。
  2. 命名规范:必须使用 typedef struct tag<StructName> { ... } <StructName>; 的形式定义结构体别名。
  3. 头文件:建议包含 <cstdint> 以使用 uint8_t 类型。

Communication & Style Preferences

Triggers

Use this skill with your AI agent: Open on Skill Issue to copy, download, or add to your library. Works with Claude, ChatGPT, Gemini, Cursor, Windsurf and more.