Click here to Skip to main content
15,914,160 members
Home / Discussions / ATL / WTL / STL
   

ATL / WTL / STL

 
GeneralATL7 probs with enum in interface Pin
Rainer Mangold23-Feb-03 11:17
Rainer Mangold23-Feb-03 11:17 
GeneralRe: ATL7 probs with enum in interface Pin
AlexO24-Feb-03 2:39
AlexO24-Feb-03 2:39 
GeneralI guess this should be a simple one... Pin
User 988522-Feb-03 5:13
User 988522-Feb-03 5:13 
GeneralRe: I guess this should be a simple one... Pin
Pavel Klocek23-Feb-03 1:35
Pavel Klocek23-Feb-03 1:35 
QuestionHow to send mail in ATL? Pin
shanksprasad20-Feb-03 23:07
shanksprasad20-Feb-03 23:07 
AnswerRe: How to send mail in ATL? Pin
Giles20-Feb-03 23:31
Giles20-Feb-03 23:31 
GeneralRe: How to send mail in ATL? Pin
Anders Molin24-Feb-03 13:05
professionalAnders Molin24-Feb-03 13:05 
GeneralQuestion about ambiguous overloading operator >> in STL. Pin
George220-Feb-03 21:24
George220-Feb-03 21:24 
Hi, everyone!


Please look at the following codes. I think I overload the
operator clearly. But compiler still say that it is ambiguous.
Here are the source codes and related error message.


Source:

--------
#include <iostream>
#include <map>
#include <set>
#include <string>

using namespace std;

class employee_data {
public:
employee_data() : name (""), skill(0), salary(0) {}
employee_data(string n, int s, long sa) :
name (n), skill (s), salary (sa) {}

string name;
int skill;
long salary;

friend ostream& operator<< (ostream& os, const employee_data& e);
};

ostream& operator<< (ostream& os, const employee_data& e) {
os << "employee: " << e.name << " " << e.skill << " " << e.salary;
return os;
}

class employee {
public:
employee (int i, employee_data e) :
identification_code (i), description (e) {}

int identification_code; // key expression to identify an employee
employee_data description;

bool operator< (const employee& e) const {
return identification_code < e.identification_code; }
};

int main()
{
set <employee, less<employee> > employee_set;

multiset <employee, less<employee> > employee_multiset;

map <int, employee_data, less<int> > employee_map;
multimap <int, employee_data, less<int> > employee_multimap;

employee_data ed1 ("john", 1, 5000);
employee_data ed2 ("tom", 5, 2000);
employee_data ed3 ("mary", 2, 3000);

employee e1 (1010, ed1);
employee e2 (2020, ed2);
employee e3 (3030, ed3);

pair<const int, employee_data> a[2] = { make_pair (2020, ed2),
make_pair (3030, ed3) };
employee_map.insert (&a[0], &a[2]);

employee_data d = employee_map[2020];
cout << d << endl;


return 1;
}
--------


Error message:
--------
C:\Program Files\Microsoft Visual Studio\MyProjects\testMap1\testMap1.cpp(86) : error C2593: 'operator <<' is ambiguous
--------


Thanks in advance,
George
GeneralRe: Question about ambiguous overloading operator >> in STL. Pin
George220-Feb-03 23:14
George220-Feb-03 23:14 
GeneralRe: Question about ambiguous overloading operator >> in STL. Pin
Tim Smith21-Feb-03 2:23
Tim Smith21-Feb-03 2:23 
GeneralRe: Question about ambiguous overloading operator >> in STL. Pin
George221-Feb-03 2:42
George221-Feb-03 2:42 
GeneralRe: Question about ambiguous overloading operator >> in STL. Pin
Joaquín M López Muñoz21-Feb-03 2:55
Joaquín M López Muñoz21-Feb-03 2:55 
GeneralRe: Question about ambiguous overloading operator >> in STL. Pin
George221-Feb-03 3:08
George221-Feb-03 3:08 
GeneralPassing string to ATL interface function Pin
Shah Shehpori20-Feb-03 19:52
sussShah Shehpori20-Feb-03 19:52 
GeneralRe: Passing string to ATL interface function Pin
Steve S21-Feb-03 1:51
Steve S21-Feb-03 1:51 
QuestionVC6.0 map.insert method is not STL standard? Pin
George220-Feb-03 18:11
George220-Feb-03 18:11 
AnswerRe: VC6.0 map.insert method is not STL standard? Pin
Joaquín M López Muñoz20-Feb-03 20:42
Joaquín M López Muñoz20-Feb-03 20:42 
GeneralRe: VC6.0 map.insert method is not STL standard? Pin
George220-Feb-03 20:50
George220-Feb-03 20:50 
GeneralMy solution is correct? (about funtion parameter in STL) Pin
George220-Feb-03 16:27
George220-Feb-03 16:27 
GeneralRe: My solution is correct? (about funtion parameter in STL) Pin
Christian Graus20-Feb-03 16:52
protectorChristian Graus20-Feb-03 16:52 
GeneralRe: My solution is correct? (about funtion parameter in STL) Pin
George220-Feb-03 17:23
George220-Feb-03 17:23 
GeneralQuestion about overloading operator >> in STL. Pin
George220-Feb-03 3:01
George220-Feb-03 3:01 
GeneralRe: Question about overloading operator >> in STL. Pin
Joaquín M López Muñoz20-Feb-03 6:44
Joaquín M López Muñoz20-Feb-03 6:44 
GeneralRe: Question about overloading operator >> in STL. Pin
George220-Feb-03 15:52
George220-Feb-03 15:52 
GeneralNeed a hint on implementing path picker WTL control. Pin
Ilushka20-Feb-03 2:40
Ilushka20-Feb-03 2:40 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.