Re: Overload of ! operator

2013-06-25 Thread monarch_dodra
On Wednesday, 26 June 2013 at 05:29:49 UTC, Jonathan M Davis wrote: On Wednesday, June 26, 2013 07:15:19 Eric wrote: I should have also added that the overloaded ! method returns a class instance and not a bool. Well, at that point, you're completely out of luck with regards to overloading !.

Re: Overload of ! operator

2013-06-25 Thread Jonathan M Davis
On Wednesday, June 26, 2013 07:15:19 Eric wrote: > I should have also added that the overloaded ! method returns a > class instance and not a bool. Well, at that point, you're completely out of luck with regards to overloading !. In general, D doesn't really support overloading operators in a man

Re: Overload of ! operator

2013-06-25 Thread Jonathan M Davis
On Wednesday, June 26, 2013 07:14:36 cal wrote: > But that code I posted does work, and gives the output shown. Am > I misunderstanding? Then my understanding of how ! is handled is wrong. Apparently !s does get replaced with !cast(bool)s, or it couldn't work. But note that bool b = s; doesn't

Re: Overload of ! operator

2013-06-25 Thread Eric
On Wednesday, 26 June 2013 at 04:59:19 UTC, cal wrote: On Wednesday, 26 June 2013 at 04:06:05 UTC, Jonathan M Davis wrote: Yeah, that should work for the conditions in if, while, and for loops but won't work for anything else (_maybe_ ternary operators, but I'm not sure). So, if you need to be

Re: Overload of ! operator

2013-06-25 Thread cal
On Wednesday, 26 June 2013 at 05:08:07 UTC, Jonathan M Davis wrote: On Wednesday, June 26, 2013 06:59:14 cal wrote: On Wednesday, 26 June 2013 at 04:06:05 UTC, Jonathan M Davis wrote: > Yeah, that should work for the conditions in if, while, and > for > loops but > won't work for anything els

Re: Overload of ! operator

2013-06-25 Thread Jonathan M Davis
On Wednesday, June 26, 2013 06:59:14 cal wrote: > On Wednesday, 26 June 2013 at 04:06:05 UTC, Jonathan M Davis > > wrote: > > Yeah, that should work for the conditions in if, while, and for > > loops but > > won't work for anything else (_maybe_ ternary operators, but > > I'm not sure). > > So, if

Re: Overload of ! operator

2013-06-25 Thread cal
On Wednesday, 26 June 2013 at 04:06:05 UTC, Jonathan M Davis wrote: Yeah, that should work for the conditions in if, while, and for loops but won't work for anything else (_maybe_ ternary operators, but I'm not sure). So, if you need to be able to do !obj in the general case, that's not going t

Re: Overload of ! operator

2013-06-25 Thread Eric
On Wednesday, 26 June 2013 at 04:16:30 UTC, Ali Çehreli wrote: On 06/25/2013 09:05 PM, Jonathan M Davis wrote: > On Wednesday, June 26, 2013 05:35:03 cal wrote: >> On Wednesday, 26 June 2013 at 02:50:51 UTC, Eric wrote: >>> Is there a way to overload the ! operator? I can't seem to get >>> it t

Re: Overload of ! operator

2013-06-25 Thread Ali Çehreli
On 06/25/2013 09:05 PM, Jonathan M Davis wrote: > On Wednesday, June 26, 2013 05:35:03 cal wrote: >> On Wednesday, 26 June 2013 at 02:50:51 UTC, Eric wrote: >>> Is there a way to overload the ! operator? I can't seem to get >>> it to work with the standard unaryOp method. I need this >>> becaus

Re: Overload of ! operator

2013-06-25 Thread Jonathan M Davis
On Wednesday, June 26, 2013 05:35:03 cal wrote: > On Wednesday, 26 June 2013 at 02:50:51 UTC, Eric wrote: > > Is there a way to overload the ! operator? I can't seem to get > > it to work with the standard unaryOp method. I need this > > because > > I am making a wrapper for a C++ API that has !

Re: Overload of ! operator

2013-06-25 Thread cal
On Wednesday, 26 June 2013 at 02:50:51 UTC, Eric wrote: Is there a way to overload the ! operator? I can't seem to get it to work with the standard unaryOp method. I need this because I am making a wrapper for a C++ API that has ! overloaded. -Eric According to http://dlang.org/operatorov

Re: Overload of ! operator

2013-06-25 Thread Jonathan M Davis
On Wednesday, June 26, 2013 04:50:44 Eric wrote: > Is there a way to overload the ! operator? I can't seem to get > it to work with the standard unaryOp method. I need this because > I am making a wrapper for a C++ API that has ! overloaded. TDPL does not list it as an overloadable operator, so

Re: Overload of ! operator

2013-06-25 Thread bearophile
Eric: Is there a way to overload the ! operator? I can't seem to get it to work with the standard unaryOp method. I need this because I am making a wrapper for a C++ API that has ! overloaded. D is not a superset of C++ and I think there is no way to overload the ! alone. This is by desig

Overload of ! operator

2013-06-25 Thread Eric
Is there a way to overload the ! operator? I can't seem to get it to work with the standard unaryOp method. I need this because I am making a wrapper for a C++ API that has ! overloaded. -Eric