Though implementation problem

This is a discussion on Though implementation problem within the C++ Programming forums, part of the General Programming Boards category; Originally Posted by Elysia
No, it's not the interface per se that's the problem, but the internal mechanisms.
And it ...

Replace is the public interface of the free function that you should call to do the work.
Then they will wrap ReplaceInternal that will do the actual replacing.
But ReplaceInternal shouldn't be called directly because 1) it takes a bool that should not be passed directly and 2) it has only one version - the one that takes a range. Therefore ReplaceInternal should be hidden away from prying eyes, but since it's free it cannot.

It has become an accepted convention to put implementation details in a sub-namespace called detail. Users know to stay away from those.

If I understand you right, then you probably want to replace "This" with "That" in following sentence:
"This is a tree."
Right?

So if in your example Replace(what, with, start, end):
what - "This"
with - "That"
Then how will your generic solution compare if the sequence to be replaced is actually equal to "This", which is not a single word, but, generically speaking, a sequence of elements.

How will you compare such sequence within the destination sequence, which needs the replacement!?!

I am speaking generically! Reusable ofcourse!!

Other wise forget the bling-bling-blah!
And, just think, how to replace words within a string, in simple yet efficient manner!

If you only want to perform and search and replace within a specific region.However, there will also be overloads that doesn't take start or begin (will perform search & replace on whole string).

Extra features never hurt! Make them some default arguments! So I need not concern myself with them!

If I understand you right, then you probably want to replace "This" with "That" in following sentence:
"This is a tree."
Right?

So if in your example Replace(what, with, start, end):
what - "This"
with - "That"
Then how will your generic solution compare if the sequence to be replaced is actually equal to "This", which is not a single word, but, generically speaking, a sequence of elements.

How will you compare such sequence within the destination sequence, which needs the replacement!?!

I am speaking generically! Reusable ofcourse!!

Other wise forget the bling-bling-blah!
And, just think, how to replace words within a string, in simple yet efficient manner!

Err hello? How it a problem to replace a string? We've done that a hundred times and that implementation is already done. A long time ago.

Extra features never hurt! Make them some default arguments! So I need not concern myself with them!

Yes, also unfortunately, the C++ standard forbids initializing default arguments with a non-static value (I think I'm getting this right), and also references must be initialized with a const value.

Well replacing (as in the real meaning), is easy, but only if the "with" is equal in length to "what".
Otherwise see this string:
CStringEx str("Name: {1}\nOver draft {2}\nInterest {3}\n");
and this Replace usage:

It would work with any given type, but it only works on a element basis.
You can't expect a sequence of values to be treated as one value or element.
Boost isn't letting me define a proper return type for my operators -/+...
After that... well... Well, after that's over and done with, I guess major testing is due.
Then I could release an alpha.