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

Richard Kimberly Heck rikiheck at lyx.org
Fri Oct 2 17:11:00 UTC 2020


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.

Riki




More information about the lyx-devel mailing list