From: K. F. <kfr...@gm...> - 2010-12-27 19:20:40
|
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? Thanks. K. Frank |
From: Antoni J. <a2...@gm...> - 2010-12-27 20:59:34
|
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): I think you have skipped the commas in the last triplet: > {{4,5,6},{-4,-5,-6}}, {{7,8,9},{-7,-8,-9}} }; > |
From: K. F. <kfr...@gm...> - 2010-12-27 22:03:39
|
Hi Antoni - On Mon, Dec 27, 2010 at 3:59 PM, Antoni Jaume <a2...@gm...> wrote: > 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): > > I think you have skipped the commas in the last triplet: >> >> {{4,5,6},{-4,-5,-6}}, {{7,8,9},{-7,-8,-9}} }; Yes, indeed I have -- a typo on my part. Note, however, that this line (line 7 of my code sample) compiles properly (even with the error). (It turns out that {-7-8-9} initializes the vector that is a piece of the larger structure to {-24}, i.e., a vector of length one with vec[0] = -24.) Fixing the typo produces no substantive change: Line 8 (the test of vector-of-vector-of-pair) still fails to compile with mingw32 4.5.0, but does compile with mingw-w64, 4.5.2. Thanks for the catch. K. Frank |
From: Ehsan A. <aza...@gm...> - 2010-12-28 01:59:29
|
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 > Thanks. > > > K. Frank > > ------------------------------------------------------------------------------ > Learn how Oracle Real Application Clusters (RAC) One Node allows customers > to consolidate database storage, standardize their database environment, and, > should the need arise, upgrade to a full multi-node Oracle RAC database > without downtime or disruption > http://p.sf.net/sfu/oracle-sfdevnl > _______________________________________________ > MinGW-users mailing list > Min...@li... > > This list observes the Etiquette found at > http://www.mingw.org/Mailing_Lists. > We ask that you be polite and do the same. Disregard for the list etiquette may cause your account to be moderated. > > _______________________________________________ > You may change your MinGW Account Options or unsubscribe at: > https://lists.sourceforge.net/lists/listinfo/mingw-users > Also: mailto:min...@li...?subject=unsubscribe > |
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 >> ... |
From: K. F. <kfr...@gm...> - 2010-12-29 04:30:39
|
Hi All! Ehsan's suggestion to try mingw-w32-bin_i686-mingw did the trick. (See below.) On Mon, Dec 27, 2010 at 10:11 PM, K. Frank <kfr...@gm...> wrote: > 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>)' >>> ... > >> 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. I downloaded mingw-w32-bin_i686-mingw_20101002_4.5_sezero.zip (from http://sourceforge.net/projects/mingw-w64/files/Toolchains%20targetting%20Win32/Personal%20Builds/sezero_4.5_20101002/) It is indeed g++ version 4.5.2 (--version reports "g++ (GCC) 4.5.2 20101002 (prerelease) [svn/rev.164902 - mingw-w64/oz]".), and produces 32-bit code. The sample code compiles fine (just like it did with the 64-bit 4.5.2 g++ (mingw-w64-bin_x86_64-mingw_20101002_4.5_sezero.zip). (It seems to me that this was most likely a bug in c++0x support that has been fixed as of 4.5.2.) Thanks for the advice. And thanks to Ozkan Sezer for his builds. K. Frank > ... |