Jean-Marc Lasgouttes <[EMAIL PROTECTED]> writes:
| That's good indeed. You could probably habve used LSubString to do the
| replace, but I'm disgressing...
|
| \begin{disgression}
| It seems to me that you can do something like
| LSubString foo(command,"$$FNAME");
| foo = QuoteName(name);
| which is much funnier, or even (does C++ allows this?)
| LSubString(command,"$$FNAME") = QuoteName(name);
|
| However, it is not clear to me whether it is legal to call
| LSubString::operator=, when the substring has not been found in the
| original string (i.e. no $$FName here).
|
| Lars, do you know whether it would work? If not, could this be changed?
| \end{disgression}
>From a conforming string implementation this would probably through
length_error or somehting.
If you read the constructor you see that pos get set to string::npos
if the substring is not found. so a subsequent replace will fail.
If you know that the substring is present,
LSubString(str, "substr") = "newsubstr";
would be ok.
LSubString foo(command, "$$FNAME");
for a command that does not contain a $$FNAME would not be a valid
substring.
So everything you do with it will fail/throw/abort etc.
Lgb