mirror of
https://github.com/affaan-m/everything-claude-code.git
synced 2026-05-18 21:31:15 +08:00
Translate everything-claude-code repository to Japanese including: - 17 root documentation files - 60 agent documentation files - 80 command documentation files - 99 rule files across 18 language directories (common, angular, arkts, cpp, csharp, dart, fsharp, golang, java, kotlin, perl, php, python, ruby, rust, swift, typescript, web) - 199 skill documentation files Total: 455 files translated to Japanese with: - Consistent terminology glossary applied throughout - YAML field names preserved in English (name, description, etc.) - Code blocks and examples untouched (comments translated) - Markdown structure and relative links preserved - Professional translation maintaining technical accuracy This translation expands ECC accessibility to Japanese-speaking developers and teams. Co-Authored-By: Claude Haiku 4.5 <noreply@anthropic.com>
52 lines
1.7 KiB
Markdown
52 lines
1.7 KiB
Markdown
---
|
||
paths:
|
||
- "**/*.cpp"
|
||
- "**/*.hpp"
|
||
- "**/*.cc"
|
||
- "**/*.hh"
|
||
- "**/*.cxx"
|
||
- "**/*.h"
|
||
- "**/CMakeLists.txt"
|
||
---
|
||
# C++ パターン
|
||
|
||
> このファイルは [common/patterns.md](../common/patterns.md) を C++ 固有のコンテンツで拡張します。
|
||
|
||
## RAII(Resource Acquisition Is Initialization)
|
||
|
||
リソースのライフタイムをオブジェクトのライフタイムに結びつける:
|
||
|
||
```cpp
|
||
class FileHandle {
|
||
public:
|
||
explicit FileHandle(const std::string& path) : file_(std::fopen(path.c_str(), "r")) {}
|
||
~FileHandle() { if (file_) std::fclose(file_); }
|
||
FileHandle(const FileHandle&) = delete;
|
||
FileHandle& operator=(const FileHandle&) = delete;
|
||
private:
|
||
std::FILE* file_;
|
||
};
|
||
```
|
||
|
||
## 5の法則/0の法則
|
||
|
||
- **0の法則**: カスタムデストラクタ、コピー/ムーブコンストラクタ、代入が不要なクラスを優先する
|
||
- **5の法則**: デストラクタ/コピーコンストラクタ/コピー代入/ムーブコンストラクタ/ムーブ代入のいずれかを定義する場合、5つすべてを定義する
|
||
|
||
## 値セマンティクス
|
||
|
||
- 小さい/トリビアルな型は値渡しにする
|
||
- 大きな型は `const&` で渡す
|
||
- 値で返す(RVO/NRVO に依存する)
|
||
- シンクパラメータにはムーブセマンティクスを使用する
|
||
|
||
## エラーハンドリング
|
||
|
||
- 例外的な状況には例外を使用する
|
||
- 存在しない可能性のある値には `std::optional` を使用する
|
||
- 想定される失敗には `std::expected`(C++23)または結果型を使用する
|
||
|
||
## 参考
|
||
|
||
包括的な C++ パターンとアンチパターンについてはスキル: `cpp-coding-standards` を参照。
|