[std-interval] passing by value vs reference

Sylvain Pion Sylvain.Pion at sophia.inria.fr
Wed Apr 5 17:04:06 PDT 2006


Guillaume Melquiond wrote:
> Le mercredi 05 avril 2006 à 15:37 +0200, Gabriel Dos Reis a écrit :
> 
> 
>>| > I would prefer 3 to 4.  I think
>>| > the complexity of implementing 4 is not worth it.
>>| 
>>| I don't see any additional complexity in 4 with respect to 3. As already
>>| mentioned by Bill Clarke, you could simply have a typedef member in
>>| interval<T> to express the calling convention of the functions of the
>>| interval library: typedef interval<T> const &param_type;
>>
>>If done that way, in the typical cases, the "T" would then appear in
>>non-deducible context. 
> 
> 
> Right. This occurred to me when reading Sylvain's reply. However,
> although typical, it seems to me this only applies to cases outside the
> interval library. Indeed, the functions of the library do not have to
> use param_type, since they already know their own calling convention,
> and hence T is deducible there. So the issue only applies to
> user-defined template functions that would try to benefit from using the
> same calling convention.
> 
> Anyway, do you know of a way to avoid this issue?
> (Please do not suggest macros :-)

"friend injection" I guess can be used for that, but then it
competes with macros in terms of code cleanliness.

-- 
Sylvain


More information about the Std-interval mailing list