Skip to content

Commit 0dc2ffd

Browse files
committed
clang-fromat applid
1 parent 7447b47 commit 0dc2ffd

15 files changed

+1173
-1251
lines changed

src/algorithms_library.cpp

100755100644
Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -532,7 +532,7 @@ void sort() {
532532
std::shuffle(vec1.begin(), vec1.end(), g);
533533

534534
///////////////////partial_sort, finding top 3 students,
535-
///sorted///////////////////
535+
/// sorted///////////////////
536536
std::partial_sort(number_set1.begin(), number_set1.begin() + 3,
537537
number_set1.end());
538538

@@ -541,7 +541,7 @@ void sort() {
541541
std::cout << "\n";
542542

543543
/////////////////////nth_element, finding top 3 students, not necessarily
544-
///sorted/////////////////////
544+
/// sorted/////////////////////
545545
std::shuffle(vec1.begin(), vec1.end(), g);
546546
std::nth_element(number_set1.begin(), number_set1.begin() + 3,
547547
number_set1.end());
@@ -550,7 +550,7 @@ void sort() {
550550
std::cout << "\n";
551551

552552
///////////////////////partion data into two groups, neither of the groups are
553-
///sorted/////////////////////
553+
/// sorted/////////////////////
554554
std::shuffle(number_set1.begin(), number_set1.end(), g);
555555
std::vector<int>::iterator iterator_to_the_first_element_of_the_second_group =
556556
std::partition(number_set1.begin(), number_set1.end(),
@@ -574,7 +574,7 @@ void sort() {
574574
std::cout << "\n";
575575

576576
/////////////////////////stable_partition,partion data into two groups, but it
577-
///preserve the original order///////////////////////
577+
/// preserve the original order///////////////////////
578578
std::shuffle(number_set1.begin(), number_set1.end(), g);
579579
std::stable_partition(number_set1.begin(), number_set1.end(),
580580
[](int x) { return x < 30; });

src/cast.cpp

100755100644
Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@ pointer type and data pointed by the pointer is same or not.
3131
*/
3232

3333
/////////////////////////////////Static
34-
///Cast/////////////////////////////////////
34+
/// Cast/////////////////////////////////////
3535
class Int {
3636
int x;
3737

src/class/header_guard/add.h

100755100644
Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,3 @@
66
// your declarations here
77
int add(int x, int y);
88
#endif
9-
10-
11-

src/class/header_guard/mymath.h

100755100644
Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,6 @@
22
#define MATH_H
33

44
// your declarations here
5-
int somemathfunction(){return 0;}
5+
int somemathfunction() { return 0; }
66

77
#endif

src/class/header_guard/subtract.h

100755100644
Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,4 +6,3 @@
66
// your declarations here
77
int subtract(int x, int y);
88
#endif
9-

src/class/virtual_function_abstract_class.cpp

100755100644
Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -65,7 +65,7 @@ class Derived : public Base {
6565
} // namespace VirtualFunction
6666
int main() {
6767
///////////////////////////////////////Virtual
68-
///Function///////////////////////////////////
68+
/// Function///////////////////////////////////
6969

7070
{
7171
std::cout << "Order of function calls:" << std::endl;
@@ -78,7 +78,7 @@ int main() {
7878
}
7979

8080
///////////////////////////////////////Pure Virtual and Abstract
81-
///Classes///////////////////////////////////
81+
/// Classes///////////////////////////////////
8282

8383
{}
8484

src/function_pointer.cpp

100755100644
Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8,15 +8,15 @@ later be called through that function pointer.
88
*/
99

1010
///////////////////////////////////Adder
11-
///Example////////////////////////////////////
11+
/// Example////////////////////////////////////
1212

1313
int adder(int a, int b) { return a + b; }
1414

1515
// defining
1616
int (*adder_fn_ptr)(int, int);
1717

1818
/////////////////////////////////Foreach
19-
///Example////////////////////////////////////
19+
/// Example////////////////////////////////////
2020

2121
void foreach (std::vector<int> values, void(funcPrint)(int)) {
2222
for (auto value : values)

src/lists.cpp

100755100644
Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@ void print(std::list<int> &list) {
2222
int main() {
2323

2424
////////////////////////////////push_back,
25-
///push_front///////////////////////////////
25+
/// push_front///////////////////////////////
2626
std::list<int> list_of_numbers;
2727
list_of_numbers.push_back(1);
2828
list_of_numbers.push_back(2);
@@ -33,7 +33,7 @@ int main() {
3333
print(list_of_numbers);
3434

3535
////////////////////////////////remove,
36-
///remove_if///////////////////////////////
36+
/// remove_if///////////////////////////////
3737

3838
std::cout << "removing second element:" << std::endl;
3939
std::list<int>::iterator itr = list_of_numbers.begin();
@@ -48,14 +48,14 @@ int main() {
4848
print(list_of_numbers);
4949

5050
////////////////////////////////remove,
51-
///remove_if///////////////////////////////
51+
/// remove_if///////////////////////////////
5252
std::cout << "delete all even numbers:" << std::endl;
5353
auto even = [](int x) { return (x % 2 == 0); };
5454
list_of_numbers.remove_if(even);
5555
print(list_of_numbers);
5656

5757
////////////////////////////////front, back
58-
///element///////////////////////////////
58+
/// element///////////////////////////////
5959

6060
std::cout << "front element:" << std::endl;
6161
std::cout << list_of_numbers.front() << std::endl;

src/multithreading/join_detach_threads.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@
1313
#include <queue>
1414

1515
////////////////////////////////////Join, Detach
16-
///Threads//////////////////////////////
16+
/// Threads//////////////////////////////
1717

1818
void print(int a, int &b) { std::cout << a << " " << b << std::endl; }
1919

src/printing_with_format.cpp

Lines changed: 13 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -2,20 +2,20 @@
22
#include <iostream>
33
#include <string>
44
#include <string_view>
5-
5+
66
template <typename... Args>
7-
std::string dyna_print(std::string_view rt_fmt_str, Args&&... args) {
8-
return std::vformat(rt_fmt_str, std::make_format_args(args...));
7+
std::string dyna_print(std::string_view rt_fmt_str, Args &&... args) {
8+
return std::vformat(rt_fmt_str, std::make_format_args(args...));
99
}
10-
10+
1111
int main() {
12-
std::cout << std::format("Hello {}!\n", "world");
13-
14-
std::string fmt;
15-
for (int i{}; i != 3; ++i) {
16-
fmt += "{} "; // constructs the formatting string
17-
std::cout << fmt << " : ";
18-
std::cout << dyna_print(fmt, "alpha", 'Z', 3.14, "unused");
19-
std::cout << '\n';
20-
}
12+
std::cout << std::format("Hello {}!\n", "world");
13+
14+
std::string fmt;
15+
for (int i{}; i != 3; ++i) {
16+
fmt += "{} "; // constructs the formatting string
17+
std::cout << fmt << " : ";
18+
std::cout << dyna_print(fmt, "alpha", 'Z', 3.14, "unused");
19+
std::cout << '\n';
20+
}
2121
}

src/streams_IO_operation_format_output.cpp

100755100644
Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -258,7 +258,7 @@ void stringstreamExample() {
258258
}
259259

260260
/////////////////////////////count words
261-
///frquency/////////////////////////////////
261+
/// frquency/////////////////////////////////
262262
std::stringstream wordsFrquencyStream("a b bb c a dd d");
263263
wordsFrquencyStream.str("a b bb c a dd d");
264264

src/string.cpp

100755100644
Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -118,7 +118,8 @@ void cStyleString() {
118118
char name0[10] = {
119119
'b', 'e', 'h', 'n',
120120
'a', 'm', '\0'}; // stack variable, compiler output: char name0[10] =
121-
// {'b', 'e', 'h', 'n', 'a', 'm', '\0', '\0', '\0', '\0'};
121+
// {'b', 'e', 'h', 'n', 'a', 'm', '\0', '\0', '\0',
122+
// '\0'};
122123
char name1[] = {
123124
'b', 'e', 'h', 'n',
124125
'a', 'm', '\0'}; // stack variable, compiler output: char name1[7] = {'b',

src/structs.cpp

100755100644
Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,7 @@ int Structsmain()
3838
// int main()
3939
{
4040
// initializer list. This allows you to initialize some or all the members
41-
//of a struct at declaration time.
41+
// of a struct at declaration time.
4242
Employee Joe = {1, 42, 60000.0f};
4343
Employee sJoe;
4444
sJoe.nID = 14;
@@ -55,7 +55,7 @@ int Structsmain()
5555
cout << myDataElement.hasData << endl;
5656

5757
// example of "->" operator, when we have pointer to struct or class, for
58-
//accessing member we have to use -> operator
58+
// accessing member we have to use -> operator
5959
DataElement RealData;
6060
DataElement *PointerToRealData = &RealData;
6161
PointerToRealData->iVal = 1234;

src/template.cpp

100755100644
Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -159,7 +159,7 @@ template <class TYPE> void PrintTwice(TYPE data) {
159159
template <class T> T Add(T n1, T n2) { return n1 + n2; }
160160

161161
////////////////////////////////Template
162-
///Specialization////////////////////////////////
162+
/// Specialization////////////////////////////////
163163

164164
// An Example Program for function template specialization
165165

@@ -302,16 +302,16 @@ struct Vector<3> {
302302

303303
int main() {
304304
// For the first call of GetAverage, where IntArray is passed, compiler
305-
//would instantiate this function as: double GetAverage(int tArray[], int
306-
//nElements);
305+
// would instantiate this function as: double GetAverage(int tArray[],
306+
// int nElements);
307307

308308
int IntArray[5] = {100, 200, 400, 500, 1000};
309309
float FloatArray[3] = {1.55f, 5.44f, 12.36f};
310310
cout << GetAverage(IntArray, 5);
311311
cout << GetAverage(FloatArray, 3);
312312

313313
////////////////////////////////Template
314-
///Specialization////////////////////////////////
314+
/// Specialization////////////////////////////////
315315
// function template specialization
316316
add(10, 3);
317317
add(std::string("a"), std::string("b"));

0 commit comments

Comments
 (0)