dlang-book/book/04-массивы-ассоциативные-массивы-и-строки/src/chapter-4-1-5/app.d

10 lines
575 B
D
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

void main()
{
auto a = ["hello", "world"];
auto b = a;
assert(a is b); // Тест прой­ден, у a и b од­ни те же гра­ни­цы
assert(a == b); // Ес­те­ст­вен­но, тест прой­ден
b = a.dup;
assert(a == b); // Тест прой­ден, a и b рав­ны, хо­тя за­ни­ма­ют раз­ные об­лас­ти па­мя­ти
assert(a !is b); // Тест прой­ден, a и b раз­лич­ны, хо­тя име­ют оди­на­ко­вое со­дер­жи­мое
}