Talk About Network

Google


Register and Login
Nick
Password
Register create new account Sign up is FREE and you can post replies, new topics, bookmark posts and more!
Recover lost password


Programming > C++ Moderated > Re: Simulating ...
Latest [ Topics | Posts ] Archive Post A New Topic Post a Reply
<< Topic < Post Post 8 of 11 Topic 9498 of 9823
Post > Topic >>

Re: Simulating new user-defined operators

by Vidar Hasfjord <vattilah-groups@[EMAIL PROTECTED] > Apr 16, 2008 at 03:55 AM

> What are the merits of this solution over just using a set for ctors for
> the E and SL cl*****?
> E(DeleteFile(file));
> string message = format (SL(IDS_OUT_OF_RANGE)) % value;

It is a short-hand.

In my use case E and SL are instances of cl***** (i.e. objects); not
cl*****. But your alternative with constructors (or even better, just
free functions) of course works. It is also just one more letter. But
the hassle is the nesting of parenthesis.

Your syntax can be achieved with my objects by overloading operator
'()'. In fact I have both operator % and () overloaded in my code
(sometimes the latter is required for proper precedence). But I
generally prefer the shorter % operator for readability and
productivity.

Regards,
Vidar Hasfjord

-- 
      [ See http://www.gotw.ca/resources/clcm.htm
for info about ]
      [ comp.lang.c++.moderated.    First time posters: Do this! ]
 




 11 Posts in Topic:
Simulating new user-defined operators
Vidar Hasfjord <vattil  2008-04-14 12:43:32 
Re: Simulating new user-defined operators
Michael Aaron Safyan <  2008-04-14 21:25:12 
Re: Simulating new user-defined operators
"Martin T." <  2008-04-15 12:28:37 
Re: Simulating new user-defined operators
Edward Rosten <Edward.  2008-04-15 12:33:04 
Re: Simulating new user-defined operators
Alberto Ganesh Barbati &l  2008-04-15 23:19:14 
Re: Simulating new user-defined operators
Seungbeom Kim <musiphi  2008-04-15 23:18:03 
Re: Simulating new user-defined operators
ManicQin <ManicQin@[EM  2008-04-16 03:58:47 
Re: Simulating new user-defined operators
Vidar Hasfjord <vattil  2008-04-16 03:55:06 
Re: Simulating new user-defined operators
Carl Barron <cbarron41  2008-04-16 03:59:56 
Re: Simulating new user-defined operators
Michael Aaron Safyan <  2008-04-16 04:13:19 
Re: Simulating new user-defined operators
Vidar Hasfjord <vattil  2008-04-16 04:13:19 

Post A Reply:
  Go here to Signup

AddThis Feed Button


About - Advertising - Contact - Frequently Asked Questions - Privacy Policy - Terms of Use - Signup

Contact
tan12V112 Thu Jul 24 1:50:35 CDT 2008.