Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commit7c211c2

Browse files
authored
Update 10.2.concepts.cpp
1 parent212f4f3 commit7c211c2

File tree

1 file changed

+6
-6
lines changed

1 file changed

+6
-6
lines changed

‎code/10/10.2.concepts.cpp

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@ struct Person {
2929
double height, weight;
3030
Person(double a,double b) : height(a), weight(b) {}
3131
stringto_string(){
32-
return"weight:"+std::to_string(weight) +", height:"+std::to_string(height);
32+
return"weight:"+to_string(weight) +", height:"+to_string(height);
3333
}
3434
};
3535

@@ -56,21 +56,21 @@ string to_string(std::vector<int> v){
5656

5757

5858
voidprint(Stringable a){
59-
std::cout << a.to_string() <<std::endl;
59+
cout << a.to_string() << endl;
6060
}
6161

6262
voidprint(HasStringFunc a){
63-
std::cout <<to_string(a) <<std::endl;
63+
cout <<to_string(a) << endl;
6464
}
6565

6666
intmain() {
67-
std::list<int> l {1,2,3};
67+
list<int> l {1,2,3};
6868
Personp(57,170.0);
69-
std::vector<int> v {34,23,34,56,78};
69+
vector<int> v {34,23,34,56,78};
7070

7171
print(p);// uses concept Stringable
7272
print(l);
7373
print(3);// uses concept HasStringFunc
7474
// print(v); // error
7575
return0;
76-
}
76+
}

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp