Skip to content

Commit f212745

Browse files
chore: use iwyu on strings/**.cpp
1 parent a290ae7 commit f212745

File tree

7 files changed

+39
-34
lines changed

7 files changed

+39
-34
lines changed

strings/boyer_moore.cpp

Lines changed: 7 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -42,12 +42,13 @@
4242
* @author [Stoycho Kyosev](https://github.com/stoychoX)
4343
*/
4444

45-
#include <cassert> /// for assert
46-
#include <climits> /// for CHAR_MAX macro
47-
#include <cstring> /// for strlen
48-
#include <iostream> /// for IO operations
49-
#include <string> /// for std::string
50-
#include <vector> /// for std::vector
45+
#include <cassert> // for assert
46+
#include <climits> // for CHAR_MAX
47+
#include <cstring> // for size_t, strlen
48+
#include <iostream> // for operator<<, basic_ostream, cout
49+
#include <string> // for basic_string, string
50+
#include <vector> // for vector
51+
#include <algorithm> // for max
5152

5253
#define APLHABET_SIZE CHAR_MAX ///< number of symbols in the alphabet we use
5354

strings/brute_force_string_searching.cpp

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -2,13 +2,14 @@
22
* @file
33
* @brief String pattern search - brute force
44
*/
5-
#include <iostream>
5+
#include <iostream> // for operator<<, basic_ostream, char_traits, cout
6+
#include <string> // for basic_string, operator==, string, to_string
67
#ifdef _MSC_VER
7-
#include <string> // use this for MS Visual C++
8+
#include <string> // for basic_string, operator==, string, to_string
89
#else
9-
#include <cstring>
10+
#include <cstring> // for size_t
1011
#endif
11-
#include <vector>
12+
#include <vector> // for vector, allocator
1213

1314
namespace string_search {
1415
/**

strings/horspool.cpp

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -4,9 +4,10 @@
44
* @author [Harry Kontakis](https://github.com/ckontakis)
55
*/
66

7-
#include <iostream>
8-
#include <unordered_map>
9-
#include <cassert>
7+
#include <unordered_map> // for unordered_map, _Node_iterator_base, operator!=
8+
#include <cassert> // for assert
9+
#include <string> // for basic_string, string
10+
#include <utility> // for pair, make_pair
1011

1112
/**
1213
* @namespace strings

strings/knuth_morris_pratt.cpp

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -13,10 +13,11 @@
1313
* @author [Yancey](https://github.com/Yancey2023)
1414
*/
1515

16-
#include <cassert> /// for assert
17-
#include <iostream> /// for IO operations
18-
#include <string> /// for std::string
19-
#include <vector> /// for std::vector
16+
#include <cassert> // for assert
17+
#include <cstddef> // for size_t
18+
#include <iostream> // for operator<<, basic_ostream, cout
19+
#include <string> // for basic_string, string
20+
#include <vector> // for vector
2021

2122
/**
2223
* @namespace string_search

strings/manacher_algorithm.cpp

Lines changed: 7 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -10,14 +10,15 @@
1010
* @author [Riti Kumari](https://github.com/riti2409)
1111
*/
1212

13-
#include <cassert> /// for assert
14-
#include <cstdint> /// for integral typedefs
15-
#include <iostream> /// for IO operations
16-
#include <vector> /// for std::vector STL
13+
#include <cassert> // for assert
14+
#include <cstdint> // for uint64_t
15+
#include <iostream> // for char_traits, basic_ostream, operator<<, cout, endl
16+
#include <vector> // for allocator, vector
17+
#include <algorithm> // for min
18+
#include <string> // for basic_string, operator==, operator+, string
1719
#ifdef _MSC_VER
18-
#include <string> /// for string (required for MS Visual C++)
20+
#include <string> // for basic_string, operator==, operator+, string
1921
#else
20-
#include <cstring> /// for string
2122
#endif
2223

2324
/**

strings/rabin_karp.cpp

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -4,13 +4,13 @@
44
* Algorithm](https://en.wikipedia.org/wiki/Rabin–Karp_algorithm) for finding a
55
* pattern within a piece of text with complexity O(n + m)
66
*/
7-
#include <cassert>
8-
#include <cmath>
9-
#include <iostream>
7+
#include <stdint.h> // for int64_t
8+
#include <cassert> // for assert
9+
#include <cmath> // for pow
10+
#include <string> // for basic_string, string
1011
#ifdef _MSC_VER
11-
#include <string> // use this for MS Visucal C++
12+
#include <string> // for basic_string, string
1213
#else
13-
#include <cstring>
1414
#endif
1515

1616
#define PRIME 5 ///< Prime modulus for hash functions

strings/z_function.cpp

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -11,15 +11,15 @@
1111
* @author [Ritika Gupta](https://github.com/RitikaGupta8734)
1212
*/
1313

14-
#include <cstdint> /// for integral typedefs
15-
#include <iostream> /// for IO operations
14+
#include <cstdint> // for uint64_t
15+
#include <algorithm> // for min
16+
#include <string> // for basic_string, string, operator+, char_traits
1617
#ifdef _MSC_VER
17-
#include <string> /// for string (use this for MS Visual C++)
18+
#include <string> // for basic_string, string, operator+, char_traits
1819
#else
19-
#include <cstring> /// for string
2020
#endif
21-
#include <cassert> /// for assert
22-
#include <vector> /// for std::vector
21+
#include <cassert> // for assert
22+
#include <vector> // for vector, allocator, operator==
2323

2424
/**
2525
* @brief Generate the Z-function for the inputted string.

0 commit comments

Comments
 (0)