Click here to Skip to main content
15,918,243 members
Home / Discussions / Managed C++/CLI
   

Managed C++/CLI

 
GeneralRe: why it is giving runtime error? Pin
mcnu11-Sep-05 15:45
mcnu11-Sep-05 15:45 
GeneralRe: why it is giving runtime error? Pin
Christian Graus11-Sep-05 15:56
protectorChristian Graus11-Sep-05 15:56 
GeneralRe: why it is giving runtime error? Pin
mcnu11-Sep-05 16:13
mcnu11-Sep-05 16:13 
GeneralRe: why it is giving runtime error? Pin
Christian Graus11-Sep-05 16:20
protectorChristian Graus11-Sep-05 16:20 
GeneralRe: why it is giving runtime error? Pin
mcnu11-Sep-05 16:50
mcnu11-Sep-05 16:50 
GeneralRe: why it is giving runtime error? Pin
Christian Graus11-Sep-05 16:51
protectorChristian Graus11-Sep-05 16:51 
GeneralRe: why it is giving runtime error? Pin
Nemanja Trifunovic12-Sep-05 2:35
Nemanja Trifunovic12-Sep-05 2:35 
Questionoperator << is ambiguous? Pin
LiYS9-Sep-05 18:24
LiYS9-Sep-05 18:24 
Why the compiler complains about "'operator <<' is ambiguous" in statement like cout << I;. Is it ambiguous because it doesn't know which "<<" operator to call: the one in iostream and the one in code snippet below? If so I don't see any ambiguous exist!
#include <iostream>
#include <sstream> // "String streams"
#include <cstring>
using namespace std;
class IntArray 
{
public:
	enum { sz = 5 };
	int i[sz];
	IntArray() { memset(i, 0, sz* sizeof(*i)); }
	int& operator[](int x) 
	{
		return i[x];
	}
	friend ostream&	operator<<(ostream& os, const IntArray& ia);
	friend istream&	operator>>(istream& is, IntArray& ia);
};

ostream& operator<<(ostream& os, const IntArray& ia) 
{
	for(int j = 0; j < ia.sz; j++) 
	{
		os << ia.i[j];
		if(j != ia.sz -1)
		os << ", ";
	}
	os << endl;
	return os;
}

istringstream& operator>>(istringstream& is, IntArray& ia)
{
	for(int j = 0; j < ia.sz; j++)
		is >> ia.i[j];
	return is;
}

int main() 
{
	stringstream input("47 34 56 92 103");
	IntArray I;
	input >> I;
	I[4] = -1; // Use overloaded operator[]
	cout << I;
}




AnswerRe: operator &lt;&lt; is ambiguous? Pin
mcnu10-Sep-05 2:00
mcnu10-Sep-05 2:00 
GeneralRe: operator &lt;&lt; is ambiguous? Pin
LiYS10-Sep-05 2:49
LiYS10-Sep-05 2:49 
GeneralRe: operator &lt;&lt; is ambiguous? Pin
mcnu10-Sep-05 6:10
mcnu10-Sep-05 6:10 
GeneralRe: operator &lt;&lt; is ambiguous? Pin
LiYS10-Sep-05 15:06
LiYS10-Sep-05 15:06 
GeneralRe: operator &lt;&lt; is ambiguous? Pin
mcnu10-Sep-05 17:28
mcnu10-Sep-05 17:28 
GeneralRe: operator &lt;&lt; is ambiguous? Pin
Christian Graus11-Sep-05 12:35
protectorChristian Graus11-Sep-05 12:35 
Question&quot;'string' does not name a type&quot;? Pin
Lord Kixdemp9-Sep-05 11:12
Lord Kixdemp9-Sep-05 11:12 
AnswerRe: &quot;'string' does not name a type&quot;? Pin
Nemanja Trifunovic9-Sep-05 14:02
Nemanja Trifunovic9-Sep-05 14:02 
QuestionRe: &quot;'string' does not name a type&quot;? Pin
Lord Kixdemp9-Sep-05 16:42
Lord Kixdemp9-Sep-05 16:42 
AnswerRe: &quot;'string' does not name a type&quot;? Pin
Michael Dunn9-Sep-05 20:09
sitebuilderMichael Dunn9-Sep-05 20:09 
GeneralRe: &quot;'string' does not name a type&quot;? Pin
Lord Kixdemp10-Sep-05 5:50
Lord Kixdemp10-Sep-05 5:50 
QuestionC++ Metrics suite Pin
Member 21064129-Sep-05 9:38
Member 21064129-Sep-05 9:38 
QuestionList of all Files in my Directory Pin
i-p-g-i9-Sep-05 6:10
i-p-g-i9-Sep-05 6:10 
AnswerRe: List of all Files in my Directory Pin
Anonymous10-Sep-05 0:40
Anonymous10-Sep-05 0:40 
GeneralRe: List of all Files in my Directory Pin
i-p-g-i11-Sep-05 21:33
i-p-g-i11-Sep-05 21:33 
GeneralRe: List of all Files in my Directory Pin
i-p-g-i11-Sep-05 23:01
i-p-g-i11-Sep-05 23:01 
Questionsnmp Pin
sebastianos8-Sep-05 15:32
sebastianos8-Sep-05 15:32 

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.