Skip to content

Commit 8a8fd42

Browse files
chore: use iwyu on others/**.cpp
1 parent eff2f44 commit 8a8fd42

11 files changed

+42
-36
lines changed

others/decimal_to_roman_numeral.cpp

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -4,10 +4,8 @@
44
* to both Lower case and Upper case Roman Numeral
55
*/
66

7-
#include <cmath>
8-
#include <cstdio>
9-
#include <cstring>
10-
#include <iostream>
7+
#include <iostream> // for char_traits, basic_ostream, operator<<, basic_os...
8+
#include <string> // for basic_string, operator+, allocator, string, oper...
119

1210
/** This functions fills a string with character c, n times and returns it
1311
* @note This can probably be replace by `memcpy` function.

others/easter.cpp

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -17,9 +17,8 @@
1717
* @author [AlternateWalls](https://github.com/AlternateWalls)
1818
*/
1919

20-
#include <cassert> /// for assert
21-
#include <cstdint> /// for integral typedefs
22-
#include <iostream> /// for IO operations
20+
#include <cassert> // for assert
21+
#include <cstdint> // for uint64_t
2322

2423
/*
2524
* @brief Contains information for Easter date

others/fast_integer_input.cpp

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,8 @@
33
* @brief Read integers from stdin continuously as they are entered without
44
* waiting for the `\n` character
55
*/
6-
#include <iostream>
6+
#include <iostream> // for char_traits, basic_ostream, basic_ostream::opera...
7+
#include <cstdio> // for getchar
78

89
/** Function to read the number from stdin. The function reads input until a non
910
* numeric character is entered.

others/iterative_tree_traversals.cpp

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -35,11 +35,12 @@
3535
* set of steps until the Stack becomes empty or the current becomes NULL. And
3636
* return the result array as the inorder traversal of a tree.
3737
*/
38-
#include <algorithm> /// for `reverse`
39-
#include <cassert> /// for `assert`
40-
#include <iostream> /// for I/O operations
41-
#include <stack> /// for `stack`
42-
#include <vector> /// for `vector`
38+
#include <stdint.h> // for int64_t
39+
#include <algorithm> // for reverse
40+
#include <cassert> // for assert
41+
#include <iostream> // for basic_ostream, operator<<, char_traits, cout, endl
42+
#include <stack> // for stack
43+
#include <vector> // for vector
4344

4445
/**
4546
* @namespace others

others/kadanes3.cpp

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -14,11 +14,13 @@
1414
* @author [Abhijeet Tiwari](https://github.com/thisabhijeet)
1515
*/
1616

17-
#include <array> /// for std::array
18-
#include <cassert> /// for assert
19-
#include <climits> /// for INT_MIN value
20-
#include <cstdint> /// for integral typedefs
21-
#include <iostream> /// for IO operations
17+
#include <array> // for array
18+
#include <cassert> // for assert
19+
#include <climits> // for INT_MIN
20+
#include <cstdint> // for int64_t, uint64_t
21+
#include <iostream> // for operator<<, basic_ostream, cout
22+
#include <cstddef> // for size_t
23+
2224
/**
2325
* @brief Utility function to check the current maximum number
2426
* \param arr input array

others/kelvin_to_celsius.cpp

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -17,9 +17,10 @@
1717
* @author [David Leal](https://github.com/Panquesito7)
1818
*/
1919

20-
#include <cassert> /// for assert
21-
#include <cmath> /// for std::abs
22-
#include <iostream> /// for IO operations
20+
#include <bits/std_abs.h> // for abs
21+
#include <cassert> // for assert
22+
#include <iostream> // for operator<<, basic_ostream, cout
23+
#include <stdexcept> // for invalid_argument
2324

2425
/**
2526
* @namespace

others/matrix_exponentiation.cpp

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -22,8 +22,9 @@ Steps for Matrix Expo
2222
The first element of this matrix is the required result.
2323
*/
2424

25-
#include <iostream>
26-
#include <vector>
25+
#include <stdint.h> // for int64_t
26+
#include <iostream> // for basic_istream, char_traits, cin, basic_ostream
27+
#include <vector> // for vector
2728

2829
using std::cin;
2930
using std::cout;

others/palindrome_of_number.cpp

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -5,14 +5,14 @@
55
*
66
* This program cheats by using the STL library's std::reverse function.
77
*/
8-
#include <algorithm>
9-
#include <iostream>
8+
#include <algorithm> // for reverse
9+
#include <iostream> // for operator<<, basic_ostream, cout, basic_istream:...
10+
#include <string> // for basic_string, allocator, operator==, string
1011

1112
#ifdef _MSC_VER
1213
// Required to compile std::toString function using MSVC
13-
#include <string>
14+
#include <string> // for basic_string, allocator, operator==, string
1415
#else
15-
#include <cstring>
1616
#endif
1717

1818
/** Main function */

others/paranthesis_matching.cpp

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -5,11 +5,11 @@
55
* @note Implementation is C-type and does not utilize the C++ constructs
66
* @todo implement as a C++ class
77
*/
8-
#include <iostream>
8+
#include <iostream> // for operator<<, basic_ostream, cout, basic_istream, cin
9+
#include <string> // for basic_string, operator>>, string
910
#ifdef _MSC_VER
10-
#include <string> // Visual Studio C requires this include
11+
#include <string> // for basic_string, operator>>, string
1112
#else
12-
#include <cstring>
1313
#endif
1414

1515
/** check number */

others/postfix_evaluation.cpp

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -10,11 +10,13 @@
1010
* Evaluate the operator and push the result back to the stack
1111
* When the expression is ended, the number in the stack is the final answer
1212
*/
13+
#include <ctype.h> // for isdigit
1314
#include <algorithm> // for all_of
14-
#include <array> // for std::array
15+
#include <array> // for array
1516
#include <cassert> // for assert
16-
#include <iostream> // for io operations
17-
#include <string> // for stof
17+
#include <iostream> // for operator<<, basic_ostream, cout
18+
#include <string> // for basic_string, char_traits, string, stof
19+
#include <cstddef> // for size_t
1820

1921
/**
2022
* @namespace others

others/smallest_circle.cpp

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -7,9 +7,10 @@
77
* @see [other
88
* implementation](https://www.nayuki.io/page/smallest-enclosing-circle)
99
*/
10-
#include <cmath>
11-
#include <iostream>
12-
#include <vector>
10+
#include <cmath> // for sqrt, INFINITY
11+
#include <cstddef> // for size_t
12+
#include <iostream> // for basic_ostream, char_traits, cout, endl, operator<<
13+
#include <vector> // for vector
1314

1415
/** Define a point */
1516
struct Point {

0 commit comments

Comments
 (0)