|
From: K. F. <kfr...@gm...> - 2010-12-28 03:12:02
|
Hello Ehsan!
(Cross-posted, as of this reply, to mingw64.)
On Mon, Dec 27, 2010 at 8:59 PM, Ehsan Azarnasab <aza...@gm...> wrote:
> On Mon, Dec 27, 2010 at 12:15 PM, K. Frank <kfr...@gm...> wrote:
>> Hello List!
>>
>> I have a question about a specific bit of c++0x support.
>>
>> I would like to use an initializer list to initialize a vector-of-vector-of-pair
>> (sample code below). Is there a version of mingw available that supports
>> this?
>>
>> This works on a mingw-w64 build of g++ 4.5.2, and fails on a recent
>> mingw32 build of g++ version 4.5.0. (It also fails on a tdm2-mingw32
>> build of g++ version 4.4.1.)
>>
>> Code (init_vvp.cpp):
>>
>> // g++ -std=c++0x -c init_vvp.cpp
>> #include <vector>
>> #include <utility>
>> using std::vector;
>> using std::pair;
>> vector<vector<int>> vv = { {1,2,3}, {4,5,6}, {7,8,9} };
>> vector<pair<vector<int>,vector<int>>> vpv = { {{1,2,3},{-1,-2,-3}},
>> {{4,5,6},{-4,-5,-6}}, {{7,8,9},{-7-8-9}} };
>> vector<vector<pair<int,int>>> vvp = { {{1,-1},{2,-2},{3,-3}},
>> {{4,-4},{5,-5},{6,-6}}, {{7,-7},{8,-8},{9,-9}} };
>>
>>
>> The mingw32 4.5.0 compiler gives an error on the last line (line 8):
>>
>> init_vvp.cpp:8:110: error: no matching function for call to
>> 'std::vector<std::vector<std::pair<int, int> >
>>>::vector(<brace-enclosed initializer list>)'
>>
>> That is, the initializer list fails for vector-of-vector-of-pair, but works for
>> vector-of-vector and vector-of-pair-of-vector. (For what it's worth, none
>> of the nested initializer lists are accepted by the Comeau online compiler.)
>>
>>
>> A couple of points and questions:
>>
>> 1) I believe that this is legal c++0x syntax, but correct me if I'm wrong.
>>
>> 2) I'm assuming that this is a g++ version issue (4.5.0 vs. 4.5.2), rather
>> than a mingw32 vs. mingw-w64 issue. True?
>>
>> 3) I haven't found any discussion of this as a known g++ c++0x bug.
>>
>>
>> Anyway, to reiterate my main question: Is there a (32-bit) version of
>> mingw available that supports this particular construct?
>>
> quoting from:
> http://sourceforge.net/apps/trac/mingw-w64/wiki/download%20filename%20structure
> have you tried mingw-w32-bin_i686-linux or mingw-w32-bin_i686-mingw
No I haven't tried a 32-bit-target compiler from the mingw-w64 project.
That's a good point. Assuming (as I suspect) that the initializer-list
issue is a g++ version issue (i.e., fixed in g++ 4.5.2), then maybe I
can get a 4.5.2 version targeting win32 from the mingw-w64 project.
Would any one know which if any) of the 32-bit-targeting mingw-w64
builds are version 4.5.2 (or later)?
Thanks -- I'll continue to look into this suggestion.
K. Frank
>> ...
|