refactor(topics): 멀티 에이전트용 지식 재편 — _Common(공통 기본기) + Domain_* 구조

에이전트 8종(대화형/프로그래머 C·S/디자이너/설계자/기획자/QA/PD/PM)에게
[공통 기본 능력 + 롤별 Specialty] 2층으로 지식을 주입하기 위한 재분류.
문서 내용·포맷은 무수정, 폴더 이동만 (6,372개 문서 수 보존 확인).

- Topic_Programming → Domain_Programming (내부 구조 보존)
- Topic_Graphic → Domain_Design
- Topic_Business → Domain_Product
- Topic_General → Domain_General
- _Common 신설: Math(구 Topic_Math_Specialty), Reasoning(구 General/From_Thinking & Reasoning),
  Reasoning_Creativity(구 General/From_창의성), Communication(Poetic_Blog_Writing + From_writing)
- 타 도메인의 From_* 폴더는 유지 (출처 표기일 뿐, 이미 도메인에 맞게 분류된 문서)
- 빈 폴더 정리 (memory/procedures)
- 에이전트→폴더 매핑은 workspace의 .astra/agent-knowledge-map.json (9개 에이전트)

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
This commit is contained in:
Antigravity Agent
2026-07-11 11:05:56 +09:00
parent 6549ead309
commit c24165b8bc
6193 changed files with 1717 additions and 31 deletions
@@ -0,0 +1,82 @@
---
id: cpp-maps
title: "C++ Maps"
category: "Programming_Language"
status: "draft"
verification_status: "conceptual"
canonical_id: ""
aliases: ["std::map", "key-value pairs C++", "C++ 맵"]
duplicate_of: ""
source_trust_level: "B"
confidence_score: 0.86
created_at: 2026-07-04
updated_at: 2026-07-04
review_reason: ""
merge_history: []
tags: ["cpp", "programming-language", "w3schools", "stl", "map"]
raw_sources: ["https://www.w3schools.com/cpp/cpp_maps.asp"]
applied_in: []
github_commit: ""
---
# [[CPP Maps]]
## 🎯 한 줄 통찰 (One-line insight)
`map` reuses set's "auto-sort + unique" behavior but shifts what must be unique from the ELEMENT itself to just the KEY, letting VALUES repeat freely — and it overloads `[]` with a dual meaning no other container has: `people["Jenny"] = 22;` on a key that doesn't exist SILENTLY CREATES it (unlike vector's `[]`, which never grows the container), meaning map's `[]` is simultaneously a read, a write, AND an insert operator depending on context, a three-way overload that requires `.at()` or `.count()` when you need to tell those cases apart. [S1]
## 🧠 핵심 개념 (Core concepts)
- **`map<keytype, valuetype> name`** — two type parameters instead of one, e.g. `map<string, int> people;`; requires `<map>`. [S1]
- **Unique keys, non-unique values** — like set's uniqueness rule but applied only to the key half of each pair; values can repeat freely. [S1]
- **Auto-sorted by key** — same ascending-order-by-default behavior as set, reversible with `greater<type>` as the third template parameter. [S1]
- **`[]` as read/write/insert** — `people["John"]` reads the value for an existing key, `people["John"] = 50;` overwrites it, and `people["Jenny"] = 22;` on a NEW key silently inserts it — three distinct behaviors under one syntax. [S1]
- **`.at()`** — safer read/write alternative that throws if the key doesn't exist, unlike `[]` which would silently create a new entry instead of erroring. [S1]
- **`.insert({key, value})`** — explicit alternative to `[]` for adding; if the key already exists, the insert is silently ignored (first value wins, matching set's duplicate-drop behavior). [S1]
- **`.count(key)`** — returns 1/0 to check key existence without risking an accidental insert. [S1]
- **Looping requires `auto` + `.first`/`.second`** — `for (auto person : people) { cout << person.first << person.second; }`, since each element is a key-value pair, not a single value. [S1]
## 📖 세부 내용 (Details)
- Declaration: `map<string, int> people = { {"John", 32}, {"Adele", 45}, {"Bo", 29} };`. [S1]
- Access: `people["John"]`, `people.at("Adele")`; `.at()` throws for a missing key (`people.at("Jenny")` errors), while `people["Jenny"]` would just create it. [S1]
- Duplicate-key insert is ignored: `people.insert({"Jenny", 22}); people.insert({"Jenny", 30});` keeps only 22. [S1]
- Existence check without mutation: `people.count("John")` returns 1. [S1]
- Loop pattern: `for (auto person : people) { cout << person.first << " is: " << person.second << "\n"; }` — output is sorted by key (Adele, Bo, John), not insertion order. [S1]
## ⚖️ 모순 및 업데이트 (Contradictions & updates)
- **[] 연산자가 vector와 다르게 동작함**: vector의 []는 존재하는 인덱스만 읽고 범위를 벗어나면 정의되지 않은 동작이었지만, map의 []는 존재하지 않는 키에 값을 대입하면 조용히 새 요소를 생성한다는 점이 vector와의 핵심 차이로 확인됨. [S1]
- **set의 고유성 규칙이 키에만 적용되도록 완화됨**: set은 요소 전체가 고유해야 했지만, map은 키만 고유하면 되고 값은 자유롭게 중복될 수 있다는 점이 set 규칙의 부분적 완화로 확인됨. [S1]
## 🛠️ 적용 사례 (Applied in summary)
사람 이름과 나이를 저장하는 map에서 값을 읽고, 수정하고, .count()로 존재 여부를 확인하는 예제가 원문에서 직접 실전 활용 사례로 제시됨. [S1]
## 💻 코드 패턴 (Code patterns)
Map's `[]` reads, writes, AND silently inserts depending on context (C++):
```cpp
#include <map>
map<string, int> people = { {"John", 32}, {"Adele", 45}, {"Bo", 29} };
people["Jenny"] = 22; // key doesn't exist -> silently inserted
cout << people.at("Adele"); // safe read, throws if missing
cout << people.count("John"); // 1 if exists, 0 if not -- no risk of insert
for (auto person : people) { // sorted by key: Adele, Bo, Jenny, John
cout << person.first << " is: " << person.second << "\n";
}
```
## ✅ 검증 상태 및 신뢰도
- **상태:** draft
- **검증 단계:** conceptual
- **출처 신뢰도:** B (W3Schools — widely used educational reference, not a primary standards body)
- **신뢰 점수:** 0.86
- **중복 검사 결과:** 신규 생성 (New discovery)
## 🔗 지식 그래프 (Knowledge Graph)
- **상위/루트:** [[C++ Tutorial]]
- **관련 개념:** [[CPP Sets]], [[CPP Iterators]], [[CPP Data Structures]]
- **참조 맥락:** 데이터 구조(STL) 섹션 — Iterators 챕터로 이어짐.
## 📚 출처 (Sources)
- [S1] W3Schools — C++ Maps — https://www.w3schools.com/cpp/cpp_maps.asp
## 📝 변경 이력 (Change history)
- 2026-07-04: Initial draft synthesized from the W3Schools "C++ Maps" page (Astra wiki-curation, P-Reinforce v3.1 format).