Re: Compilation problem when upgrading from g++ 3.3 to g++ 3.4
From: John Harrison (john_andronicus_at_hotmail.com)
Date: 11/16/04
- Next message: John Harrison: "Re: Creating pythagorean triples from input."
- Previous message: Andre Kostur: "Re: Calling function that may throw an exception"
- In reply to: Alex Vinokur: "Compilation problem when upgrading from g++ 3.3 to g++ 3.4"
- Next in thread: Ron Natalie: "Re: Compilation problem when upgrading from g++ 3.3 to g++ 3.4"
- Reply: Ron Natalie: "Re: Compilation problem when upgrading from g++ 3.3 to g++ 3.4"
- Reply: Michiel Salters: "Re: Compilation problem when upgrading from g++ 3.3 to g++ 3.4"
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
Date: Tue, 16 Nov 2004 08:00:13 -0000
"Alex Vinokur" <alexvn@big-foot.com> wrote in message
news:2vtovqF2pe8alU1@uni-berlin.de...
> Hi,
>
> The code below has no problem with GNU g++ 3.3,
> but it has a problem with GNU g++ 3.4.
>
> Any suggestions?
Arrays cannot be members of STL containers because they are not copyable or
assignable. No idea why g++ 3.3 allowed it in the first place.
>
> ------ foo.cpp ------
> #include <vector>
> using namespace std;
>
> typedef char foo_t[3];
> #define ELEM1 "ab"
> #define ELEM2 "cd"
>
> const foo_t a[] = {ELEM1, ELEM2};
> const vector<foo_t> v = vector<foo_t>(a, a + sizeof (a)/sizeof (*a));
>
> int main()
> {
> return 0;
> }
> ---------------------
>
Try something like this
class Char3
{
public:
Char3(const char*);
char operator[](size_t i);
char c[3];
};
const Char3 a[] = {ELEM1, ELEM2};
const vector<Char3> v = vector<Char3>(a, a + sizeof (a)/sizeof (*a));
john
- Next message: John Harrison: "Re: Creating pythagorean triples from input."
- Previous message: Andre Kostur: "Re: Calling function that may throw an exception"
- In reply to: Alex Vinokur: "Compilation problem when upgrading from g++ 3.3 to g++ 3.4"
- Next in thread: Ron Natalie: "Re: Compilation problem when upgrading from g++ 3.3 to g++ 3.4"
- Reply: Ron Natalie: "Re: Compilation problem when upgrading from g++ 3.3 to g++ 3.4"
- Reply: Michiel Salters: "Re: Compilation problem when upgrading from g++ 3.3 to g++ 3.4"
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
Relevant Pages
|