Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update aliases.md #1005

Merged
merged 1 commit into from
Feb 29, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 5 additions & 5 deletions docs/cpp2/aliases.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# Aliases

Aliases are pronounced **"synonym for**, and written using the same **name `:` kind `=` value** [declaration syntax](../cpp2/declarations.md) as everything in Cpp2:
Aliases are pronounced **"synonym for"**, and written using the same **name `:` kind `=` value** [declaration syntax](../cpp2/declarations.md) as everything in Cpp2:

- **name** is declared to be a synonym for **value**.

Expand Down Expand Up @@ -37,7 +37,7 @@ main: () = {

## <a id="type-aliases"></a> Type aliases

A namespace alias is written the same way as a [type](types.md), but using `==` and with the name of another type as its value. For example:
A type alias is written the same way as a [type](types.md), but using `==` and with the name of another type as its value. For example:

``` cpp title="Type aliases" hl_lines="1 2 7 10"
// 'imap<T>' is a type defined as a synonym for 'std::map<i32, T>'
Expand All @@ -49,7 +49,7 @@ main: () = {
map2: imap<std::string> = ();

// Assertion they are the same type, using the same_as concept
assert( std::same_as< decltype(map1), decltype(map2) > );
static_assert( std::same_as< decltype(map1), decltype(map2) > );
}
```

Expand All @@ -67,7 +67,7 @@ main: () = {
ints: std::array<i32, square(4)> = ();

// Assertion that the size is the square of 4
assert( ints.size() == 16 );
static_assert( ints.size() == 16 );

// And if can be used at run time, with run time values
std::cout << "the square of 4 is (square(4))$\n";
Expand All @@ -89,7 +89,7 @@ BufferSize: i32 == 1'000'000;

main: () = {
buf: std::array<std::byte, BufferSize> = ();
assert( buf.size() == BufferSize );
static_assert( buf.size() == BufferSize );
}
```

Expand Down