@@ -32,7 +32,7 @@ namespace {
3232
3333// Check using iterators
3434 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 ) {
3636 typedef typename Container::const_iterator iter_type;
3737 typedef typename std::pair<iter_type, iter_type> ret_type;
3838 typedef std::string::const_iterator pattern_type;
@@ -53,7 +53,7 @@ namespace {
5353// iter_type it1r = ret1r.first;
5454// iter_type it2 = ret2.first;
5555// 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 );
5757
5858 std::cout << " (Iterators) Pattern is " << needle.length () << " , haysstack is " << haystack.length () << " chars long; " << std::endl;
5959 try {
@@ -97,7 +97,7 @@ namespace {
9797// Check using pointers
9898// We're assuming that the container implements contiguous storage here.
9999 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 ) {
101101 typedef const typename Container::value_type *ptr_type;
102102 typedef typename std::pair<ptr_type, ptr_type> ret_type;
103103
@@ -110,7 +110,7 @@ namespace {
110110 ret_type ret1 = ba::boyer_moore_search (hBeg, hEnd, nBeg, nEnd);
111111 ret_type ret2 = ba::boyer_moore_horspool_search (hBeg, hEnd, nBeg, nEnd);
112112 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 );
114114
115115 std::cout << " (Pointers) Pattern is " << needle.length () << " , haysstack is " << haystack.length () << " chars long; " << std::endl;
116116 try {
@@ -147,7 +147,7 @@ namespace {
147147
148148// Check using objects
149149 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 ) {
151151 typedef typename Container::const_iterator iter_type;
152152 typedef typename std::pair<iter_type, iter_type> ret_type;
153153 typedef std::string::const_iterator pattern_type;
@@ -169,7 +169,7 @@ namespace {
169169 ret_type retr1r = bm_r (haystack);
170170 ret_type ret2 = bmh (hBeg, hEnd);
171171 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 );
173173
174174 std::cout << " (Objects) Pattern is " << needle.length () << " , haysstack is " << haystack.length () << " chars long; " << std::endl;
175175 try {
@@ -224,7 +224,7 @@ namespace {
224224
225225
226226 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 ) {
228228 check_one_iter ( haystack, needle, expected );
229229 check_one_pointer ( haystack, needle, expected );
230230 check_one_object ( haystack, needle, expected );
0 commit comments