File tree Expand file tree Collapse file tree 1 file changed +12
-0
lines changed
Expand file tree Collapse file tree 1 file changed +12
-0
lines changed Original file line number Diff line number Diff line change @@ -65,6 +65,18 @@ int main() {
6565- ` suffix(0xFE, 0xFF) ` では、` data.bin ` の内容のあとに` 0xFE 0xFF ` のバイト列を追加している。
6666- ` if_empty(0x00) ` では、` data.bin ` がからであった場合、` 0x00 ` のバイト列を格納している。
6767
68+ また、` #embed ` ディレクティブは、複数のパラメータを** 順不同** で組み合わせて指定することもできる。
69+
70+ ``` cpp example
71+ int main () {
72+ constexpr unsigned char combined_data[ ] = {
73+ #embed "data.bin" limit(1024) prefix(0x01, 0x02) suffix(0xFF) if_empty(0x00)
74+ };
75+ }
76+ ```
77+ これは、` limit(1024) ` でファイルサイズを1024バイトに制限し、` prefix(0x01, 0x02) ` で先頭バイト列` 0x01 0x02 ` を追加し、
78+ ` suffix(0xFF) ` で末尾` 0xFF ` を追加し、` if_empty(0x00) ` で空の場合は` 0x00 ` を格納することになる。
79+
6880
6981## 参照
7082- [ P1967R14 #embed - a scannable, tooling-friendly binary resource inclusion mechanism] ( https://open-std.org/jtc1/sc22/wg21/docs/papers/2025/p1967r14.html )
You can’t perform that action at this time.
0 commit comments