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

Status : 

  Fixed<br /><br />
		This item has been fixed in the current or upcoming version of this product.<br /><br />
		A more detailed explanation for the resolution of this particular item may have been provided in the comments section.


1
0
Sign in
to vote
ID 624378 Comments
Status Closed Workarounds
Type Bug Repros 0
Opened 11/24/2010 12:06:09 PM
Access Restriction Public

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.
Sign in to post a comment.
Posted by Xiang [MSFT] 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 Helen [MSFT] 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)