Skip to content

Commit

Permalink
Template generics (#2200)
Browse files Browse the repository at this point in the history
Add template generics, with optional constraints but no [SFINAE](https://en.cppreference.com/w/cpp/language/sfinae), to Carbon. Template generics allows the compiler postpone type checking of expressions dependent on a template parameter until the function is called and the value of that parameter is known.

Example usage:

```carbon
fn Identity[template T:! Type](x: T) -> T {
  return x;
}
```

Co-authored-by: Richard Smith <[email protected]>
Co-authored-by: Chandler Carruth <[email protected]>
  • Loading branch information
3 people authored Nov 17, 2022
1 parent adac572 commit c9a1e35
Showing 1 changed file with 1,118 additions and 0 deletions.
Loading

0 comments on commit c9a1e35

Please sign in to comment.