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

ATL / WTL / STL

 
AnswerRe: Should I build my objects as ATL project? Pin
Dmitry Khudorozhkov9-Feb-07 8:29
Dmitry Khudorozhkov9-Feb-07 8:29 
QuestionAggregation component ? Pin
cjpvscjp2-Feb-07 21:08
cjpvscjp2-Feb-07 21:08 
QuestionExport the needed Interface Pin
aloktambi1-Feb-07 19:25
aloktambi1-Feb-07 19:25 
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 
Hi all
I'm a newbe with STL and templates.
I did my template class and I would like to create a function for writing it to output stream. I supposed that this last should be also a template function like the code below, but it doesn't work.

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);
private:
vector<T> list_of_obj;
};

template <class T>
ostream& operator<<(ostream& os, CNeuron<T>& obj)
{ os << obj.list_of_obj[0] << endl;
return os; }

If I write a function specialized like the one below with string it works ,but NOT using other types(also simple like int):I've got linking error.
Why this happens?
Should I write a specialized function for each type?


ostream& operator<<(ostream& os, CNeuron<string>& obj)
{ os << obj.list_of_obj[0] << endl;
return os; }

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

Regards
ManuStone
AnswerRe: Template and operator &lt;&lt; Pin
prasad_som31-Jan-07 1:14
prasad_som31-Jan-07 1:14 
GeneralRe: Template and operator &lt;&lt; Pin
manustone31-Jan-07 1:44
manustone31-Jan-07 1:44 
GeneralRe: Template and operator &amp;lt;&amp;lt; Pin
prasad_som31-Jan-07 2:10
prasad_som31-Jan-07 2:10 
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 

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.