> ## Documentation Index
> Fetch the complete documentation index at: https://differens.ossl.dev/llms.txt
> Use this file to discover all available pages before exploring further.

# C++

> Semantic diffing for C++

## C++ extractor

The C++ extractor maps tree-sitter C++ CST nodes to canonical concepts. Class and namespace names come from the standard `name` field; function names are recovered through the declarator chain.

### Detected concepts

| tree-sitter node type | Canonical concept |
| - | - |
| `function_definition` | Function |
| `class_specifier` | Class |
| `struct_specifier` | Struct |
| `enum_specifier` | Enum |
| `namespace_definition` | Namespace |
| `declaration` / `field_declaration` | Variable |
| `template_declaration` | TemplateDeclaration |
| `template_parameter_list` | TypeParameters |
| `parameter_declaration` | Parameter |
| `preproc_include` | PreprocInclude |
| `access_specifier` | AccessSpecifier |

### Example

Renaming a method:

```cpp theme={null}
// old.cpp
class Counter { int total(int n) { return n + 1; } };
```

```cpp theme={null}
// new.cpp
class Counter { int sum(int n) { return n + 1; } };
```

Running `differens old.cpp new.cpp`:

```
~ renamed function `total` to `sum` in class `Counter`
```

### Known limitations

* Preprocessor macros are tokens, not structure; conditional compilation does not expand before diffing.
* Templates are diffed as written: an instantiation change reports in the template body, not per instantiation.
