Click here to Skip to main content
15,919,358 members
Home / Discussions / C / C++ / MFC
   

C / C++ / MFC

 
QuestionRe: Broken code? Pin
Maximilien18-Oct-07 14:49
Maximilien18-Oct-07 14:49 
AnswerRe: Broken code? [modified] Pin
Tydia-kun18-Oct-07 15:26
Tydia-kun18-Oct-07 15:26 
GeneralRe: Broken code? Pin
User 58385218-Oct-07 17:04
User 58385218-Oct-07 17:04 
GeneralRe: Broken code? Pin
Tydia-kun19-Oct-07 0:35
Tydia-kun19-Oct-07 0:35 
GeneralRe: Broken code? Pin
Maximilien19-Oct-07 1:39
Maximilien19-Oct-07 1:39 
GeneralRe: Broken code? Pin
Tydia-kun19-Oct-07 1:41
Tydia-kun19-Oct-07 1:41 
QuestionRe: Broken code? Pin
Maximilien19-Oct-07 3:26
Maximilien19-Oct-07 3:26 
AnswerRe: Broken code? Pin
Tydia-kun19-Oct-07 3:38
Tydia-kun19-Oct-07 3:38 
That wouldn't work unless you overlord a operator = (CBuffer<int>) or simply make a template operator = such as template<typename T2> operator = (CBuffer<T2>).
That way, the compiler can call the overloaded operator = and pass bufferOfInt to it with T2 = int.
Memcpy is a very stupid (and dangerous) way of assigning a class to another class since classes are built around handling its own memory and variables.
If you read about templates, then you know that you can specify a type for a template and the compiler will generate a function with that type when the template function is invoked. Take for example

template<typename T2> operator = (CBuffer<T2>)

When you do bufferOfString = bufferOfInt, it generates an overloaded function

operator = (CBuffer<int>)

And calls it. That's it.
GeneralRe: Broken code? Pin
User 58385221-Oct-07 12:51
User 58385221-Oct-07 12:51 
GeneralRe: Broken code? Pin
Tydia-kun23-Oct-07 7:13
Tydia-kun23-Oct-07 7:13 
GeneralRe: Broken code? Pin
John R. Shaw18-Oct-07 17:45
John R. Shaw18-Oct-07 17:45 
GeneralRe: Broken code? Pin
Tydia-kun19-Oct-07 0:36
Tydia-kun19-Oct-07 0:36 
QuestionHow to dock a dialog box Pin
s196675m18-Oct-07 11:18
s196675m18-Oct-07 11:18 
Questionstring vs string* Pin
pourang18-Oct-07 8:40
pourang18-Oct-07 8:40 
AnswerRe: string vs string* Pin
Nemanja Trifunovic18-Oct-07 9:08
Nemanja Trifunovic18-Oct-07 9:08 
GeneralRe: string vs string* Pin
pourang18-Oct-07 10:49
pourang18-Oct-07 10:49 
GeneralRe: string vs string* Pin
Nemanja Trifunovic18-Oct-07 12:03
Nemanja Trifunovic18-Oct-07 12:03 
GeneralRe: string vs string* Pin
pourang19-Oct-07 1:23
pourang19-Oct-07 1:23 
QuestionGetting MX records without using DnsQuery() Pin
jadothebest18-Oct-07 6:55
jadothebest18-Oct-07 6:55 
AnswerRe: Getting MX records without using DnsQuery() Pin
Mike Dimmick18-Oct-07 7:10
Mike Dimmick18-Oct-07 7:10 
QuestionCView class help [modified] Pin
Hakan Bulut18-Oct-07 6:25
Hakan Bulut18-Oct-07 6:25 
AnswerRe: CView class help Pin
toxcct18-Oct-07 6:27
toxcct18-Oct-07 6:27 
GeneralRe: CView class help Pin
Hakan Bulut18-Oct-07 6:46
Hakan Bulut18-Oct-07 6:46 
GeneralRe: CView class help Pin
toxcct18-Oct-07 6:48
toxcct18-Oct-07 6:48 
GeneralRe: CView class help Pin
Hakan Bulut18-Oct-07 6:56
Hakan Bulut18-Oct-07 6:56 

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.