Click here to Skip to main content
15,896,296 members
Home / Discussions / C / C++ / MFC
   

C / C++ / MFC

 
GeneralQuestion about local variable used as a reference. Pin
George220-Apr-03 22:18
George220-Apr-03 22:18 
GeneralRe: Question about local variable used as a reference. Pin
Joaquín M López Muñoz20-Apr-03 22:36
Joaquín M López Muñoz20-Apr-03 22:36 
GeneralRe: Question about local variable used as a reference. Pin
George220-Apr-03 23:27
George220-Apr-03 23:27 
GeneralURGENT HELP REQUIRED:mad: Pin
Cyberizen20-Apr-03 22:01
Cyberizen20-Apr-03 22:01 
GeneralRe: URGENT HELP REQUIRED:mad: Pin
Joaquín M López Muñoz20-Apr-03 22:39
Joaquín M López Muñoz20-Apr-03 22:39 
QuestionWhere can I find tutorial about interface? Pin
George220-Apr-03 21:56
George220-Apr-03 21:56 
GeneralTemplate overriding of operator [] Pin
Alexandru Savescu20-Apr-03 21:20
Alexandru Savescu20-Apr-03 21:20 
GeneralRe: Template overriding of operator [] Pin
Joaquín M López Muñoz20-Apr-03 21:51
Joaquín M López Muñoz20-Apr-03 21:51 
The syntax for calling your templatized operator is as convoluted as it can get:
m.template operator[]<int>("str");
Unfortunately, VC++ 6.0sp5 does not swallow this (don't know for other MS compilers). An alternative, that also simplifies notation, is as follows:
template <typename T>
struct Type2Type // borrowed from Alexandrescu's "Modern C++ Design"
{
  typedef T type;
};
 
struct MyClass
{
  template <typename T> T operator () (const char * x,Type2Type<T>)
  {
    T t;
    ...
    return t;
  }
};
 
int main()
{
  MyClass m;
  m("str",Type2Type<int>());
  m("str",Type2Type<double>());
  return 0;
}
This solution alas drops the nice [] notation in favor of simpler parentheses, but I don't think you have a better alternative.

Joaquín M López Muñoz
Telefónica, Investigación y Desarrollo
GeneralTiming problem in run-time loading DLL Pin
pklim20-Apr-03 20:17
pklim20-Apr-03 20:17 
QuestionCListCtrl: AutoArrage & Ascending Sort? Pin
Bùi Phạm Minh Trí20-Apr-03 16:56
Bùi Phạm Minh Trí20-Apr-03 16:56 
GeneralQuestion about a edit box! Help! Pin
dxhdxh20-Apr-03 14:09
dxhdxh20-Apr-03 14:09 
GeneralRe: Question about a edit box! Help! Pin
Nick Parker20-Apr-03 16:57
protectorNick Parker20-Apr-03 16:57 
GeneralRe: Question about a edit box! Help! Pin
DuFF21-Apr-03 7:08
DuFF21-Apr-03 7:08 
GeneralI need help with MATLAB questions Pin
nxz420-Apr-03 11:17
nxz420-Apr-03 11:17 
GeneralRe: I need help with MATLAB questions Pin
Nick Parker20-Apr-03 16:51
protectorNick Parker20-Apr-03 16:51 
GeneralRe: I need help with MATLAB questions Pin
Anonymous20-Apr-03 21:52
Anonymous20-Apr-03 21:52 
GeneralRe: I need help with MATLAB questions Pin
Toni7821-Apr-03 11:58
Toni7821-Apr-03 11:58 
GeneralUsing the serial com port Pin
Q15002220-Apr-03 10:05
Q15002220-Apr-03 10:05 
GeneralRe: Using the serial com port Pin
anju20-Apr-03 17:38
anju20-Apr-03 17:38 
GeneralRe: Using the serial com port Pin
Toni7821-Apr-03 11:53
Toni7821-Apr-03 11:53 
GeneralWorker-Thread In Win32 Application Pin
ZarrinPour20-Apr-03 5:27
ZarrinPour20-Apr-03 5:27 
GeneralRe: Worker-Thread In Win32 Application Pin
Ravi Bhavnani20-Apr-03 6:34
professionalRavi Bhavnani20-Apr-03 6:34 
GeneralRe: Worker-Thread In Win32 Application Pin
Johann Gerell20-Apr-03 6:48
Johann Gerell20-Apr-03 6:48 
GeneralRe: Worker-Thread In Win32 Application Pin
Ravi Bhavnani20-Apr-03 12:09
professionalRavi Bhavnani20-Apr-03 12:09 
GeneralAdding controls to a ListView based app Pin
TelMonks20-Apr-03 4:01
TelMonks20-Apr-03 4:01 

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.