@@ -32,7 +32,7 @@ namespace {
32
32
33
33
// Check using iterators
34
34
template <typename Container>
35
- void check_one_iter ( const Container &haystack, const std::string &needle, int expected ) {
35
+ void check_one_iter ( const Container &haystack, const std::string &needle, std:: ptrdiff_t expected ) {
36
36
typedef typename Container::const_iterator iter_type;
37
37
typedef typename std::pair<iter_type, iter_type> ret_type;
38
38
typedef std::string::const_iterator pattern_type;
@@ -53,7 +53,7 @@ namespace {
53
53
// iter_type it1r = ret1r.first;
54
54
// iter_type it2 = ret2.first;
55
55
// iter_type it3 = ret3.first;
56
- const int dist = ret1.first == hEnd ? -1 : std::distance ( hBeg, ret1.first );
56
+ const std:: ptrdiff_t dist = ret1.first == hEnd ? -1 : std::distance ( hBeg, ret1.first );
57
57
58
58
std::cout << " (Iterators) Pattern is " << needle.length () << " , haysstack is " << haystack.length () << " chars long; " << std::endl;
59
59
try {
@@ -97,7 +97,7 @@ namespace {
97
97
// Check using pointers
98
98
// We're assuming that the container implements contiguous storage here.
99
99
template <typename Container>
100
- void check_one_pointer ( const Container &haystack, const std::string &needle, int expected ) {
100
+ void check_one_pointer ( const Container &haystack, const std::string &needle, std:: ptrdiff_t expected ) {
101
101
typedef const typename Container::value_type *ptr_type;
102
102
typedef typename std::pair<ptr_type, ptr_type> ret_type;
103
103
@@ -110,7 +110,7 @@ namespace {
110
110
ret_type ret1 = ba::boyer_moore_search (hBeg, hEnd, nBeg, nEnd);
111
111
ret_type ret2 = ba::boyer_moore_horspool_search (hBeg, hEnd, nBeg, nEnd);
112
112
ret_type ret3 = ba::knuth_morris_pratt_search (hBeg, hEnd, nBeg, nEnd);
113
- const int dist = ret1.first == hEnd ? -1 : std::distance ( hBeg, ret1.first );
113
+ const std:: ptrdiff_t dist = ret1.first == hEnd ? -1 : std::distance ( hBeg, ret1.first );
114
114
115
115
std::cout << " (Pointers) Pattern is " << needle.length () << " , haysstack is " << haystack.length () << " chars long; " << std::endl;
116
116
try {
@@ -147,7 +147,7 @@ namespace {
147
147
148
148
// Check using objects
149
149
template <typename Container>
150
- void check_one_object ( const Container &haystack, const std::string &needle, int expected ) {
150
+ void check_one_object ( const Container &haystack, const std::string &needle, std:: ptrdiff_t expected ) {
151
151
typedef typename Container::const_iterator iter_type;
152
152
typedef typename std::pair<iter_type, iter_type> ret_type;
153
153
typedef std::string::const_iterator pattern_type;
@@ -169,7 +169,7 @@ namespace {
169
169
ret_type retr1r = bm_r (haystack);
170
170
ret_type ret2 = bmh (hBeg, hEnd);
171
171
ret_type ret3 = kmp (hBeg, hEnd);
172
- const int dist = ret1.first == hEnd ? -1 : std::distance ( hBeg, ret1.first );
172
+ const std:: ptrdiff_t dist = ret1.first == hEnd ? -1 : std::distance ( hBeg, ret1.first );
173
173
174
174
std::cout << " (Objects) Pattern is " << needle.length () << " , haysstack is " << haystack.length () << " chars long; " << std::endl;
175
175
try {
@@ -224,7 +224,7 @@ namespace {
224
224
225
225
226
226
template <typename Container>
227
- void check_one ( const Container &haystack, const std::string &needle, int expected ) {
227
+ void check_one ( const Container &haystack, const std::string &needle, std:: ptrdiff_t expected ) {
228
228
check_one_iter ( haystack, needle, expected );
229
229
check_one_pointer ( haystack, needle, expected );
230
230
check_one_object ( haystack, needle, expected );
0 commit comments