Skip to content

Commit

Permalink
chore: use iwyu on others/**.cpp
Browse files Browse the repository at this point in the history
  • Loading branch information
realstealthninja committed Sep 13, 2024
1 parent eff2f44 commit 8a8fd42
Show file tree
Hide file tree
Showing 11 changed files with 42 additions and 36 deletions.
6 changes: 2 additions & 4 deletions others/decimal_to_roman_numeral.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -4,10 +4,8 @@
* to both Lower case and Upper case Roman Numeral
*/

#include <cmath>
#include <cstdio>
#include <cstring>
#include <iostream>
#include <iostream> // for char_traits, basic_ostream, operator<<, basic_os...
#include <string> // for basic_string, operator+, allocator, string, oper...

/** This functions fills a string with character c, n times and returns it
* @note This can probably be replace by `memcpy` function.
Expand Down
5 changes: 2 additions & 3 deletions others/easter.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -17,9 +17,8 @@
* @author [AlternateWalls](https://github.com/AlternateWalls)
*/

#include <cassert> /// for assert
#include <cstdint> /// for integral typedefs
#include <iostream> /// for IO operations
#include <cassert> // for assert
#include <cstdint> // for uint64_t

/*
* @brief Contains information for Easter date
Expand Down
3 changes: 2 additions & 1 deletion others/fast_integer_input.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,8 @@
* @brief Read integers from stdin continuously as they are entered without
* waiting for the `\n` character
*/
#include <iostream>
#include <iostream> // for char_traits, basic_ostream, basic_ostream::opera...
#include <cstdio> // for getchar

/** Function to read the number from stdin. The function reads input until a non
* numeric character is entered.
Expand Down
11 changes: 6 additions & 5 deletions others/iterative_tree_traversals.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -35,11 +35,12 @@
* set of steps until the Stack becomes empty or the current becomes NULL. And
* return the result array as the inorder traversal of a tree.
*/
#include <algorithm> /// for `reverse`
#include <cassert> /// for `assert`
#include <iostream> /// for I/O operations
#include <stack> /// for `stack`
#include <vector> /// for `vector`
#include <stdint.h> // for int64_t
#include <algorithm> // for reverse
#include <cassert> // for assert
#include <iostream> // for basic_ostream, operator<<, char_traits, cout, endl
#include <stack> // for stack
#include <vector> // for vector

/**
* @namespace others
Expand Down
12 changes: 7 additions & 5 deletions others/kadanes3.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -14,11 +14,13 @@
* @author [Abhijeet Tiwari](https://github.com/thisabhijeet)
*/

#include <array> /// for std::array
#include <cassert> /// for assert
#include <climits> /// for INT_MIN value
#include <cstdint> /// for integral typedefs
#include <iostream> /// for IO operations
#include <array> // for array
#include <cassert> // for assert
#include <climits> // for INT_MIN
#include <cstdint> // for int64_t, uint64_t
#include <iostream> // for operator<<, basic_ostream, cout
#include <cstddef> // for size_t

/**
* @brief Utility function to check the current maximum number
* \param arr input array
Expand Down
7 changes: 4 additions & 3 deletions others/kelvin_to_celsius.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -17,9 +17,10 @@
* @author [David Leal](https://github.com/Panquesito7)
*/

#include <cassert> /// for assert
#include <cmath> /// for std::abs
#include <iostream> /// for IO operations
#include <bits/std_abs.h> // for abs
#include <cassert> // for assert
#include <iostream> // for operator<<, basic_ostream, cout
#include <stdexcept> // for invalid_argument

/**
* @namespace
Expand Down
5 changes: 3 additions & 2 deletions others/matrix_exponentiation.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -22,8 +22,9 @@ Steps for Matrix Expo
The first element of this matrix is the required result.
*/

#include <iostream>
#include <vector>
#include <stdint.h> // for int64_t
#include <iostream> // for basic_istream, char_traits, cin, basic_ostream
#include <vector> // for vector

using std::cin;
using std::cout;
Expand Down
8 changes: 4 additions & 4 deletions others/palindrome_of_number.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -5,14 +5,14 @@
*
* This program cheats by using the STL library's std::reverse function.
*/
#include <algorithm>
#include <iostream>
#include <algorithm> // for reverse
#include <iostream> // for operator<<, basic_ostream, cout, basic_istream:...
#include <string> // for basic_string, allocator, operator==, string

#ifdef _MSC_VER
// Required to compile std::toString function using MSVC
#include <string>
#include <string> // for basic_string, allocator, operator==, string
#else
#include <cstring>
#endif

/** Main function */
Expand Down
6 changes: 3 additions & 3 deletions others/paranthesis_matching.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -5,11 +5,11 @@
* @note Implementation is C-type and does not utilize the C++ constructs
* @todo implement as a C++ class
*/
#include <iostream>
#include <iostream> // for operator<<, basic_ostream, cout, basic_istream, cin
#include <string> // for basic_string, operator>>, string
#ifdef _MSC_VER
#include <string> // Visual Studio C requires this include
#include <string> // for basic_string, operator>>, string
#else
#include <cstring>
#endif

/** check number */
Expand Down
8 changes: 5 additions & 3 deletions others/postfix_evaluation.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -10,11 +10,13 @@
* Evaluate the operator and push the result back to the stack
* When the expression is ended, the number in the stack is the final answer
*/
#include <ctype.h> // for isdigit
#include <algorithm> // for all_of
#include <array> // for std::array
#include <array> // for array
#include <cassert> // for assert
#include <iostream> // for io operations
#include <string> // for stof
#include <iostream> // for operator<<, basic_ostream, cout
#include <string> // for basic_string, char_traits, string, stof
#include <cstddef> // for size_t

/**
* @namespace others
Expand Down
7 changes: 4 additions & 3 deletions others/smallest_circle.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -7,9 +7,10 @@
* @see [other
* implementation](https://www.nayuki.io/page/smallest-enclosing-circle)
*/
#include <cmath>
#include <iostream>
#include <vector>
#include <cmath> // for sqrt, INFINITY
#include <cstddef> // for size_t
#include <iostream> // for basic_ostream, char_traits, cout, endl, operator<<
#include <vector> // for vector

/** Define a point */
struct Point {
Expand Down

0 comments on commit 8a8fd42

Please sign in to comment.