# C++ keyword: alignas (since C++11)

> C++ Atlas: `cppatlas.com/w/cpp/keyword/alignas` | Source: https://en.cppreference.com/w/cpp/keyword/alignas | Domain: Keywords

## Official Specification Summary (cppreference)

### Usage

- `alignas` specifier

### Example

```cpp
struct s1 final {};
struct alignas(2) s2 final {};

static_assert(alignof(s1) == 1);
static_assert(alignof(s2) == 2);
```

### See also

- [`alignof`](https://en.cppreference.com/w/cpp/keyword/alignof)

---
Attribution: content from https://en.cppreference.com/w/cpp/keyword/alignas (cppreference.com), licensed under CC-BY-SA 3.0 and GFDL. Modified: converted to markdown, study notes added. Offline snapshot of 9 February 2025.