Wave/flex_string and replace< InputIterator > bug

Hi all, I am implementing test cases to validate the implementation of my fixed_string class and basic_string_impl (based on flex_string) and noticed a defect in the implementation of: template< typename InputIterator > inline string_type & replace( iterator i1, iterator i2, InputIterator j1, InputIterator j2 ); It handles the Integral case fine, but when the InputIterators are actually iterators, it asserts false, where the standard dictates it returns: replace( i1, i2, basic_string( j1, j2 )); or equivalent behaviour, e.g. in the implementation I'm using: replace( i1, i2, std::distance( j1, j2 ), char_type()); std::copy( j1, j2, i1 ); Is there any specific reason for this, or is it an implementation bug? Regards, Reece _________________________________________________________________ Want to block unwanted pop-ups? Download the free MSN Toolbar now! http://toolbar.msn.co.uk/

Reece Dunn wrote:
I am implementing test cases to validate the implementation of my fixed_string class and basic_string_impl (based on flex_string) and noticed a defect in the implementation of:
template< typename InputIterator > inline string_type & replace( iterator i1, iterator i2, InputIterator j1, InputIterator j2 );
It handles the Integral case fine, but when the InputIterators are actually iterators, it asserts false, where the standard dictates it returns:
replace( i1, i2, basic_string( j1, j2 ));
or equivalent behaviour, e.g. in the implementation I'm using:
replace( i1, i2, std::distance( j1, j2 ), char_type()); std::copy( j1, j2, i1 );
Is there any specific reason for this, or is it an implementation bug?
It's simply not implemented yet, I guess. Andrei (Alexandrescu) inserted an assertion to draw the attention of the user to this fact. You may contact him directly, maybe it's implemented already (the flex_string version contained in Wave is a bit dated). Regards Hartmut

"Hartmut Kaiser" <hartmutkaiser@t-online.de> wrote in message news:1BWfiC-1whMxs0@afwd00.sul.t-online.com...
Reece Dunn wrote:
I am implementing test cases to validate the implementation of my fixed_string class and basic_string_impl (based on flex_string) and noticed a defect in the implementation of:
template< typename InputIterator > inline string_type & replace( iterator i1, iterator i2, InputIterator j1, InputIterator j2 );
It handles the Integral case fine, but when the InputIterators are actually iterators, it asserts false, where the standard dictates it returns:
replace( i1, i2, basic_string( j1, j2 ));
or equivalent behaviour, e.g. in the implementation I'm using:
replace( i1, i2, std::distance( j1, j2 ), char_type()); std::copy( j1, j2, i1 );
Is there any specific reason for this, or is it an implementation bug?
It's simply not implemented yet, I guess. Andrei (Alexandrescu) inserted
an
assertion to draw the attention of the user to this fact. You may contact him directly, maybe it's implemented already (the flex_string version contained in Wave is a bit dated).
I don't have much time to browse boost's newsgroup nowadays, but I saw this post by chance. Could you please take a look at http://moderncppdesign.com/code and see how that implementation of flex_string works? Thanks! Andrei
participants (3)
-
Andrei Alexandrescu (See Website for Email)
-
Hartmut Kaiser
-
Reece Dunn