J
jacob navia
Hi
I am learning C, and to improve my skills, I am rewriting the STL in C.
One of the functions I need to write is "Contains", that finds a sequence
in another container, for instance, an easy one is
strstr(source, sequence);
That finds a substring ("sequence") in "source".
I am writing bit strings now, and the problem is to find if a
sequence of bits is inside a larger sequence of bits.
Let's say the signature is
bool bit_strstr(char *source, size_t source_len,
char *sequence, size_t sequence_len);
The length is given in BITS.
The more I think about it, the more complicated this thing looks.
Of course I suppose that in this forum of C specialists many people
could give me good hints.
Thanks in advance.
A newbie
I am learning C, and to improve my skills, I am rewriting the STL in C.
One of the functions I need to write is "Contains", that finds a sequence
in another container, for instance, an easy one is
strstr(source, sequence);
That finds a substring ("sequence") in "source".
I am writing bit strings now, and the problem is to find if a
sequence of bits is inside a larger sequence of bits.
Let's say the signature is
bool bit_strstr(char *source, size_t source_len,
char *sequence, size_t sequence_len);
The length is given in BITS.
The more I think about it, the more complicated this thing looks.
Of course I suppose that in this forum of C specialists many people
could give me good hints.
Thanks in advance.
A newbie