chore: use iwyu on others/**.cpp

This commit is contained in:
realstealthninja
2024-09-13 15:39:10 +05:30
parent eff2f44a50
commit 8a8fd42383
11 changed files with 42 additions and 36 deletions

View File

@@ -4,10 +4,8 @@
* to both Lower case and Upper case Roman Numeral * to both Lower case and Upper case Roman Numeral
*/ */
#include <cmath> #include <iostream> // for char_traits, basic_ostream, operator<<, basic_os...
#include <cstdio> #include <string> // for basic_string, operator+, allocator, string, oper...
#include <cstring>
#include <iostream>
/** This functions fills a string with character c, n times and returns it /** This functions fills a string with character c, n times and returns it
* @note This can probably be replace by `memcpy` function. * @note This can probably be replace by `memcpy` function.

View File

@@ -17,9 +17,8 @@
* @author [AlternateWalls](https://github.com/AlternateWalls) * @author [AlternateWalls](https://github.com/AlternateWalls)
*/ */
#include <cassert> /// for assert #include <cassert> // for assert
#include <cstdint> /// for integral typedefs #include <cstdint> // for uint64_t
#include <iostream> /// for IO operations
/* /*
* @brief Contains information for Easter date * @brief Contains information for Easter date

View File

@@ -3,7 +3,8 @@
* @brief Read integers from stdin continuously as they are entered without * @brief Read integers from stdin continuously as they are entered without
* waiting for the `\n` character * 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 /** Function to read the number from stdin. The function reads input until a non
* numeric character is entered. * numeric character is entered.

View File

@@ -35,11 +35,12 @@
* set of steps until the Stack becomes empty or the current becomes NULL. And * 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. * return the result array as the inorder traversal of a tree.
*/ */
#include <algorithm> /// for `reverse` #include <stdint.h> // for int64_t
#include <cassert> /// for `assert` #include <algorithm> // for reverse
#include <iostream> /// for I/O operations #include <cassert> // for assert
#include <stack> /// for `stack` #include <iostream> // for basic_ostream, operator<<, char_traits, cout, endl
#include <vector> /// for `vector` #include <stack> // for stack
#include <vector> // for vector
/** /**
* @namespace others * @namespace others

View File

@@ -14,11 +14,13 @@
* @author [Abhijeet Tiwari](https://github.com/thisabhijeet) * @author [Abhijeet Tiwari](https://github.com/thisabhijeet)
*/ */
#include <array> /// for std::array #include <array> // for array
#include <cassert> /// for assert #include <cassert> // for assert
#include <climits> /// for INT_MIN value #include <climits> // for INT_MIN
#include <cstdint> /// for integral typedefs #include <cstdint> // for int64_t, uint64_t
#include <iostream> /// for IO operations #include <iostream> // for operator<<, basic_ostream, cout
#include <cstddef> // for size_t
/** /**
* @brief Utility function to check the current maximum number * @brief Utility function to check the current maximum number
* \param arr input array * \param arr input array

View File

@@ -17,9 +17,10 @@
* @author [David Leal](https://github.com/Panquesito7) * @author [David Leal](https://github.com/Panquesito7)
*/ */
#include <cassert> /// for assert #include <bits/std_abs.h> // for abs
#include <cmath> /// for std::abs #include <cassert> // for assert
#include <iostream> /// for IO operations #include <iostream> // for operator<<, basic_ostream, cout
#include <stdexcept> // for invalid_argument
/** /**
* @namespace * @namespace

View File

@@ -22,8 +22,9 @@ Steps for Matrix Expo
The first element of this matrix is the required result. The first element of this matrix is the required result.
*/ */
#include <iostream> #include <stdint.h> // for int64_t
#include <vector> #include <iostream> // for basic_istream, char_traits, cin, basic_ostream
#include <vector> // for vector
using std::cin; using std::cin;
using std::cout; using std::cout;

View File

@@ -5,14 +5,14 @@
* *
* This program cheats by using the STL library's std::reverse function. * This program cheats by using the STL library's std::reverse function.
*/ */
#include <algorithm> #include <algorithm> // for reverse
#include <iostream> #include <iostream> // for operator<<, basic_ostream, cout, basic_istream:...
#include <string> // for basic_string, allocator, operator==, string
#ifdef _MSC_VER #ifdef _MSC_VER
// Required to compile std::toString function using MSVC // Required to compile std::toString function using MSVC
#include <string> #include <string> // for basic_string, allocator, operator==, string
#else #else
#include <cstring>
#endif #endif
/** Main function */ /** Main function */

View File

@@ -5,11 +5,11 @@
* @note Implementation is C-type and does not utilize the C++ constructs * @note Implementation is C-type and does not utilize the C++ constructs
* @todo implement as a C++ class * @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 #ifdef _MSC_VER
#include <string> // Visual Studio C requires this include #include <string> // for basic_string, operator>>, string
#else #else
#include <cstring>
#endif #endif
/** check number */ /** check number */

View File

@@ -10,11 +10,13 @@
* Evaluate the operator and push the result back to the stack * 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 * 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 <algorithm> // for all_of
#include <array> // for std::array #include <array> // for array
#include <cassert> // for assert #include <cassert> // for assert
#include <iostream> // for io operations #include <iostream> // for operator<<, basic_ostream, cout
#include <string> // for stof #include <string> // for basic_string, char_traits, string, stof
#include <cstddef> // for size_t
/** /**
* @namespace others * @namespace others

View File

@@ -7,9 +7,10 @@
* @see [other * @see [other
* implementation](https://www.nayuki.io/page/smallest-enclosing-circle) * implementation](https://www.nayuki.io/page/smallest-enclosing-circle)
*/ */
#include <cmath> #include <cmath> // for sqrt, INFINITY
#include <iostream> #include <cstddef> // for size_t
#include <vector> #include <iostream> // for basic_ostream, char_traits, cout, endl, operator<<
#include <vector> // for vector
/** Define a point */ /** Define a point */
struct Point { struct Point {