class A
{
public:
std::list<A> m_a;
};
yields errorC2079: '_Value' uses undefined class 'A'
using std::vector will work...
How can I get it working with VC6?
--
-Gernot
int main(int argc, char** argv) {printf
("%silto%c%cf%cgl%ssic%ccom%c", "ma", 58, 'g', 64, "ba", 46, 10);} 7 2498
"Gernot Frisch" wrote: class A { public: std::list<A> m_a; };
yields errorC2079: '_Value' uses undefined class 'A'
using std::vector will work...
How can I get it working with VC6?
-- -Gernot int main(int argc, char** argv) {printf ("%silto%c%cf%cgl%ssic%ccom%c", "ma", 58, 'g', 64, "ba", 46, 10);}
Storing pointers maybe?
"Eric Lilja" <er*************@yahoo.com> schrieb im Newsbeitrag
news:d0**********@news.island.liu.se... "Gernot Frisch" wrote: class A { public: std::list<A> m_a; };
yields errorC2079: '_Value' uses undefined class 'A'
using std::vector will work...
How can I get it working with VC6?
-- -Gernot int main(int argc, char** argv) {printf ("%silto%c%cf%cgl%ssic%ccom%c", "ma", 58, 'g', 64, "ba", 46, 10);}
Storing pointers maybe?
// in .h:
class A
{
class DATA;
DATA* pData;
}
// in .cpp
class A::DATA
{
std::list<A> m_A;
};
worked for me - but it's not nice and I start disliking VC6 more and
more.
"Gernot Frisch" wrote: "Eric Lilja" <er*************@yahoo.com> schrieb im Newsbeitrag news:d0**********@news.island.liu.se... "Gernot Frisch" wrote: class A { public: std::list<A> m_a; };
yields errorC2079: '_Value' uses undefined class 'A'
using std::vector will work...
How can I get it working with VC6?
-- -Gernot int main(int argc, char** argv) {printf ("%silto%c%cf%cgl%ssic%ccom%c", "ma", 58, 'g', 64, "ba", 46, 10);}
Storing pointers maybe?
// in .h:
class A { class DATA; DATA* pData; }
// in .cpp class A::DATA { std::list<A> m_A; };
worked for me - but it's not nice and I start disliking VC6 more and more.
Off-topic:
Well, it is seven (or is it eight?) years old now. I used it for many years,
but now I use MSVC++ 7.1 or GCC 3.4.3. It's much easier to port
standards-conforming C++ code between the two than it was when I was using
MSVC++ 6.0 (and an older version of gcc). If you have to work with such an
old tool due to a misinformed decision by a non-technical boss, you have my
pity.
/ Eric
> "Gernot Frisch" wrote: "Eric Lilja" <er*************@yahoo.com> schrieb im Newsbeitrag news:d0**********@news.island.liu.se... "Gernot Frisch" wrote: class A { public: std::list<A> m_a; };
yields errorC2079: '_Value' uses undefined class 'A'
using std::vector will work...
How can I get it working with VC6?
-- -Gernot int main(int argc, char** argv) {printf
("%silto%c%cf%cgl%ssic%ccom%c", "ma", 58, 'g', 64, "ba", 46, 10);}
Storing pointers maybe?
// in .h:
class A { class DATA; DATA* pData; }
// in .cpp class A::DATA { std::list<A> m_A; };
worked for me - but it's not nice and I start disliking VC6 more and
more.
Off-topic: Well, it is seven (or is it eight?) years old now. I used it for many
years, but now I use MSVC++ 7.1 or GCC 3.4.3. It's much easier to port standards-conforming C++ code between the two than it was when I was using MSVC++ 6.0 (and an older version of gcc). If you have to work with such an old tool due to a misinformed decision by a non-technical boss, you have
my pity.
Well. I do not want to advocate for MSVC but this has entirely nothing to do
with the compiler but the library (std::list) implementation. I do not know
if standard requires the above code to work and if yes, the library is to
blame.
MV
"Marek Vondrak" <mv******@ceu.cz> skrev i en meddelelse
news:d0***********@ns.felk.cvut.cz... "Gernot Frisch" wrote: > > "Eric Lilja" <er*************@yahoo.com> schrieb im Newsbeitrag > news:d0**********@news.island.liu.se... >> >> "Gernot Frisch" wrote: >>> class A >>> { >>> public: >>> std::list<A> m_a; >>> }; >>> >>> yields errorC2079: '_Value' uses undefined class 'A' >>> >>> using std::vector will work... >>> >>> How can I get it working with VC6? >>> >>> -- >>> -Gernot >>> int main(int argc, char** argv) {printf ("%silto%c%cf%cgl%ssic%ccom%c", >>> "ma", 58, 'g', 64, "ba", 46, 10);} >>> >>> >>> >> >> Storing pointers maybe? > > > // in .h: > > class A > { > class DATA; > DATA* pData; > } > > // in .cpp > class A::DATA > { > std::list<A> m_A; > }; > > worked for me - but it's not nice and I start disliking VC6 more and more. > > Off-topic: Well, it is seven (or is it eight?) years old now. I used it for many years, but now I use MSVC++ 7.1 or GCC 3.4.3. It's much easier to port standards-conforming C++ code between the two than it was when I was using MSVC++ 6.0 (and an older version of gcc). If you have to work with such an old tool due to a misinformed decision by a non-technical boss, you have my pity.
Well. I do not want to advocate for MSVC but this has entirely nothing to do with the compiler but the library (std::list) implementation. I do not know if standard requires the above code to work and if yes, the library is to blame.
The library is naturally restricted by the compiler so this is not
black-and-white. Actually I believe that the VC6.0 STL implementation is
reasonable, considering the limitations of the compiler. MV
/Peter
Gernot Frisch wrote: class A { public: std::list<A> m_a;
The template parameter must be a complete type at the point of
instantiation.
Some other compilers have similar problems with your code; for
example, in mine, std::list<T> defines a struct list_node which
contains an object of type T.
};
yields errorC2079: '_Value' uses undefined class 'A'
using std::vector will work...
Not guaranteed by the standard.
How can I get it working with VC6?
This seems to work on my system, although I don't know if it's
standard:
template<int n> class A_
{
public:
std::list<A_> m_a;
};
typedef A_<0> A;
Old Wolf wrote: Gernot Frisch wrote: class A { public: std::list<A> m_a; The template parameter must be a complete type at the point of instantiation.
This seems to work on my system, although I don't know if it's standard:
template<int n> class A_ { public: std::list<A_> m_a; };
typedef A_<0> A;
Definitely illegal. The argument to std::list<> must be a type. You
pass a template.
The best solution, which also reduces the number of headers included
was already mentioned. Use a pimpl idiom, and move the list to the
..cpp file. Another solution could be to store boost::ref<A>
HTH,
Michiel Salters This thread has been closed and replies have been disabled. Please start a new discussion. Similar topics
by: Mike Pemberton |
last post by:
I'm sure there's a good explanation for this effect, but I get rather
a strange output from this little test:
#include <iostream>
#include <list>
int main()
{
std::list<int> int_list;
|
by: Kyle Teague |
last post by:
I have a list of pointers to structs as a private member of a class.
If I call begin() in the same function as I added the data then no
access violation occurs. However, if I try to call begin() in...
|
by: Dave |
last post by:
Hello all,
After perusing the Standard, I believe it is true to say that once you
insert an element into a std::list<>, its location in memory never changes.
This makes a std::list<> ideal for...
|
by: JustSomeGuy |
last post by:
I need to write an new class derived from the list class.
This class stores data in the list to the disk if an object
that is added to the list is over 1K in size.
What methods of the std stl...
|
by: Eric Lilja |
last post by:
Hello, consider this complete program (sorry, it's not minimal but I hope
it's readable at least):
#include <algorithm>
#include <iostream>
#include <vector>
class Row
{
public:
|
by: alex221 |
last post by:
In need to implement a tree structure in which every node has arbitrary
number of children the following code has come into mind:
using std::list;
template < class Contents class Tree_node{
...
|
by: isliguezze |
last post by:
template <class T>
class List {
public:
List();
List(const List&);
List(int, const T&);
void push_back(const T &);
void push_front(const T &);
void pop_back();
|
by: Isliguezze |
last post by:
Does anybody know how to make a wrapper for that iterator? Here's my
wrapper class for std::list:
template <class Tclass List {
private:
std::list<T*lst;
public:
List() { lst = new...
|
by: Juha Nieminen |
last post by:
Assume we have this:
std::list<Typelist1(10, 1), list2(20, 2);
std::list<Type>::iterator iter = list1.end();
list1.swap(list2);
What happens here, according to the standard?
1) 'iter'...
|
by: antdb |
last post by:
Ⅰ. Advantage of AntDB: hyper-convergence + streaming processing engine
In the overall architecture, a new "hyper-convergence" concept was proposed, which integrated multiple engines and...
|
by: Matthew3360 |
last post by:
Hi there. I have been struggling to find out how to use a variable as my location in my header redirect function.
Here is my code.
header("Location:".$urlback);
Is this the right layout the...
|
by: Matthew3360 |
last post by:
Hi, I have a python app that i want to be able to get variables from a php page on my webserver. My python app is on my computer. How would I make it so the python app could use a http request to get...
|
by: AndyPSV |
last post by:
HOW CAN I CREATE AN AI with an .executable file that would suck all files in the folder and on my computerHOW CAN I CREATE AN AI with an .executable file that would suck all files in the folder and...
|
by: WisdomUfot |
last post by:
It's an interesting question you've got about how Gmail hides the HTTP referrer when a link in an email is clicked. While I don't have the specific technical details, Gmail likely implements measures...
|
by: Matthew3360 |
last post by:
Hi,
I have been trying to connect to a local host using php curl. But I am finding it hard to do this. I am doing the curl get request from my web server and have made sure to enable curl. I get a...
|
by: Oralloy |
last post by:
Hello Folks,
I am trying to hook up a CPU which I designed using SystemC to I/O pins on an FPGA.
My problem (spelled failure) is with the synthesis of my design into a bitstream, not the C++...
|
by: Carina712 |
last post by:
Setting background colors for Excel documents can help to improve the visual appeal of the document and make it easier to read and understand. Background colors can be used to highlight important...
|
by: BLUEPANDA |
last post by:
At BluePanda Dev, we're passionate about building high-quality software and sharing our knowledge with the community. That's why we've created a SaaS starter kit that's not only easy to use but also...
| |