i am using maps with a string in the template argument and i want to
find the difference of two maps into another amp for this i can use the
set_difference function but the arguments of the functions are
iterators.
can any one help me in this how to send the arguments in
to the function.
Thanks in advance.
Regards
Dilip 3 3626 sd*******@gmail.com wrote: i am using maps with a string in the template argument and i want to find the difference of two maps into another amp for this i can use the set_difference function but the arguments of the functions are iterators. can any one help me in this how to send the arguments in to the function.
set_difference( first.begin(), first.end(),
second.begin(), second.end(),
result.begin() );
--
Ian Collins.
this is the same i have done but i am getting an std:pair error asking
some operator should be over loaded . for this i am attaching the code
which i have used.....
#include <map>
#include <algorithm>
#include <functional> // For greater<int>( )
#include <iostream>
#include<vector>
using namespace std;
int main( )
{
map<char*,int> mapobj1;
map<char*,int> mapobj2;
map<char*,int> mapobj3;
mapobj1["one"] = 111;
mapobj1["two"] = 112;
mapobj1["three"] = 113;
mapobj1["four"] = 114;
mapobj2["five"] = 111;
mapobj2["two"] = 112;
mapobj2["three"] = 113;
mapobj2["four"] = 124;
set_difference(mapobj1.begin(),mapobj1.end(),mapob j2.begin(),mapobj2.end(),mapobj3.begin());
}
and the error is
error C2582: 'std::pair<char * const,int>' : 'operator =' function is
unavailable
Ian Collins wrote: sd*******@gmail.com wrote:
i am using maps with a string in the template argument and i want to find the difference of two maps into another amp for this i can use the set_difference function but the arguments of the functions are iterators. can any one help me in this how to send the arguments in to the function.
set_difference( first.begin(), first.end(), second.begin(), second.end(), result.begin() );
set_difference(first.begin(), first.end(),
second.begin(), second.end(),
back_inserter(result), pred);
where pred takes two pair objects and compares them appropriately. Since
result is a map, you can't overwrite its values, so you need back_inserter.
--
Pete Becker
Roundhouse Consulting, Ltd. This thread has been closed and replies have been disabled. Please start a new discussion. Similar topics |
by: Mike |
last post by:
Hello,
I have a few rather urgent questions that I hope someone can help with (I
need to figure this out prior to a meeting tomorrow.) First, a bit of
background: The company I work for is...
|
by: Sean |
last post by:
Have you ever wanted to add the great features inherent in Google Maps?
Here is how you do it.
==============
== STEP ONE ==
==============
Create a new MS Access form called frmGoogleMap....
|
by: Robin Tucker |
last post by:
I need to find some documents/research for my manager about VB.NET v C# use.
I've noticed that there are many more people using C# than VB.NET, that
there seem to be more job vacancies specifying...
|
by: KK |
last post by:
Hi,
I'm trying to come up with an efficient way to solve the following
problem.
Let A = { (1, b), (2, d), (3, a), (4, c) ,... }
B = { (1, d), (2, a), (3, e), (4, f),... }
where a,b,c......
|
by: sam_cit |
last post by:
Hi,
I came to read this particular statement with respect to reducing the
complexity of a code,
The usage of functional maps matrices instead of switch statements
should be considered.
I...
| |
by: tezheng |
last post by:
since std::map is some kind of std::set<std::pair>
can i use "set_difference" with std::map?
how to deal with the "operator =" of std::pair<T1, T2>, as T1 and T2 could
be various type.
|
by: Duncan Smith |
last post by:
Just before I have to implement my own.. I don't suppose the .NET
framework has an equivalent of the STL set_difference algorithm
yet...?
For e.g. If I have two containers: CompareSet={1,2,3}...
|
by: mahaveer |
last post by:
Hi ,
I am facing a strange problem with STL maps ,I am using gdb to debug my debug my code. Upto one point the number of entries in the map is shown as follows ,
$79 = {_M_t = {
_M_impl...
|
by: Ganesh J. Acharya |
last post by:
Hi there,
I want to redesign my website and make that look professional.
I made this about 6 years ago with very little knowledge of internet.
Today I am getting about 4000 visitors a day for...
|
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: 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...
|
by: isladogs |
last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM).
In this session, we are pleased to welcome a new...
|
by: conductexam |
last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and...
|
by: TSSRALBI |
last post by:
Hello
I'm a network technician in training and I need your help.
I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs.
The...
|
by: adsilva |
last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
| |
by: bsmnconsultancy |
last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence...
| |