Home Dashboard Directory Help
Search

Can I double&& in template by Knowing me knowing you, a-ha


Status: 

Closed
 as Fixed Help for as Fixed


1
0
Sign in
to vote
Type: Bug
ID: 624378
Opened: 11/24/2010 12:06:09 PM
Access Restriction: Public
0
Workaround(s)
view
0
User(s) can reproduce this bug

Description

Guys take a look at this masterpiece:

#include "stdafx.h"
#include <iostream>
#include <cmath>



template<int Mantissa, int Exponent>

struct AllocFactorScientific

{

static long double getFactor()

{

    return Mantissa * ::pow(10.0,Exponent);

}

};



template<long double&& factor>

struct AllocFactorLinear

{

    static long double getFactor()

    {

        return factor;

    }

};



int _tmain(int argc, _TCHAR* argv[])

{

    AllocFactorScientific<102,-2> scientific;

    std::cout << scientific.getFactor() << '\n';

    AllocFactorLinear<1.03> linear;

    std::cout << linear.getFactor() << '\n';

    return 0;

}

It does compile but IntelliSense shows an error. The $100 Q is can I have declaration of template in this form: template<double&& someValue> ..?
Thank you.
Details
Sign in to post a comment.
Posted by Microsoft on 12/21/2010 at 9:55 AM
Hi:
    Rvalue reference is not allowed as the type of non-type argument according to the standard.
    A fix for this issue has been checked into the compiler sources. The fix should show up in the next release of Visual C++.

Xiang Fan
Visual C++ Team
Posted by Microsoft on 11/24/2010 at 6:04 PM
Thanks for your feedback.

We are rerouting this issue to the appropriate group within the Visual Studio Product Team for triage and resolution. These specialized experts will follow-up with your issue.
Posted by Microsoft on 11/24/2010 at 12:23 PM
Thank you for your feedback, we are currently reviewing the issue you have submitted. If this issue is urgent, please contact support directly(http://support.microsoft.com)
Sign in to post a workaround.