Ben Chuanlong Du's Blog

It is never too late to learn.

Const Generic in Rust

Things on this page are fragmentary and immature notes/thoughts of the author. Please read with your own judgement!

  1. Starting from Rust 1.51, constant generics is supported for integral types.

  2. The crate static_assertions can be used to assert that a const generic parameter satisfy certain conditions at compile time …

Rust Error "error: expected item, found 'let'"

Things on this page are fragmentary and immature notes/thoughts of the author. Please read with your own judgement!

The error message "error: expected item, found 'let'" is commonly encountered in Rust when you mistakenly place a let statement in an invalid location. A let statement can only be used …

Const and Static Variables in C++

Things on this page are fragmentary and immature notes/thoughts of the author. Please read with your own judgement!

Const Variables

but you can initialize a static constexpr variable inside the defintion of a class.

  1. constexpr means that the corresponding value can be dertermined at compile time.

Static Variables

  1. You …