From 8a8fd42383207c24bee7dbf8f502ceb339b0e63d Mon Sep 17 00:00:00 2001 From: realstealthninja <68815218+realstealthninja@users.noreply.github.com> Date: Fri, 13 Sep 2024 15:39:10 +0530 Subject: [PATCH] chore: use iwyu on others/**.cpp --- others/decimal_to_roman_numeral.cpp | 6 ++---- others/easter.cpp | 5 ++--- others/fast_integer_input.cpp | 3 ++- others/iterative_tree_traversals.cpp | 11 ++++++----- others/kadanes3.cpp | 12 +++++++----- others/kelvin_to_celsius.cpp | 7 ++++--- others/matrix_exponentiation.cpp | 5 +++-- others/palindrome_of_number.cpp | 8 ++++---- others/paranthesis_matching.cpp | 6 +++--- others/postfix_evaluation.cpp | 8 +++++--- others/smallest_circle.cpp | 7 ++++--- 11 files changed, 42 insertions(+), 36 deletions(-) diff --git a/others/decimal_to_roman_numeral.cpp b/others/decimal_to_roman_numeral.cpp index ad4aa32c5ad..c44f0af7ae7 100644 --- a/others/decimal_to_roman_numeral.cpp +++ b/others/decimal_to_roman_numeral.cpp @@ -4,10 +4,8 @@ * to both Lower case and Upper case Roman Numeral */ -#include -#include -#include -#include +#include // for char_traits, basic_ostream, operator<<, basic_os... +#include // 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. diff --git a/others/easter.cpp b/others/easter.cpp index 44b10335300..639ee18d365 100644 --- a/others/easter.cpp +++ b/others/easter.cpp @@ -17,9 +17,8 @@ * @author [AlternateWalls](https://github.com/AlternateWalls) */ -#include /// for assert -#include /// for integral typedefs -#include /// for IO operations +#include // for assert +#include // for uint64_t /* * @brief Contains information for Easter date diff --git a/others/fast_integer_input.cpp b/others/fast_integer_input.cpp index 87963c9ad88..a3fd4e87cf2 100644 --- a/others/fast_integer_input.cpp +++ b/others/fast_integer_input.cpp @@ -3,7 +3,8 @@ * @brief Read integers from stdin continuously as they are entered without * waiting for the `\n` character */ -#include +#include // for char_traits, basic_ostream, basic_ostream::opera... +#include // for getchar /** Function to read the number from stdin. The function reads input until a non * numeric character is entered. diff --git a/others/iterative_tree_traversals.cpp b/others/iterative_tree_traversals.cpp index 11fa1814688..2a97fbf3862 100644 --- a/others/iterative_tree_traversals.cpp +++ b/others/iterative_tree_traversals.cpp @@ -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 /// for `reverse` -#include /// for `assert` -#include /// for I/O operations -#include /// for `stack` -#include /// for `vector` +#include // for int64_t +#include // for reverse +#include // for assert +#include // for basic_ostream, operator<<, char_traits, cout, endl +#include // for stack +#include // for vector /** * @namespace others diff --git a/others/kadanes3.cpp b/others/kadanes3.cpp index 22c1119c858..b22cb96233b 100644 --- a/others/kadanes3.cpp +++ b/others/kadanes3.cpp @@ -14,11 +14,13 @@ * @author [Abhijeet Tiwari](https://github.com/thisabhijeet) */ -#include /// for std::array -#include /// for assert -#include /// for INT_MIN value -#include /// for integral typedefs -#include /// for IO operations +#include // for array +#include // for assert +#include // for INT_MIN +#include // for int64_t, uint64_t +#include // for operator<<, basic_ostream, cout +#include // for size_t + /** * @brief Utility function to check the current maximum number * \param arr input array diff --git a/others/kelvin_to_celsius.cpp b/others/kelvin_to_celsius.cpp index b5efdeddf78..149c19d48f7 100644 --- a/others/kelvin_to_celsius.cpp +++ b/others/kelvin_to_celsius.cpp @@ -17,9 +17,10 @@ * @author [David Leal](https://github.com/Panquesito7) */ -#include /// for assert -#include /// for std::abs -#include /// for IO operations +#include // for abs +#include // for assert +#include // for operator<<, basic_ostream, cout +#include // for invalid_argument /** * @namespace diff --git a/others/matrix_exponentiation.cpp b/others/matrix_exponentiation.cpp index bde7f521bbc..eec75fdfb90 100644 --- a/others/matrix_exponentiation.cpp +++ b/others/matrix_exponentiation.cpp @@ -22,8 +22,9 @@ Steps for Matrix Expo The first element of this matrix is the required result. */ -#include -#include +#include // for int64_t +#include // for basic_istream, char_traits, cin, basic_ostream +#include // for vector using std::cin; using std::cout; diff --git a/others/palindrome_of_number.cpp b/others/palindrome_of_number.cpp index 66401ff966a..241dcacf946 100644 --- a/others/palindrome_of_number.cpp +++ b/others/palindrome_of_number.cpp @@ -5,14 +5,14 @@ * * This program cheats by using the STL library's std::reverse function. */ -#include -#include +#include // for reverse +#include // for operator<<, basic_ostream, cout, basic_istream:... +#include // for basic_string, allocator, operator==, string #ifdef _MSC_VER // Required to compile std::toString function using MSVC -#include +#include // for basic_string, allocator, operator==, string #else -#include #endif /** Main function */ diff --git a/others/paranthesis_matching.cpp b/others/paranthesis_matching.cpp index d9c52c813a0..6456d9d522e 100644 --- a/others/paranthesis_matching.cpp +++ b/others/paranthesis_matching.cpp @@ -5,11 +5,11 @@ * @note Implementation is C-type and does not utilize the C++ constructs * @todo implement as a C++ class */ -#include +#include // for operator<<, basic_ostream, cout, basic_istream, cin +#include // for basic_string, operator>>, string #ifdef _MSC_VER -#include // Visual Studio C requires this include +#include // for basic_string, operator>>, string #else -#include #endif /** check number */ diff --git a/others/postfix_evaluation.cpp b/others/postfix_evaluation.cpp index 1ea77c6f8a5..1b45288db0e 100644 --- a/others/postfix_evaluation.cpp +++ b/others/postfix_evaluation.cpp @@ -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 // for isdigit #include // for all_of -#include // for std::array +#include // for array #include // for assert -#include // for io operations -#include // for stof +#include // for operator<<, basic_ostream, cout +#include // for basic_string, char_traits, string, stof +#include // for size_t /** * @namespace others diff --git a/others/smallest_circle.cpp b/others/smallest_circle.cpp index 9ee4353eb4e..0c5879d63b4 100644 --- a/others/smallest_circle.cpp +++ b/others/smallest_circle.cpp @@ -7,9 +7,10 @@ * @see [other * implementation](https://www.nayuki.io/page/smallest-enclosing-circle) */ -#include -#include -#include +#include // for sqrt, INFINITY +#include // for size_t +#include // for basic_ostream, char_traits, cout, endl, operator<< +#include // for vector /** Define a point */ struct Point {