Warning: file_get_contents(/data/phpspider/zhask/data//catemap/9/visual-studio/8.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Visual studio constexpr C++;11 g+代码正常+;4.8.2,但不适用于最新的Visual Studio 2013更新3 CTP 2_Visual Studio_C++11_G++4.8 - Fatal编程技术网

Visual studio constexpr C++;11 g+代码正常+;4.8.2,但不适用于最新的Visual Studio 2013更新3 CTP 2

Visual studio constexpr C++;11 g+代码正常+;4.8.2,但不适用于最新的Visual Studio 2013更新3 CTP 2,visual-studio,c++11,g++4.8,Visual Studio,C++11,G++4.8,带有如下语句的代码可以使用g++.exe(x86_64-posix-seh-rev4,由MinGW-W64项目构建)4.8.2编译,但不能使用最新版本 问题:我可能做错了什么,比如没有打开某些功能,或者最新的Visual Studio 2013不支持这样的声明?代码需要在VisualStudio下编译——有没有关于如何绕过此限制的建议 namespace NA { namespace NB { class C1 : P1 { static c

带有如下语句的代码可以使用g++.exe(x86_64-posix-seh-rev4,由MinGW-W64项目构建)4.8.2编译,但不能使用最新版本

问题:我可能做错了什么,比如没有打开某些功能,或者最新的Visual Studio 2013不支持这样的声明?代码需要在VisualStudio下编译——有没有关于如何绕过此限制的建议

namespace NA
{
   namespace NB
   {
      class C1 : P1
      {
         static constexpr double one     = 1.0;
         static constexpr double two     = one + one;
         static constexpr float  a_foo[][2]  =  { { 1.0, 1.1, 1.2 },
                                                  { 2.0, 2.1, 2.2 } };

         static constexpr int    n_ele   = 1024;
         static constexpr int    n_d     = 128;
         static constexpr int    n_ape   = n_ele -
                                           n_d  +
                                           1;

         std::vector< std::array< int, (int)n_ele >> ape
         {
            std::vector< std::array< int, (int)n_ele >>
            ( (int)n_ape,  {{0}} )
         };

         std::array<
                      std::array< int,  (int)n_d >,
                      (int)n_ape
                   >  c_to_e = {{ std::array< int, (int)n_d >( {0} ) }};
      }
   }
}
NA
{
名称空间NB
{
C1类:P1类
{
静态constexpr双1=1.0;
静态constexpr double two=1+1;
静态constexpr float a_foo[][2]={{{1.0,1.1,1.2},
{ 2.0, 2.1, 2.2 } };
静态constexpr int n_ele=1024;
静态constexpr int n_d=128;
静态constexpr int n_ape=n_ele-
n_d+
1.
std::vector>ape
{
std::vector>
((int)n_ape,{{0})
};
std::数组<
标准::数组,
(int)n_猿
>c_to_e={{std::array({0}});
}
}
}
根据这一点,C++11
constexpr
被列为部分
,因为VS在成员函数上不支持它

C++14
constexpr
支持位于单独的一行,其含义尚未实现。


<> P> >我们想,我们将等待新的版本:代码> > CONTXPRP</C>功能完全实现。

< P> Visual C++ 2013根本不支持CONTROPRPR。你可以使用“静态const”代替“静态conExPR”,用于VisualC++。

什么是“部分”?它在哪里没有实现?@BぃぃC++11
constepr
被列为“部分”,因为VS14 CTP1在成员函数上不支持它。“你到底为什么要将所有这些
int
s强制转换为
int
s?Visual Studio的
constepr
支持有限。下一个VisualStudio应该包括更多支持。查看VS2014 CTP(代号2014)。我认为任何VS2013更新都不太可能真正改变对VS2013的支持。@Casey简短回答:疏忽。详细回答:项目最初是在Matlab中进行的,其中成员是双倍的。第一个端口到C++(G++)保留双倍,因此需要演员。后来的修订确定了实际上是整数的变量,并使用整数数据类型;在这个阶段,一些铸型没有被移除。所有这些工作仍在进行中,不幸的是需要在VisualStudio中完成。