CPPSERV


Home Projects Jobs Clientele Contact

cppserv


[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

New public API [was: Re: Need to talk off-the-record]



One thing I was thinking about (and even started using in some cases)
is to change methods returing collections. The way it is now:
virtual std::vector<std::string>  getAttributeNames()
This means that whole vector, as well as every string inside will be copied
(possibly twice - inside function when creating retval, and then to the
actual
return value). Now, instead we could change signiture as follows:
virtual void getAttributeNames(std::vector<std::string> &out)
This will avoid unnessesary copying.

Java does not have to worry about it, since it returns references, and thus
only one copy of object is created.


Krzysztof Rzymkowski wrote:

>Take a look at
>/mod_servlet/servlet/include/ServletRequest.h
>and
>/mod_servlet/servlet/include/ext/ServletRequest/{body,header,footer}.h
>
>This might look as a hack, but it fully separates ServletRequest.h
>(which is using templates) for both out projects.
>
>  
>

-- 
Ilya A. Volynets-Evenbakh
Total Knowledge. CTO
http://www.total-knowledge.com


Authoright © Total Knowledge: 2001-2008