Skip to content

Commit b76957a

Browse files
committed
readme
1 parent e34c220 commit b76957a

2 files changed

Lines changed: 77 additions & 0 deletions

File tree

README.md

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -45,6 +45,10 @@ Pull requests of make/cmake are welcome!
4545
* [libcurl](https://curl.haxx.se/libcurl/)
4646
* [ZMQ](https://zeromq.org/)
4747

48+
49+
* [Awesome C++](https://github.com/fffaraz/awesome-cpp)
50+
* [Awesome Mordern C++](https://github.com/rigtorp/awesome-modern-cpp)
51+
4852
## See Also
4953

5054
* [boost guide](https://github.com/chronolaw/boost_guide.git) - Sample code for Boost library Guide

section2/test06.cpp

Lines changed: 73 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@
66

77
#include <iostream>
88
#include <string>
9+
#include <vector>
910
#include <map>
1011

1112
void case1()
@@ -23,10 +24,82 @@ void case1()
2324
//cout << i << x;
2425
}
2526

27+
void case2()
28+
{
29+
auto i = 0;
30+
//auto i{0} ;
31+
auto x = 1.0;
32+
33+
auto str = "hello";
34+
//decltype("hello") str = "hello";
35+
36+
std::map<int, std::string> m = {{1,"a"}, {2,"b"}};
37+
38+
auto iter = m.begin();
39+
40+
auto f = bind1st(std::less<int>(), 2);
41+
42+
//using namespace std;
43+
//cout << typeid(str).name() << endl;
44+
}
45+
46+
void case3()
47+
{
48+
auto x = 0L;
49+
auto y = &x;
50+
auto z {&x};
51+
}
52+
53+
class X final
54+
{
55+
//auto a = 10;
56+
int a = 10;
57+
};
58+
59+
void case4()
60+
{
61+
auto x = 10L;
62+
63+
auto& x1 = x;
64+
auto* x2 = &x;
65+
const auto& x3 = x;
66+
auto x4 = &x3;
67+
68+
using namespace std;
69+
70+
cout << *x2 << endl;
71+
cout << *x4 << endl;
72+
//cout << typeid(x4).name() << endl;
73+
}
74+
75+
void case5()
76+
{
77+
using namespace std;
78+
79+
vector<int> v = {2,3,5,7,11};
80+
81+
for(const auto& i : v) {
82+
cout << i << ",";
83+
}
84+
cout << endl;
85+
86+
for(auto& i : v) {
87+
i++;
88+
cout << i << ",";
89+
}
90+
cout << endl;
91+
}
92+
2693

2794
int main()
2895
{
2996
using namespace std;
3097

98+
case1();
99+
case2();
100+
case3();
101+
case4();
102+
case5();
103+
31104
cout << "auto/decltype demo" << endl;
32105
}

0 commit comments

Comments
 (0)