[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [Gnucap-devel] waves branch and wave copy constructor
From: |
Felix Salfelder |
Subject: |
Re: [Gnucap-devel] waves branch and wave copy constructor |
Date: |
Sat, 20 Dec 2014 22:20:53 +0100 |
User-agent: |
Mutt/1.5.21 (2010-09-15) |
On Sat, Dec 20, 2014 at 01:43:53PM -0500, al davis wrote:
> There are lots of such copies in the current implementation.
> Every time the map is accessed, either in or out, something is
> copied and something is deleted.
std::map<X,Y>::operator[](const&X) returns a Y&, which acts more or less
like a Y* here. thus, no copy is involved when accessing existant entry
(speaking of c++98).
FWIW, in c++11, not even upon creating a new pair (accessing a
nonexisting map element) the copy constructor of Y is called. they did a
great job in avoiding unnecessary copies, which they are totally aware
of.
i'm not fully convinced that the current implementation calls more
copies than it should. but sure, i might be missing something.
cheers
felix
PS: i am still not against removal of the WAVE copy constructor, anyway,
we should better not try to reinvent stl :)