digitalmars.D.learn - ~ ?
- pgtkda (2/2) Jun 26 2014 What does this symbol mean in relation to D?
- =?UTF-8?B?QWxpIMOHZWhyZWxp?= (19/21) Jun 26 2014 It can be used in two ways:
- pgtkda (2/24) Jun 26 2014 Thanks :)
- Chris (2/4) Jun 27 2014 ~ D means it's about the best language I've come across so far.
On 06/26/2014 10:58 PM, pgtkda wrote:What does this symbol mean in relation to D? ~It can be used in two ways: 1) When used as a unary operator, it means bitwise complement: assert(~0xaa55aa55 == 0x55aa55aa); 2) When used as a binary operator, it means concatenation: assert("hello" ~ " world" == "hello world"); auto arr = [ 1, 2 ]; assert(arr ~ 3 == [ 1, 2, 3 ]); When used with assignment, it means appending: auto arr = [ 1, 2 ]; arr ~= 3; assert(arr == [ 1, 2, 3 ]); It can also be used in the special function name ~this(), which is the destructor of a struct or a class. (Related functions: 'static ~this()' and 'shared static ~this()') Ali [1] http://ddili.org/ders/d.en/bit_operations.html [2] http://ddili.org/ders/d.en/arrays.html [3] ddili.org/ders/d.en/special_functions.html
Jun 26 2014
On Friday, 27 June 2014 at 06:33:07 UTC, Ali Çehreli wrote:On 06/26/2014 10:58 PM, pgtkda wrote:Thanks :)What does this symbol mean in relation to D? ~It can be used in two ways: 1) When used as a unary operator, it means bitwise complement: assert(~0xaa55aa55 == 0x55aa55aa); 2) When used as a binary operator, it means concatenation: assert("hello" ~ " world" == "hello world"); auto arr = [ 1, 2 ]; assert(arr ~ 3 == [ 1, 2, 3 ]); When used with assignment, it means appending: auto arr = [ 1, 2 ]; arr ~= 3; assert(arr == [ 1, 2, 3 ]); It can also be used in the special function name ~this(), which is the destructor of a struct or a class. (Related functions: 'static ~this()' and 'shared static ~this()') Ali [1] http://ddili.org/ders/d.en/bit_operations.html [2] http://ddili.org/ders/d.en/arrays.html [3] ddili.org/ders/d.en/special_functions.html
Jun 26 2014
On Friday, 27 June 2014 at 05:58:14 UTC, pgtkda wrote:What does this symbol mean in relation to D? ~~ D means it's about the best language I've come across so far.
Jun 27 2014