Hello,
The C++ reference says the return result of "copy" is an output
iterator. I'm wondering how I can assign the returned iterator to
some other iterator. I tried
int main(){
string s("abcdefg");
vector<charv;
vector<char>::iterator k = copy(s.begin(),s.end(),back_inserter(v));
return 0;
}
because for "copy", the returned iterator should point to the last
element in the destination range. However, the code above couldn't
compile. What's my problem? Moreover, does "copy" return the iterator
pointing to the last element or one past the last element?
As for "remove_copy", does it return the iterator pointing to one past
the last element? How can I assign the return result to some
iterator? I think it should be the same as for "copy".
Thanks,
Jess 3 1927
On Jul 6, 10:51 am, Jess <w...@hotmail.comwrote:
Hello,
The C++ reference says the return result of "copy" is an output
iterator. I'm wondering how I can assign the returned iterator to
some other iterator. I tried
int main(){
string s("abcdefg");
vector<charv;
vector<char>::iterator k = copy(s.begin(),s.end(),back_inserter(v));
copy will return the back_insert_iterator
std::back_insert_iterator<std::vector<char k = copy(s.begin(),
s.end(), back_insertor(v));
Moreover, does "copy" return the iterator
pointing to the last element or one past the last element?
last element
>
As for "remove_copy", does it return the iterator pointing to one past
the last element?
no. last element.
How can I assign the return result to some
iterator? I think it should be the same as for "copy".
Yeah.
Thanks,
Jess
"Neelesh Bodas" <ne***********@gmail.comwrote in message
news:11**********************@a26g2000pre.googlegr oups.com...
> Moreover, does "copy" return the iterator pointing to the last element or one past the last element?
last element
I think not. The typical implementation does something similar to this:
template<class In, class Out>
Out copy(In begin, In end, Out dest)
{
while (begin != end)
*out++ = *begin++;
return out;
}
so what it returns is an iterator referring to the point after the last
element of the result.
Thanks for the replies!
Jess This thread has been closed and replies have been disabled. Please start a new discussion. Similar topics
by: Chagh |
last post by:
hi all,
how can we have a select satement in an SP?(i want to return a result
set from the SP). i want to migrate from SQL Server to MySQL and i
don’t know what to do with these SPs.
it can be...
|
by: uthuras |
last post by:
hi all,
One of my customer having warehouse database running on DB2. Recently
when they execute the following query at db2 command line
the exepected result take ages before return result
...
|
by: Florian |
last post by:
Hi Uthuras,
it would be helpful to see the access path. However sometimes it makes
sense to rewrite a "not in" to gain better access paths:
I tried the following - hopefully similar -...
|
by: Lacka |
last post by:
Hi,
If I have a stored procedure in my database, that has two parameters (say @a
nvarchar(50) and @b int), and returns the result of a SELECT statement
(returns a result set), how can I set up...
|
by: Bernard Lebel |
last post by:
Hello,
I'm stumbled at a serious problem, and quite frankly getting
desparate. This is a rather long-winded one so I'll try to get
straight to the point.
I have this Python program, that...
|
by: Steven |
last post by:
Hello,
In English version of Windows Vista, run a command (for example
icacls.exe) as administrator from Command Prompt, i can determine if the
command successfully executed base on the return...
|
by: Big Moxy |
last post by:
Can someone please advise me on how to implement this?
The data entered by a user on form 1 on page1.php is posted to
delete.php to remove that row from a table. After the SQL operation
the user...
|
by: CAG |
last post by:
Hi,
In my application, i'm storing sql query as value of table field in database.
Like in my NewHireEmployee table, value of JoinDateQuery field can be (select hiredate from employeeInfo) or...
|
by: HowHow |
last post by:
Using Access 2000, normally query returns result horizontally. Is there any way to set the query to return result vertically?
For example, my query shown the result as below:
Heading ...
|
by: ryjfgjl |
last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
|
by: emmanuelkatto |
last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud.
Please let me know.
Thanks!
Emmanuel
|
by: Sonnysonu |
last post by:
This is the data of csv file
1 2 3
1 2 3
1 2 3
1 2 3
2 3
2 3
3
the lengths should be different i have to store the data by column-wise with in the specific length.
suppose the i have to...
|
by: Hystou |
last post by:
There are some requirements for setting up RAID:
1. The motherboard and BIOS support RAID configuration.
2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
|
by: Hystou |
last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
|
by: Oralloy |
last post by:
Hello folks,
I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>".
The problem is that using the GNU compilers,...
|
by: jinu1996 |
last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
|
by: Hystou |
last post by:
Overview:
Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
|
by: tracyyun |
last post by:
Dear forum friends,
With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
| | |