[std-interval] C++ interval std

Alan Eliasen eliasen at mindspring.com
Wed Apr 5 13:53:08 PDT 2006


Guillaume Melquiond wrote:
> Please note that our proposed interval type is meant to be a POD (plain
> old data) type and as such has no copy constructor nor destructor. As a
> consequence, on some architectures and with non-broken compilers, they
> will behave no differently than if the function arguments were simply
> integers; except that the register will probably be bigger, or two
> registers will be used. When this happens, passing by value will be
> faster than passing by const-reference. Indeed there is no architecture
> such that foo(int) is slower than bar(int const &).

   As a "primitive" type, int is a different case than an object,
though.  Please note that calling foo(Interval a) normally requires a
call to a copy constructor and a call to the destructor if Interval is a
class.  This (probably unnecessary) call to the copy constructor and
destructor is always eliminated when calling foo(const Interval&).

-- 
  Alan Eliasen                 |  "When trouble is solved before it
  eliasen at mindspring.com       |    forms, who calls that clever?"
  http://futureboy.us/         |              --Sun Tzu


More information about the Std-interval mailing list