Click here to Skip to main content
15,881,757 members
Home / Discussions / C / C++ / MFC
   

C / C++ / MFC

 
QuestionRe: Preventing Sleep (sometimes) Pin
David Crow22-Jun-09 17:20
David Crow22-Jun-09 17:20 
AnswerRe: Preventing Sleep (sometimes) Pin
Peter Weyzen22-Jun-09 17:38
Peter Weyzen22-Jun-09 17:38 
QuestionTrying to Create a Toolbar using the class ToolBar Pin
BobInNJ22-Jun-09 8:59
BobInNJ22-Jun-09 8:59 
AnswerRe: Trying to Create a Toolbar using the class ToolBar Pin
bolivar12322-Jun-09 9:30
bolivar12322-Jun-09 9:30 
GeneralRe: Trying to Create a Toolbar using the class ToolBar Pin
BobInNJ22-Jun-09 9:52
BobInNJ22-Jun-09 9:52 
GeneralRe: Trying to Create a Toolbar using the class ToolBar Pin
bolivar12322-Jun-09 10:12
bolivar12322-Jun-09 10:12 
GeneralRe: Trying to Create a Toolbar using the class ToolBar [modified] Pin
BobInNJ22-Jun-09 10:50
BobInNJ22-Jun-09 10:50 
QuestionGeneric Specialized Template Definitions Pin
Skippums22-Jun-09 8:42
Skippums22-Jun-09 8:42 
I am attempting to create a template that has a constructor that takes an array of items of type T, declared as follows:
template <typename T>
class foo {
public:
    foo(T* items) {
        // Initialize foo
    }
};
Unfortunately, this code will not compile if T is a reference type, because you cannot have pointers to references. Therefore, I would like to create a template specialization that only declares this method if the template parameter T is NOT a reference variable. If it is a reference variable, I want the same method signature but I would like it to be an array of non-reference types to the class. As an example, if I knew that the template parameter base type was 'int', I could create the following specializations:
template <int>
class foo {
public:
    foo(int* items);
};

template <int&>
class foo {
public:
    foo(int* items);
};

template <int*>
class foo {
public:
    foo(int** items);
};

template <(int& )*>
class foo {
public:
    foo(int** items);
};
However, I don't know what base type the template parameter is, so I would like to do the above specialization for any base type (for example, I used int, but I could have used string, unsigned, char, or any other class). Is there any way to do this? Thanks,

Sounds like somebody's got a case of the Mondays

-Jeff

AnswerRe: Generic Specialized Template Definitions Pin
Stuart Dootson22-Jun-09 9:31
professionalStuart Dootson22-Jun-09 9:31 
GeneralRe: Generic Specialized Template Definitions Pin
Skippums23-Jun-09 3:22
Skippums23-Jun-09 3:22 
GeneralRe: Generic Specialized Template Definitions Pin
Stuart Dootson23-Jun-09 3:36
professionalStuart Dootson23-Jun-09 3:36 
AnswerRe: Generic Specialized Template Definitions Pin
Nemanja Trifunovic22-Jun-09 9:34
Nemanja Trifunovic22-Jun-09 9:34 
GeneralRe: Generic Specialized Template Definitions Pin
Skippums22-Jun-09 9:52
Skippums22-Jun-09 9:52 
GeneralRe: Generic Specialized Template Definitions Pin
Nemanja Trifunovic22-Jun-09 10:04
Nemanja Trifunovic22-Jun-09 10:04 
QuestionPerformance problem with my FindOneOf function [modified] Pin
Ivan Ivanov 8322-Jun-09 4:09
Ivan Ivanov 8322-Jun-09 4:09 
AnswerRe: Performance problem with my FindOneOf function Pin
Stuart Dootson22-Jun-09 8:46
professionalStuart Dootson22-Jun-09 8:46 
GeneralRe: Performance problem with my FindOneOf function Pin
Ivan Ivanov 8322-Jun-09 22:30
Ivan Ivanov 8322-Jun-09 22:30 
GeneralRe: Performance problem with my FindOneOf function Pin
Stuart Dootson22-Jun-09 22:48
professionalStuart Dootson22-Jun-09 22:48 
GeneralRe: Performance problem with my FindOneOf function Pin
Ivan Ivanov 8323-Jun-09 0:32
Ivan Ivanov 8323-Jun-09 0:32 
GeneralRe: Performance problem with my FindOneOf function Pin
Stuart Dootson23-Jun-09 0:41
professionalStuart Dootson23-Jun-09 0:41 
GeneralRe: Performance problem with my FindOneOf function Pin
Ivan Ivanov 8323-Jun-09 4:17
Ivan Ivanov 8323-Jun-09 4:17 
GeneralRe: Performance problem with my FindOneOf function Pin
Ivan Ivanov 8324-Jun-09 1:11
Ivan Ivanov 8324-Jun-09 1:11 
AnswerRe: Performance problem with my FindOneOf function Pin
Skippums22-Jun-09 9:02
Skippums22-Jun-09 9:02 
GeneralRe: Performance problem with my FindOneOf function Pin
Stuart Dootson22-Jun-09 9:34
professionalStuart Dootson22-Jun-09 9:34 
GeneralRe: Performance problem with my FindOneOf function Pin
Ivan Ivanov 8322-Jun-09 11:28
Ivan Ivanov 8322-Jun-09 11:28 

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.