Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > comp.lang.c++ > #11460 > unrolled thread

My Custom Longest Common Substring which searches for a pattern fails on certain strings

Started byAlec Taylor <alec.taylor6@gmail.com>
First post2011-11-14 09:38 -0800
Last post2011-11-14 10:07 -0800
Articles 3 — 2 participants

Back to article view | Back to comp.lang.c++


Contents

  My Custom Longest Common Substring which searches for a pattern fails on certain strings Alec Taylor <alec.taylor6@gmail.com> - 2011-11-14 09:38 -0800
    Re: My Custom Longest Common Substring which searches for a pattern fails on certain strings Leigh Johnston <leigh@i42.co.uk> - 2011-11-14 17:48 +0000
      Re: My Custom Longest Common Substring which searches for a pattern fails on certain strings Alec Taylor <alec.taylor6@gmail.com> - 2011-11-14 10:07 -0800

#11460 — My Custom Longest Common Substring which searches for a pattern fails on certain strings

FromAlec Taylor <alec.taylor6@gmail.com>
Date2011-11-14 09:38 -0800
SubjectMy Custom Longest Common Substring which searches for a pattern fails on certain strings
Message-ID<10442033.560.1321292318166.JavaMail.geo-discussion-forums@prlm15>
Good morning,

Unfortunately my Custom Longest Common Substring function which includes a number failed when a word appears before the number.

This one works: http://ideone.com/SSoTe

This one fails: http://ideone.com/9xkB5

The second should have the same output as the first.

Can you point out the bug in my code?

Thanks for all suggestions,

Alec Taylor 

[toc] | [next] | [standalone]


#11462

FromLeigh Johnston <leigh@i42.co.uk>
Date2011-11-14 17:48 +0000
Message-ID<X5qdnfxcSaPqyVzTnZ2dnUVZ8gidnZ2d@giganews.com>
In reply to#11460
On 14/11/2011 17:38, Alec Taylor wrote:
> Good morning,
>
> Unfortunately my Custom Longest Common Substring function which includes a number failed when a word appears before the number.
>
> This one works: http://ideone.com/SSoTe
>
> This one fails: http://ideone.com/9xkB5
>
> The second should have the same output as the first.
>
> Can you point out the bug in my code?
>
> Thanks for all suggestions,

As I said on IRC ".second.first.second" is so lame; your use of 
std::pair is gratuitous; write a class/struct instead giving the strings 
sensible names so that a human can parse your code and understand wtf is 
going on.

Also posting pastebin URLs on Usenet newsgroups is a bad idea as 
pastebin posts tend not to be permanent (unlike newsgroup posts).

HTH.

/Leigh

[toc] | [prev] | [next] | [standalone]


#11465

FromAlec Taylor <alec.taylor6@gmail.com>
Date2011-11-14 10:07 -0800
Message-ID<21111291.499.1321294045018.JavaMail.geo-discussion-forums@prnv30>
In reply to#11462
Okay, got it to work: http://ideone.com/9xkB5

[toc] | [prev] | [standalone]


Back to top | Article view | comp.lang.c++


csiph-web