<div>Hi all. I have some questions.</div> <div> </div> <div>1. Is there any trick in C# similar to Expression Template in C++ to avoid pairwise evaluation? <BR>For example, if we have the following code in C++:</div> <div> </div> <div> // DoubleVec is a class that contains a vector of double. This class has typical aritmathic operator, + - * /.<BR> <BR> DoubleVec y(1000), a(1000), b(1000), c(1000),d(1000); <BR> y = (a+b)/(c-d);</div> <div> </div> <div>without expression template we will need 4 loops and 3 temporaries DoubleVect to process the expression as the operands are processed 2 at a time. With expression template trick in C++, we can process the expression in one hit (in one loop, no temporaries).</div> <div> </div> <div>2. Is template processed at compile time or run time in C#? I know that in C++ it's processed at compile time.</div>
<div> </div> <div>3. I know that in C# the assignment operator '=' for object will copy the reference of rhs to the lhs.</div> <div><BR>How about if we need to define an assignment operator for an object that needs to copy the value of member variables (not reference) of rhs to lhs?<BR>How do we tell C# to copy value, not reference?</div> <div> </div> <div> </div> <div>Many thanks for your attention.</div><p>
<hr size=1>Talk is cheap. Use Yahoo! Messenger to make PC-to-Phone calls. <a href="http://us.rd.yahoo.com/mail_us/taglines/postman7/*http://us.rd.yahoo.com/evt=39666/*http://messenger.yahoo.com"> Great rates starting at 1¢/min.