use std::copy for transformation from vector to char*

git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@293 a592a061-630c-0410-9148-cb99ea01b6c8
This commit is contained in:
Lars Gullik Bjønnes 1999-11-05 06:49:59 +00:00
parent 65e9b99a59
commit 47526150a1
2 changed files with 5 additions and 10 deletions

View File

@ -1,5 +1,8 @@
1999-11-05 Lars Gullik Bjønnes <larsbj@lyx.org>
* src/text2.C (InsertStringB): use std::copy
(InsertStringA): use std::copy
* src/bufferlist.C: use a vector to store the buffers in. This is
an internal change and should not affect any other thing.

View File

@ -2505,11 +2505,7 @@ bool LyXText::SearchBackward(char const * string)
void LyXText::InsertStringA(LyXParagraph::TextContainer const & text)
{
char * str = new char[text.size() + 1];
// shoudl use std::copy or something
for (LyXParagraph::size_type i = 0; i < static_cast<int>(text.size());
++i) {
str[i] = text[i];
}
copy(text.begin(), text.end(), str);
str[text.size()] = '\0';
InsertStringA(str);
delete [] str;
@ -2664,11 +2660,7 @@ void LyXText::InsertStringA(char const * str)
void LyXText::InsertStringB(LyXParagraph::TextContainer const & text)
{
char * str = new char[text.size() + 1];
// should use std::copy or something
for(LyXParagraph::size_type i = 0; i < static_cast<int>(text.size());
++i) {
str[i] = text[i];
}
copy(text.begin(), text.end(), str);
str[text.size()] = '\0';
InsertStringB(str);
delete [] str;