Click here to Skip to main content
15,899,679 members
Home / Discussions / C / C++ / MFC
   

C / C++ / MFC

 
AnswerRe: MFC application using different Windows theme Pin
transoft8-Oct-09 11:36
transoft8-Oct-09 11:36 
QuestionIs there any way ,that i could access to special icons like "My Document" Folder icon or "Contacts" Folder Icon or even "My Computer" Icon of the operating system. Pin
A&Ms8-Oct-09 8:37
A&Ms8-Oct-09 8:37 
AnswerRe: Is there any way ,that i could access to special icons like "My Document" Folder icon or "Contacts" Folder Icon or even "My Computer" Icon of the operating system. Pin
Code-o-mat8-Oct-09 9:38
Code-o-mat8-Oct-09 9:38 
GeneralRe: Is there any way ,that i could access to special icons like "My Document" Folder icon or "Contacts" Folder Icon or even "My Computer" Icon of the operating system. Pin
A&Ms8-Oct-09 20:43
A&Ms8-Oct-09 20:43 
GeneralRe: Is there any way ,that i could access to special icons like "My Document" Folder icon or "Contacts" Folder Icon or even "My Computer" Icon of the operating system. Pin
Code-o-mat8-Oct-09 22:26
Code-o-mat8-Oct-09 22:26 
GeneralRe: Is there any way ,that i could access to special icons like "My Document" Folder icon or "Contacts" Folder Icon or even "My Computer" Icon of the operating system. Pin
A&Ms9-Oct-09 8:27
A&Ms9-Oct-09 8:27 
GeneralRe: Is there any way ,that i could access to special icons like "My Document" Folder icon or "Contacts" Folder Icon or even "My Computer" Icon of the operating system. Pin
Code-o-mat9-Oct-09 8:48
Code-o-mat9-Oct-09 8:48 
Questionoverloading left-shift operator to output to stringstream Pin
Sauce!8-Oct-09 6:25
Sauce!8-Oct-09 6:25 
I'm sure you all know about how to overload the left-shift operator for an std::ostream in order to output the contents of a class's members using the familiar cout syntax. A refresher for those who dont;

inline friend std::ostream &operator <<(std::ostream &os, const myClass &rhs)
{
	os << rhs.someMember;
	
	return os;
}


And of course, to use this operator we simply do the following;

myClass foo;
std::cout << foo;


Now, I'm working with stringstreams and need to be able to output in a similar manner, however I can't for the life of me figure out how to get the same behaviour out of stringstreams. The code I'm trying simply won't work.

inline friend std::stringstream &operator <<(std::stringstream &ss, const myClass &rhs)
{
	ss << rhs.someMember;

	return ss;
}


I then do the following;

myClass foo;
std::stringstream ss;
ss << foo;


This gives me the compiler error (when attempting to use said operator) - error C2679: binary '<<' : no operator found which takes a right-hand operand of type 'myClass' (or there is no acceptable conversion)

If that's not the correct syntax, then what is? Is it possible to do at all?
AnswerRe: overloading left-shift operator to output to stringstream Pin
David Crow8-Oct-09 7:38
David Crow8-Oct-09 7:38 
GeneralRe: overloading left-shift operator to output to stringstream [modified] Pin
Sauce!8-Oct-09 17:18
Sauce!8-Oct-09 17:18 
AnswerRe: overloading left-shift operator to output to stringstream Pin
David Crow9-Oct-09 4:42
David Crow9-Oct-09 4:42 
Questiondata access Pin
thangvel8-Oct-09 6:14
thangvel8-Oct-09 6:14 
AnswerRe: data access Pin
Rajesh R Subramanian8-Oct-09 6:37
professionalRajesh R Subramanian8-Oct-09 6:37 
GeneralRe: data access Pin
kilt8-Oct-09 23:18
kilt8-Oct-09 23:18 
QuestionUsing TCHAR and char array Pin
dipuks8-Oct-09 6:09
dipuks8-Oct-09 6:09 
AnswerRe: Using TCHAR and char array [modified] Pin
CPallini8-Oct-09 6:14
mveCPallini8-Oct-09 6:14 
GeneralRe: Using TCHAR and char array Pin
Richard MacCutchan8-Oct-09 6:25
mveRichard MacCutchan8-Oct-09 6:25 
GeneralRe: Using TCHAR and char array Pin
dipuks8-Oct-09 6:43
dipuks8-Oct-09 6:43 
GeneralRe: Using TCHAR and char array Pin
CPallini8-Oct-09 7:50
mveCPallini8-Oct-09 7:50 
GeneralRe: Using TCHAR and char array Pin
Richard MacCutchan8-Oct-09 8:29
mveRichard MacCutchan8-Oct-09 8:29 
GeneralRe: Using TCHAR and char array Pin
dipuks8-Oct-09 6:26
dipuks8-Oct-09 6:26 
GeneralRe: Using TCHAR and char array Pin
Richard MacCutchan8-Oct-09 6:55
mveRichard MacCutchan8-Oct-09 6:55 
GeneralRe: Using TCHAR and char array Pin
Rajesh R Subramanian8-Oct-09 7:02
professionalRajesh R Subramanian8-Oct-09 7:02 
GeneralRe: Using TCHAR and char array Pin
Richard MacCutchan8-Oct-09 7:12
mveRichard MacCutchan8-Oct-09 7:12 
AnswerRe: Using TCHAR and char array Pin
Rajesh R Subramanian8-Oct-09 7:00
professionalRajesh R Subramanian8-Oct-09 7:00 

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.