[LyX/master] Pass parameters as const references when possible

Jean-Marc Lasgouttes lasgouttes at lyx.org
Fri Oct 2 17:20:58 UTC 2020


Le 02/10/2020 à 19:11, Richard Kimberly Heck a écrit :
> On 10/2/20 12:29 PM, Jean-Marc Lasgouttes wrote:
>>   	/// Does an optional argument follow after the current token?
>> -	bool hasOpt(std::string const l = "[");
>> +	bool hasOpt(std::string const & l = "[");
> 
> I am a bit surprised that this is allowed---it looks like a reference to
> a temporary value---but apparently it is. I guess the temporary is in
> scope throughout the function body. Apparently this is NOT ok without
> the 'const', though.

Yes, we have a lot of these, actually.

JMarc



More information about the lyx-devel mailing list