blob: 13a20ac2a6305b7374e4abb21486b1776110b778 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
|
#include <string>
template <typename... Args>
std::string cmStrCat(Args&&... args)
{
return "";
}
std::string a = "This is a string variable";
std::string b = " and this is a string variable";
std::string concat;
// Correction needed
void test1()
{
concat = a + b;
concat = a + " and this is a string literal";
concat = a + 'O';
concat = "This is a string literal" + b;
concat = 'O' + a;
concat = a + " and this is a string literal" + 'O' + b;
concat += b;
concat += " and this is a string literal";
concat += 'o';
concat += b + " and this is a string literal " + 'o' + b;
}
// No correction needed
void test2()
{
a = b;
a = "This is a string literal";
a = 'X';
cmStrCat(a, b);
}
|