Click here to Skip to main content
14,364,290 members

ATL / WTL / STL

 
PinnedHOW TO ANSWER A QUESTION Pin
Chris Maunder16-Jul-09 4:09
adminChris Maunder16-Jul-09 4:09 
PinnedHow to get an answer to your question PinPopular
Chris Maunder16-Jul-09 4:05
adminChris Maunder16-Jul-09 4:05 
QuestionTo insert a node at the back of a XOR doubly linked list Pin
Tarun Jha17-Oct-19 10:38
memberTarun Jha17-Oct-19 10:38 
QuestionWhy non-template function does not compile where as template function compiles? Pin
PBMBJoshi3-May-19 0:23
memberPBMBJoshi3-May-19 0:23 
AnswerRe: Why non-template function does not compile where as template function compiles? Pin
Richard MacCutchan3-May-19 0:29
protectorRichard MacCutchan3-May-19 0:29 
AnswerRe: Why non-template function does not compile where as template function compiles? Pin
k505410-Oct-19 9:53
memberk505410-Oct-19 9:53 
int&& is a rvalue reference. Until C++11 we only had lvalue references. In Nontemplate_universal_ref(x), x is a lvalue, not an rvalue. Try the following:
template <typename ParamType>
void Template_universal_ref(ParamType&& param)
{
    cout << "Template_universal_ref, param : " << param << endl;
}

void NonTemplate_universal_ref(int&& param)
{
    cout << "NonTemplate_universal_ref(int&&), param : " << param << endl;
}

void NonTemplate_universal_ref(int& param)
{
    cout << "NonTemplate_universal_ref(int&), param : " << param << endl;
}

int main()
{
    int x=5;
    Template_universal_ref(x);
    NonTemplate_universal_ref(x); 
    NonTemplate_universal_ref(x+3);
    return 0;
}
Note that in the second call to NonTemplate_universal_ref, the argument x+3 is not an lvalue, that is, it cannot be assigned to.

Now, maybe someone can explain why the call via the template works?
QuestionAdvice on interdependent asynchronous functions and task queuing? Pin
arnold_w8-Feb-19 0:07
memberarnold_w8-Feb-19 0:07 
AnswerRe: Advice on interdependent asynchronous functions and task queuing? Pin
arnold_w8-Feb-19 0:34
memberarnold_w8-Feb-19 0:34 
QuestionRecommended way to deal with queues and pointers to buffers Pin
arnold_w3-Feb-19 10:09
memberarnold_w3-Feb-19 10:09 
AnswerRe: Recommended way to deal with queues and pointers to buffers Pin
Richard MacCutchan3-Feb-19 23:19
protectorRichard MacCutchan3-Feb-19 23:19 
GeneralRe: Recommended way to deal with queues and pointers to buffers Pin
arnold_w4-Feb-19 0:40
memberarnold_w4-Feb-19 0:40 
GeneralRe: Recommended way to deal with queues and pointers to buffers Pin
Richard MacCutchan4-Feb-19 0:48
protectorRichard MacCutchan4-Feb-19 0:48 
GeneralRe: Recommended way to deal with queues and pointers to buffers Pin
arnold_w4-Feb-19 4:15
memberarnold_w4-Feb-19 4:15 
GeneralRe: Recommended way to deal with queues and pointers to buffers Pin
Richard MacCutchan4-Feb-19 4:46
protectorRichard MacCutchan4-Feb-19 4:46 
GeneralRe: Recommended way to deal with queues and pointers to buffers Pin
arnold_w4-Feb-19 4:55
memberarnold_w4-Feb-19 4:55 
GeneralRe: Recommended way to deal with queues and pointers to buffers Pin
Richard MacCutchan4-Feb-19 5:04
protectorRichard MacCutchan4-Feb-19 5:04 
GeneralRe: Recommended way to deal with queues and pointers to buffers Pin
Business2sell18-Feb-19 19:08
professionalBusiness2sell18-Feb-19 19:08 
QuestionCan a union in standard C "skip" members? Pin
arnold_w31-Jan-19 23:46
memberarnold_w31-Jan-19 23:46 
AnswerRe: Can a union in standard C "skip" members? Pin
Richard MacCutchan1-Feb-19 0:18
protectorRichard MacCutchan1-Feb-19 0:18 
GeneralRe: Can a union in standard C "skip" members? Pin
arnold_w1-Feb-19 0:47
memberarnold_w1-Feb-19 0:47 
GeneralRe: Can a union in standard C "skip" members? Pin
Richard MacCutchan1-Feb-19 0:52
protectorRichard MacCutchan1-Feb-19 0:52 
GeneralRe: Can a union in standard C "skip" members? Pin
arnold_w1-Feb-19 1:13
memberarnold_w1-Feb-19 1:13 
GeneralRe: Can a union in standard C "skip" members? Pin
Richard MacCutchan1-Feb-19 2:42
protectorRichard MacCutchan1-Feb-19 2:42 
GeneralRe: Can a union in standard C "skip" members? Pin
arnold_w1-Feb-19 3:08
memberarnold_w1-Feb-19 3:08 
GeneralRe: Can a union in standard C "skip" members? Pin
Richard MacCutchan1-Feb-19 3:57
protectorRichard MacCutchan1-Feb-19 3:57 

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.