Click here to Skip to main content
15,910,009 members
Home / Discussions / ATL / WTL / STL
   

ATL / WTL / STL

 
QuestionATL IDispEventSimpleImpl reverse order bug still present in VC++ 2005 ???? Pin
Emmanuel TB1-Feb-07 3:44
Emmanuel TB1-Feb-07 3:44 
Questioni wana show the plugin only in Outlook and wana hide in Word and Excel Pin
salman kazi1-Feb-07 0:51
salman kazi1-Feb-07 0:51 
AnswerRe: i wana show the plugin only in Outlook and wana hide in Word and Excel Pin
kltslijun1-Feb-07 21:02
kltslijun1-Feb-07 21:02 
GeneralRe: i wana show the plugin only in Outlook and wana hide in Word and Excel Pin
salman kazi8-Feb-07 18:41
salman kazi8-Feb-07 18:41 
QuestionTemplate and operator << Pin
manustone30-Jan-07 23:34
manustone30-Jan-07 23:34 
AnswerRe: Template and operator << Pin
prasad_som31-Jan-07 1:14
prasad_som31-Jan-07 1:14 
GeneralRe: Template and operator << Pin
manustone31-Jan-07 1:44
manustone31-Jan-07 1:44 
GeneralRe: Template and operator << Pin
prasad_som31-Jan-07 2:10
prasad_som31-Jan-07 2:10 
manustone wrote:
template <class T>
ostream& operator<>(ostream& os,CNeuron<T>& obj)
{
os <> obj.list_of_obj[0] <> endl;
os <> obj.list_of_obj[1] <> endl;
os <> obj.list_of_obj[2] <> endl;
os <> obj.list_of_obj[3] <> endl;
return os;
}


This will not compile if T is string.

I can run your original code with these changes, But that will not solve your purpose.
template<class T>
class CNeuron{
public:
  CNeuron( const T obj )    {list_of_obj.push_back( obj );}
  ~CNeuron()
{
	list_of_obj.pop_back();
}
   friend ostream& operator <<(ostream& os, CNeuron<T>& obj)
{
//This will not work , because compiler will 
see for over loaded operator << for class T,
 in your case T is string, not having operator <<.
//os << obj.list_of_obj[0] << endl;
return os;  
};
private:
  vector<T> list_of_obj;
};

void main()
{
Neuron<string> n("ciccio"); 
cout << n << endl;
CNeuron<int> n2(20);
cout << n2 << endl;      //No Linking Error
}





GeneralRe: Template and operator &lt;&lt; Pin
manustone31-Jan-07 1:55
manustone31-Jan-07 1:55 
AnswerRe: Template and operator &lt;&lt; Pin
Michael Dunn31-Jan-07 3:12
sitebuilderMichael Dunn31-Jan-07 3:12 
QuestionProblem with a Function Template Pin
manustone30-Jan-07 9:22
manustone30-Jan-07 9:22 
AnswerRe: Problem with a Function Template Pin
Michael Dunn30-Jan-07 10:15
sitebuilderMichael Dunn30-Jan-07 10:15 
AnswerRe: Problem with a Function Template Pin
Michael Bergman30-Jan-07 11:31
Michael Bergman30-Jan-07 11:31 
GeneralRe: Problem with a Function Template Pin
manustone30-Jan-07 23:01
manustone30-Jan-07 23:01 
QuestionDisappearing slider Pin
AghaKhan29-Jan-07 12:27
AghaKhan29-Jan-07 12:27 
QuestionWhen Servers Crash! Pin
Michael Bergman29-Jan-07 8:51
Michael Bergman29-Jan-07 8:51 
QuestionIWMSBufferAllocator Windows Media Server 9 Pin
Tili29-Jan-07 0:11
Tili29-Jan-07 0:11 
QuestionSTL: C2440: 'initializing' : cannot convert from 'char [12]' to 'SecureString' Pin
Jeffrey Walton25-Jan-07 12:24
Jeffrey Walton25-Jan-07 12:24 
AnswerRe: STL: C2440: 'initializing' : cannot convert from 'char [12]' to 'SecureString' Pin
prasad_som25-Jan-07 17:14
prasad_som25-Jan-07 17:14 
GeneralRe: STL: C2440: 'initializing' : cannot convert from 'char [12]' to 'SecureString' Pin
Jeffrey Walton26-Jan-07 3:29
Jeffrey Walton26-Jan-07 3:29 
GeneralRe: STL: C2440: 'initializing' : cannot convert from 'char [12]' to 'SecureString' Pin
prasad_som26-Jan-07 5:42
prasad_som26-Jan-07 5:42 
GeneralRe: STL: C2440: 'initializing' : cannot convert from 'char [12]' to 'SecureString' Pin
Jeffrey Walton26-Jan-07 7:18
Jeffrey Walton26-Jan-07 7:18 
GeneralRe: STL: C2440: 'initializing' : cannot convert from 'char [12]' to 'SecureString' Pin
Jeffrey Walton26-Jan-07 4:14
Jeffrey Walton26-Jan-07 4:14 
AnswerRe: STL: C2440: 'initializing' : cannot convert from 'char [12]' to 'SecureString' Pin
Michael Dunn25-Jan-07 17:40
sitebuilderMichael Dunn25-Jan-07 17:40 
GeneralRe: STL: C2440: 'initializing' : cannot convert from 'char [12]' to 'SecureString' Pin
Jeffrey Walton26-Jan-07 3:26
Jeffrey Walton26-Jan-07 3:26 

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.