c++ - Any reason to use (MFC) CList rather than CList? -
I have learned some guidelines that all of us have always used Const to pass a variable from one context , As if I have shown in the sample code that it His second template uses the Any suggestions would be helpful thanks. Programming without CRT is like driving without the C ++ safety belt. 1. It prevents you from changing the variable, 2. This prevents you from assigning accidental variables 3. Acceptance Const Reference By the argument gives you the ability to pass the value with reference to the security of passing by value At the same time, the compiler can generate more efficient code because it knows what is the position of the variable / function The time will be. If you are writing tight C ++ code, then this is good. For the sake of your reference I have read the effect of discontent in this article, but recommended its use accurately. func console T & A) and I know that there is another template parameter in
CList one
ARG_TYPE . I will use
ARG_TYPE as its parameter type
CList :: AddTail (like ARG_TYPE item)
non-type type as argument I have any reason to like
non-type type as parameter type?
CList & lt; String, and String & gt; a; vs
CList & lt; String, const & amp; String & gt; B;
Comments
Post a Comment