Re: [Dev-C++] Optimizing using the STL
Open Source C & C++ IDE for Windows
Brought to you by:
claplace
|
From: David M. <ci...@ya...> - 2003-07-26 03:03:58
|
Hmm,
Some interesting comments. (I know I need to increment the
iterator, I
forgot that when I sent this e-mail). So far the only
optimization that
would be applicable is the passing by refrence. This
program is
multi-threaded so even though I could use mutexes, etc. to
prevent the
string from changing between calls to write_to_player I
would rather not
have that headache. If you are wondering I plan to put the
map in a
Read-write mutex (the only time that map changes is when a
player logs in or
logs out).
Thanks for all your comments.
----- Original Message -----
From: "P.D. van Zelst" <pa...@my...>
To: <ci...@ya...>
Sent: Friday, July 25, 2003 7:18 AM
Subject: RE: [Dev-C++] Optimizing using the STL
> Hi,
>
> Well, incrementing the iterator inside your while loop
would be a
> performance improvement I suppose :P
> And to nitpick about the arguments a bit... it would be
more efficient
> to pass the string as a const string&.
> But other than that I wouldn't know how to optimize this
function any
> further. I know there's a template function "memfun",
which allows you
> to call member functions in objects, but I don't know if
it's possible
> to pass parameters to that.
>
> Regards,
>
>
> Paul
>
> -----Original Message-----
> From: dev...@li...
> [mailto:dev...@li...] On
Behalf Of David
> McKen
> Sent: Thursday, July 24, 2003 9:17 PM
> To: Dev-C Mailing List
> Subject: [Dev-C++] Optimizing using the STL
>
>
> Any suggestions on how I can optimized the following
> function?
>
> void pc_char::write_to_all_pc(string to_send, bool
> add_eoln)
> {
> map<string, pc_char *>::iterator i =
> current_players.begin();
>
> while (i != current_players.end()) {
> (*i).second->write_to_player(to_send, add_eoln);
> }
> }
>
> I was hoping to use for_each but kept coming across the
> problem of "How the hell am I going to pass the arguments
> to write_to_player?"
>
> Thanks in Advance
>
> =====
> Signed
> David Mcken
>
> Life Sucks
> Live with it
>
> __________________________________
> Do you Yahoo!?
> Yahoo! SiteBuilder - Free, easy-to-use web site design
software
> http://sitebuilder.yahoo.com
>
>
> -------------------------------------------------------
> This SF.Net email sponsored by: Free pre-built ASP.NET
sites including
> Data Reports, E-commerce, Portals, and Forums are
available now.
> Download today and enter to win an XBOX or Visual Studio
.NET.
>
http://aspnet.click-url.com/go/psa00100003ave/direct;at.aspnet_072303_01
> /01
> _______________________________________________
> Dev-cpp-users mailing list
> Dev...@li...
> TO UNSUBSCRIBE:
http://www23.brinkster.com/noicys/devcpp/ub.htm
>
https://lists.sourceforge.net/lists/listinfo/dev-cpp-users
>
>
__________________________________
Do you Yahoo!?
Yahoo! SiteBuilder - Free, easy-to-use web site design software
http://sitebuilder.yahoo.com
|