[std-interval] C++ interval std

Gabriel Dos Reis gdr at integrable-solutions.net
Wed Apr 5 16:17:18 PDT 2006


Steve Clamage <Stephen.Clamage at Sun.COM> writes:

| Alan Eliasen wrote:
| > Bill Clarke wrote:
| >
| >>This experiment is extremely platform specific, as you probably are
| >>aware.  Most platforms in use today other than x86 will be the other way
| >>around (add-by-value will be faster than add-by-const-ref).
| >    How can that assertion possibly be made?  As you know, if a
| > parameter
| > is passed by value, then the copy constructor is automatically called
| > for each object (e.g. twice for an add operator) on function entry, and
| > then the destructor is called (twice) on function exit.
| 
| A simple object like complex or interval should have no user-defined
| copy constructor or destructor. That is, the default copy constructor
| generated by the compiler does the right thing and does not need to be
| user-defined. The destructor has nothing to do, and so should not be
| user-defined. In that case, pass-by-value can be optimized into
| register passing with no additional copying.

I do agree with Steve.

-- Gaby


More information about the Std-interval mailing list