On Wednesday, 4 December 2019 at 14:44:43 UTC, Ola Fosheim
Grøstad wrote:
When is there a noticable difference when using const values
instead of immutable values in a function body? And when should
immutable be used instead of const?
f(){
const x = g();
immutable y = g();
... do stuff with x and y …
}
I'm comparing D to C++ and I get the following mapping:
D:
enum constant = number
C++:
enum : decltype(number) { constant = number }
D:
auto p = g()
C++:
auto p = g()
D:
const p = g()
C++:
const auto p = g()
D:
immutable p = g()
C++:
hmmm...
Has anyone done a feature by feature comparison with C++? It
would be interesting to see what it looks like.
Unfortunately I am not yet good with D to answer your question .
But Ali Çehreli made some comparesions with C++.
https://dconf.org/2013/talks/cehreli.pdf
And I think you will find the answers of your questions in it
also.