|
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
|