Re:Re: string
"jaycee" <
XXXX@XXXXX.COM >writes:
[Rearranged quotes]
Quote
" Bruce Salzman" < XXXX@XXXXX.COM >wrote:
>string s = "the first string is " + a + " and the second one is" + b;
>
>One line...is that what you meant by shorter?
yupz, i tried that one but it doesn't work.
Please remove the term "it doesn't work" from your active language posted to
newsgroups; it doesn't work :-)
Always say *what* doesn't work
- compiler error (quote the error message)
- linker error (quote the error message)
- unexpected behavior (what did you expect? what happened instead?)
- access violation (where in the code?)
- etc.
Quote
it only works for ansistrings.
I fail to see the difference between std::string and AnsiString in the
expression.
The above expression attempts to apply binary + to an array of char const and
a pointer to char. There is no operator+ for these two operand types,
independently of the type of s.
The easiest solution is to construct a std::string from the first operand;
std::string s(std::string("the first string is ")
+ a
+ " and the second one is"
+ b);
{smallsort}