TIP: Click on subject to list as thread! ANSI
echo: c_plusplus
to: JERRY COFFIN
from: CAMERON CLARK
date: 1997-06-04 20:57:00
subject: Re: template hell?

JC>  CC> class DLList {
JC>  CC>   Node* head;                       // head node in list - dummy 
ode
JC>  CC> public:
JC>  CC>   Node* cur;               // current node used to seach the list
JC> 
JC> Why do you make this public?  I can't tell how you're using it, but it
JC> looks like something that ought to be private...
    It should be private for the sole purpose of encapsulation. A return
    current method does exist so its data can be returned.
JC> simple data type, you're probably better off passing a const reference
JC> instead of an actual item by value.  I.e. I'd change this to:
JC> 
JC>               method(dtype const &item);
    This will save on stack space for each call. If the record was that big
    then maybe a list of them might not be a good idea.
JC> Basically you use:
JC> 
JC> ret_type full_class_name::method_name(params);
JC> 
JC> In the case of a template, the full name of a class looks like:
JC> 
JC>     class_name
JC> 
JC> instead of just:
JC> 
JC>     class_name
JC> 
JC> that you use with a non-templated class.  Hopefully that makes some
JC> sense instead of just making things muddier...
JC>     Later,
JC>     Jerry.
    I hate the way that templates are done in C++. I'm sure it makes it
    easier for the compiler writer, but, it makes the code unintuitive and
    clutered.
--- GEcho 1.00
---------------
* Origin: Digital OnLine Magazine! - (409)838-8237 (1:3811/350)

SOURCE: echomail via exec-pc

Email questions or comments to sysop@ipingthereforeiam.com
All parts of this website painstakingly hand-crafted in the U.S.A.!
IPTIA BBS/MUD/Terminal/Game Server List, © 2025 IPTIA Consulting™.